浏览代码

More breakage...
* Added `scene.ambientColor` and `Scene` now ignores `AmbientLights` (transferring hex for temporal backwards compatibility)
* CanvasRenderer and SVGRenderer using `scene.ambientColor`. Tried to update `WebGLRenderer` too, but the method in question doesn't seem to have access to the scene :S
* Removed `scene.origin` and updated examples that used it.
* Improved subdivision example

Mr.doob 14 年之前
父节点
当前提交
c89e3fe49a

+ 280 - 280
build/Three.js

@@ -16,20 +16,20 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
 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++)Array.prototype.push.apply(f,this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,e){var f;f=e.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return e.distanceTo(b)}function e(b,c,e,f){var f=f.clone().subSelf(c),
 e=e.clone().subSelf(c),h=b.clone().subSelf(c),b=f.dot(f),c=f.dot(e),f=f.dot(h),k=e.dot(e),e=e.dot(h),h=1/(b*k-c*c),k=(k*f-c*e)*h,b=(b*e-c*f)*h;return k>0&&b>0&&k+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,m,n,p,t,w,u,x,v,A=b.geometry,z=A.vertices,y=[],f=0;for(h=A.faces.length;f<h;f++)if(k=A.faces[f],x=this.origin.clone(),v=this.direction.clone(),t=b.matrixWorld,m=t.multiplyVector3(k.centroid.clone()).subSelf(x),u=m.dot(v),!(u<=0)&&(m=t.multiplyVector3(z[k.a].position.clone()),n=t.multiplyVector3(z[k.b].position.clone()),p=t.multiplyVector3(z[k.c].position.clone()),t=k instanceof THREE.Face4?t.multiplyVector3(z[k.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
-u=v.dot(w),b.doubleSided||(b.flipSided?u>0:u<0)))if(u=w.dot((new THREE.Vector3).sub(m,x))/u,x=x.addSelf(v.multiplyScalar(u)),k instanceof THREE.Face3)e(x,m,n,p)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,t)||e(x,n,p,t)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k);y.sort(function(b,c){return b.distance-c.distance});return y}else return[]}};
+Math.max(b.scale.y,b.scale.z)))return[];var h,k,m,n,p,t,w,u,x,v,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f<h;f++)if(k=y.faces[f],x=this.origin.clone(),v=this.direction.clone(),t=b.matrixWorld,m=t.multiplyVector3(k.centroid.clone()).subSelf(x),u=m.dot(v),!(u<=0)&&(m=t.multiplyVector3(z[k.a].position.clone()),n=t.multiplyVector3(z[k.b].position.clone()),p=t.multiplyVector3(z[k.c].position.clone()),t=k instanceof THREE.Face4?t.multiplyVector3(z[k.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
+u=v.dot(w),b.doubleSided||(b.flipSided?u>0:u<0)))if(u=w.dot((new THREE.Vector3).sub(m,x))/u,x=x.addSelf(v.multiplyScalar(u)),k instanceof THREE.Face3)e(x,m,n,p)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},A.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,t)||e(x,n,p,t)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},A.push(k);A.sort(function(b,c){return b.distance-c.distance});return A}else return[]}};
 THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,u){n=!1;c=k;e=m;f=w;h=u;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=c<k?c:k,e=e<m?e:m,f=f>k?f:k,h=h>m?h:m);b()};this.add3Points=
 function(k,m,w,u,x,v){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<u?m<v?m:v:u<v?u:v,f=k>w?k>x?k:x:w>x?w:x,h=m>u?m>v?m:v:u>v?u:v):(c=k<w?k<x?k<c?k:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c,e=m<u?m<v?m<e?m:e:v<e?v:e:u<v?u<e?u:e:v<e?v:e,f=k>w?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>u?m>v?m>h?m:h:v>h?v:h:u>v?u>h?u:h:v>h?v:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=c<k.getLeft()?c:k.getLeft(),e=e<k.getTop()?e:k.getTop(),f=f>k.getRight()?f:k.getRight(),h=h>
 k.getBottom()?h:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;h+=k;b()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f<k.getRight()?f:k.getRight();h=h<k.getBottom()?h:k.getBottom();b()};this.intersects=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(){n=!0;h=f=e=c=0;b()};this.isEmpty=function(){return n}};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,m,n,p,t,w,u,x,v,A,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,p||0,t||0,w!==void 0?w:1,u||0,x||0,v||0,A||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,p,t,w,u,x,v,A,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=p;this.n32=t;this.n33=w;this.n34=u;this.n41=x;this.n42=v;this.n43=A;this.n44=z;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.Matrix4=function(b,c,e,f,h,k,m,n,p,t,w,u,x,v,y,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,p||0,t||0,w!==void 0?w:1,u||0,x||0,v||0,y||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,p,t,w,u,x,v,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=p;this.n32=t;this.n33=w;this.n34=u;this.n41=x;this.n42=v;this.n43=y;this.n44=z;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,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44,F=c.n11,D=c.n12,
-G=c.n13,L=c.n14,M=c.n21,K=c.n22,H=c.n23,B=c.n24,ca=c.n31,J=c.n32,P=c.n33,Q=c.n34,T=c.n41,X=c.n42,o=c.n43,da=c.n44;this.n11=e*F+f*M+h*ca+k*T;this.n12=e*D+f*K+h*J+k*X;this.n13=e*G+f*H+h*P+k*o;this.n14=e*L+f*B+h*Q+k*da;this.n21=m*F+n*M+p*ca+t*T;this.n22=m*D+n*K+p*J+t*X;this.n23=m*G+n*H+p*P+t*o;this.n24=m*L+n*B+p*Q+t*da;this.n31=w*F+u*M+x*ca+v*T;this.n32=w*D+u*K+x*J+v*X;this.n33=w*G+u*H+x*P+v*o;this.n34=w*L+u*B+x*Q+v*da;this.n41=A*F+z*M+y*ca+E*T;this.n42=A*D+z*K+y*J+E*X;this.n43=A*G+z*H+y*P+E*o;this.n44=
-A*L+z*B+y*Q+E*da;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,m=this.n23,n=this.n24,p=this.n31,t=this.n32,w=this.n33,u=this.n34,x=this.n41,v=this.n42,A=this.n43,z=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*u*v+b*m*u*v+f*k*p*A-c*n*p*A-f*h*t*A+b*n*t*A+c*h*u*A-b*k*u*A-e*k*p*z+c*m*p*z+e*h*t*z-b*m*t*z-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,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,y=b.n41,z=b.n42,A=b.n43,F=b.n44,E=c.n11,D=c.n12,
+G=c.n13,L=c.n14,M=c.n21,J=c.n22,B=c.n23,K=c.n24,ca=c.n31,I=c.n32,P=c.n33,Q=c.n34,S=c.n41,W=c.n42,o=c.n43,da=c.n44;this.n11=e*E+f*M+h*ca+k*S;this.n12=e*D+f*J+h*I+k*W;this.n13=e*G+f*B+h*P+k*o;this.n14=e*L+f*K+h*Q+k*da;this.n21=m*E+n*M+p*ca+t*S;this.n22=m*D+n*J+p*I+t*W;this.n23=m*G+n*B+p*P+t*o;this.n24=m*L+n*K+p*Q+t*da;this.n31=w*E+u*M+x*ca+v*S;this.n32=w*D+u*J+x*I+v*W;this.n33=w*G+u*B+x*P+v*o;this.n34=w*L+u*K+x*Q+v*da;this.n41=y*E+z*M+A*ca+F*S;this.n42=y*D+z*J+A*I+F*W;this.n43=y*G+z*B+A*P+F*o;this.n44=
+y*L+z*K+A*Q+F*da;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,m=this.n23,n=this.n24,p=this.n31,t=this.n32,w=this.n33,u=this.n34,x=this.n41,v=this.n42,y=this.n43,z=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*u*v+b*m*u*v+f*k*p*y-c*n*p*y-f*h*t*y+b*n*t*y+c*h*u*y-b*k*u*y-e*k*p*z+c*m*p*z+e*h*t*z-b*m*t*z-c*h*
 w*z+b*k*w*z},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]=
@@ -42,8 +42,8 @@ b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,p=c*m;c*=n;var t=e*m;e*=n;f*=n;k*=
 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,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*z-t*x*z+t*u*y-n*v*y-p*u*E+n*x*E;c.n12=k*x*z-h*v*z-k*u*y+f*v*y+h*u*E-f*x*E;c.n13=h*t*z-k*p*z+k*n*y-f*t*y-h*n*E+f*p*E;c.n14=k*p*u-h*t*u-k*n*x+f*t*x+h*n*v-f*p*v;c.n21=t*x*A-p*v*A-t*w*y+m*v*y+p*w*E-m*x*E;c.n22=h*v*A-k*x*A+k*w*y-e*v*y-h*w*E+e*x*E;c.n23=k*p*A-h*t*A-k*m*y+e*t*y+h*m*E-e*p*E;c.n24=
-h*t*w-k*p*w+k*m*x-e*t*x-h*m*v+e*p*v;c.n31=n*v*A-t*u*A+t*w*z-m*v*z-n*w*E+m*u*E;c.n32=k*u*A-f*v*A-k*w*z+e*v*z+f*w*E-e*u*E;c.n33=h*t*A-k*n*A+k*m*z-e*t*z-f*m*E+e*n*E;c.n34=k*n*w-f*t*w-k*m*u+e*t*u+f*m*v-e*n*v;c.n41=p*u*A-n*x*A-p*w*z+m*x*z+n*w*y-m*u*y;c.n42=f*x*A-h*u*A+h*w*z-e*x*z-f*w*y+e*u*y;c.n43=h*n*A-f*p*A-h*m*z+e*p*z+f*m*y-e*n*y;c.n44=f*p*w-h*n*w+h*m*u-e*p*u-f*m*x+e*n*x;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,t=b.n24,w=b.n31,u=b.n32,x=b.n33,v=b.n34,y=b.n41,z=b.n42,A=b.n43,F=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*z-t*x*z+t*u*A-n*v*A-p*u*F+n*x*F;c.n12=k*x*z-h*v*z-k*u*A+f*v*A+h*u*F-f*x*F;c.n13=h*t*z-k*p*z+k*n*A-f*t*A-h*n*F+f*p*F;c.n14=k*p*u-h*t*u-k*n*x+f*t*x+h*n*v-f*p*v;c.n21=t*x*y-p*v*y-t*w*A+m*v*A+p*w*F-m*x*F;c.n22=h*v*y-k*x*y+k*w*A-e*v*A-h*w*F+e*x*F;c.n23=k*p*y-h*t*y-k*m*A+e*t*A+h*m*F-e*p*F;c.n24=
+h*t*w-k*p*w+k*m*x-e*t*x-h*m*v+e*p*v;c.n31=n*v*y-t*u*y+t*w*z-m*v*z-n*w*F+m*u*F;c.n32=k*u*y-f*v*y-k*w*z+e*v*z+f*w*F-e*u*F;c.n33=h*t*y-k*n*y+k*m*z-e*t*z-f*m*F+e*n*F;c.n34=k*n*w-f*t*w-k*m*u+e*t*u+f*m*v-e*n*v;c.n41=p*u*y-n*x*y-p*w*z+m*x*z+n*w*A-m*u*A;c.n42=f*x*y-h*u*y+h*w*z-e*x*z-f*w*A+e*u*A;c.n43=h*n*y-f*p*y-h*m*z+e*p*z+f*m*A-e*n*A;c.n44=f*p*w-h*n*w+h*m*u-e*p*u-f*m*x+e*n*x;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,m=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+b.n31*t;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*m;e[4]=b*n;e[5]=b*p;e[6]=b*t;e[7]=b*w;e[8]=b*u;return c};
 THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var m;m=new THREE.Matrix4;m.n11=2*h/(c-b);m.n12=0;m.n13=(c+b)/(c-b);m.n14=0;m.n21=0;m.n22=2*h/(f-e);m.n23=(f+e)/(f-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+h)/(k-h);m.n34=-2*k*h/(k-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};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 m,n,p,t;m=new THREE.Matrix4;n=c-b;p=e-f;t=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/p;m.n23=0;m.n24=-((e+f)/p);m.n31=0;m.n32=0;m.n33=-2/t;m.n34=-((k+h)/t);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};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;
@@ -54,22 +54,22 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],t,w,u=[],x,v=[],A,z,y=[],E,F,D=[],G=[],L=[],M=new THREE.Vector4,K=new THREE.Vector4,
-H=new THREE.Matrix4,B=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(b,c){H.multiply(c.projectionMatrix,c.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,c){H.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=G.length=
-0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,v=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=ca[u].x*t.n14+ca[u].y*t.n24+ca[u].z*t.n34+ca[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=k[h]=k[h]||new THREE.RenderableObject,h++,f=p,M.copy(n.position),H.multiplyVector3(M),f.object=n,f.z=M.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
-function(f,k,h){var o=k.near,G=k.far,M,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra,na,O,oa,qa;F=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);H.multiply(k.projectionMatrix,k.matrixWorldInverse);ca[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);ca[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);ca[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);ca[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);ca[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-
-H.n34);ca[5].set(H.n41+H.n31,H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(M=0;M<6;M++)$=ca[M],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(M=$.length;f<M;f++)if(Y=$[f].object,Y.visible)if(fa=Y.matrixWorld,ia=Y.matrixRotationWorld,ra=Y.materials,na=Y.overdraw,n=0,Y instanceof THREE.Mesh){O=Y.geometry;ka=O.vertices;oa=O.faces;O=O.faceVertexUvs;la=0;for(ha=ka.length;la<ha;la++)m=b(),m.positionWorld.copy(ka[la].position),fa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
-H.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;ka=0;for(la=oa.length;ka<la;ka++){ha=oa[ka];if(ha instanceof THREE.Face3)if(aa=p[ha.a],ma=p[ha.b],ea=p[ha.c],aa.visible&&ma.visible&&ea.visible&&(Y.doubleSided||Y.flipSided!=(ea.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<
+THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],t,w,u=[],x,v=[],y,z,A=[],F,E,D=[],G=[],L=[],M=new THREE.Vector4,J=new THREE.Vector4,
+B=new THREE.Matrix4,K=new THREE.Matrix4,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(b,c){B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){B.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=G.length=
+0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,v=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=ca[u].x*t.n14+ca[u].y*t.n24+ca[u].z*t.n34+ca[u].w,p<=v){p=!1;break a}p=!0}p=!p}if(!p)p=k[h]=k[h]||new THREE.RenderableObject,h++,f=p,M.copy(n.position),B.multiplyVector3(M),f.object=n,f.z=M.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=
+function(f,k,h){var o=k.near,G=k.far,M,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra,na,O,oa,qa;E=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);ca[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);ca[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);ca[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);ca[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);ca[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-
+B.n34);ca[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(M=0;M<6;M++)$=ca[M],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(M=$.length;f<M;f++)if(Y=$[f].object,Y.visible)if(fa=Y.matrixWorld,ia=Y.matrixRotationWorld,ra=Y.materials,na=Y.overdraw,n=0,Y instanceof THREE.Mesh){O=Y.geometry;ka=O.vertices;oa=O.faces;O=O.faceVertexUvs;la=0;for(ha=ka.length;la<ha;la++)m=b(),m.positionWorld.copy(ka[la].position),fa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
+B.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;ka=0;for(la=oa.length;ka<la;ka++){ha=oa[ka];if(ha instanceof THREE.Face3)if(aa=p[ha.a],ma=p[ha.b],ea=p[ha.c],aa.visible&&ma.visible&&ea.visible&&(Y.doubleSided||Y.flipSided!=(ea.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<
 0))Z=u[w]=u[w]||new THREE.RenderableFace3,w++,t=Z,t.v1.copy(aa),t.v2.copy(ma),t.v3.copy(ea);else continue;else if(ha instanceof THREE.Face4)if(aa=p[ha.a],ma=p[ha.b],ea=p[ha.c],Z=p[ha.d],aa.visible&&ma.visible&&ea.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(Z.positionScreen.y-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x)<0||(ma.positionScreen.x-ea.positionScreen.x)*(Z.positionScreen.y-ea.positionScreen.y)-
-(ma.positionScreen.y-ea.positionScreen.y)*(Z.positionScreen.x-ea.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,t=qa,t.v1.copy(aa),t.v2.copy(ma),t.v3.copy(ea),t.v4.copy(Z);else continue;t.normalWorld.copy(ha.normal);ia.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);fa.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);H.multiplyVector3(t.centroidScreen);ea=ha.vertexNormals;aa=0;for(ma=ea.length;aa<ma;aa++)Z=t.vertexNormalsWorld[aa],Z.copy(ea[aa]),
-ia.multiplyVector3(Z);aa=0;for(ma=O.length;aa<ma;aa++)if(qa=O[aa][ka]){ea=0;for(Z=qa.length;ea<Z;ea++)t.uvs[aa][ea]=qa[ea]}t.meshMaterials=ra;t.faceMaterials=ha.materials;t.overdraw=na;t.z=t.centroidScreen.z;L.push(t)}}else if(Y instanceof THREE.Line){B.multiply(H,fa);ka=Y.geometry.vertices;aa=b();aa.positionScreen.copy(ka[0].position);B.multiplyVector4(aa.positionScreen);la=1;for(ha=ka.length;la<ha;la++)if(aa=b(),aa.positionScreen.copy(ka[la].position),B.multiplyVector4(aa.positionScreen),ma=p[n-
-2],J.copy(aa.positionScreen),P.copy(ma.positionScreen),e(J,P))J.multiplyScalar(1/J.w),P.multiplyScalar(1/P.w),fa=y[z]=y[z]||new THREE.RenderableLine,z++,A=fa,A.v1.positionScreen.copy(J),A.v2.positionScreen.copy(P),A.z=Math.max(J.z,P.z),A.materials=Y.materials,L.push(A)}else if(Y instanceof THREE.Particle&&(K.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))fa=D[F]=D[F]||new THREE.RenderableParticle,F++,E=fa,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=
-Y.rotation.z,E.scale.x=Y.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=Y.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=Y.materials,L.push(E);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
+(ma.positionScreen.y-ea.positionScreen.y)*(Z.positionScreen.x-ea.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,t=qa,t.v1.copy(aa),t.v2.copy(ma),t.v3.copy(ea),t.v4.copy(Z);else continue;t.normalWorld.copy(ha.normal);ia.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);fa.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);B.multiplyVector3(t.centroidScreen);ea=ha.vertexNormals;aa=0;for(ma=ea.length;aa<ma;aa++)Z=t.vertexNormalsWorld[aa],Z.copy(ea[aa]),
+ia.multiplyVector3(Z);aa=0;for(ma=O.length;aa<ma;aa++)if(qa=O[aa][ka]){ea=0;for(Z=qa.length;ea<Z;ea++)t.uvs[aa][ea]=qa[ea]}t.meshMaterials=ra;t.faceMaterials=ha.materials;t.overdraw=na;t.z=t.centroidScreen.z;L.push(t)}}else if(Y instanceof THREE.Line){K.multiply(B,fa);ka=Y.geometry.vertices;aa=b();aa.positionScreen.copy(ka[0].position);K.multiplyVector4(aa.positionScreen);la=1;for(ha=ka.length;la<ha;la++)if(aa=b(),aa.positionScreen.copy(ka[la].position),K.multiplyVector4(aa.positionScreen),ma=p[n-
+2],I.copy(aa.positionScreen),P.copy(ma.positionScreen),e(I,P))I.multiplyScalar(1/I.w),P.multiplyScalar(1/P.w),fa=A[z]=A[z]||new THREE.RenderableLine,z++,y=fa,y.v1.positionScreen.copy(I),y.v2.positionScreen.copy(P),y.z=Math.max(I.z,P.z),y.materials=Y.materials,L.push(y)}else if(Y instanceof THREE.Particle&&(J.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34,1),B.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))fa=D[E]=D[E]||new THREE.RenderableParticle,E++,F=fa,F.x=J.x/J.w,F.y=J.y/J.w,F.z=J.z,F.rotation=
+Y.rotation.z,F.scale.x=Y.scale.x*Math.abs(F.x-(J.x+k.projectionMatrix.n11)/(J.w+k.projectionMatrix.n14)),F.scale.y=Y.scale.y*Math.abs(F.y-(J.y+k.projectionMatrix.n22)/(J.w+k.projectionMatrix.n24)),F.materials=Y.materials,L.push(F);h&&L.sort(c);return L}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 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=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),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*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,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-f*n;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,m=this.y,n=this.z,p=this.w,t=p*e+m*h-n*f,w=p*f+n*e-k*h,u=p*h+k*f-m*e,e=-k*
-e-m*f-n*h;c.x=t*p+e*-k+w*-n-u*-m;c.y=w*p+e*-m+u*-k-t*-n;c.z=u*p+e*-n+t*-m-w*-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),m=Math.sqrt(1-h*h);if(Math.abs(m)<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)/m;f=Math.sin(f*k)/m;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};
+e-m*f-n*h;c.x=t*p+e*-k+w*-n-u*-m;c.y=w*p+e*-m+u*-k-t*-n;c.z=u*p+e*-n+t*-m-w*-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),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.001)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)/m;f=Math.sin(f*k)/m;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,m){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=m instanceof Array?m:[m];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)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
@@ -78,9 +78,9 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
 e,f,h,k,m,n=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){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();k.normal.copy(n)}},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,c,e,f,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;w=m[k];u=m[h];x=m[o];v=p.x-n.x;A=t.x-n.x;z=p.y-n.y;y=t.y-n.y;E=p.z-n.z;F=t.z-n.z;D=u.u-w.u;G=x.u-w.u;L=u.v-w.v;M=x.v-w.v;K=1/(D*M-G*L);J.set((M*v-L*A)*K,(M*z-L*y)*K,(M*E-L*F)*K);P.set((D*A-G*v)*K,(D*y-G*z)*K,(D*F-G*E)*K);B[c].addSelf(J);B[e].addSelf(J);B[f].addSelf(J);ca[c].addSelf(P);
-ca[e].addSelf(P);ca[f].addSelf(P)}var c,e,f,h,k,m,n,p,t,w,u,x,v,A,z,y,E,F,D,G,L,M,K,H,B=[],ca=[],J=new THREE.Vector3,P=new THREE.Vector3,Q=new THREE.Vector3,T=new THREE.Vector3,X=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,ca[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=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 o=["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++)X.copy(k.vertexNormals[f]),h=k[o[f]],H=B[h],Q.copy(H),Q.subSelf(X.multiplyScalar(X.dot(H))).normalize(),T.cross(k.vertexNormals[f],H),h=T.dot(ca[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.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,
+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,c,e,f,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;w=m[k];u=m[h];x=m[o];v=p.x-n.x;y=t.x-n.x;z=p.y-n.y;A=t.y-n.y;F=p.z-n.z;E=t.z-n.z;D=u.u-w.u;G=x.u-w.u;L=u.v-w.v;M=x.v-w.v;J=1/(D*M-G*L);I.set((M*v-L*y)*J,(M*z-L*A)*J,(M*F-L*E)*J);P.set((D*y-G*v)*J,(D*A-G*z)*J,(D*E-G*F)*J);K[c].addSelf(I);K[e].addSelf(I);K[f].addSelf(I);ca[c].addSelf(P);
+ca[e].addSelf(P);ca[f].addSelf(P)}var c,e,f,h,k,m,n,p,t,w,u,x,v,y,z,A,F,E,D,G,L,M,J,B,K=[],ca=[],I=new THREE.Vector3,P=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,ca[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=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 o=["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++)W.copy(k.vertexNormals[f]),h=k[o[f]],B=K[h],Q.copy(B),Q.subSelf(W.multiplyScalar(W.dot(B))).normalize(),S.cross(k.vertexNormals[f],B),h=S.dot(ca[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.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}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
 e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[k];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
@@ -140,54 +140,54 @@ THREE.Sprite=function(b){THREE.Object3D.call(this);this.color=b.color!==void 0?n
 !this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
 THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
-THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.origin=new THREE.Vector3;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(b){this.supr.add.call(this,b);this.addChildRecurse(b)};
+THREE.Scene=function(){THREE.Object3D.call(this);this.ambientColor=new THREE.Color;this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.Scene.prototype.add=function(b){b instanceof THREE.AmbientLight?(console.warn("DEPRECATED: AmbientLight( hex ) is now scene.ambientColor.setHex( hex )."),this.ambientColor.setHex(b.color.getHex())):(this.supr.add.call(this,b),this.addChildRecurse(b))};
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b);var c=this.__objectsRemoved.indexOf(b);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.remove=function(b){this.supr.remove.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),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
 THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-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,t,w,u,x,v,A,z;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(x=b[p],x instanceof THREE.RenderableParticle){A=x.x*h+h;z=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=A+"px",v.style.top=z+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)v.strokeStyle=F=b}function h(b){if(D!=b)v.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-t,w,u,x,v=p.getContext("2d"),A=new THREE.Color(0),z=0,y=1,E=0,F=null,D=null,G=null,L=null,M=null,K,H,B,ca,J=new THREE.RenderableVertex,P=new THREE.RenderableVertex,Q,T,X,o,da,V,la,ha,ka,aa,ma,ea,Z=new THREE.Color(0),$=new THREE.Color(0),Y=new THREE.Color(0),fa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],na,O,oa,qa,va,ta,Ea,Aa,Ca,Fa,U=new THREE.Rectangle,S=new THREE.Rectangle,N=new THREE.Rectangle,ua=!1,ga=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,pa=new THREE.Vector3,
-Ia,Da,Ka,Ba,Ga,W,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;W=Ga.getContext("2d");W.translate(-b/2,-b/2);W.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;u=Math.floor(t/2);x=Math.floor(w/2);p.width=t;
-p.height=w;U.set(-u,-x,u,x);S.set(-u,-x,u,x);y=1;E=0;M=L=G=D=F=null};this.setClearColor=function(b,c){A.copy(b);z=c;S.set(-u,-x,u,x)};this.setClearColorHex=function(b,c){A.setHex(b);z=c;S.set(-u,-x,u,x)};this.clear=function(){v.setTransform(1,0,0,-1,u,x);S.isEmpty()||(S.minSelf(U),S.inflate(2),z<1&&v.clearRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*
-255)+","+z+")"),v.fillRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight()))),S.empty())};this.render=function(b,p){function t(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function w(b,c,e,
-f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=e.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,p,t,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=
-m.map.image,w=t.width>>1,xa=t.height>>1,m=k.scale.x*u,p=k.scale.y*x,o=m*w,n=p*xa,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-p),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),U.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),
-v.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)v.lineWidth=G=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function A(b,f,h,m,n,t,u,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);
-Q=b.positionScreen.x;T=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;da=h.positionScreen.x;V=h.positionScreen.y;F(Q,T,X,o,da,V);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(Q,T,X,o,da,V,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(u.vertexNormalsWorld[0]),va=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
-ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(Q,T,X,o,da,V,va,ta,Ea,Aa,Ca,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&
-(v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(Q,T,X,o,da,V,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),ua?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?($.r=Y.r=fa.r=ja.r,$.g=Y.g=fa.g=ja.g,$.b=Y.b=fa.b=ja.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],$),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],Y),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],fa),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,
-Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*$.b,1)),Y.r=Math.max(0,Math.min(v.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(v.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(v.color.b*Y.b,1)),fa.r=Math.max(0,Math.min(v.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(v.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(v.color.b*fa.b,1)),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(Q,T,X,o,da,V,0,0,1,0,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,u.centroidWorld,u.normalWorld,
-ga),Z.r=Math.max(0,Math.min(v.color.r*ga.r,1)),Z.g=Math.max(0,Math.min(v.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(v.color.b*ga.b,1)),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(h.positionScreen.z,na,
-O),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(Q,T,X,o,da,V,0,0,1,0,0,1,oa);else if(v instanceof THREE.MeshNormalMaterial)Z.r=Wa(u.normalWorld.x),Z.g=Wa(u.normalWorld.y),Z.b=Wa(u.normalWorld.z),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)}function E(b,f,h,m,n,t,v,u,x){k.info.render.vertices+=4;k.info.render.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)A(b,f,m,0,1,3,v,u,x),A(n,h,t,1,2,3,v,u,x);else if(Q=b.positionScreen.x,
-T=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,da=h.positionScreen.x,V=h.positionScreen.y,la=m.positionScreen.x,ha=m.positionScreen.y,ka=n.positionScreen.x,aa=n.positionScreen.y,ma=t.positionScreen.x,ea=t.positionScreen.y,u instanceof THREE.MeshBasicMaterial)D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)ua?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
-4?($.r=Y.r=fa.r=ia.r=ja.r,$.g=Y.g=fa.g=ia.g=ja.g,$.b=Y.b=fa.b=ia.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],$),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],Y),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],fa),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),$.r=Math.max(0,Math.min(u.color.r*$.r,1)),$.g=Math.max(0,Math.min(u.color.g*$.g,1)),$.b=Math.max(0,Math.min(u.color.b*$.b,1)),Y.r=Math.max(0,Math.min(u.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(u.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(u.color.b*
-Y.b,1)),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),oa=Ya($,Y,fa,ia),F(Q,T,X,o,la,ha),Va(Q,T,X,o,la,ha,0,0,1,0,0,1,oa),F(ka,aa,da,V,ma,ea),Va(ka,aa,da,V,ma,ea,1,0,1,1,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ga),Z.r=Math.max(0,Math.min(u.color.r*ga.r,
-1)),Z.g=Math.max(0,Math.min(u.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(u.color.b*ga.b,1)),D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Z)):(D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)Z.r=Wa(v.normalWorld.x),Z.g=Wa(v.normalWorld.y),Z.b=Wa(v.normalWorld.z),D(Q,T,X,o,da,V,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,
-u.wireframeLinejoin):Oa(Z);else if(u instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(m.positionScreen.z,na,O),ia.r=ia.g=ia.b=1-Ra(h.positionScreen.z,na,O),oa=Ya($,Y,fa,ia),F(Q,T,X,o,la,ha),Va(Q,T,X,o,la,ha,0,0,1,0,0,1,oa),F(ka,aa,da,V,ma,ea),Va(ka,aa,da,V,ma,ea,1,0,1,1,0,1,oa)}function F(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function D(b,
-c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,p,t,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT==THREE.RepeatWrapping;ra[w.id]=v.createPattern(w.image,
-xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ra[w.id]);var xa=w.offset.x/w.repeat.x,z=w.offset.y/w.repeat.y,U=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+xa)*U,n=(n+z)*w,p=(p+xa)*U,t=(t+z)*w,u=(u+xa)*U,x=(x+z)*w;e-=b;f-=c;k-=b;m-=c;p-=o;t-=n;u-=o;x-=n;xa=1/(p*x-u*t);w=(x*e-t*k)*xa;t=(x*f-t*m)*xa;e=(p*k-u*e)*xa;f=(p*m-u*f)*xa;b=b-w*o-e*n;c=c-t*o-f*n;v.save();v.transform(w,t,e,f,b,c);v.fill();v.restore()}}function Va(b,c,e,f,k,h,m,o,n,p,t,
-u,w){var x,xa;x=w.width-1;xa=w.height-1;m*=x;o*=xa;n*=x;p*=xa;t*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;p-=o;t-=m;u-=o;xa=1/(n*u-t*p);x=(u*e-p*k)*xa;p=(u*f-p*h)*xa;e=(n*k-t*e)*xa;f=(n*h-t*f)*xa;b=b-x*m-e*o;c=c-p*m-f*o;v.save();v.transform(x,p,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:
-k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=e<0?0:e>255?255:e;Ba[12]=t<0?0:t>255?255:t;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);W.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=
-k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,p,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=u;K.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,H=sa.v2,
-K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(H.positionScreen.x,H.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&y(K,H,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,H=sa.v2,B=sa.v3,K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,
-sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen)),N.add3Points(K.positionScreen.x,K.positionScreen.y,H.positionScreen.x,H.positionScreen.y,B.positionScreen.x,B.positionScreen.y),U.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&A(K,H,B,0,1,2,sa,za,b)}else za.opacity!=
-0&&A(K,H,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,H=sa.v2,B=sa.v3,ca=sa.v4,K.positionScreen.x*=u,K.positionScreen.y*=x,H.positionScreen.x*=u,H.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,ca.positionScreen.x*=u,ca.positionScreen.y*=x,J.positionScreen.copy(H.positionScreen),P.positionScreen.copy(ca.positionScreen),sa.overdraw&&(Pa(K.positionScreen,H.positionScreen),Pa(H.positionScreen,ca.positionScreen),Pa(ca.positionScreen,K.positionScreen),Pa(B.positionScreen,
-J.positionScreen),Pa(B.positionScreen,P.positionScreen)),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(H.positionScreen.x,H.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(ca.positionScreen.x,ca.positionScreen.y),U.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&E(K,H,B,ca,J,P,sa,za,b)}else za.opacity!=
-0&&E(K,H,B,ca,J,P,sa,za,b)}S.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(ca.sub(h.position,c.centroidWorld),ca.normalize(),m=c.normalWorld.dot(ca)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;Q=f(T++);
-Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),G.r=Math.max(0,Math.min(n.color.r*L.r,1)),G.g=Math.max(0,Math.min(n.color.g*L.g,1)),G.b=Math.max(0,Math.min(n.color.b*L.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
-o.z*n.__farMinusNear),G.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(c,e,m,o,n,t,u){k.info.render.vertices+=
-4;k.info.render.faces++;Q=f(T++);Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),G.r=Math.max(0,Math.min(t.color.r*L.r,1)),G.g=Math.max(0,Math.min(t.color.g*L.g,1)),G.b=Math.max(0,Math.min(t.color.b*L.b,1))):
-G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(B=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(B,B,B)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+
-"; fill-opacity: "+t.opacity);p.appendChild(Q)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,u,x,v,A,z,y,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
-K=new THREE.Color(0),H=new THREE.Color(0),B,ca=new THREE.Vector3,J=[],P=[],Q,T,X,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;w=c;u=t/2;x=w/2;p.setAttribute("viewBox",-u+" "+-x+" "+t+" "+w);p.setAttribute("width",t);p.setAttribute("height",w);E.set(-u,-x,u,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
-this.render=function(b,f){var h,t,w,G,L,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);X=T=0;if(D=b.lights.length>0){B=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(t=B.length;h<t;h++)w=B[h],G=w.color,w instanceof THREE.AmbientLight?(M.r+=G.r,M.g+=G.g,M.b+=G.b):w instanceof THREE.DirectionalLight?(K.r+=G.r,K.g+=G.g,K.b+=G.b):w instanceof THREE.PointLight&&(H.r+=G.r,H.g+=G.g,H.b+=G.b)}h=0;for(t=m.length;h<
-t;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){v=B;v.x*=u;v.y*=-x;w=0;for(G=B.materials.length;w<G;)w++}else if(B instanceof THREE.RenderableLine){if(v=B.v1,A=B.v2,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),E.intersects(F)){w=0;for(G=B.materials.length;w<G;)if(($=B.materials[w++])&&$.opacity!=0){L=v;J=A;var Y=X++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),o==0&&P[Y].setAttribute("shape-rendering","crispEdges"));Q=P[Y];Q.setAttribute("x1",L.positionScreen.x);Q.setAttribute("y1",L.positionScreen.y);Q.setAttribute("x2",J.positionScreen.x);Q.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),p.appendChild(Q))}}}else if(B instanceof
-THREE.RenderableFace3){if(v=B.v1,A=B.v2,z=B.v3,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(F)){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&
-$.opacity!=0&&c(v,A,z,B,$,b)}else $&&$.opacity!=0&&c(v,A,z,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(v=B.v1,A=B.v2,z=B.v3,y=B.v4,v.positionScreen.x*=u,v.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),
-E.intersects(F))){w=0;for(G=B.meshMaterials.length;w<G;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&$.opacity!=0&&e(v,A,z,y,B,$,b)}else $&&$.opacity!=0&&e(v,A,z,y,B,$,b)}}};
+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,t,w,u,x,v,y,z;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(x=b[p],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=y+"px",v.style.top=z+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(A!=b)v.globalAlpha=A=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}F=b}}function f(b){if(E!=b)v.strokeStyle=E=b}function h(b){if(D!=b)v.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+t,w,u,x,v=p.getContext("2d"),y=new THREE.Color(0),z=0,A=1,F=0,E=null,D=null,G=null,L=null,M=null,J,B,K,ca,I=new THREE.RenderableVertex,P=new THREE.RenderableVertex,Q,S,W,o,da,T,la,ha,ka,aa,ma,ea,Z=new THREE.Color(0),$=new THREE.Color(0),Y=new THREE.Color(0),fa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],na,O,oa,qa,ua,ta,Ea,Aa,Ca,Fa,X=new THREE.Rectangle,U=new THREE.Rectangle,N=new THREE.Rectangle,va=!1,ga=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,wa=new THREE.Color,pa=new THREE.Vector3,
+Ia,Da,Ka,Ba,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;u=Math.floor(t/2);x=Math.floor(w/2);p.width=t;
+p.height=w;X.set(-u,-x,u,x);U.set(-u,-x,u,x);A=1;F=0;M=L=G=D=E=null};this.setClearColor=function(b,c){y.copy(b);z=c;U.set(-u,-x,u,x)};this.setClearColorHex=function(b,c){y.setHex(b);z=c;U.set(-u,-x,u,x)};this.clear=function(){v.setTransform(1,0,0,-1,u,x);U.isEmpty()||(U.minSelf(X),U.inflate(2),z<1&&v.clearRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
+255)+","+z+")"),v.fillRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight()))),U.empty())};this.render=function(b,p){function t(b){var c,e,f,k=b.lights;ja.copy(b.ambientColor);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b)}function w(b,c,e,f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],
+m=h.color,h instanceof THREE.DirectionalLight?(o=e.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function z(b,k,m){c(m.opacity);e(m.blending);var o,n,p,t,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=m.map.image,w=t.width>>1,xa=t.height>>1,m=k.scale.x*
+u,p=k.scale.y*x,o=m*w,n=p*xa,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-p),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),v.restore()))}function A(b,k,h,m){c(m.opacity);
+e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)v.lineWidth=G=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function y(b,f,h,m,n,t,u,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);Q=b.positionScreen.x;S=b.positionScreen.y;W=
+f.positionScreen.x;o=f.positionScreen.y;da=h.positionScreen.x;T=h.positionScreen.y;E(Q,S,W,o,da,T);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],ab(Q,S,W,o,da,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(u.vertexNormalsWorld[0]),ua=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+
+0.5,pa.copy(u.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(Q,S,W,o,da,T,ua,ta,Ea,Aa,Ca,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&(v.map.mapping instanceof THREE.UVMapping&&
+(qa=u.uvs[0],ab(Q,S,W,o,da,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),va?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?($.r=Y.r=fa.r=ja.r,$.g=Y.g=fa.g=ja.g,$.b=Y.b=fa.b=ja.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],$),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],Y),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],fa),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*
+$.b,1)),Y.r=Math.max(0,Math.min(v.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(v.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(v.color.b*Y.b,1)),fa.r=Math.max(0,Math.min(v.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(v.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(v.color.b*fa.b,1)),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,oa=Ya($,Y,fa,ia),Va(Q,S,W,o,da,T,0,0,1,0,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,u.centroidWorld,u.normalWorld,ga),Z.r=Math.max(0,Math.min(v.color.r*ga.r,1)),Z.g=Math.max(0,
+Math.min(v.color.g*ga.g,1)),Z.b=Math.max(0,Math.min(v.color.b*ga.b,1)),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(h.positionScreen.z,na,O),ia.r=(Y.r+fa.r)*0.5,ia.g=(Y.g+fa.g)*0.5,ia.b=(Y.b+fa.b)*0.5,
+oa=Ya($,Y,fa,ia),Va(Q,S,W,o,da,T,0,0,1,0,0,1,oa);else if(v instanceof THREE.MeshNormalMaterial)Z.r=Wa(u.normalWorld.x),Z.g=Wa(u.normalWorld.y),Z.b=Wa(u.normalWorld.z),v.wireframe?Na(Z,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(Z)}function F(b,f,h,m,n,t,v,u,x){k.info.render.vertices+=4;k.info.render.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)y(b,f,m,0,1,3,v,u,x),y(n,h,t,1,2,3,v,u,x);else if(Q=b.positionScreen.x,S=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,
+da=h.positionScreen.x,T=h.positionScreen.y,la=m.positionScreen.x,ha=m.positionScreen.y,ka=n.positionScreen.x,aa=n.positionScreen.y,ma=t.positionScreen.x,ea=t.positionScreen.y,u instanceof THREE.MeshBasicMaterial)D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color);else if(u instanceof THREE.MeshLambertMaterial)va?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?($.r=Y.r=fa.r=ia.r=ja.r,$.g=Y.g=fa.g=ia.g=ja.g,
+$.b=Y.b=fa.b=ia.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],$),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],Y),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],fa),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),$.r=Math.max(0,Math.min(u.color.r*$.r,1)),$.g=Math.max(0,Math.min(u.color.g*$.g,1)),$.b=Math.max(0,Math.min(u.color.b*$.b,1)),Y.r=Math.max(0,Math.min(u.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(u.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(u.color.b*Y.b,1)),fa.r=Math.max(0,Math.min(u.color.r*
+fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),oa=Ya($,Y,fa,ia),E(Q,S,W,o,la,ha),Va(Q,S,W,o,la,ha,0,0,1,0,0,1,oa),E(ka,aa,da,T,ma,ea),Va(ka,aa,da,T,ma,ea,1,0,1,1,0,1,oa)):(ga.r=ja.r,ga.g=ja.g,ga.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ga),Z.r=Math.max(0,Math.min(u.color.r*ga.r,1)),Z.g=Math.max(0,Math.min(u.color.g*ga.g,
+1)),Z.b=Math.max(0,Math.min(u.color.b*ga.b,1)),D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Z)):(D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(u.color));else if(u instanceof THREE.MeshNormalMaterial)Z.r=Wa(v.normalWorld.x),Z.g=Wa(v.normalWorld.y),Z.b=Wa(v.normalWorld.z),D(Q,S,W,o,da,T,la,ha),u.wireframe?Na(Z,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Oa(Z);else if(u instanceof
+THREE.MeshDepthMaterial)na=p.near,O=p.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,O),Y.r=Y.g=Y.b=1-Ra(f.positionScreen.z,na,O),fa.r=fa.g=fa.b=1-Ra(m.positionScreen.z,na,O),ia.r=ia.g=ia.b=1-Ra(h.positionScreen.z,na,O),oa=Ya($,Y,fa,ia),E(Q,S,W,o,la,ha),Va(Q,S,W,o,la,ha,0,0,1,0,0,1,oa),E(ka,aa,da,T,ma,ea),Va(ka,aa,da,T,ma,ea,1,0,1,1,0,1,oa)}function E(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function D(b,c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);
+v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,p,t,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT==THREE.RepeatWrapping;ra[w.id]=v.createPattern(w.image,xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":
+"no-repeat");w.needsUpdate=!1}h(ra[w.id]);var xa=w.offset.x/w.repeat.x,z=w.offset.y/w.repeat.y,X=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+xa)*X,n=(n+z)*w,p=(p+xa)*X,t=(t+z)*w,u=(u+xa)*X,x=(x+z)*w;e-=b;f-=c;k-=b;m-=c;p-=o;t-=n;u-=o;x-=n;xa=1/(p*x-u*t);w=(x*e-t*k)*xa;t=(x*f-t*m)*xa;e=(p*k-u*e)*xa;f=(p*m-u*f)*xa;b=b-w*o-e*n;c=c-t*o-f*n;v.save();v.transform(w,t,e,f,b,c);v.fill();v.restore()}}function Va(b,c,e,f,k,h,m,o,n,p,t,u,w){var x,xa;x=w.width-1;xa=w.height-1;m*=x;o*=xa;
+n*=x;p*=xa;t*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;p-=o;t-=m;u-=o;xa=1/(n*u-t*p);x=(u*e-p*k)*xa;p=(u*f-p*h)*xa;e=(n*k-t*e)*xa;f=(n*h-t*f)*xa;b=b-x*m-e*o;c=c-p*m-f*o;v.save();v.transform(x,p,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:k;Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=
+m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=e<0?0:e>255?255:e;Ba[12]=t<0?0:t>255?255:t;Ba[13]=u<0?0:u>255?255:u;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,sa,Ha,Qa,
+Xa,$a,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,p,this.sortElements);(va=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];N.empty();if(sa instanceof THREE.RenderableParticle){J=sa;J.x*=u;J.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(J,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(J=sa.v1,B=sa.v2,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=
+u,B.positionScreen.y*=x,N.addPoint(J.positionScreen.x,J.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),X.intersects(N)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&A(J,B,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(J=sa.v1,B=sa.v2,K=sa.v3,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,K.positionScreen.x*=u,K.positionScreen.y*=x,sa.overdraw&&(Pa(J.positionScreen,B.positionScreen),Pa(B.positionScreen,
+K.positionScreen),Pa(K.positionScreen,J.positionScreen)),N.add3Points(J.positionScreen.x,J.positionScreen.y,B.positionScreen.x,B.positionScreen.y,K.positionScreen.x,K.positionScreen.y),X.intersects(N)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&y(J,B,K,0,1,2,sa,za,b)}else za.opacity!=0&&y(J,B,K,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&
+(J=sa.v1,B=sa.v2,K=sa.v3,ca=sa.v4,J.positionScreen.x*=u,J.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,K.positionScreen.x*=u,K.positionScreen.y*=x,ca.positionScreen.x*=u,ca.positionScreen.y*=x,I.positionScreen.copy(B.positionScreen),P.positionScreen.copy(ca.positionScreen),sa.overdraw&&(Pa(J.positionScreen,B.positionScreen),Pa(B.positionScreen,ca.positionScreen),Pa(ca.positionScreen,J.positionScreen),Pa(K.positionScreen,I.positionScreen),Pa(K.positionScreen,P.positionScreen)),N.addPoint(J.positionScreen.x,
+J.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(ca.positionScreen.x,ca.positionScreen.y),X.intersects(N))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&F(J,B,K,ca,I,P,sa,za,b)}else za.opacity!=0&&F(J,B,K,ca,I,P,sa,za,b)}U.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(ca.sub(h.position,c.centroidWorld),ca.normalize(),m=c.normalWorld.dot(ca)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;Q=f(S++);
+Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),G.r=Math.max(0,Math.min(n.color.r*L.r,1)),G.g=Math.max(0,Math.min(n.color.g*L.g,1)),G.b=Math.max(0,Math.min(n.color.b*L.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-
+o.z*n.__farMinusNear),G.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(c,e,m,o,n,t,u){k.info.render.vertices+=
+4;k.info.render.faces++;Q=f(S++);Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(u,n,L),G.r=Math.max(0,Math.min(t.color.r*L.r,1)),G.g=Math.max(0,Math.min(t.color.g*L.g,1)),G.b=Math.max(0,Math.min(t.color.b*L.b,1))):
+G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+
+"; fill-opacity: "+t.opacity);p.appendChild(Q)}function f(b){I[b]==null&&(I[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&I[b].setAttribute("shape-rendering","crispEdges"));return I[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,u,x,v,y,z,A,F=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
+J=new THREE.Color(0),B=new THREE.Color(0),K,ca=new THREE.Vector3,I=[],P=[],Q,S,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){t=b;w=c;u=t/2;x=w/2;p.setAttribute("viewBox",-u+" "+-x+" "+t+" "+w);p.setAttribute("width",t);p.setAttribute("height",w);F.set(-u,-x,u,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
+this.render=function(b,f){var h,t,w,G,L,I,K,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=S=0;if(D=b.lights.length>0){K=b.lights;M.copy(b.ambientColor);J.setRGB(0,0,0);B.setRGB(0,0,0);h=0;for(t=K.length;h<t;h++)w=K[h],G=w.color,w instanceof THREE.DirectionalLight?(J.r+=G.r,J.g+=G.g,J.b+=G.b):w instanceof THREE.PointLight&&(B.r+=G.r,B.g+=G.g,B.b+=G.b)}h=0;for(t=m.length;h<t;h++)if(K=m[h],E.empty(),K instanceof THREE.RenderableParticle){v=
+K;v.x*=u;v.y*=-x;w=0;for(G=K.materials.length;w<G;)w++}else if(K instanceof THREE.RenderableLine){if(v=K.v1,y=K.v2,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),F.intersects(E)){w=0;for(G=K.materials.length;w<G;)if(($=K.materials[w++])&&$.opacity!=0){L=v;I=y;var Y=W++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg","line"),o==0&&P[Y].setAttribute("shape-rendering",
+"crispEdges"));Q=P[Y];Q.setAttribute("x1",L.positionScreen.x);Q.setAttribute("y1",L.positionScreen.y);Q.setAttribute("x2",I.positionScreen.x);Q.setAttribute("y2",I.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),p.appendChild(Q))}}}else if(K instanceof THREE.RenderableFace3){if(v=K.v1,y=K.v2,
+z=K.v3,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),F.intersects(E)){w=0;for(G=K.meshMaterials.length;w<G;)if($=K.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(I=K.faceMaterials.length;L<I;)($=K.faceMaterials[L++])&&$.opacity!=0&&c(v,y,z,K,$,b)}else $&&
+$.opacity!=0&&c(v,y,z,K,$,b)}}else if(K instanceof THREE.RenderableFace4&&(v=K.v1,y=K.v2,z=K.v3,A=K.v4,v.positionScreen.x*=u,v.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,A.positionScreen.y),F.intersects(E))){w=
+0;for(G=K.meshMaterials.length;w<G;)if($=K.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(I=K.faceMaterials.length;L<I;)($=K.faceMaterials[L++])&&$.opacity!=0&&e(v,y,z,A,K,$,b)}else $&&$.opacity!=0&&e(v,y,z,A,K,$,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",
@@ -219,121 +219,121 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),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"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,p=b.colors,t=p.length,u=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,z=b.__dirtyColors,U=b.__webglCustomAttributes,y,A;if(U)for(y in U)U[y].offset=0;if(e.sortParticles){ta.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ca.copy(k),ta.multiplyVector3(Ca),w[f]=[Ca.z,f];w.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
-for(f=0;f<t;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U)for(y in U){f=U[y];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[index];f.size===2?(f.array[t]=A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=
-A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(z)for(f=0;f<t;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(U)for(y in U)if(f=U[y],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[h];f.size===2?(f.array[t]=
-A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(U)for(y in U)if(f=U[y],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
-f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||X.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(X.maxMorphTargets);for(var h=0,m=X.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=V&&(o.useProgram(h),V=h,n=!0);if(f.id!=ha)ha=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
-THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,v=0,w=0,x=0,z,A,y,N=Fa,S=N.directional.colors,E=N.directional.positions,F=N.point.colors,D=N.point.positions,G=N.point.distances,na=0,ua=0,e=p=y=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,z=p.position,A=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)v+=u.r,w+=u.g,x+=u.b;else if(p instanceof
-THREE.DirectionalLight)y=na*3,S[y]=u.r*A,S[y+1]=u.g*A,S[y+2]=u.b*A,E[y]=z.x,E[y+1]=z.y,E[y+2]=z.z,na+=1;else if(p instanceof THREE.SpotLight)y=na*3,S[y]=u.r*A,S[y+1]=u.g*A,S[y+2]=u.b*A,u=1/z.length(),E[y]=z.x*u,E[y+1]=z.y*u,E[y+2]=z.z*u,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=u.r*A,F[p+1]=u.g*A,F[p+2]=u.b*A,D[p]=z.x,D[p+1]=z.y,D[p+2]=z.z,G[ua]=y,ua+=1;e=na*3;for(n=S.length;e<n;e++)S[e]=0;e=ua*3;for(n=F.length;e<n;e++)F[e]=0;N.point.length=ua;N.directional.length=na;N.ambient[0]=v;
-N.ambient[1]=w;N.ambient[2]=x;c=Fa;t.enableLighting.value=c.directional.length+c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=
-f.color,t.opacity.value=f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=
-f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=U.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(c=0;c<pa.length;c++)t.shadowMatrix.value[c]=
-pa[c],t.shadowMap.texture[c]=X.shadowMap[c];t.shadowDarkness.value=X.shadowMapDarkness;t.shadowBias.value=X.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(w=h.uniforms[c[t][1]])if(v=c[t][0],x=v.type,n=v.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
-n);else if(x=="v3v"){if(!v._array)v._array=new Float32Array(3*n.length);x=0;for(z=n.length;x<z;x++)N=x*3,v._array[N]=n[x].x,v._array[N+1]=n[x].y,v._array[N+2]=n[x].z;o.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);x=0;for(z=n.length;x<z;x++)n[x].flattenToArrayOffset(v._array,x*16);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="t"){if(o.uniform1i(w,
-n),w=v.texture)if(w.image instanceof Array&&w.image.length==6){if(v=w,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[n]);H(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof
-THREE.WebGLRenderTargetCube?(v=w,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):B(w,n)}else if(x=="tv"){if(!v._array){v._array=[];x=0;for(z=v.texture.length;x<z;x++)v._array[x]=n+x}o.uniform1iv(w,v._array);x=0;for(z=v.texture.length;x<z;x++)(w=v.texture[x])&&B(w,v._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
-THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
-m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ka&&(ka=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
-o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,
-w=0,u=m.morphTargetInfluences,x,z=u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<z;x++)!p[x]&&u[x]>v&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[w]=1;v=-1;t++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
+THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,p=b.colors,t=p.length,u=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,z=b.__dirtyColors,X=b.__webglCustomAttributes,A,y;if(X)for(A in X)X[A].offset=0;if(e.sortParticles){ta.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ca.copy(k),ta.multiplyVector3(Ca),w[f]=[Ca.z,f];w.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
+for(f=0;f<t;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(X)for(A in X){f=X[A];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[t]=y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=
+y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(z)for(f=0;f<t;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(X)for(A in X)if(f=X[A],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[t]=
+y.x,f.array[t+1]=y.y):f.size===3?f.type==="c"?(f.array[t]=y.r,f.array[t+1]=y.g,f.array[t+2]=y.b):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z):(f.array[t]=y.x,f.array[t+1]=y.y,f.array[t+2]=y.z,f.array[t+3]=y.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(z||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(X)for(A in X)if(f=X[A],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||W.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=T&&(o.useProgram(h),T=h,n=!0);if(f.id!=ha)ha=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
+THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,u,v,w,x,z=Fa,y=z.directional.colors,A=z.directional.positions,N=z.point.colors,U=z.point.positions,F=z.point.distances,E=0,D=0,e=p=x=0,n=c.length;e<n;e++)if(p=c[e],u=p.color,v=p.position,w=p.intensity,x=p.distance,p instanceof THREE.DirectionalLight)x=E*3,y[x]=u.r*w,y[x+1]=u.g*w,y[x+
+2]=u.b*w,A[x]=v.x,A[x+1]=v.y,A[x+2]=v.z,E+=1;else if(p instanceof THREE.SpotLight)x=E*3,y[x]=u.r*w,y[x+1]=u.g*w,y[x+2]=u.b*w,u=1/v.length(),A[x]=v.x*u,A[x+1]=v.y*u,A[x+2]=v.z*u,E+=1;else if(p instanceof THREE.PointLight)p=D*3,N[p]=u.r*w,N[p+1]=u.g*w,N[p+2]=u.b*w,U[p]=v.x,U[p+1]=v.y,U[p+2]=v.z,F[D]=x,D+=1;e=E*3;for(n=y.length;e<n;e++)y[e]=0;e=D*3;for(n=N.length;e<n;e++)N[e]=0;z.point.length=D;z.directional.length=E;z.ambient[0]=0;z.ambient[1]=0;z.ambient[2]=0;c=Fa;t.enableLighting.value=c.directional.length+
+c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,
+f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=
+X.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(c=0;c<pa.length;c++)t.shadowMatrix.value[c]=pa[c],t.shadowMap.texture[c]=W.shadowMap[c];t.shadowDarkness.value=
+W.shadowMapDarkness;t.shadowBias.value=W.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(z=h.uniforms[c[t][1]])if(v=c[t][0],y=v.type,n=v.value,y=="i")o.uniform1i(z,n);else if(y=="f")o.uniform1f(z,n);else if(y=="v2")o.uniform2f(z,n.x,n.y);else if(y=="v3")o.uniform3f(z,n.x,n.y,n.z);else if(y=="v4")o.uniform4f(z,n.x,n.y,n.z,n.w);else if(y=="c")o.uniform3f(z,n.r,n.g,n.b);else if(y=="fv1")o.uniform1fv(z,n);else if(y=="fv")o.uniform3fv(z,n);else if(y=="v3v"){if(!v._array)v._array=new Float32Array(3*
+n.length);y=0;for(A=n.length;y<A;y++)N=y*3,v._array[N]=n[y].x,v._array[N+1]=n[y].y,v._array[N+2]=n[y].z;o.uniform3fv(z,v._array)}else if(y=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(z,!1,v._array)}else if(y=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);y=0;for(A=n.length;y<A;y++)n[y].flattenToArrayOffset(v._array,y*16);o.uniformMatrix4fv(z,!1,v._array)}else if(y=="t"){if(o.uniform1i(z,n),z=v.texture)if(z.image instanceof Array&&z.image.length==
+6){if(v=z,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[n]);B(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else z instanceof THREE.WebGLRenderTargetCube?
+(v=z,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):K(z,n)}else if(y=="tv"){if(!v._array){v._array=[];y=0;for(A=v.texture.length;y<A;y++)v._array[y]=n+y}o.uniform1iv(z,v._array);y=0;for(A=v.texture.length;y<A;y++)(z=v.texture[y])&&K(z,v._array[y])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshPhongMaterial||
+f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==
+null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ka&&(ka=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(f.position,
+3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,w=0,u=m.morphTargetInfluences,x,y=
+u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!p[x]&&u[x]>v&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[w]=1;v=-1;t++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
 0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
 h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,
 o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,
-o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=h.__webglFaceCount,X.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),X.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),X.info.render.calls++):
-m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),X.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
+o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
+m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
 b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)e=b.normalArray,f=e[w],h=e[w+1],k=e[w+2],m=e[w+3],t=e[w+4],u=e[w+5],n=e[w+6],p=e[w+7],v=e[w+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,e[w]=f,e[w+1]=h,e[w+2]=k,e[w+3]=f,e[w+4]=h,e[w+5]=k,e[w+6]=f,e[w+7]=h,e[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
-0,b.count);b.count=0}function k(b){if(ma!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ma=b.doubleSided;if(ea!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ea=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){Y!=b&&(o.depthMask(b),Y=b)}function p(b,c,e){fa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=b);if(b&&(ia!=c||ra!=e))o.polygonOffset(c,e),ia=c,ra=e}function t(b){va[0].set(b.n41-
-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);va[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);va[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);va[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);va[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);va[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=va[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=va[f].x*c.n14+va[f].y*c.n24+va[f].z*c.n34+va[f].w,b<=e)return!1;return!0}function u(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?u(k,e):u(h,e)}function v(b){var c,e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
-0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?u(o,h):u(n,h))}else(h=c)&&(h.transparent?u(o,h):u(n,h))}function A(b,c){return c.z-b.z}function z(b){var c,n,p,u=0,v,x,z,y,U=b.lights;wa||(wa=new THREE.PerspectiveCamera(X.shadowCameraFov,X.shadowMapWidth/X.shadowMapHeight,X.shadowCameraNear,X.shadowCameraFar));c=0;for(n=U.length;c<n;c++)if(p=U[c],p instanceof THREE.SpotLight&&p.castShadow){ha=-1;X.shadowMap[u]||(X.shadowMap[u]=new THREE.WebGLRenderTarget(X.shadowMapWidth,X.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);v=X.shadowMap[u];x=pa[u];wa.position.copy(p.position);wa.lookAt(p.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Aa);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
-t(ta);X.initWebGLObjects(b);ca(v);o.clearColor(1,1,1,1);X.clear();o.clearColor(ga.r,ga.g,ga.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)z=b.__webglObjects[v],y=z.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||w(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),E(y,wa,!1),z.render=!0):z.render=!1:z.render=!1;m(!0);K(THREE.NormalBlending);for(v=0;v<x;v++)if(z=b.__webglObjects[v],z.render)y=z.object,buffer=z.buffer,k(y),z=y.customDepthMaterial?
-y.customDepthMaterial:y.geometry.morphTargets.length?Ka:Da,f(wa,U,null,z,buffer,y);for(v=0;v<p;v++)z=b.__webglObjectsImmediate[v],y=z.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),E(y,wa,!1),k(y),program=e(wa,U,null,Da,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,va):y.render(function(b){h(b,program,Da.shading)}));u++}}function y(b,c){var e,f,h;e=W.attributes;var k=W.uniforms,m=qa/oa,n,t=[],p=oa*0.5,u=qa*0.5,v=!0;o.useProgram(W.program);
-V=W.program;ka=$=Z=-1;Ja||(o.enableVertexAttribArray(W.attributes.position),o.enableVertexAttribArray(W.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<
-f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(u-h.position.y)/
+0,b.count);b.count=0}function k(b){if(ma!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ma=b.doubleSided;if(ea!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ea=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){Y!=b&&(o.depthMask(b),Y=b)}function p(b,c,e){fa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=b);if(b&&(ia!=c||ra!=e))o.polygonOffset(c,e),ia=c,ra=e}function t(b){ua[0].set(b.n41-
+b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ua[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ua[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ua[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ua[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ua[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=ua[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
+Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ua[f].x*c.n14+ua[f].y*c.n24+ua[f].z*c.n34+ua[f].w,b<=e)return!1;return!0}function u(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?u(k,e):u(h,e)}function v(b){var c,e,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
+0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?u(o,h):u(n,h))}else(h=c)&&(h.transparent?u(o,h):u(n,h))}function y(b,c){return c.z-b.z}function z(b){var c,n,p,u=0,v,x,y,z,A=b.lights;wa||(wa=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=A.length;c<n;c++)if(p=A[c],p instanceof THREE.SpotLight&&p.castShadow){ha=-1;W.shadowMap[u]||(W.shadowMap[u]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[u]||(pa[u]=new THREE.Matrix4);v=W.shadowMap[u];x=pa[u];wa.position.copy(p.position);wa.lookAt(p.target.position);wa.update(void 0,!0);b.update(void 0,!1,wa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(wa.projectionMatrix);x.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Aa);wa.projectionMatrix.flattenToArray(Ea);ta.multiply(wa.projectionMatrix,wa.matrixWorldInverse);
+t(ta);W.initWebGLObjects(b);ca(v);o.clearColor(1,1,1,1);W.clear();o.clearColor(ga.r,ga.g,ga.b,ja);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,wa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);J(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)z=y.object,buffer=y.buffer,k(z),y=z.customDepthMaterial?
+z.customDepthMaterial:z.geometry.morphTargets.length?Ka:Da,f(wa,A,null,y,buffer,z);for(v=0;v<p;v++)y=b.__webglObjectsImmediate[v],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,wa,!1),k(z),program=e(wa,A,null,Da,z),z.immediateRenderCallback?z.immediateRenderCallback(program,o,ua):z.render(function(b){h(b,program,Da.shading)}));u++}}function A(b,c){var e,f,h;e=V.attributes;var k=V.uniforms,m=qa/oa,n,t=[],p=oa*0.5,u=qa*0.5,v=!0;o.useProgram(V.program);
+T=V.program;ka=$=Z=-1;Ja||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<
+f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(u-h.position.y)/
 u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?qa:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,
-h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Y)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
-var e,f,h,k,m,n,o,t,p={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:u}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
-materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=Z){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
-o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}Z=b}}function H(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,T(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,T(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,T(c.magFilter)),
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)))}function B(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
-THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,T(b.format),b.image.width,b.image.height,0,T(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function ca(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=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,T(b.format),
-b.width,b.height,0,T(b.format),T(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
+h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),J(h.blending),K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(Y)}function F(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function E(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
+var e,f,h,k,m,n,o,t,p={},v=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=c(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:v}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
+materials:n,vertices:0,numMorphTargets:v})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=aa++,b.geometryGroupsList.push(b.geometryGroups[u])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=Z){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);
+o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}Z=b}}function B(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,S(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,S(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,S(c.magFilter)),
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,S(c.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)))}function K(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
+THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);B(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function ca(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=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);B(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),B(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,S(b.format),
+b.width,b.height,0,S(b.format),S(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
 o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);c?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,
-null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=oa,b=qa,f=na,h=O);c!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),la=c)}function J(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
-o.bindTexture(o.TEXTURE_2D,null))}function P(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
+null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=oa,b=qa,f=na,h=O);c!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),la=c)}function I(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
+o.bindTexture(o.TEXTURE_2D,null))}function P(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
 case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;
-case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var X=this,o,da=[],V=null,
-la=null,ha=-1,ka=null,aa=0,ma=null,ea=null,Z=null,$=null,Y=null,fa=null,ia=null,ra=null,na=0,O=0,oa=0,qa=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},U=b.canvas!==void 0?b.canvas:document.createElement("canvas"),S=
-b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=U;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
+case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,da=[],T=null,
+la=null,ha=-1,ka=null,aa=0,ma=null,ea=null,Z=null,$=null,Y=null,fa=null,ia=null,ra=null,na=0,O=0,oa=0,qa=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},X=b.canvas!==void 0?b.canvas:document.createElement("canvas"),U=
+b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,va=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=X;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 wa,pa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
-uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=U.getContext("experimental-webgl",{antialias:ua,stencil:S,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
-o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);S=0;W.vertices[S++]=-1;W.vertices[S++]=-1;W.vertices[S++]=0;W.vertices[S++]=1;W.vertices[S++]=1;W.vertices[S++]=-1;W.vertices[S++]=1;W.vertices[S++]=1;W.vertices[S++]=1;W.vertices[S++]=
-1;W.vertices[S++]=1;W.vertices[S++]=0;W.vertices[S++]=-1;W.vertices[S++]=1;W.vertices[S++]=0;S=W.vertices[S++]=0;W.faces[S++]=0;W.faces[S++]=1;W.faces[S++]=2;W.faces[S++]=0;W.faces[S++]=2;W.faces[S++]=3;W.vertexBuffer=o.createBuffer();W.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,W.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,W.faces,o.STATIC_DRAW);W.program=o.createProgram();
-o.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=o.getAttribLocation(W.program,"position");W.attributes.uv=o.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=o.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=o.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=o.getUniformLocation(W.program,"rotation");
-W.uniforms.scale=o.getUniformLocation(W.program,"scale");W.uniforms.alignment=o.getUniformLocation(W.program,"alignment");W.uniforms.color=o.getUniformLocation(W.program,"color");W.uniforms.map=o.getUniformLocation(W.program,"map");W.uniforms.opacity=o.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=o.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=o.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=o.getUniformLocation(W.program,
-"screenPosition");W.uniforms.modelViewMatrix=o.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=o.getUniformLocation(W.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){U.width=b;U.height=c;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(b,c,e,f){na=b;O=c;oa=e;qa=f;o.viewport(na,O,oa,qa)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
+uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=X.getContext("experimental-webgl",{antialias:va,stencil:U,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);
+o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(ga.r,ga.g,ga.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);U=0;V.vertices[U++]=-1;V.vertices[U++]=-1;V.vertices[U++]=0;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=
+1;V.vertices[U++]=1;V.vertices[U++]=0;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=0;U=V.vertices[U++]=0;V.faces[U++]=0;V.faces[U++]=1;V.faces[U++]=2;V.faces[U++]=0;V.faces[U++]=2;V.faces[U++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();
+o.attachShader(V.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");
+V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,
+"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){X.width=b;X.height=c;this.setViewport(0,0,X.width,X.height)};this.setViewport=function(b,c,e,f){na=b;O=c;oa=e;qa=f;o.viewport(na,O,oa,qa)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
 function(b,c){ga.setHex(b);ja=c;o.clearColor(ga.r,ga.g,ga.b,ja)};this.setClearColor=function(b,c){ga.copy(b);ja=c;o.clearColor(ga.r,ga.g,ga.b,ja)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return ja};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};this.getContext=function(){return o};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];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);
-o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);X.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
-X.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),X.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),X.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
-b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,u,v;p=v=t=0;for(u=c.length;p<u;p++)m=c[p],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&
-t++;t+v<=ya?p=v:(p=Math.ceil(ya*v/(t+v)),t=ya-p);m={directional:p,point:t};t=v=0;for(p=c.length;t<p;t++)u=c[t],u instanceof THREE.SpotLight&&u.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;u=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
-maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},z,f=[];n?f.push(n):(f.push(p),f.push(u));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=da.length;z<f;z++)if(da[z].code==n){x=da[z].program;break a}z=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
+o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
+W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
+b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,v,u;p=u=t=0;for(v=c.length;p<v;p++)m=c[p],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&
+t++;t+u<=ya?p=u:(p=Math.ceil(ya*u/(t+u)),t=ya-p);m={directional:p,point:t};t=u=0;for(p=c.length;t<p;t++)v=c[t],v instanceof THREE.SpotLight&&v.castShadow&&u++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;v=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},z,f=[];n?f.push(n):(f.push(p),f.push(v));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=da.length;z<f;z++)if(da[z].code==n){x=da[z].program;break a}z=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
 "#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
 m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
-e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(z,P("fragment",m+p));o.attachShader(z,P("vertex",f+u));o.linkProgram(z);o.getProgramParameter(z,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(z,o.VALIDATE_STATUS)+", gl error ["+
+e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(z,P("fragment",m+p));o.attachShader(z,P("vertex",f+v));o.linkProgram(z);o.getProgramParameter(z,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(z,o.VALIDATE_STATUS)+", gl error ["+
 o.getError()+"]");z.uniforms={};z.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in t)f.push(y);y=f;f=0;for(t=y.length;f<t;f++)p=y[f],z.uniforms[p]=o.getUniformLocation(z,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(x in c)f.push(x);
-x=f;y=0;for(c=x.length;y<c;y++)e=x[y],z.attributes[e]=o.getAttribLocation(z,e);z.id=da.length;da.push({program:z,code:n});X.info.memory.programs=da.length;x=z}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
+x=f;y=0;for(c=x.length;y<c;y++)e=x[y],z.attributes[e]=o.getAttribLocation(z,e);z.id=da.length;da.push({program:z,code:n});W.info.memory.programs=da.length;x=z}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
 o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)y="morphTarget"+k,x[y]>=0&&(o.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){ca(b);
-this.clear(c,e,f)};this.render=function(b,c,u,U){var N,S,F,D,G,na,B,H,ua=b.lights,L=b.fog;ha=-1;this.shadowMapEnabled&&z(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);t(ta);this.initWebGLObjects(b);ca(u);(this.autoClear||U)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-G=b.__webglObjects.length;for(U=0;U<G;U++)if(N=b.__webglObjects[U],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(A);na=b.__webglObjectsImmediate.length;for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],
-B=N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(U=0;U<G;U++)if(N=b.__webglObjects[U],N.render)B=N.object,H=N.buffer,k(B),f(c,ua,L,b.overrideMaterial,H,B);for(U=0;U<na;U++)N=b.__webglObjectsImmediate[U],B=N.object,B.visible&&(k(B),S=e(c,ua,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(S,o,va):B.render(function(b){h(b,S,
-Da.shading)}))}else{K(THREE.NormalBlending);for(U=G-1;U>=0;U--)if(N=b.__webglObjects[U],N.render){B=N.object;H=N.buffer;F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,H,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),S=e(c,
-ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(S,o,va):B.render(function(b){h(b,S,Da.shading)})}for(U=0;U<G;U++)if(N=b.__webglObjects[U],N.render){B=N.object;H=N.buffer;F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,H,B)}for(U=0;U<na;U++)if(N=b.__webglObjectsImmediate[U],B=N.object,B.visible){F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),
-m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),S=e(c,ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(S,o,va):B.render(function(b){h(b,S,Da.shading)})}}b.__webglSprites.length&&y(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&J(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
+this.clear(c,e,f)};this.render=function(b,c,u,X){var N,U,E,D,G,K,B,na,va=b.lights,L=b.fog;ha=-1;this.shadowMapEnabled&&z(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);t(ta);this.initWebGLObjects(b);ca(u);(this.autoClear||X)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+G=b.__webglObjects.length;for(X=0;X<G;X++)if(N=b.__webglObjects[X],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(y);K=b.__webglObjectsImmediate.length;for(X=0;X<K;X++)N=b.__webglObjectsImmediate[X],B=
+N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),F(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(X=0;X<G;X++)if(N=b.__webglObjects[X],N.render)B=N.object,na=N.buffer,k(B),f(c,va,L,b.overrideMaterial,na,B);for(X=0;X<K;X++)N=b.__webglObjectsImmediate[X],B=N.object,B.visible&&(k(B),U=e(c,va,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,
+Da.shading)}))}else{J(THREE.NormalBlending);for(X=G-1;X>=0;X--)if(N=b.__webglObjects[X],N.render){B=N.object;na=N.buffer;E=N.opaque;k(B);for(N=0;N<E.count;N++)D=E.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,va,L,D,na,B)}for(X=0;X<K;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){E=N.opaque;k(B);for(N=0;N<E.count;N++)D=E.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,
+va,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,Da.shading)})}for(X=0;X<G;X++)if(N=b.__webglObjects[X],N.render){B=N.object;na=N.buffer;E=N.transparent;k(B);for(N=0;N<E.count;N++)D=E.list[N],J(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,va,L,D,na,B)}for(X=0;X<K;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){E=N.transparent;k(B);for(N=0;N<E.count;N++)D=E.list[N],J(D.blending),
+m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,va,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,ua):B.render(function(b){h(b,U,Da.shading)})}}b.__webglSprites.length&&A(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&I(u)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
 f=b,h=void 0,k=void 0,m=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(h in k=e.geometry,k.geometryGroups==void 0&&L(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();
 n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<
-p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}X.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,z=void 0,y=void 0,U=y=t=0,N=w=v=void 0,w=p=N=v=u=void 0,x=n.geometry,z=x.faces,N=m.faces,u=0,v=N.length;u<v;u++)w=N[u],w=z[w],w instanceof THREE.Face3?(t+=3,y+=1,U+=3):w instanceof THREE.Face4&&(t+=4,y+=2,U+=4);for(var u=m,v=n,A=N=z=void 0,S=void 0,A=void 0,w=[],z=0,N=v.materials.length;z<N;z++)if(A=v.materials[z],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
-l;A++)(S=u.materials[A])&&w.push(S)}else(S=A)&&w.push(S);u=w;m.__materials=u;a:{z=v=void 0;N=u.length;for(v=0;v<N;v++)if(z=u[v],z.map||z.lightMap||z instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{N=z=void 0;w=u.length;for(z=0;z<w;z++)if(N=u[z],!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){N=N&&N.shading!=void 0&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}N=!1}a:{w=z=void 0;A=u.length;for(z=0;z<A;z++)if(w=u[z],w.vertexColors){w=
+p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,z=void 0,y=void 0,X=y=t=0,N=w=v=void 0,w=p=N=v=u=void 0,x=n.geometry,z=x.faces,N=m.faces,u=0,v=N.length;u<v;u++)w=N[u],w=z[w],w instanceof THREE.Face3?(t+=3,y+=1,X+=3):w instanceof THREE.Face4&&(t+=4,y+=2,X+=4);for(var u=m,v=n,A=N=z=void 0,U=void 0,A=void 0,w=[],z=0,N=v.materials.length;z<N;z++)if(A=v.materials[z],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
+l;A++)(U=u.materials[A])&&w.push(U)}else(U=A)&&w.push(U);u=w;m.__materials=u;a:{z=v=void 0;N=u.length;for(v=0;v<N;v++)if(z=u[v],z.map||z.lightMap||z instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{N=z=void 0;w=u.length;for(z=0;z<w;z++)if(N=u[z],!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){N=N&&N.shading!=void 0&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}N=!1}a:{w=z=void 0;A=u.length;for(z=0;z<A;z++)if(w=u[z],w.vertexColors){w=
 w.vertexColors;break a}w=!1}m.__vertexArray=new Float32Array(t*3);if(N)m.__normalArray=new Float32Array(t*3);if(x.hasTangents)m.__tangentArray=new Float32Array(t*4);if(w)m.__colorArray=new Float32Array(t*3);if(v){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=
-new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(U*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(z=m.numMorphTargets;x<z;x++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=N==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=w;m.__normalType=N;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
-n.geometry.edgeFaces.length*6:0);m.__webglLineCount=U*2;x=0;for(z=u.length;x<z;x++)if(v=u[x],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){w=v.attributes[a];N={};for(p in w)N[p]=w[p];if(!N.__webglInitialized||N.createUniqueBuffers)N.__webglInitialized=!0,y=1,N.type==="v2"?y=2:N.type==="v3"?y=3:N.type==="v4"?y=4:N.type==="c"&&(y=3),N.size=y,N.array=new Float32Array(t*y),N.buffer=o.createBuffer(),N.buffer.belongsToAttribute=a,w.needsUpdate=!0,
-N.__original=w;m.__webglCustomAttributes[a]=N}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
-n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),X.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
-m.__webglColorBuffer=o.createBuffer();X.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;U=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(U=n.materials[p],U.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in U.attributes){originalAttribute=U.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
+new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(X*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(z=m.numMorphTargets;x<z;x++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=N==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=w;m.__normalType=N;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
+n.geometry.edgeFaces.length*6:0);m.__webglLineCount=X*2;x=0;for(z=u.length;x<z;x++)if(v=u[x],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){w=v.attributes[a];N={};for(p in w)N[p]=w[p];if(!N.__webglInitialized||N.createUniqueBuffers)N.__webglInitialized=!0,y=1,N.type==="v2"?y=2:N.type==="v3"?y=3:N.type==="v4"?y=4:N.type==="c"&&(y=3),N.size=y,N.array=new Float32Array(t*y),N.buffer=o.createBuffer(),N.buffer.belongsToAttribute=a,w.needsUpdate=!0,
+N.__original=w;m.__webglCustomAttributes[a]=N}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
+n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
+m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;X=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(X=n.materials[p],X.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in X.attributes){originalAttribute=X.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(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
 !0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],M(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,M(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
 e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
-1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,U=!h.dynamic,p.__inittedArrays){var E=u=x=void 0,B=void 0,na=E=void 0,H=void 0,ua=void 0,ja=void 0,J=S=A=w=N=z=v=void 0,ga=void 0,K=void 0,
-I=B=ja=B=ua=H=void 0,C=void 0,O=C=I=H=void 0,Y=void 0,P=O=C=I=E=E=na=ja=B=O=C=I=Y=O=C=I=Y=O=C=I=void 0,Q=0,oa=0,$=0,ca=0,qa=0,V=0,T=0,ya=0,W=0,R=0,pa=0,O=I=0,O=void 0,fa=p.__vertexArray,wa=p.__uvArray,va=p.__uv2Array,ha=p.__normalArray,ia=p.__tangentArray,ka=p.__colorArray,Z=p.__skinVertexAArray,aa=p.__skinVertexBArray,da=p.__skinIndexArray,ea=p.__skinWeightArray,Da=p.__morphTargetsArrays,la=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,z=p.__vertexColorType,
-v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(la)for(P in la)la[P].offset=0,la[P].offsetSrc=0;x=0;for(u=cb.length;x<u;x++)if(E=cb[x],B=fb[E],db&&(w=db[E]),eb&&(A=eb[E]),E=
-B.vertexNormals,na=B.normal,H=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)S=Ja[B.a].position,J=Ja[B.b].position,ga=Ja[B.c].position,fa[oa]=S.x,fa[oa+1]=S.y,fa[oa+2]=S.z,fa[oa+3]=J.x,fa[oa+4]=J.y,fa[oa+5]=J.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,oa+=9;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
-C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=O,C.array[I+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(S=C.value[B.a],J=C.value[B.b],ga=C.value[B.c]):C.boundTo==="faces"?(ga=J=S=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(S=C.value[O],J=C.value[O+1],ga=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[I]=S.x,C.array[I+1]=
-S.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ga.x,C.array[I+5]=ga.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=S.r,C.array[I+1]=S.g,C.array[I+2]=S.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ga.r,C.array[I+7]=ga.g,C.array[I+8]=ga.b):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ga.x,C.array[I+7]=ga.y,C.array[I+8]=ga.z),C.offset+=9):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=S.w,
-C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ga.x,C.array[I+9]=ga.y,C.array[I+10]=ga.z,C.array[I+11]=ga.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)S=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ga=La[I].vertices[B.c].position,O=Da[I],O[pa]=S.x,O[pa+1]=S.y,O[pa+2]=S.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+3]=I.w,ea[R+
-4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],da[R]=I.x,da[R+1]=I.y,da[R+2]=I.z,da[R+3]=I.w,da[R+4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Z[R]=I.x,Z[R+1]=I.y,Z[R+2]=I.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=1,aa[R+
-4]=C.x,aa[R+5]=C.y,aa[R+6]=C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+9]=O.y,aa[R+10]=O.z,aa[R+11]=1,R+=12;if(Ca&&z)H.length==3&&z==THREE.VertexColors?(B=H[0],I=H[1],C=H[2]):C=I=B=ua,ka[W]=B.r,ka[W+1]=B.g,ka[W+2]=B.b,ka[W+3]=I.r,ka[W+4]=I.g,ka[W+5]=I.b,ka[W+6]=C.r,ka[W+7]=C.g,ka[W+8]=C.b,W+=9;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ia[T]=H.x,ia[T+1]=H.y,ia[T+2]=H.z,ia[T+3]=H.w,ia[T+4]=ua.x,ia[T+5]=ua.y,ia[T+6]=ua.z,ia[T+7]=ua.w,ia[T+8]=B.x,ia[T+9]=B.y,ia[T+10]=B.z,ia[T+11]=B.w,T+=12;if(Ga&&N)if(E.length==
-3&&Ia)for(ja=0;ja<3;ja++)na=E[ja],ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;else for(ja=0;ja<3;ja++)ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<3;ja++)E=w[ja],wa[$]=E.u,wa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)E=A[ja],va[ca]=E.u,va[ca+1]=E.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+2,qa+=3,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+2,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ya+=6,Q+=3)}else if(B instanceof THREE.Face4){if(Ea)S=Ja[B.a].position,J=Ja[B.b].position,
-ga=Ja[B.c].position,K=Ja[B.d].position,fa[oa]=S.x,fa[oa+1]=S.y,fa[oa+2]=S.z,fa[oa+3]=J.x,fa[oa+4]=J.y,fa[oa+5]=J.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,fa[oa+9]=K.x,fa[oa+10]=K.y,fa[oa+11]=K.z,oa+=12;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=
-O,C.array[I+2]=O,C.array[I+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.array[I+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(S=C.value[B.a],J=C.value[B.b],ga=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ga=J=S=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(S=C.value[O],J=C.value[O+1],ga=C.value[O+2],K=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[I]=S.x,
-C.array[I+1]=S.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ga.x,C.array[I+5]=ga.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=S.r,C.array[I+1]=S.g,C.array[I+2]=S.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ga.r,C.array[I+7]=ga.g,C.array[I+8]=ga.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ga.x,C.array[I+7]=ga.y,
-C.array[I+8]=ga.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=S.x,C.array[I+1]=S.y,C.array[I+2]=S.z,C.array[I+3]=S.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ga.x,C.array[I+9]=ga.y,C.array[I+10]=ga.z,C.array[I+11]=ga.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)S=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ga=La[I].vertices[B.c].position,
-K=La[I].vertices[B.d].position,O=Da[I],O[pa]=S.x,O[pa+1]=S.y,O[pa+2]=S.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z,O[pa+9]=K.x,O[pa+10]=K.y,O[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Y=Ma[B.d],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+3]=I.w,ea[R+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,ea[R+12]=Y.x,ea[R+13]=Y.y,ea[R+14]=Y.z,ea[R+15]=Y.w,I=Ua[B.a],C=Ua[B.b],O=Ua[B.c],Y=Ua[B.d],da[R]=I.x,da[R+1]=I.y,
-da[R+2]=I.z,da[R+3]=I.w,da[R+4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,da[R+12]=Y.x,da[R+13]=Y.y,da[R+14]=Y.z,da[R+15]=Y.w,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Y=Sa[B.d],Z[R]=I.x,Z[R+1]=I.y,Z[R+2]=I.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,Z[R+12]=Y.x,Z[R+13]=Y.y,Z[R+14]=Y.z,Z[R+15]=1,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=1,aa[R+4]=C.x,aa[R+5]=C.y,aa[R+6]=
-C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+9]=O.y,aa[R+10]=O.z,aa[R+11]=1,aa[R+12]=B.x,aa[R+13]=B.y,aa[R+14]=B.z,aa[R+15]=1,R+=16;if(Ca&&z)H.length==4&&z==THREE.VertexColors?(B=H[0],I=H[1],C=H[2],H=H[3]):H=C=I=B=ua,ka[W]=B.r,ka[W+1]=B.g,ka[W+2]=B.b,ka[W+3]=I.r,ka[W+4]=I.g,ka[W+5]=I.b,ka[W+6]=C.r,ka[W+7]=C.g,ka[W+8]=C.b,ka[W+9]=H.r,ka[W+10]=H.g,ka[W+11]=H.b,W+=12;if(Ka&&ta.hasTangents)H=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[T]=H.x,ia[T+1]=H.y,ia[T+2]=H.z,ia[T+3]=H.w,ia[T+4]=ua.x,ia[T+5]=ua.y,ia[T+6]=ua.z,ia[T+7]=
-ua.w,ia[T+8]=B.x,ia[T+9]=B.y,ia[T+10]=B.z,ia[T+11]=B.w,ia[T+12]=ja.x,ia[T+13]=ja.y,ia[T+14]=ja.z,ia[T+15]=ja.w,T+=16;if(Ga&&N)if(E.length==4&&Ia)for(ja=0;ja<4;ja++)na=E[ja],ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;else for(ja=0;ja<4;ja++)ha[V]=na.x,ha[V+1]=na.y,ha[V+2]=na.z,V+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<4;ja++)E=w[ja],wa[$]=E.u,wa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)E=A[ja],va[ca]=E.u,va[ca+1]=E.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+3,ma[qa+3]=Q+1,ma[qa+4]=Q+2,ma[qa+
-5]=Q+3,qa+=6,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+3,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ra[ya+6]=Q+2,ra[ya+7]=Q+3,ya+=8,Q+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));if(la)for(P in la)C=la[P],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&W>0&&(o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ka,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Aa&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
-ea,y));U&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}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(k instanceof THREE.Ribbon){h=
-k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)x=u[U].position,n=U*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
-y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=U=U=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(U=0;U<v;U++)x=u[U].position,n=U*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(U=0;U<p;U++)color=t[U],n=U*3,y[n]=color.r,y[n+1]=color.g,
-y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=F(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
-o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=E(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,X=!h.dynamic,p.__inittedArrays){var F=u=x=void 0,B=void 0,K=F=void 0,na=void 0,va=void 0,ja=void 0,I=U=A=w=N=z=v=void 0,ga=void 0,J=void 0,
+H=B=ja=B=va=na=void 0,C=void 0,O=C=H=na=void 0,Y=void 0,P=O=C=H=F=F=K=ja=B=O=C=H=Y=O=C=H=Y=O=C=H=void 0,Q=0,oa=0,$=0,ca=0,qa=0,T=0,S=0,ya=0,V=0,R=0,pa=0,O=H=0,O=void 0,fa=p.__vertexArray,wa=p.__uvArray,ua=p.__uv2Array,ha=p.__normalArray,ia=p.__tangentArray,ka=p.__colorArray,Z=p.__skinVertexAArray,aa=p.__skinVertexBArray,da=p.__skinIndexArray,ea=p.__skinWeightArray,Da=p.__morphTargetsArrays,la=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,z=p.__vertexColorType,
+v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(la)for(P in la)la[P].offset=0,la[P].offsetSrc=0;x=0;for(u=cb.length;x<u;x++)if(F=cb[x],B=fb[F],db&&(w=db[F]),eb&&(A=eb[F]),F=
+B.vertexNormals,K=B.normal,na=B.vertexColors,va=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)U=Ja[B.a].position,I=Ja[B.b].position,ga=Ja[B.c].position,fa[oa]=U.x,fa[oa+1]=U.y,fa[oa+2]=U.z,fa[oa+3]=I.x,fa[oa+4]=I.y,fa[oa+5]=I.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,oa+=9;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)H=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[B.a],C.array[H+1]=C.value[B.b],C.array[H+2]=C.value[B.c]):
+C.boundTo==="faces"?(O=C.value[O],C.array[H]=O,C.array[H+1]=O,C.array[H+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[O],C.array[H+1]=C.value[O+1],C.array[H+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],I=C.value[B.b],ga=C.value[B.c]):C.boundTo==="faces"?(ga=I=U=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[O],I=C.value[O+1],ga=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[H]=U.x,C.array[H+1]=
+U.y,C.array[H+2]=I.x,C.array[H+3]=I.y,C.array[H+4]=ga.x,C.array[H+5]=ga.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[H]=U.r,C.array[H+1]=U.g,C.array[H+2]=U.b,C.array[H+3]=I.r,C.array[H+4]=I.g,C.array[H+5]=I.b,C.array[H+6]=ga.r,C.array[H+7]=ga.g,C.array[H+8]=ga.b):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=I.x,C.array[H+4]=I.y,C.array[H+5]=I.z,C.array[H+6]=ga.x,C.array[H+7]=ga.y,C.array[H+8]=ga.z),C.offset+=9):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=U.w,
+C.array[H+4]=I.x,C.array[H+5]=I.y,C.array[H+6]=I.z,C.array[H+7]=I.w,C.array[H+8]=ga.x,C.array[H+9]=ga.y,C.array[H+10]=ga.z,C.array[H+11]=ga.w,C.offset+=12));if(Fa){H=0;for(C=La.length;H<C;H++)U=La[H].vertices[B.a].position,I=La[H].vertices[B.b].position,ga=La[H].vertices[B.c].position,O=Da[H],O[pa]=U.x,O[pa+1]=U.y,O[pa+2]=U.z,O[pa+3]=I.x,O[pa+4]=I.y,O[pa+5]=I.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z;pa+=9}if(Ma.length)H=Ma[B.a],C=Ma[B.b],O=Ma[B.c],ea[R]=H.x,ea[R+1]=H.y,ea[R+2]=H.z,ea[R+3]=H.w,ea[R+
+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,H=Ua[B.a],C=Ua[B.b],O=Ua[B.c],da[R]=H.x,da[R+1]=H.y,da[R+2]=H.z,da[R+3]=H.w,da[R+4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,H=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Z[R]=H.x,Z[R+1]=H.y,Z[R+2]=H.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,H=Ta[B.a],C=Ta[B.b],O=Ta[B.c],aa[R]=H.x,aa[R+1]=H.y,aa[R+2]=H.z,aa[R+3]=1,aa[R+
+4]=C.x,aa[R+5]=C.y,aa[R+6]=C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+9]=O.y,aa[R+10]=O.z,aa[R+11]=1,R+=12;if(Ca&&z)na.length==3&&z==THREE.VertexColors?(B=na[0],H=na[1],C=na[2]):C=H=B=va,ka[V]=B.r,ka[V+1]=B.g,ka[V+2]=B.b,ka[V+3]=H.r,ka[V+4]=H.g,ka[V+5]=H.b,ka[V+6]=C.r,ka[V+7]=C.g,ka[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)na=ja[0],va=ja[1],B=ja[2],ia[S]=na.x,ia[S+1]=na.y,ia[S+2]=na.z,ia[S+3]=na.w,ia[S+4]=va.x,ia[S+5]=va.y,ia[S+6]=va.z,ia[S+7]=va.w,ia[S+8]=B.x,ia[S+9]=B.y,ia[S+10]=B.z,ia[S+11]=B.w,S+=12;if(Ga&&N)if(F.length==
+3&&Ia)for(ja=0;ja<3;ja++)K=F[ja],ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;else for(ja=0;ja<3;ja++)ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<3;ja++)F=w[ja],wa[$]=F.u,wa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)F=A[ja],ua[ca]=F.u,ua[ca+1]=F.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+2,qa+=3,ra[ya]=Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+2,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ya+=6,Q+=3)}else if(B instanceof THREE.Face4){if(Ea)U=Ja[B.a].position,I=Ja[B.b].position,ga=Ja[B.c].position,
+J=Ja[B.d].position,fa[oa]=U.x,fa[oa+1]=U.y,fa[oa+2]=U.z,fa[oa+3]=I.x,fa[oa+4]=I.y,fa[oa+5]=I.z,fa[oa+6]=ga.x,fa[oa+7]=ga.y,fa[oa+8]=ga.z,fa[oa+9]=J.x,fa[oa+10]=J.y,fa[oa+11]=J.z,oa+=12;if(la)for(P in la)if(C=la[P],C.__original.needsUpdate)H=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[H]=C.value[B.a],C.array[H+1]=C.value[B.b],C.array[H+2]=C.value[B.c],C.array[H+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[H]=O,C.array[H+1]=O,C.array[H+2]=O,C.array[H+
+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[H]=C.value[O],C.array[H+1]=C.value[O+1],C.array[H+2]=C.value[O+2],C.array[H+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],I=C.value[B.b],ga=C.value[B.c],J=C.value[B.d]):C.boundTo==="faces"?(J=ga=I=U=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[O],I=C.value[O+1],ga=C.value[O+2],J=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+
+2]=I.x,C.array[H+3]=I.y,C.array[H+4]=ga.x,C.array[H+5]=ga.y,C.array[H+6]=J.x,C.array[H+7]=J.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[H]=U.r,C.array[H+1]=U.g,C.array[H+2]=U.b,C.array[H+3]=I.r,C.array[H+4]=I.g,C.array[H+5]=I.b,C.array[H+6]=ga.r,C.array[H+7]=ga.g,C.array[H+8]=ga.b,C.array[H+9]=J.r,C.array[H+10]=J.g,C.array[H+11]=J.b):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=I.x,C.array[H+4]=I.y,C.array[H+5]=I.z,C.array[H+6]=ga.x,C.array[H+7]=ga.y,C.array[H+8]=ga.z,C.array[H+
+9]=J.x,C.array[H+10]=J.y,C.array[H+11]=J.z),C.offset+=12):(C.array[H]=U.x,C.array[H+1]=U.y,C.array[H+2]=U.z,C.array[H+3]=U.w,C.array[H+4]=I.x,C.array[H+5]=I.y,C.array[H+6]=I.z,C.array[H+7]=I.w,C.array[H+8]=ga.x,C.array[H+9]=ga.y,C.array[H+10]=ga.z,C.array[H+11]=ga.w,C.array[H+12]=J.x,C.array[H+13]=J.y,C.array[H+14]=J.z,C.array[H+15]=J.w,C.offset+=16));if(Fa){H=0;for(C=La.length;H<C;H++)U=La[H].vertices[B.a].position,I=La[H].vertices[B.b].position,ga=La[H].vertices[B.c].position,J=La[H].vertices[B.d].position,
+O=Da[H],O[pa]=U.x,O[pa+1]=U.y,O[pa+2]=U.z,O[pa+3]=I.x,O[pa+4]=I.y,O[pa+5]=I.z,O[pa+6]=ga.x,O[pa+7]=ga.y,O[pa+8]=ga.z,O[pa+9]=J.x,O[pa+10]=J.y,O[pa+11]=J.z;pa+=12}if(Ma.length)H=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Y=Ma[B.d],ea[R]=H.x,ea[R+1]=H.y,ea[R+2]=H.z,ea[R+3]=H.w,ea[R+4]=C.x,ea[R+5]=C.y,ea[R+6]=C.z,ea[R+7]=C.w,ea[R+8]=O.x,ea[R+9]=O.y,ea[R+10]=O.z,ea[R+11]=O.w,ea[R+12]=Y.x,ea[R+13]=Y.y,ea[R+14]=Y.z,ea[R+15]=Y.w,H=Ua[B.a],C=Ua[B.b],O=Ua[B.c],Y=Ua[B.d],da[R]=H.x,da[R+1]=H.y,da[R+2]=H.z,da[R+3]=H.w,da[R+
+4]=C.x,da[R+5]=C.y,da[R+6]=C.z,da[R+7]=C.w,da[R+8]=O.x,da[R+9]=O.y,da[R+10]=O.z,da[R+11]=O.w,da[R+12]=Y.x,da[R+13]=Y.y,da[R+14]=Y.z,da[R+15]=Y.w,H=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Y=Sa[B.d],Z[R]=H.x,Z[R+1]=H.y,Z[R+2]=H.z,Z[R+3]=1,Z[R+4]=C.x,Z[R+5]=C.y,Z[R+6]=C.z,Z[R+7]=1,Z[R+8]=O.x,Z[R+9]=O.y,Z[R+10]=O.z,Z[R+11]=1,Z[R+12]=Y.x,Z[R+13]=Y.y,Z[R+14]=Y.z,Z[R+15]=1,H=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],aa[R]=H.x,aa[R+1]=H.y,aa[R+2]=H.z,aa[R+3]=1,aa[R+4]=C.x,aa[R+5]=C.y,aa[R+6]=C.z,aa[R+7]=1,aa[R+8]=O.x,aa[R+
+9]=O.y,aa[R+10]=O.z,aa[R+11]=1,aa[R+12]=B.x,aa[R+13]=B.y,aa[R+14]=B.z,aa[R+15]=1,R+=16;if(Ca&&z)na.length==4&&z==THREE.VertexColors?(B=na[0],H=na[1],C=na[2],na=na[3]):na=C=H=B=va,ka[V]=B.r,ka[V+1]=B.g,ka[V+2]=B.b,ka[V+3]=H.r,ka[V+4]=H.g,ka[V+5]=H.b,ka[V+6]=C.r,ka[V+7]=C.g,ka[V+8]=C.b,ka[V+9]=na.r,ka[V+10]=na.g,ka[V+11]=na.b,V+=12;if(Ka&&ta.hasTangents)na=ja[0],va=ja[1],B=ja[2],ja=ja[3],ia[S]=na.x,ia[S+1]=na.y,ia[S+2]=na.z,ia[S+3]=na.w,ia[S+4]=va.x,ia[S+5]=va.y,ia[S+6]=va.z,ia[S+7]=va.w,ia[S+8]=B.x,
+ia[S+9]=B.y,ia[S+10]=B.z,ia[S+11]=B.w,ia[S+12]=ja.x,ia[S+13]=ja.y,ia[S+14]=ja.z,ia[S+15]=ja.w,S+=16;if(Ga&&N)if(F.length==4&&Ia)for(ja=0;ja<4;ja++)K=F[ja],ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;else for(ja=0;ja<4;ja++)ha[T]=K.x,ha[T+1]=K.y,ha[T+2]=K.z,T+=3;if(Aa&&w!==void 0&&v)for(ja=0;ja<4;ja++)F=w[ja],wa[$]=F.u,wa[$+1]=F.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)F=A[ja],ua[ca]=F.u,ua[ca+1]=F.v,ca+=2;Ba&&(ma[qa]=Q,ma[qa+1]=Q+1,ma[qa+2]=Q+3,ma[qa+3]=Q+1,ma[qa+4]=Q+2,ma[qa+5]=Q+3,qa+=6,ra[ya]=
+Q,ra[ya+1]=Q+1,ra[ya+2]=Q,ra[ya+3]=Q+3,ra[ya+4]=Q+1,ra[ya+5]=Q+2,ra[ya+6]=Q+2,ra[ya+7]=Q+3,ya+=8,Q+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));if(la)for(P in la)C=la[P],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){H=0;for(C=La.length;H<C;H++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[H]),o.bufferData(o.ARRAY_BUFFER,Da[H],y)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),
+o.bufferData(o.ARRAY_BUFFER,ka,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Aa&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ua,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,
+ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y));X&&(delete p.__inittedArrays,
+delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}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(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||
+h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)x=u[X].position,n=X*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=
+!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)x=u[X].position,n=X*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,
+k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=E(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};
+this.supportsVertexTextures=function(){return Ga}};
 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};
@@ -343,8 +343,8 @@ 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),m=Math.min(Math.min(e,f),h);if(m==k)m=e=0;else{var n=k-m,m=n/k,e=e==k?(f-h)/n:f==k?2+(h-e)/n:4+(e-f)/n;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=m;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,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,t=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var u=0,x=n.length;u<x;u++){var v=new THREE.Vertex(n[u].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}u=0;for(x=t.length;u<x;u++){var v=t[u],A,z,y=v.vertexNormals,
-E=v.vertexColors;v instanceof THREE.Face3?A=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(A=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));A.normal.copy(v.normal);f&&f.multiplyVector3(A.normal);m=0;for(n=y.length;m<n;m++)z=y[m].clone(),f&&f.multiplyVector3(z),A.vertexNormals.push(z);A.color.copy(v.color);m=0;for(n=E.length;m<n;m++)z=E[m],A.vertexColors.push(z.clone());A.materials=v.materials.slice();A.centroid.copy(v.centroid);e&&e.multiplyVector3(A.centroid);p.push(A)}u=0;for(x=k.length;u<
+THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,t=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var u=0,x=n.length;u<x;u++){var v=new THREE.Vertex(n[u].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}u=0;for(x=t.length;u<x;u++){var v=t[u],y,z,A=v.vertexNormals,
+F=v.vertexColors;v instanceof THREE.Face3?y=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(y=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));y.normal.copy(v.normal);f&&f.multiplyVector3(y.normal);m=0;for(n=A.length;m<n;m++)z=A[m].clone(),f&&f.multiplyVector3(z),y.vertexNormals.push(z);y.color.copy(v.color);m=0;for(n=F.length;m<n;m++)z=F[m],y.vertexColors.push(z.clone());y.materials=v.materials.slice();y.centroid.copy(v.centroid);e&&e.multiplyVector3(y.centroid);p.push(y)}u=0;for(x=k.length;u<
 x;u++){e=k[u];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));w.push(f)}},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 m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],p,t,w=n.vertexNormals,u=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
 for(m=w.length;f<m;f++)t=w[f],p.vertexNormals.push(t.clone());p.color.copy(n.color);f=0;for(m=u.length;f<m;f++)t=u[f],p.vertexColors.push(t.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(m=h.length;f<m;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,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
 f+h>1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},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,
@@ -353,9 +353,9 @@ b?e(c,h-1):t[h]<b?e(h+1,f):h}return e(0,t.length-1)}var f,h,k=b.faces,m=b.vertic
 t[h]=p}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*p,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[n]=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},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
 (b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};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 m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),t=p.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,v=(u+1)%h,A=w-1<0?f-1:w-1,z=(w+1)%f,y=[],E=[0,0,n[(u*f+w)*4]/255*c];y.push([-1,0,n[(u*f+A)*4]/255*c]);y.push([-1,-1,n[(x*f+A)*4]/255*c]);y.push([0,-1,n[(x*f+w)*4]/255*c]);y.push([1,-1,n[(x*f+z)*4]/255*c]);
-y.push([1,0,n[(u*f+z)*4]/255*c]);y.push([1,1,n[(v*f+z)*4]/255*c]);y.push([0,1,n[(v*f+w)*4]/255*c]);y.push([-1,1,n[(v*f+A)*4]/255*c]);x=[];A=y.length;for(v=0;v<A;v++){var z=y[v],F=y[(v+1)%A],z=[z[0]-E[0],z[1]-E[1],z[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([z[1]*F[2]-z[2]*F[1],z[2]*F[0]-z[0]*F[2],z[0]*F[1]-z[1]*F[0]]))}y=[0,0,0];for(v=0;v<x.length;v++)y[0]+=x[v][0],y[1]+=x[v][1],y[2]+=x[v][2];y[0]/=x.length;y[1]/=x.length;y[2]/=x.length;E=(u*f+w)*4;t[E]=(y[0]+1)/2*255|0;t[E+1]=(y[1]+0.5)*
-255|0;t[E+2]=y[2]*255|0;t[E+3]=255}m.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)}};
+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 m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),t=p.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,v=(u+1)%h,y=w-1<0?f-1:w-1,z=(w+1)%f,A=[],F=[0,0,n[(u*f+w)*4]/255*c];A.push([-1,0,n[(u*f+y)*4]/255*c]);A.push([-1,-1,n[(x*f+y)*4]/255*c]);A.push([0,-1,n[(x*f+w)*4]/255*c]);A.push([1,-1,n[(x*f+z)*4]/255*c]);
+A.push([1,0,n[(u*f+z)*4]/255*c]);A.push([1,1,n[(v*f+z)*4]/255*c]);A.push([0,1,n[(v*f+w)*4]/255*c]);A.push([-1,1,n[(v*f+y)*4]/255*c]);x=[];y=A.length;for(v=0;v<y;v++){var z=A[v],E=A[(v+1)%y],z=[z[0]-F[0],z[1]-F[1],z[2]-F[2]],E=[E[0]-F[0],E[1]-F[1],E[2]-F[2]];x.push(e([z[1]*E[2]-z[2]*E[1],z[2]*E[0]-z[0]*E[2],z[0]*E[1]-z[1]*E[0]]))}A=[0,0,0];for(v=0;v<x.length;v++)A[0]+=x[v][0],A[1]+=x[v][1],A[2]+=x[v][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;F=(u*f+w)*4;t[F]=(A[0]+1)/2*255|0;t[F+1]=(A[1]+0.5)*
+255|0;t[F+2]=A[2]*255|0;t[F+3]=255}m.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}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
@@ -393,9 +393,9 @@ 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 m=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(n[n.length-2],n[n.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:m})};
 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])];Array.prototype.push.apply(e,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 m=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:m})};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,m,n,p,t,w,u,x,v,A,z;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],m=k.action,k=k.args,m){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=k[2];p=k[3];u=k[0];x=k[1];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,v,u,n),z=THREE.Shape.Utils.b2(z,A,x,
-p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];p=k[5];u=k[0];x=k[1];t=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,v,u,t,n),z=THREE.Shape.Utils.b3(z,A,x,w,p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
-for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];p=k[1];t=k[2];u=k[3];z=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);A=z-u;var y=b*2;for(m=1;m<=y;m++)z=m/y,x||(z=1-z),z=u+z*A,k=w+n+t*Math.cos(z),z=v+p+t*Math.sin(z),e.push(new THREE.Vector2(k,z))}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.getPoints=function(b,c){var b=b||12,e=[],f,h,k,m,n,p,t,w,u,x,v,y,z;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],m=k.action,k=k.args,m){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=k[2];p=k[3];u=k[0];x=k[1];e.length>0?(m=e[e.length-1],v=m.x,y=m.y):(m=this.actions[f-1].args,v=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,v,u,n),z=THREE.Shape.Utils.b2(z,y,x,
+p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];p=k[5];u=k[0];x=k[1];t=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,y=m.y):(m=this.actions[f-1].args,v=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,v,u,t,n),z=THREE.Shape.Utils.b3(z,y,x,w,p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
+for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];p=k[1];t=k[2];u=k[3];z=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);y=z-u;var A=b*2;for(m=1;m<=A;m++)z=m/A,x||(z=1-z),z=u+z*y,k=w+n+t*Math.cos(z),z=v+p+t*Math.sin(z),e.push(new THREE.Vector2(k,z))}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 m=this.getPoints(),n,p,t,w,u;n=0;for(p=m.length;n<p;n++)t=m[n],w=t.x,u=t.y,t.x=b*w+c*u+e,t.y=f*u+h*w+k;return m};
 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()};
@@ -403,9 +403,9 @@ THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],k=new THREE.Path;b=0;f
 f.curves):m.holes.push(f);k.push(m)}else{m=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(m.actions=f.actions,m.curves=f.curves,k.push(m),m=new THREE.Shape):m.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,m,n,p,t,w,u,x,v,A=[];for(p=0;p<c.length;p++){t=c[p];Array.prototype.push.apply(f,t);k=Number.POSITIVE_INFINITY;for(h=0;h<t.length;h++){x=t[h];v=[];for(u=0;u<e.length;u++)w=e[u],w=x.distanceToSquared(w),v.push(w),w<k&&(k=w,m=h,n=u)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;var z=[t[m],e[n],e[h]];u=THREE.FontUtils.Triangulate.area(z);var y=[t[m],t[k],e[n]];x=THREE.FontUtils.Triangulate.area(y);v=n;w=m;n+=1;m+=-1;n<
-0&&(n+=e.length);n%=e.length;m<0&&(m+=t.length);m%=t.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;z=[t[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);y=[t[m],t[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);u+x>z+y&&(n=v,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=t.length),m%=t.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:t.length-1);u=e.slice(0,n);x=e.slice(n);v=t.slice(m);w=t.slice(0,m);k=[t[m],t[k],e[n]];A.push([t[m],e[n],e[h]]);A.push(k);e=u.concat(v).concat(w).concat(x)}return{shape:e,
-isolatedPts:A,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,m,n,p,t={};k=0;for(m=f.length;k<m;k++)p=f[k].x+":"+f[k].y,t[p]!==void 0&&console.log("Duplicate point",p),t[p]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[f]=p)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[f]=p)}return e.concat(h)},
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,m,n,p,t,w,u,x,v,y=[];for(p=0;p<c.length;p++){t=c[p];Array.prototype.push.apply(f,t);k=Number.POSITIVE_INFINITY;for(h=0;h<t.length;h++){x=t[h];v=[];for(u=0;u<e.length;u++)w=e[u],w=x.distanceToSquared(w),v.push(w),w<k&&(k=w,m=h,n=u)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;var z=[t[m],e[n],e[h]];u=THREE.FontUtils.Triangulate.area(z);var A=[t[m],t[k],e[n]];x=THREE.FontUtils.Triangulate.area(A);v=n;w=m;n+=1;m+=-1;n<
+0&&(n+=e.length);n%=e.length;m<0&&(m+=t.length);m%=t.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;z=[t[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[t[m],t[k],e[n]];A=THREE.FontUtils.Triangulate.area(A);u+x>z+A&&(n=v,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=t.length),m%=t.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:t.length-1);u=e.slice(0,n);x=e.slice(n);v=t.slice(m);w=t.slice(0,m);k=[t[m],t[k],e[n]];y.push([t[m],e[n],e[h]]);y.push(k);e=u.concat(v).concat(w).concat(x)}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,m,n,p,t={};k=0;for(m=f.length;k<m;k++)p=f[k].x+":"+f[k].y,t[p]!==void 0&&console.log("Duplicate point",p),t[p]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[f]=p)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=t[p],p!==void 0&&(n[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++)Array.prototype.push.apply(c,b[e].toShapes());return c};
@@ -418,7 +418,7 @@ 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,m,n,p,t,w=this.data.JIT.hierarchy,u,x;this.currentTime+=b*this.timeScale;x=this.currentTime;u=this.currentTime%=this.data.length;t=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,A=this.hierarchy.length;v<A;v++)if(b=this.hierarchy[v],p=b.animationCache,this.JITCompile&&w[v][t]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=w[v][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,m,n,p,t,w=this.data.JIT.hierarchy,u,x;this.currentTime+=b*this.timeScale;x=this.currentTime;u=this.currentTime%=this.data.length;t=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&&w[v][t]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=w[v][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
 !1):(b.matrix=w[v][t],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 z=0;z<3;z++){e=c[z];m=p.prevKey[e];n=p.nextKey[e];if(n.time<=x){if(u<x)if(this.loop){m=this.data.hierarchy[v].keys[0];for(n=this.getNextKeyWith(e,v,1);n.time<u;)m=n,n=this.getNextKeyWith(e,v,n.index+1)}else{this.stop();return}else{do m=n,n=this.getNextKeyWith(e,v,n.index+1);while(n.time<
 u)}p.prevKey[e]=m;p.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-m.time)/(n.time-m.time);h=m[e];k=n[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,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,n.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===
@@ -432,7 +432,7 @@ f,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFil
 new THREE.Vector3(0,0,-1));this.cameraPX.lookAt(this.cameraPXTarget);this.cameraNX.lookAt(this.cameraNXTarget);this.cameraPY.lookAt(this.cameraPYTarget);this.cameraNY.lookAt(this.cameraNYTarget);this.cameraPZ.lookAt(this.cameraPZTarget);this.cameraNZ.lookAt(this.cameraNZTarget)};this.updateCubeMap=function(b,e){var c=this.renderTarget;b.setFaceCulling("back","cw");e.scale.y=-1;e.position.y=2*this.height;e.updateMatrix();c.activeCubeFace=0;b.render(e,this.cameraPX,c);c.activeCubeFace=1;b.render(e,
 this.cameraNX,c);e.scale.y=1;e.position.y=0;e.updateMatrix();e.scale.x=-1;e.updateMatrix();c.activeCubeFace=2;b.render(e,this.cameraPY,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw");c.activeCubeFace=3;b.render(e,this.cameraNY,c);e.scale.x=-1;e.updateMatrix();b.setFaceCulling("back","cw");c.activeCubeFace=4;b.render(e,this.cameraPZ,c);c.activeCubeFace=5;b.render(e,this.cameraNZ,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw")}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};
 THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};
-THREE.FirstPersonControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
+THREE.FirstPersonControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();
 if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=
 b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
@@ -441,16 +441,16 @@ b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){sw
 Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
 this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
 e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
-THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),y=m.length,E=0;k=y-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<y-1;k++)E=f*n.chunks[k]/n.total,e.keys[k]={time:E,pos:m[k]};h.hierarchy[0]=
+THREE.PathControls=function(b,c){function e(b){if((b*=2)<1)return 0.5*b*b;return-0.5*(--b*(b-2)-1)}function f(b,e){return function(){e.apply(b,arguments)}}function h(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),A=m.length,F=0;k=A-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<A-1;k++)F=f*n.chunks[k]/n.total,e.keys[k]={time:F,pos:m[k]};h.hierarchy[0]=
 e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function k(b,e){var c,f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}this.object=b;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var m=Math.PI*2,n=Math.PI/180;this.update=function(){var b,c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*n;this.theta=this.lon*n;b=this.phi%m;this.phi=b>=0?b:b+m;b=this.verticalAngleMap.srcRange;
 c=this.verticalAngleMap.dstRange;var f=c[1]-c[0];this.phi=e(((this.phi-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.horizontalAngleMap.srcRange;c=this.horizontalAngleMap.dstRange;f=c[1]-c[0];this.theta=e(((this.theta-b[0])*(c[1]-c[0])/(b[1]-b[0])+c[0]-c[0])/f)*f+c[0];b=this.target.position;b.x=100*Math.sin(this.phi)*Math.cos(this.theta);b.y=100*Math.cos(this.phi);b.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(b){this.domElement===
 document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),e=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),m=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,b);b=new THREE.Mesh(m,e);b.position.set(0,10,0);this.animation=h(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(b)}else this.animation=h(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var b=
 this.debugPath,e=this.spline,c=k(e,10),m=k(e,10),n=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,n);particleObj=new THREE.ParticleSystem(m,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.add(lineObj);particleObj.scale.set(1,1,1);b.add(particleObj);m=new THREE.SphereGeometry(1,16,8);n=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<e.points.length;i++)c=new THREE.Mesh(m,n),c.position.copy(e.points[i]),b.add(c)}this.domElement.addEventListener("mousemove",
 f(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=
 1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=
 0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.object.moveForward=
@@ -459,12 +459,12 @@ THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,argu
 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};
 this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,
 0]}};this.domElement.addEventListener("mousemove",e(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",e(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",e(this,this.mouseup),!1);this.domElement.addEventListener("keydown",e(this,this.keydown),!1);this.domElement.addEventListener("keyup",e(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,t=0,w=0,u=0,x=0,v=window.innerWidth/2,A=window.innerHeight/2;this.update=function(){var b=
+THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,t=0,w=0,u=0,x=0,v=window.innerWidth/2,y=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*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(b*t);this.object.translateY(b*w);m&&(this.roll+=this.rollSpeed*this.delta*n);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();h.copy(this.forward);f.set(0,1,0);e.cross(f,h).normalize();f.cross(h,e).normalize();this.object.matrix.n11=e.x;this.object.matrix.n12=f.x;this.object.matrix.n13=h.x;this.object.matrix.n21=e.y;this.object.matrix.n22=f.y;this.object.matrix.n23=h.y;this.object.matrix.n31=e.z;this.object.matrix.n32=f.z;this.object.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);
 k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(k);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(b){this.object.position.x+=this.object.matrix.n11*b;this.object.position.y+=this.object.matrix.n21*b;this.object.position.z+=this.object.matrix.n31*b};this.translateY=function(b){this.object.position.x+=this.object.matrix.n12*
 b;this.object.position.y+=this.object.matrix.n22*b;this.object.position.z+=this.object.matrix.n32*b};this.translateZ=function(b){this.object.position.x-=this.object.matrix.n13*b;this.object.position.y-=this.object.matrix.n23*b;this.object.position.z-=this.object.matrix.n33*b};this.rotateHorizontally=function(b){e.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);e.multiplyScalar(b);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(b){f.set(this.object.matrix.n12,
-this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){u=(b.clientX-v)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",
+this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){u=(b.clientX-v)/window.innerWidth;x=(b.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",
 function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:m=!0;n=1;break;case 69:m=!0;n=-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:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=
 0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:w=0;break;case 70:w=0}},!1)};
 THREE.TrackballControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
@@ -476,28 +476,28 @@ this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();
 (h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(u=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?p=t=this.getMouseOnScreen(b.clientX,
 b.clientY):this.noPan||(w=u=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
 this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,z=f||1,A=h||1,P=n/2,Q=t/2,T=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",z=k||1;var X=z+1,o=A+1;n/=z;var da=t/A;for(x=0;x<o;x++)for(t=0;t<X;t++){var V=new THREE.Vector3;V[b]=(t*n-P)*c;V[e]=(x*da-Q)*m;V[v]=p;w.vertices.push(new THREE.Vertex(V))}for(x=0;x<A;x++)for(t=0;t<z;t++)w.faces.push(new THREE.Face4(t+X*
-x+T,t+X*(x+1)+T,t+1+X*(x+1)+T,t+1+X*x+T,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/z,x/A),new THREE.UV(t/z,(x+1)/A),new THREE.UV((t+1)/z,(x+1)/A),new THREE.UV((t+1)/z,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function t(b,e,c,m,n,t,p,u){var v,x,y=f||1,z=h||1,P=n/2,Q=t/2,S=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",z=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",y=k||1;var W=y+1,o=z+1;n/=y;var da=t/z;for(x=0;x<o;x++)for(t=0;t<W;t++){var T=new THREE.Vector3;T[b]=(t*n-P)*c;T[e]=(x*da-Q)*m;T[v]=p;w.vertices.push(new THREE.Vertex(T))}for(x=0;x<z;x++)for(t=0;t<y;t++)w.faces.push(new THREE.Face4(t+W*
+x+S,t+W*(x+1)+S,t+1+W*(x+1)+S,t+1+W*x+S,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/y,x/z),new THREE.UV(t/y,(x+1)/z),new THREE.UV((t+1)/y,(x+1)/z),new THREE.UV((t+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
 p[z]);this.sides.px&&t("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&t("z","y",-1*n,-1,e,c,u,this.materials[1]);this.sides.py&&t("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&t("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&t("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();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){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,t=[],w=[];for(p=0;p<=h;p++){var u=[],x=[],v=p/h,A=v*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(A*Math.sin(z*Math.PI*2),-v*e+m,A*Math.cos(z*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(z,v))}t.push(u);w.push(x)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=t[p][n],u=t[p+1][n],x=t[p+1][n+1],v=t[p][n+1],A=
-this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),y=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[v].position.clone().setY(0).normalize(),F=w[p][n].clone(),D=w[p+1][n].clone(),G=w[p+1][n+1].clone(),L=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,v,[A,z,y,E]));this.faceVertexUvs[0].push([F,D,G,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=t[0][n],u=t[0][n+
-1],x=this.vertices.length-1,A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),F=w[0][n].clone(),D=w[0][n+1].clone(),G=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,D,G])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=t[p][n+1],u=t[p][n],x=this.vertices.length-1,A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),F=w[p][n+1].clone(),D=w[p][n].clone(),
-G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[A,z,y])),this.faceVertexUvs[0].push([F,D,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,t=[],w=[];for(p=0;p<=h;p++){var u=[],x=[],v=p/h,y=v*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-v*e+m,y*Math.cos(z*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(z,v))}t.push(u);w.push(x)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=t[p][n],u=t[p+1][n],x=t[p+1][n+1],v=t[p][n+1],y=
+this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[u].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),F=this.vertices[v].position.clone().setY(0).normalize(),E=w[p][n].clone(),D=w[p+1][n].clone(),G=w[p+1][n+1].clone(),L=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,v,[y,z,A,F]));this.faceVertexUvs[0].push([E,D,G,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=t[0][n],u=t[0][n+
+1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),E=w[0][n].clone(),D=w[0][n+1].clone(),G=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,u,x,[y,z,A])),this.faceVertexUvs[0].push([E,D,G])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=t[p][n+1],u=t[p][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),E=w[p][n+1].clone(),D=w[p][n].clone(),
+G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[y,z,A])),this.faceVertexUvs[0].push([E,D,G])}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,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
-n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ma=J;ea=J-1;ea<0&&(ea=b.length-
-1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=da*e,h=da*(e+1),k=Z+ma+f,m=Z+ma+h,o=k,f=Z+ea+f,h=Z+ea+h,t=m;o+=ca;f+=ca;h+=ca;t+=ca;B.faces.push(new THREE.Face4(o,f,h,t,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(B.vertices[k].position.z+p)/h,m=(B.vertices[m].position.z+p)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=ca;e+=ca;c+=ca;B.faces.push(new THREE.Face3(b,
-e,c,null,null,D));if(D){var f=L.maxY,h=L.maxX,k=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/h,B.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,A=c.bendPath,z=c.extrudePath,y,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,L=this.shapebb;if(z)y=z.getPoints(x),v=y.length,E=!0,u=!1;u||(t=p=w=0);var M,K,H,B=this,ca=this.vertices.length;A&&b.addWrapPath(A);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);A=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();K=0;for(H=x.length;K<H;K++)M=x[K],THREE.Shape.Utils.isClockWise(M)&&
-(x[K]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(A,x);F=A;K=0;for(H=x.length;K<H;K++)M=x[K],A=A.concat(M);var J,P,Q,T,X,o,da=A.length,V=z.length,la=[];J=0;P=F.length;ma=P-1;for(ea=J+1;J<P;J++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),la[J]=f(F[J],F[ma],F[ea]);var ha=[],ka,aa=la.concat();K=0;for(H=x.length;K<H;K++){M=x[K];ka=[];J=0;P=M.length;ma=P-1;for(ea=J+1;J<P;J++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),ka[J]=f(M[J],M[ma],M[ea]);ha.push(ka);aa=aa.concat(ka)}for(Q=0;Q<w;Q++){T=Q/w;X=p*(1-
-T);T=t*Math.sin(T*Math.PI/2);J=0;for(P=F.length;J<P;J++)o=e(F[J],la[J],T),k(o.x,o.y,-X);K=0;for(H=x.length;K<H;K++){M=x[K];ka=ha[K];J=0;for(P=M.length;J<P;J++)o=e(M[J],ka[J],T),k(o.x,o.y,-X)}}T=t;for(J=0;J<da;J++)o=u?e(A[J],aa[J],T):A[J],E?k(o.x,o.y+y[0].y,y[0].x):k(o.x,o.y,0);for(Q=1;Q<=v;Q++)for(J=0;J<da;J++)o=u?e(A[J],aa[J],T):A[J],E?k(o.x,o.y+y[Q-1].y,y[Q-1].x):k(o.x,o.y,n/v*Q);for(Q=w-1;Q>=0;Q--){T=Q/w;X=p*(1-T);T=t*Math.sin(T*Math.PI/2);J=0;for(P=F.length;J<P;J++)o=e(F[J],la[J],T),k(o.x,o.y,
-n+X);K=0;for(H=x.length;K<H;K++){M=x[K];ka=ha[K];J=0;for(P=M.length;J<P;J++)o=e(M[J],ka[J],T),E?k(o.x,o.y+y[v-1].y,y[v-1].x+X):k(o.x,o.y,n+X)}}if(u){u=da*0;for(J=0;J<V;J++)t=z[J],m(t[2]+u,t[1]+u,t[0]+u);u=da*(v+w*2);for(J=0;J<V;J++)t=z[J],m(t[0]+u,t[1]+u,t[2]+u)}else{for(J=0;J<V;J++)t=z[J],m(t[2],t[1],t[0]);for(J=0;J<V;J++)t=z[J],m(t[0]+da*v,t[1]+da*v,t[2]+da*v)}var ma,ea,Z=0;h(F);Z+=F.length;K=0;for(H=x.length;K<H;K++)M=x[K],h(M),Z+=M.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+n.copy(e).addSelf(k);o.copy(c).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(I=b.length;--I>=0;){ma=I;ea=I-1;ea<0&&(ea=b.length-
+1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=da*e,h=da*(e+1),k=Z+ma+f,m=Z+ma+h,o=k,f=Z+ea+f,h=Z+ea+h,t=m;o+=ca;f+=ca;h+=ca;t+=ca;K.faces.push(new THREE.Face4(o,f,h,t,null,null,G));G&&(o=e/c,f=(e+1)/c,h=n+p*2,k=(K.vertices[k].position.z+p)/h,m=(K.vertices[m].position.z+p)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=ca;e+=ca;c+=ca;K.faces.push(new THREE.Face3(b,
+e,c,null,null,D));if(D){var f=L.maxY,h=L.maxX,k=K.vertices[e].position.x,e=K.vertices[e].position.y,m=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/h,K.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,F=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,L=this.shapebb;if(z)A=z.getPoints(x),v=A.length,F=!0,u=!1;u||(t=p=w=0);var M,J,B,K=this,ca=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(B=x.length;J<B;J++)M=x[J],THREE.Shape.Utils.isClockWise(M)&&
+(x[J]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(B=x.length;J<B;J++)M=x[J],y=y.concat(M);var I,P,Q,S,W,o,da=y.length,T=z.length,la=[];I=0;P=E.length;ma=P-1;for(ea=I+1;I<P;I++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),la[I]=f(E[I],E[ma],E[ea]);var ha=[],ka,aa=la.concat();J=0;for(B=x.length;J<B;J++){M=x[J];ka=[];I=0;P=M.length;ma=P-1;for(ea=I+1;I<P;I++,ma++,ea++)ma==P&&(ma=0),ea==P&&(ea=0),ka[I]=f(M[I],M[ma],M[ea]);ha.push(ka);aa=aa.concat(ka)}for(Q=0;Q<w;Q++){S=Q/w;W=p*(1-
+S);S=t*Math.sin(S*Math.PI/2);I=0;for(P=E.length;I<P;I++)o=e(E[I],la[I],S),k(o.x,o.y,-W);J=0;for(B=x.length;J<B;J++){M=x[J];ka=ha[J];I=0;for(P=M.length;I<P;I++)o=e(M[I],ka[I],S),k(o.x,o.y,-W)}}S=t;for(I=0;I<da;I++)o=u?e(y[I],aa[I],S):y[I],F?k(o.x,o.y+A[0].y,A[0].x):k(o.x,o.y,0);for(Q=1;Q<=v;Q++)for(I=0;I<da;I++)o=u?e(y[I],aa[I],S):y[I],F?k(o.x,o.y+A[Q-1].y,A[Q-1].x):k(o.x,o.y,n/v*Q);for(Q=w-1;Q>=0;Q--){S=Q/w;W=p*(1-S);S=t*Math.sin(S*Math.PI/2);I=0;for(P=E.length;I<P;I++)o=e(E[I],la[I],S),k(o.x,o.y,
+n+W);J=0;for(B=x.length;J<B;J++){M=x[J];ka=ha[J];I=0;for(P=M.length;I<P;I++)o=e(M[I],ka[I],S),F?k(o.x,o.y+A[v-1].y,A[v-1].x+W):k(o.x,o.y,n+W)}}if(u){u=da*0;for(I=0;I<T;I++)t=z[I],m(t[2]+u,t[1]+u,t[0]+u);u=da*(v+w*2);for(I=0;I<T;I++)t=z[I],m(t[0]+u,t[1]+u,t[2]+u)}else{for(I=0;I<T;I++)t=z[I],m(t[2],t[1],t[0]);for(I=0;I<T;I++)t=z[I],m(t[0]+da*v,t[1]+da*v,t[2]+da*v)}var ma,ea,Z=0;h(E);Z+=E.length;J=0;for(B=x.length;J<B;J++)M=x[J],h(M),Z+=M.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,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.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 m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),t=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,w,b);e(k.faces[n].b,t,
 p,b);e(k.faces[n].c,w,t,b);e(p,t,w,b)}k.faces=b.faces}h.faces=k.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],k=[],m=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=c){for(n=0;n<e.length;n++)p<this.angle?(e[n]=m.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=k;p==0&&(k=f);
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],k=[],m=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.001;p+=c){for(n=0;n<e.length;n++)p<this.angle?(e[n]=m.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=k;p==0&&(k=f);
 for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,n/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(b,c){function e(e){var c=e.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(b));c.index=m.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(e.z,-e.x)/2/Math.PI+0.5,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+0.5);return c}function f(b,e,c,n){n<1?(n=new THREE.Face3(b.index,e.index,c.index,[b.position,e.position,c.position]),n.centroid.addSelf(b.position).addSelf(e.position).addSelf(c.position).divideScalar(3),n.normal=n.centroid.clone().normalize(),
 m.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),m.faceVertexUvs[0].push([k(b.uv,b.position,n),k(e.uv,e.position,n),k(c.uv,c.position,n)])):(n-=1,f(b,h(b,e),h(b,c),n),f(h(b,e),e,h(e,c),n),f(h(b,c),h(e,c),c,n),f(h(b,e),h(e,c),h(b,c),n))}function h(b,c){n[b.index]||(n[b.index]=[]);n[c.index]||(n[c.index]=[]);var f=n[b.index][c.index];f===void 0&&(n[b.index][c.index]=n[c.index][b.index]=f=e((new THREE.Vector3).add(b.position,c.position).divideScalar(2)));return f}function k(b,e,c){c<0&&b.u===
@@ -505,18 +505,18 @@ m.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),m.faceVertexUvs[0].push
 c);this.boundingSphere={radius:b}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
 THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,k=b/2,m=c/2,e=e||1,f=f||1,n=e+1,p=f+1;b/=e;var t=c/f;for(h=0;h<p;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(h*t-m),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*h,c+n*(h+1),c+1+n*(h+1),c+1+n*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),m=Math.max(2,e||6),c=[],e=0;e<m+1;e++){f=e/m;var n=b*Math.cos(f*h),p=b*Math.sin(f*h),t=[],w=0;for(f=0;f<k;f++){var u=2*f/k,x=p*Math.sin(u*h),u=p*Math.cos(u*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,n,x)))-1);t.push(w)}c.push(t)}for(var v,A,z,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){t=f==k-1;m=c[e][t?0:f+1];n=c[e][t?k-1:f];p=c[e-1][t?
-k-1:f];t=c[e-1][t?0:f+1];x=e/(h-1);v=(e-1)/(h-1);A=(f+1)/k;var u=f/k,w=new THREE.UV(1-A,x),x=new THREE.UV(1-u,x),u=new THREE.UV(1-u,v),y=new THREE.UV(1-A,v);e<c.length-1&&(v=this.vertices[m].position.clone(),A=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,x,u]));e>1&&(v=
-this.vertices[m].position.clone(),A=this.vertices[p].position.clone(),z=this.vertices[t].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,p,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,u,y]))}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),m=Math.max(2,e||6),c=[],e=0;e<m+1;e++){f=e/m;var n=b*Math.cos(f*h),p=b*Math.sin(f*h),t=[],w=0;for(f=0;f<k;f++){var u=2*f/k,x=p*Math.sin(u*h),u=p*Math.cos(u*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,n,x)))-1);t.push(w)}c.push(t)}for(var v,y,z,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){t=f==k-1;m=c[e][t?0:f+1];n=c[e][t?k-1:f];p=c[e-1][t?
+k-1:f];t=c[e-1][t?0:f+1];x=e/(h-1);v=(e-1)/(h-1);y=(f+1)/k;var u=f/k,w=new THREE.UV(1-y,x),x=new THREE.UV(1-u,x),u=new THREE.UV(1-u,v),A=new THREE.UV(1-y,v);e<c.length-1&&(v=this.vertices[m].position.clone(),y=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),v.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,x,u]));e>1&&(v=
+this.vertices[m].position.clone(),y=this.vertices[p].position.clone(),z=this.vertices[t].position.clone(),v.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,p,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,u,A]))}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,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,p,t,w,u,x,v,A,z,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,
-t));h.moveTo(n,t);break;case "l":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,t));h.lineTo(n,t);break;case "q":n=c[b++]*e+f;t=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,t);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var E=m/divisions,F=THREE.Shape.Utils.b2(E,w,x,n),E=THREE.Shape.Utils.b2(E,u,v,t);k.push(new THREE.Vector2(F,E))}}break;case "b":if(n=c[b++]*e+f,t=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,A=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,t,
-x,v,A,z),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,w,x,A,n),E=THREE.Shape.Utils.b3(E,u,v,z,t),k.push(new THREE.Vector2(F,E))}}}return{offset:y.ha*e,points:k,path:h}}}};
-(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,t,w;if(c(b)>0)for(t=0;t<h;t++)m[t]=t;else for(t=0;t<h;t++)m[t]=h-1-t;var u=2*h;for(t=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=p,A=t,z=w,y=h,E=m,F=void 0,D=void 0,G=void 0,
-L=void 0,M=void 0,K=void 0,H=void 0,B=void 0,ca=void 0,D=x[E[v]].x,G=x[E[v]].y,L=x[E[A]].x,M=x[E[A]].y,K=x[E[z]].x,H=x[E[z]].y;if(1.0E-10>(L-D)*(H-G)-(M-G)*(K-D))x=!1;else{for(F=0;F<y;F++)if(!(F==v||F==A||F==z)){var B=x[E[F]].x,ca=x[E[F]].y,J=void 0,P=void 0,Q=void 0,T=void 0,X=void 0,o=void 0,da=void 0,V=void 0,la=void 0,ha=void 0,ka=void 0,aa=void 0,J=Q=X=void 0,J=K-L,P=H-M,Q=D-K,T=G-H,X=L-D,o=M-G,da=B-D,V=ca-G,la=B-L,ha=ca-M,ka=B-K,aa=ca-H,J=J*ha-P*la,X=X*V-o*da,Q=Q*aa-T*ka;if(J>=0&&Q>=0&&X>=0){x=
+this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,p,t,w,u,x,v,y,z,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,
+t));h.moveTo(n,t);break;case "l":n=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(n,t));h.lineTo(n,t);break;case "q":n=c[b++]*e+f;t=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,t);if(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var F=m/divisions,E=THREE.Shape.Utils.b2(F,w,x,n),F=THREE.Shape.Utils.b2(F,u,v,t);k.push(new THREE.Vector2(E,F))}}break;case "b":if(n=c[b++]*e+f,t=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,t,
+x,v,y,z),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)F=m/divisions,E=THREE.Shape.Utils.b3(F,w,x,y,n),F=THREE.Shape.Utils.b3(F,u,v,z,t),k.push(new THREE.Vector2(E,F))}}}return{offset:A.ha*e,points:k,path:h}}}};
+(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,t,w;if(c(b)>0)for(t=0;t<h;t++)m[t]=t;else for(t=0;t<h;t++)m[t]=h-1-t;var u=2*h;for(t=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=p,y=t,z=w,A=h,F=m,E=void 0,D=void 0,G=void 0,
+L=void 0,M=void 0,J=void 0,B=void 0,K=void 0,ca=void 0,D=x[F[v]].x,G=x[F[v]].y,L=x[F[y]].x,M=x[F[y]].y,J=x[F[z]].x,B=x[F[z]].y;if(1.0E-10>(L-D)*(B-G)-(M-G)*(J-D))x=!1;else{for(E=0;E<A;E++)if(!(E==v||E==y||E==z)){var K=x[F[E]].x,ca=x[F[E]].y,I=void 0,P=void 0,Q=void 0,S=void 0,W=void 0,o=void 0,da=void 0,T=void 0,la=void 0,ha=void 0,ka=void 0,aa=void 0,I=Q=W=void 0,I=J-L,P=B-M,Q=D-J,S=G-B,W=L-D,o=M-G,da=K-D,T=ca-G,la=K-L,ha=ca-M,ka=K-J,aa=ca-B,I=I*ha-P*la,W=W*T-o*da,Q=Q*aa-S*ka;if(I>=0&&Q>=0&&W>=0){x=
 !1;break a}}x=!0}}if(x){k.push([b[m[p]],b[m[t]],b[m[w]]]);n.push([m[p],m[t],m[w]]);p=t;for(w=t+1;w<h;p++,w++)m[p]=m[w];h--;u=2*h}}if(f)return n;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);self._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,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
 this.tube*Math.sin(m);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.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,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[m]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
@@ -526,12 +526,12 @@ this.segmentsT;++c){var p=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2
 h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,p,t,w])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var c=this.subdivisions;c-- >0;)this.smooth(b)};
 THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n,t){var p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors){p.vertexColors=[];for(var o,v,w,x=0;x<4;x++){w=t[x];o=new THREE.Color;o.setRGB(0,0,0);for(var y=0;y<w.length;y++)v=n.vertexColors[w[y]-1],o.r+=v.r,o.g+=v.g,o.b+=v.b;o.r/=w.length;o.g/=w.length;o.b/=w.length;p.vertexColors[x]=o}}h.push(p);(!m.supportUVs||u.length!=0)&&k.push([u[b],u[e],u[c],u[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,
-e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,p=n.concat(),t=[],w={},u=[],x,v,A,z,y,E=b.faceVertexUvs[0];x=0;for(v=E.length;x<v;x++){A=0;for(z=E[x].length;A<z;A++)y=f[x]["abcd".charAt(A)],u[y]||(u[y]=E[x][A])}var F;x=0;for(v=f.length;x<v;x++)if(y=f[x],t.push(y.centroid),p.push(new THREE.Vertex(y.centroid)),m.supportUVs&&u.length!=0){F=new THREE.UV;if(y instanceof THREE.Face3)F.u=u[y.a].u+u[y.b].u+u[y.c].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v,F.u/=3,F.v/=3;else if(y instanceof THREE.Face4)F.u=u[y.a].u+
-u[y.b].u+u[y.c].u+u[y.d].u,F.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,F.u/=4,F.v/=4;u.push(F)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,G,L=0,E=n.length,M;for(x in z)if(y=z[x],F=y[0],D=
-y[1],M=x.split("_"),v=M[0],M=M[1],G=new THREE.Vector3,y.length!=2?(G.addSelf(n[v].position),G.addSelf(n[M].position),G.multiplyScalar(0.5)):(G.addSelf(t[F]),G.addSelf(t[D]),G.addSelf(n[v].position),G.addSelf(n[M].position),G.multiplyScalar(0.25)),w[x]=E+f.length+L,p.push(new THREE.Vertex(G)),L++,m.supportUVs&&u.length!=0)F=new THREE.UV,F.u=u[v].u+u[M].u,F.v=u[v].v+u[M].v,F.u/=2,F.v/=2,u.push(F);x=0;for(v=t.length;x<v;x++)y=f[x],F=E+x,y instanceof THREE.Face3?(D=e(y.a,y.b),M=e(y.b,y.c),L=e(y.c,y.a),
-c(F,w[D],y.b,w[M],y,["123","12","2","23"]),c(F,w[M],y.c,w[L],y,["123","23","3","31"]),c(F,w[L],y.a,w[D],y,["123","31","1","12"])):y instanceof THREE.Face4?(D=e(y.a,y.b),M=e(y.b,y.c),L=e(y.c,y.d),G=e(y.d,y.a),c(F,w[D],y.b,w[M],y,["1234","12","2","23"]),c(F,w[M],y.c,w[L],y,["1234","13","3","34"]),c(F,w[L],y.d,w[G],y,["1234","34","4","41"]),c(F,w[G],y.a,w[D],y,["1234","41","1","12"])):console.log("face should be a face!",y);var f=p,K={},H={},p=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,
-e){H[b]===void 0&&(H[b]={});H[b][e]=null};for(x in z)y=z[x],M=x.split("_"),v=M[0],M=M[1],p(v,[v,M]),p(M,[v,M]),F=y[0],D=y[1],w(v,F),D?w(v,D):w(v,F),w(M,F),D?w(M,D):w(M,F);p=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){p.set(0,0,0);w.set(0,0,0);z=new THREE.Vector3(0,0,0);E=0;for(A in H[x])p.addSelf(t[A]),E++;p.divideScalar(E);E=K[x].length;for(A=0;A<E;A++)y=K[x][A],y=n[y[0]].position.clone().addSelf(n[y[1]].position).divideScalar(2),w.addSelf(y);w.divideScalar(E);
-z.addSelf(n[x].position);z.multiplyScalar(E-3);z.addSelf(p);z.addSelf(w.multiplyScalar(2));z.divideScalar(E);f[x].position=z}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,p=n.concat(),t=[],w={},u=[],x,v,y,z,A,F=b.faceVertexUvs[0];x=0;for(v=F.length;x<v;x++){y=0;for(z=F[x].length;y<z;y++)A=f[x]["abcd".charAt(y)],u[A]||(u[A]=F[x][y])}var E;x=0;for(v=f.length;x<v;x++)if(A=f[x],t.push(A.centroid),p.push(new THREE.Vertex(A.centroid)),m.supportUVs&&u.length!=0){E=new THREE.UV;if(A instanceof THREE.Face3)E.u=u[A.a].u+u[A.b].u+u[A.c].u,E.v=u[A.a].v+u[A.b].v+u[A.c].v,E.u/=3,E.v/=3;else if(A instanceof THREE.Face4)E.u=u[A.a].u+
+u[A.b].u+u[A.c].u+u[A.d].u,E.v=u[A.a].v+u[A.b].v+u[A.c].v+u[A.d].v,E.u/=4,E.v/=4;u.push(E)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,G,L=0,F=n.length,M;for(x in z)if(A=z[x],E=A[0],D=
+A[1],M=x.split("_"),v=M[0],M=M[1],G=new THREE.Vector3,A.length!=2?(G.addSelf(n[v].position),G.addSelf(n[M].position),G.multiplyScalar(0.5)):(G.addSelf(t[E]),G.addSelf(t[D]),G.addSelf(n[v].position),G.addSelf(n[M].position),G.multiplyScalar(0.25)),w[x]=F+f.length+L,p.push(new THREE.Vertex(G)),L++,m.supportUVs&&u.length!=0)E=new THREE.UV,E.u=u[v].u+u[M].u,E.v=u[v].v+u[M].v,E.u/=2,E.v/=2,u.push(E);x=0;for(v=t.length;x<v;x++)A=f[x],E=F+x,A instanceof THREE.Face3?(D=e(A.a,A.b),M=e(A.b,A.c),L=e(A.c,A.a),
+c(E,w[D],A.b,w[M],A,["123","12","2","23"]),c(E,w[M],A.c,w[L],A,["123","23","3","31"]),c(E,w[L],A.a,w[D],A,["123","31","1","12"])):A instanceof THREE.Face4?(D=e(A.a,A.b),M=e(A.b,A.c),L=e(A.c,A.d),G=e(A.d,A.a),c(E,w[D],A.b,w[M],A,["1234","12","2","23"]),c(E,w[M],A.c,w[L],A,["1234","13","3","34"]),c(E,w[L],A.d,w[G],A,["1234","34","4","41"]),c(E,w[G],A.a,w[D],A,["1234","41","1","12"])):console.log("face should be a face!",A);var f=p,J={},B={},p=function(b,e){J[b]===void 0&&(J[b]=[]);J[b].push(e)},w=function(b,
+e){B[b]===void 0&&(B[b]={});B[b][e]=null};for(x in z)A=z[x],M=x.split("_"),v=M[0],M=M[1],p(v,[v,M]),p(M,[v,M]),E=A[0],D=A[1],w(v,E),D?w(v,D):w(v,E),w(M,E),D?w(M,D):w(M,E);p=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(J[x]!==void 0){p.set(0,0,0);w.set(0,0,0);z=new THREE.Vector3(0,0,0);F=0;for(y in B[x])p.addSelf(t[y]),F++;p.divideScalar(F);F=J[x].length;for(y=0;y<F;y++)A=J[x][y],A=n[A[0]].position.clone().addSelf(n[A[1]].position).divideScalar(2),w.addSelf(A);w.divideScalar(F);
+z.addSelf(n[x].position);z.multiplyScalar(F-3);z.addSelf(p);z.addSelf(w.multiplyScalar(2));z.divideScalar(F);f[x].position=z}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?".":b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==
 b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,k,h,m,n){var t=document.createElement("canvas");b[e]=new THREE.Texture(t);b[e].sourceFile=k;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
@@ -546,112 +546,112 @@ c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,p=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(p==0&&(p=m.getResponseHeader("Content-Length")),k({total:p,loaded:m.responseText.length})):m.readyState==2&&(p=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
 m.setRequestHeader("Content-Type","text/plain");m.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function p(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function t(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c,
-f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+K);e=p(b,e+H);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+K);m=p(b,e+H);o=h(b,e+B);t=h(b,e+ca);e=h(b,e+J);m=E.materials[m];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,
-e+T);e=p(b,e+X);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function A(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,e+T);t=p(b,e+X);u=h(b,e+o);v=h(b,e+da);w=h(b,e+V);e=h(b,e+la);t=E.materials[t];var x=G[v*3],U=G[v*3+1];v=G[v*3+2];var y=G[w*3],N=G[w*3+1];w=G[w*3+2];var z=G[e*3],A=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,U,v),new THREE.Vector3(y,N,w),new THREE.Vector3(z,A,e)],null,t))}
-function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+ha);k=h(b,e+ka);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=E.faceVertexUvs[0];f=L[f*2+1];var t=L[k*2];k=L[k*2+1];var p=[];p.push(new THREE.UV(e,m));p.push(new THREE.UV(c,f));p.push(new THREE.UV(t,k));o.push(p)}function y(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+aa);k=h(b,e+ma);m=h(b,e+ea);e=L[c*2];o=L[c*2+1];c=L[f*2];t=L[f*2+1];f=L[k*2];var p=E.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,t));v.push(new THREE.UV(f,
-k));v.push(new THREE.UV(u,m));p.push(v)}var E=this,F=0,D,G=[],L=[],M,K,H,B,ca,J,P,Q,T,X,o,da,V,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
-F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;M=D.vertex_index_bytes;K=D.vertex_index_bytes*2;H=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;ca=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;P=D.vertex_index_bytes;
-Q=D.vertex_index_bytes*2;T=D.vertex_index_bytes*3;X=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;da=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;V=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;la=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ha=D.uv_index_bytes;ka=D.uv_index_bytes*2;aa=D.uv_index_bytes;ma=D.uv_index_bytes*2;ea=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
-4+D.material_index_bytes;Z=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);Y=D.ntri_flat_uv*(e+D.uv_index_bytes*3);fa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,k)));return D.nvertices*n}(F);F+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=t(b,e),f=t(b,e+D.normal_coordinate_bytes),h=t(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(F);F+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),L.push(f,h);return D.nuvs*k}(F);Z=F+Z;$=Z+$;Y=$+Y;fa=Y+fa;ia=fa+ia;e=ia+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
-f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),z(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(Y);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),y(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
-4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)A(e),y(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(F);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(Z);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(fa);(function(b){var e,
-c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)A(e);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.ColladaLoader=function(){function b(b,e,c){for(var b=Z.evaluate(b,Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
+f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+J);e=p(b,e+B);F.faces.push(new THREE.Face3(c,f,k,null,null,F.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+J);m=p(b,e+B);o=h(b,e+K);t=h(b,e+ca);e=h(b,e+I);m=F.materials[m];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,
+e+S);e=p(b,e+W);F.faces.push(new THREE.Face4(c,f,k,m,null,null,F.materials[e]))}function y(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+P);k=h(b,e+Q);m=h(b,e+S);t=p(b,e+W);u=h(b,e+o);v=h(b,e+da);w=h(b,e+T);e=h(b,e+la);t=F.materials[t];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var z=G[w*3],N=G[w*3+1];w=G[w*3+2];var A=G[e*3],B=G[e*3+1],e=G[e*3+2];F.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(z,N,w),new THREE.Vector3(A,B,e)],null,t))}
+function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+ha);k=h(b,e+ka);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=F.faceVertexUvs[0];f=L[f*2+1];var t=L[k*2];k=L[k*2+1];var p=[];p.push(new THREE.UV(e,m));p.push(new THREE.UV(c,f));p.push(new THREE.UV(t,k));o.push(p)}function A(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+aa);k=h(b,e+ma);m=h(b,e+ea);e=L[c*2];o=L[c*2+1];c=L[f*2];t=L[f*2+1];f=L[k*2];var p=F.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,t));v.push(new THREE.UV(f,
+k));v.push(new THREE.UV(u,m));p.push(v)}var F=this,E=0,D,G=[],L=[],M,J,B,K,ca,I,P,Q,S,W,o,da,T,la,ha,ka,aa,ma,ea,Z,$,Y,fa,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,f,e);D={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
+E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=D.header_bytes;M=D.vertex_index_bytes;J=D.vertex_index_bytes*2;B=D.vertex_index_bytes*3;K=D.vertex_index_bytes*3+D.material_index_bytes;ca=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;I=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;P=D.vertex_index_bytes;
+Q=D.vertex_index_bytes*2;S=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;da=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;T=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;la=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ha=D.uv_index_bytes;ka=D.uv_index_bytes*2;aa=D.uv_index_bytes;ma=D.uv_index_bytes*2;ea=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
+4+D.material_index_bytes;Z=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);Y=D.ntri_flat_uv*(e+D.uv_index_bytes*3);fa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);E+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),F.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,k)));return D.nvertices*n}(E);E+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=t(b,e),f=t(b,e+D.normal_coordinate_bytes),h=t(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,h/127);return D.nnormals*k}(E);E+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),L.push(f,h);return D.nuvs*k}(E);Z=E+Z;$=Z+$;Y=$+Y;fa=Y+fa;ia=fa+ia;e=ia+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
+f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),z(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(Y);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),A(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
+4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),A(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(E);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(Z);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(fa);(function(b){var e,
+c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)y(e);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.ColladaLoader=function(){function b(b,e,c){for(var b=Z.evaluate(b,Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}function e(b,c,f,h){b.world=b.world||
 new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=O[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=Y.getChildById(f.skeleton[0],!0)||Y.getChildBySid(f.skeleton[0],
 !0),n,o,t,p,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(p=0;p<n.length;p++){t=n[p];v=-1;for(var y=0;y<o.joints.length;y++)if(t.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];t.invBindMatrix=y;t.skinningMatrix=new THREE.Matrix4;t.skinningMatrix.multiply(t.world,y);t.weights=[];
 for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&t.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)t=w[n].weights[o],p=t.index,t=t.weight,v=b.vertices[p],p=x[p],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),p.position.x+=u.x*t,p.position.y+=u.y*t,p.position.z+=u.z*t;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var e=new THREE.Object3D,
-c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new A;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&oa[n.morph.source]))o=new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(oa[n.morph.source])o=
-new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=oa[n.url],t={},p=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=va[qa[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=t[u.symbol]=
+c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&oa[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(oa[n.morph.source])o=
+new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=oa[n.url],t={},p=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ua[qa[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=t[u.symbol]=
 v.material;p++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(p>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)p=n.faces[j],p.materials=[t[p.daeMaterial]]}if(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=O[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.push(o);else if(k!==void 0){t=n;p=k instanceof x?O[k.url]:k;if(!p||!p.morph)console.log("could not find morph controller!");
 else{p=p.morph;for(v=0;v<p.targets.length;v++){var w=oa[p.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===t.vertices.length&&t.morphTargets.push({name:"target_1",vertices:w.vertices})}t.morphTargets.push({name:"target_Z",vertices:t.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
 this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function u(){this.type=
-this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function A(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function y(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function F(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
-this.stride=this.count=0;this.params=[]}function G(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function H(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function B(b,e){this.type=b;this.effect=e;this.material=null}function ca(b){this.effect=b;this.format=this.init_from=
-null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Q(){this.url=""}function T(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function X(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
-this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function da(b){var e=b.getAttribute("id");if(ia[e]!=void 0)return ia[e];ia[e]=(new M(e)).parse(b);return ia[e]}function V(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function la(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function ha(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ka(b){return b.replace(/^\s+/,"").replace(/\s+$/,
-"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ma(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function ea(b,e){var c="";c+=ma(b.x,e)+",";c+=ma(b.y,e)+",";c+=ma(b.z,e);return c}var Z=null,$=null,Y,fa=null,ia={},ra={},na={},O={},oa={},qa={},va={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
+this.stride=this.count=0;this.params=[]}function G(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function B(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(b,e){this.type=b;this.effect=e;this.material=null}function ca(b){this.effect=b;this.format=this.init_from=
+null}function I(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function P(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Q(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
+this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function da(b){var e=b.getAttribute("id");if(ia[e]!=void 0)return ia[e];ia[e]=(new M(e)).parse(b);return ia[e]}function T(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function la(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function ha(b){for(var b=ka(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ka(b){return b.replace(/^\s+/,"").replace(/\s+$/,
+"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ma(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function ea(b,e){var c="";c+=ma(b.x,e)+",";c+=ma(b.y,e)+",";c+=ma(b.z,e);return c}var Z=null,$=null,Y,fa=null,ia={},ra={},na={},O={},oa={},qa={},ua={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
 b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};m.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "skin":this.skin=(new p).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(b){var e=
 {},c=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
 function(b){for(var e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new L).parse(f))}}return e};p.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=la(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
 k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new M).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};p.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new L).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
-h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new L).parse(m));break;case "v":c=ha(m.textContent);break;case "vcount":f=ha(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],t=0;t<n;t++){for(var p={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":p.joint=w;break;
-case "WEIGHT":p.weight=e[v.source].data[w]}}o.push(p);m+=h.length}for(t=0;t<o.length;t++)o[t].index=k;this.weights.push(o)}};t.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};t.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};t.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
+h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new L).parse(m));break;case "v":c=ha(m.textContent);break;case "vcount":f=ha(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],t=0;t<n;t++){for(var p={},v=0;v<h.length;v++){var u=h[v],w=c[m+u.offset];switch(u.semantic){case "JOINT":p.joint=w;break;
+case "WEIGHT":p.weight=e[u.source].data[w]}}o.push(p);m+=h.length}for(t=0;t<o.length;t++)o[t].index=k;this.weights.push(o)}};t.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};t.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};t.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
 this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c))}}return this};w.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
 ""))}if(h==b)return c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};w.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};w.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
 b)return this.transforms[e];return null};w.prototype.parse=function(b){var e;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e));break;case "instance_camera":break;
-case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new A).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
+case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
 break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in na)for(var h=na[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+
 1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var t=o.sampler,p,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){p=t.output[o];break}m=p!==void 0?p instanceof THREE.Matrix4?m.multiply(m,p):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
 e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=la(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
 this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
-x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
-v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};A.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
-e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(b){function e(b,c){var f=ea(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":da(f);break;case "vertices":this.vertices=
-(new G).parse(f);break;case "triangles":this.primitives.push((new F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ia[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
-this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};y.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,t,p,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
-n[k],source=ia[o.source],t=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,p=t*numParams,o.semantic){case "VERTEX":o=ea(e.vertices[t].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;v==
-3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new F;E.prototype.constructor=E;F.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
-F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p=ha(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
+v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
+e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new A(this)).parse(c)}}return this};A.prototype.parse=function(b){function e(b,c){var f=ea(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":da(f);break;case "vertices":this.vertices=
+(new G).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ia[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
+this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,e,c){var f=0,h,k,m=b.p,n=b.inputs,o,t,p,v=0,u=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(u=b.vcount[v++]);for(h=0;h<u;h++)for(k=0;k<n.length;k++)switch(o=
+n[k],source=ia[o.source],t=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,p=t*numParams,o.semantic){case "VERTEX":o=ea(e.vertices[t].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==
+3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):u==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*u}};F.prototype=new E;F.prototype.constructor=F;E.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
+E.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p=ha(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
 0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new L).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};L.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
 "");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ka(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=la(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
 ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ka(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
-this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new Q).parse(b.childNodes[e]);break}return this};H.prototype.isColor=
-function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=la(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
-b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",c,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
-{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=
+this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};J.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new Q).parse(b.childNodes[e]);break}return this};B.prototype.isColor=
+function(){return this.texture==null};B.prototype.isTexture=function(){return this.texture!=null};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=la(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};K.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
+b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new B).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=Z.evaluate(".//dae:float",c,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b=
+{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof B)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=
 f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};ca.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
-c.nodeName)}}return this};J.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
+c.nodeName)}}return this};I.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
 P.prototype.create=function(){if(this.shader==null)return null};P.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};P.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
-(new ca(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new J(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};P.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
-P.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new B(c.nodeName,this)).parse(c)}}};Q.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};T.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
-(new M).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new X(this)).parse(c))}}return this};X.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
+(new ca(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new I(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};P.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
+P.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new K(c.nodeName,this)).parse(c)}}};Q.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
+(new M).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new W(this)).parse(c))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
 parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new L).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=
 c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(e.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&
 document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){fa=f;var o,p=e;Z=n.responseXML;o=fa;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
-K,"material");va=b("//dae:library_effects/dae:effect",P,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",T,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",t,"visual_scene");Aa=[];Ca=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ta[p]):
-Y=null;$=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)$.add(h(Y.nodes[p]));c();for(var u in na);u={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:va,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:Y}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
+J,"material");ua=b("//dae:library_effects/dae:effect",P,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",S,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",t,"visual_scene");Aa=[];Ca=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ta[p]):
+Y=null;$=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)$.add(h(Y.nodes[p]));c();for(var u in na);u={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:ua,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:Y}};o&&o(u)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};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(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,t,w,u,x,v,A,z,y,E,F,D,G=b.faces;u=b.vertices;var L=b.normals,M=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(w=u.length;t<w;)x=new THREE.Vertex,x.position.x=u[t++]*e,x.position.y=
-u[t++]*e,x.position.z=u[t++]*e,f.vertices.push(x);t=0;for(w=G.length;t<w;){e=G[t++];u=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;u?(y=new THREE.Face4,y.a=G[t++],y.b=G[t++],y.c=G[t++],y.d=G[t++],u=4):(y=new THREE.Face3,y.a=G[t++],y.b=G[t++],y.c=G[t++],u=3);if(p)p=G[t++],y.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<K;c++)E=b.uvs[c],A=G[t++],D=E[A*2],A=E[A*2+1],f.faceUvs[c][p]=new THREE.UV(D,A);if(h)for(c=0;c<K;c++){E=b.uvs[c];F=[];for(h=0;h<u;h++)A=G[t++],D=E[A*2],A=E[A*2+1],F[h]=
-new THREE.UV(D,A);f.faceVertexUvs[c][p]=F}if(v)v=G[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.normal=h;if(x)for(c=0;c<u;c++)v=G[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.vertexNormals.push(h);if(z)x=G[t++],x=new THREE.Color(M[x]),y.color=x;if(e)for(c=0;c<u;c++)x=G[t++],x=new THREE.Color(M[x]),y.vertexColors.push(x);f.faces.push(y)}}})(h);(function(){var e,c,h,p;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],p=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
-p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,t,w,u,x,v,A;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;A=b.morphTargets[c].vertices;p=0;for(t=A.length;p<t;p+=3)w=A[p]*e,u=A[p+1]*
-e,x=A[p+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];t=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(p=w.length;e<p;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),t.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
+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(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,t,w,u,x,v,y,z,A,F,E,D,G=b.faces;u=b.vertices;var L=b.normals,M=b.colors,J=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&J++;for(c=0;c<J;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(w=u.length;t<w;)x=new THREE.Vertex,x.position.x=u[t++]*e,x.position.y=
+u[t++]*e,x.position.z=u[t++]*e,f.vertices.push(x);t=0;for(w=G.length;t<w;){e=G[t++];u=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;u?(A=new THREE.Face4,A.a=G[t++],A.b=G[t++],A.c=G[t++],A.d=G[t++],u=4):(A=new THREE.Face3,A.a=G[t++],A.b=G[t++],A.c=G[t++],u=3);if(p)p=G[t++],A.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<J;c++)F=b.uvs[c],y=G[t++],D=F[y*2],y=F[y*2+1],f.faceUvs[c][p]=new THREE.UV(D,y);if(h)for(c=0;c<J;c++){F=b.uvs[c];E=[];for(h=0;h<u;h++)y=G[t++],D=F[y*2],y=F[y*2+1],E[h]=
+new THREE.UV(D,y);f.faceVertexUvs[c][p]=E}if(v)v=G[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],A.normal=h;if(x)for(c=0;c<u;c++)v=G[t++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],A.vertexNormals.push(h);if(z)x=G[t++],x=new THREE.Color(M[x]),A.color=x;if(e)for(c=0;c<u;c++)x=G[t++],x=new THREE.Color(M[x]),A.vertexColors.push(x);f.faces.push(A)}}})(h);(function(){var e,c,h,p;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],p=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
+p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,t,w,u,x,v,y;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;y=b.morphTargets[c].vertices;p=0;for(t=y.length;p<t;p+=3)w=y[p]*e,u=y[p+1]*
+e,x=y[p+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];t=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(p=w.length;e<p;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),t.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
 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,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in P.objects)if(!V.objects[v])if(F=P.objects[v],F.geometry!==void 0){if(M=V.geometries[F.geometry]){var b=!1;ca=[];for(ha=0;ha<F.materials.length;ha++)ca[ha]=V.materials[F.materials[ha]],b=ca[ha]instanceof THREE.ShaderMaterial;b&&M.computeTangents();D=F.position;r=F.rotation;
-q=F.quaternion;s=F.scale;q=0;ca.length==0&&(ca[0]=new THREE.MeshFaceMaterial);ca.length>1&&(ca=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,ca);object.name=v;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;V.scene.add(object);V.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b));
-if(F.castsShadow)b=new THREE.ShadowVolume(M),V.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,V.scene.add(object),V.objects[v]=object,V.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}function p(b){return function(c){V.geometries[b]=c;n();T-=1;e.onLoadComplete();w()}}function t(b){return function(e){V.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:da,loadedModels:o-T,loadedTextures:da-X},V);e.onLoadProgress();T==0&&X==0&&c(V)}var u,
-x,v,A,z,y,E,F,D,G,L,M,K,H,B,ca,J,P,Q,T,X,o,da,V;P=b.data;B=new THREE.BinaryLoader;Q=new THREE.JSONLoader;X=T=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in P.objects)if(F=P.objects[v],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;G=P.transform.rotation;var la=P.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0],
-G[1],G[2]);la&&V.scene.scale.set(la[0],la[1],la[2]);(b||G||la)&&V.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(z in P.cameras)G=P.cameras[z],G.type=="perspective"?K=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(K=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),D=G.position,G=G.target,K.position.set(D[0],D[1],D[2]),K.target=new THREE.Vector3(G[0],G[1],G[2]),V.cameras[z]=K;for(A in P.lights)z=P.lights[A],K=z.color!==void 0?
-z.color:16777215,G=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,J=new THREE.DirectionalLight(K,G),J.position.set(D[0],D[1],D[2]),J.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,J=new THREE.PointLight(K,G,d),J.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(J=new THREE.AmbientLight(K)),V.scene.add(J),V.lights[A]=J;for(y in P.fogs)A=P.fogs[y],A.type=="linear"?H=new THREE.Fog(0,A.near,A.far):A.type=="exp2"&&(H=new THREE.FogExp2(0,A.density)),G=A.color,
-H.color.setRGB(G[0],G[1],G[2]),V.fogs[y]=H;if(V.cameras&&P.defaults.camera)V.currentCamera=V.cameras[P.defaults.camera];if(V.fogs&&P.defaults.fog)V.scene.fog=V.fogs[P.defaults.fog];G=P.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(G[0],G[1],G[2]);V.bgColorAlpha=P.defaults.bgalpha;for(u in P.geometries)if(y=P.geometries[u],y.type=="bin_mesh"||y.type=="ascii_mesh")T+=1,e.onLoadStart();o=T;for(u in P.geometries)y=P.geometries[u],y.type=="cube"?(M=new THREE.CubeGeometry(y.width,y.height,
-y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),V.geometries[u]=M):y.type=="plane"?(M=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),V.geometries[u]=M):y.type=="sphere"?(M=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),V.geometries[u]=M):y.type=="cylinder"?(M=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),V.geometries[u]=M):y.type=="torus"?(M=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,
-y.segmentsT),V.geometries[u]=M):y.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(y.subdivisions),V.geometries[u]=M):y.type=="bin_mesh"?B.load({model:f(y.url,P.urlBaseType),callback:p(u)}):y.type=="ascii_mesh"?Q.load({model:f(y.url,P.urlBaseType),callback:p(u)}):y.type=="embedded_mesh"&&(y=P.embeds[y.id])&&Q.createModel(y,t(u),"");for(E in P.textures)if(u=P.textures[E],u.url instanceof Array){X+=u.url.length;for(B=0;B<u.url.length;B++)e.onLoadStart()}else X+=1,e.onLoadStart();da=X;for(E in P.textures){u=
-P.textures[E];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){B=[];for(var ha=0;ha<u.url.length;ha++)B[ha]=f(u.url[ha],P.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,P.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)B.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)B.magFilter=THREE[u.magFilter];if(u.repeat){B.repeat.set(u.repeat[0],u.repeat[1]);if(u.repeat[0]!=
-1)B.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}u.offset&&B.offset.set(u.offset[0],u.offset[1]);if(u.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[u.wrap[0]]!==void 0)B.wrapS=Q[u.wrap[0]];if(Q[u.wrap[1]]!==void 0)B.wrapT=Q[u.wrap[1]]}}V.textures[E]=B}for(x in P.materials){E=P.materials[x];for(L in E.parameters)if(L=="envMap"||L=="map"||L=="lightMap")E.parameters[L]=V.textures[E.parameters[L]];else if(L=="shading")E.parameters[L]=E.parameters[L]==
-"flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")E.parameters[L]=THREE[E.parameters[L]]?THREE[E.parameters[L]]:THREE.NormalBlending;else if(L=="combine")E.parameters[L]=E.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(E.parameters[L]=="face")E.parameters[L]=THREE.FaceColors;else if(E.parameters[L])E.parameters[L]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=!0;if(E.parameters.normalMap){u=
-THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);B=E.parameters.color;Q=E.parameters.specular;y=E.parameters.ambient;H=E.parameters.shininess;b.tNormal.texture=V.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
-V.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(Q);b.uAmbientColor.value.setHex(y);b.uShininess.value=H;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);V.materials[x]=E}n();e.callbackSync(V)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=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,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in P.objects)if(!T.objects[v])if(E=P.objects[v],E.geometry!==void 0){if(M=T.geometries[E.geometry]){var b=!1;ca=[];for(ha=0;ha<E.materials.length;ha++)ca[ha]=T.materials[E.materials[ha]],b=ca[ha]instanceof THREE.ShaderMaterial;b&&M.computeTangents();D=E.position;r=E.rotation;
+q=E.quaternion;s=E.scale;q=0;ca.length==0&&(ca[0]=new THREE.MeshFaceMaterial);ca.length>1&&(ca=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,ca);object.name=v;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;T.scene.add(object);T.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
+if(E.castsShadow)b=new THREE.ShadowVolume(M),T.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,T.scene.add(object),T.objects[v]=object,T.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function p(b){return function(c){T.geometries[b]=c;n();S-=1;e.onLoadComplete();w()}}function t(b){return function(e){T.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:da,loadedModels:o-S,loadedTextures:da-W},T);e.onLoadProgress();S==0&&W==0&&c(T)}var u,
+x,v,y,z,A,F,E,D,G,L,M,J,B,K,ca,I,P,Q,S,W,o,da,T;P=b.data;K=new THREE.BinaryLoader;Q=new THREE.JSONLoader;W=S=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in P.objects)if(E=P.objects[v],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;G=P.transform.rotation;var la=P.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);G&&T.scene.rotation.set(G[0],
+G[1],G[2]);la&&T.scene.scale.set(la[0],la[1],la[2]);(b||G||la)&&T.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in P.cameras)G=P.cameras[z],G.type=="perspective"?J=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(J=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),D=G.position,G=G.target,J.position.set(D[0],D[1],D[2]),J.target=new THREE.Vector3(G[0],G[1],G[2]),T.cameras[z]=J;for(y in P.lights)z=P.lights[y],J=z.color!==void 0?
+z.color:16777215,G=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,I=new THREE.DirectionalLight(J,G),I.position.set(D[0],D[1],D[2]),I.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,I=new THREE.PointLight(J,G,d),I.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(I=new THREE.AmbientLight(J)),T.scene.add(I),T.lights[y]=I;for(A in P.fogs)y=P.fogs[A],y.type=="linear"?B=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(B=new THREE.FogExp2(0,y.density)),G=y.color,
+B.color.setRGB(G[0],G[1],G[2]),T.fogs[A]=B;if(T.cameras&&P.defaults.camera)T.currentCamera=T.cameras[P.defaults.camera];if(T.fogs&&P.defaults.fog)T.scene.fog=T.fogs[P.defaults.fog];G=P.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(G[0],G[1],G[2]);T.bgColorAlpha=P.defaults.bgalpha;for(u in P.geometries)if(A=P.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")S+=1,e.onLoadStart();o=S;for(u in P.geometries)A=P.geometries[u],A.type=="cube"?(M=new THREE.CubeGeometry(A.width,A.height,
+A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[u]=M):A.type=="plane"?(M=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=M):A.type=="sphere"?(M=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[u]=M):A.type=="cylinder"?(M=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[u]=M):A.type=="torus"?(M=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,
+A.segmentsT),T.geometries[u]=M):A.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[u]=M):A.type=="bin_mesh"?K.load({model:f(A.url,P.urlBaseType),callback:p(u)}):A.type=="ascii_mesh"?Q.load({model:f(A.url,P.urlBaseType),callback:p(u)}):A.type=="embedded_mesh"&&(A=P.embeds[A.id])&&Q.createModel(A,t(u),"");for(F in P.textures)if(u=P.textures[F],u.url instanceof Array){W+=u.url.length;for(K=0;K<u.url.length;K++)e.onLoadStart()}else W+=1,e.onLoadStart();da=W;for(F in P.textures){u=
+P.textures[F];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){K=[];for(var ha=0;ha<u.url.length;ha++)K[ha]=f(u.url[ha],P.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,u.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(u.url,P.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)K.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)K.magFilter=THREE[u.magFilter];if(u.repeat){K.repeat.set(u.repeat[0],u.repeat[1]);if(u.repeat[0]!=
+1)K.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}u.offset&&K.offset.set(u.offset[0],u.offset[1]);if(u.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[u.wrap[0]]!==void 0)K.wrapS=Q[u.wrap[0]];if(Q[u.wrap[1]]!==void 0)K.wrapT=Q[u.wrap[1]]}}T.textures[F]=K}for(x in P.materials){F=P.materials[x];for(L in F.parameters)if(L=="envMap"||L=="map"||L=="lightMap")F.parameters[L]=T.textures[F.parameters[L]];else if(L=="shading")F.parameters[L]=F.parameters[L]==
+"flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")F.parameters[L]=THREE[F.parameters[L]]?THREE[F.parameters[L]]:THREE.NormalBlending;else if(L=="combine")F.parameters[L]=F.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(F.parameters[L]=="face")F.parameters[L]=THREE.FaceColors;else if(F.parameters[L])F.parameters[L]=THREE.VertexColors;if(F.parameters.opacity!==void 0&&F.parameters.opacity<1)F.parameters.transparent=!0;if(F.parameters.normalMap){u=
+THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);K=F.parameters.color;Q=F.parameters.specular;A=F.parameters.ambient;B=F.parameters.shininess;b.tNormal.texture=T.textures[F.parameters.normalMap];if(F.parameters.normalMapFactor)b.uNormalScale.value=F.parameters.normalMapFactor;if(F.parameters.map)b.tDiffuse.texture=F.parameters.map,b.enableDiffuse.value=!0;if(F.parameters.lightMap)b.tAO.texture=F.parameters.lightMap,b.enableAO.value=!0;if(F.parameters.specularMap)b.tSpecular.texture=
+T.textures[F.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(Q);b.uAmbientColor.value.setHex(A);b.uShininess.value=B;if(F.parameters.opacity)b.uOpacity.value=F.parameters.opacity;F=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else F=new THREE[F.type](F.parameters);T.materials[x]=F}n();e.callbackSync(T)}},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,m=b.offsetY!==void 0?b.offsetY:0,n=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,m,n):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,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
-THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],w=[];(function(b,m,t){for(var p,w,y,E=b.length;t<E;t+=m)p=b[t],w=b[t+1],y=b[t+2],p=p/16383*e,w=w/16383*e,y=y/16383*e,p+=f,w+=h,y+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,w,y)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
-e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,F,D,G,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;p=k;F=f;var M=h,K=k,H=m.materials[0],B=t[M*3],ca=t[M*3+1],M=t[M*3+2],J=t[K*3],P=t[K*3+1],K=t[K*3+2];F=new THREE.Vector3(t[F*3],t[F*3+1],t[F*3+2]);M=new THREE.Vector3(B,ca,M);K=new THREE.Vector3(J,P,K);m.faces.push(new THREE.Face3(D,G,p,[F,M,K],null,H));m=w[f*2];f=w[f*
-2+1];p=w[h*2];F=w[h*2+1];D=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,p));F.push(new THREE.UV(D,G));k.push(F)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
+THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],w=[];(function(b,m,t){for(var p,w,A,F=b.length;t<F;t+=m)p=b[t],w=b[t+1],A=b[t+2],p=p/16383*e,w=w/16383*e,A=A/16383*e,p+=f,w+=h,A+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,w,A)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
+e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,t.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,E,D,G,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;p=k;E=f;var M=h,J=k,B=m.materials[0],K=t[M*3],ca=t[M*3+1],M=t[M*3+2],I=t[J*3],P=t[J*3+1],J=t[J*3+2];E=new THREE.Vector3(t[E*3],t[E*3+1],t[E*3+2]);M=new THREE.Vector3(K,ca,M);J=new THREE.Vector3(I,P,J);m.faces.push(new THREE.Face3(D,G,p,[E,M,J],null,B));m=w[f*2];f=w[f*
+2+1];p=w[h*2];E=w[h*2+1];D=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,p));E.push(new THREE.UV(D,G));k.push(E)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
 THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(e);
 e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 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,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=t;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
 2]=t;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,t,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=t+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};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,m,n){var p=k+1,t=k+this.yd,w=k+this.zd,u=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,A=p+this.yd+this.zd,z=0,y=this.field[k],E=this.field[p],F=this.field[t],D=this.field[u],G=this.field[w],L=this.field[x],M=this.field[v],K=this.field[A];y<m&&(z|=1);E<m&&(z|=2);F<m&&(z|=8);D<m&&(z|=4);G<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);K<m&&(z|=64);var H=THREE.edgeTable[z];if(H==0)return 0;var B=this.delta,
-ca=b+B,J=c+B,B=h+B;H&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,y,E));H&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,m,ca,c,h,E,D));H&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,J,h,F,D));H&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,y,F));H&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,G,L));H&32&&(this.compNorm(x),
-this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,m,ca,c,B,L,K));H&64&&(this.compNorm(v),this.compNorm(A),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,J,B,M,K));H&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,G,M));H&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,y,G));H&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,ca,c,h,E,L));H&1024&&(this.compNorm(u),this.compNorm(A),this.VIntZ(u*
-3,this.vlist,this.nlist,30,m,ca,J,h,D,K));H&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,J,h,F,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){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+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,m,n){var p=k+1,t=k+this.yd,w=k+this.zd,u=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,y=p+this.yd+this.zd,z=0,A=this.field[k],F=this.field[p],E=this.field[t],D=this.field[u],G=this.field[w],L=this.field[x],M=this.field[v],J=this.field[y];A<m&&(z|=1);F<m&&(z|=2);E<m&&(z|=8);D<m&&(z|=4);G<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);J<m&&(z|=64);var B=THREE.edgeTable[z];if(B==0)return 0;var K=this.delta,
+ca=b+K,I=c+K,K=h+K;B&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,A,F));B&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,m,ca,c,h,F,D));B&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,I,h,E,D));B&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,A,E));B&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,K,G,L));B&32&&(this.compNorm(x),
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,ca,c,K,L,J));B&64&&(this.compNorm(v),this.compNorm(y),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,I,K,M,J));B&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,K,G,M));B&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,A,G));B&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,ca,c,h,F,L));B&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
+3,this.vlist,this.nlist,30,m,ca,I,h,D,J));B&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,I,h,E,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){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[m];this.positionArray[p+7]=b[m+1];this.positionArray[p+8]=b[m+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[m];this.normalArray[p+7]=c[m+1];this.normalArray[p+8]=c[m+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(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,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,t=c*this.size,w=b*this.size,u=Math.floor(p-n);u<1&&(u=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
-1);for(var A,z,y,E,F,D;u<p;u++){w=this.size2*u;z=u/this.size-h;F=z*z;for(z=x;z<t;z++){y=w+this.size*z;A=z/this.size-c;D=A*A;for(A=v;A<n;A++)E=A/this.size-b,E=k/(1.0E-6+E*E+D+F)-m,E>0&&(this.field[y+A]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,t=this.size,w=this.yd,u=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h<v;h++)if(k=h/t,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<t;k++){p=h+k*w;for(m=0;m<t;m++)x[u*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,t,w=this.size,u=this.yd,x=
-this.zd,v=this.field,A=w*Math.sqrt(b/c);A>w&&(A=w);for(k=0;k<A;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){p=k*u;for(h=0;h<w;h++){t=p+h;for(m=0;m<w;m++)v[x*m+t]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){p=zd*m;for(k=0;k<size;k++){t=p+k*yd;for(h=0;h<size;h++)field[t+h]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+1);for(var y,z,A,F,E,D;u<p;u++){w=this.size2*u;z=u/this.size-h;E=z*z;for(z=x;z<t;z++){A=w+this.size*z;y=z/this.size-c;D=y*y;for(y=v;y<n;y++)F=y/this.size-b,F=k/(1.0E-6+F*F+D+E)-m,F>0&&(this.field[A+y]+=F)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,t=this.size,w=this.yd,u=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h<v;h++)if(k=h/t,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<t;k++){p=h+k*w;for(m=0;m<t;m++)x[u*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,t,w=this.size,u=this.yd,x=
+this.zd,v=this.field,y=w*Math.sqrt(b/c);y>w&&(y=w);for(k=0;k<y;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){p=k*u;for(h=0;h<w;h++){t=p+h;for(m=0;m<w;m++)v[x*m+t]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){p=zd*m;for(k=0;k<size;k++){t=p+k*yd;for(h=0;h<size;h++)field[t+h]+=n}}};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,m,n,p,t,w,u,x=this.size-2;for(m=1;m<x;m++){u=this.size2*m;t=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=u+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,p,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var m,n,p,t,w,u,x,v;for(m=0;m<k.count;m++)x=m*3,w=x+1,v=x+2,n=k.positionArray[x],
 p=k.positionArray[w],t=k.positionArray[v],u=new THREE.Vector3(n,p,t),n=k.normalArray[x],p=k.normalArray[w],t=k.normalArray[v],x=new THREE.Vector3(n,p,t),x.normalize(),w=new THREE.Vertex(u),c.vertices.push(w),h.push(x);nfaces=k.count/3;for(m=0;m<nfaces;m++)x=(b+m)*3,w=x+1,v=x+2,u=h[x],n=h[w],p=h[v],x=new THREE.Face3(x,w,v,[u,n,p]),c.faces.push(x);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,
@@ -695,7 +695,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 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.PerspectiveCamera,k=new THREE.PerspectiveCamera,m=new THREE.Matrix4,n=new THREE.Matrix4,p,t,w;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.PerspectiveCamera(53,1,1,1E4);v.position.z=
 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:x}},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 A=new THREE.Scene;A.add(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;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||w!==e.fov){p=e.aspect;t=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*t/125,G=t*Math.tan(w*Math.PI/360),L;m.n14=F;n.n14=-F;F=-G*p+D;L=G*p+D;E.n11=2*t/(L-F);E.n13=(L+F)/(L-F);h.projectionMatrix=E.clone();F=-G*p-D;L=G*p-D;E.n11=2*t/(L-F);E.n13=
-(L+F)/(L-F);k.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=t;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=t;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,A,v)}};
+var y=new THREE.Scene;y.add(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;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||w!==e.fov){p=e.aspect;t=e.near;w=e.fov;var F=e.projectionMatrix.clone(),E=125/30*0.5,D=E*t/125,G=t*Math.tan(w*Math.PI/360),L;m.n14=E;n.n14=-E;E=-G*p+D;L=G*p+D;F.n11=2*t/(L-E);F.n13=(L+E)/(L-E);h.projectionMatrix=F.clone();E=-G*p-D;L=G*p-D;F.n11=2*t/(L-E);F.n13=
+(L+E)/(L-E);k.projectionMatrix=F.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=t;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=t;k.far=e.far;f.call(c,b,k,x,!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,m=new THREE.PerspectiveCamera;m.target=new THREE.Vector3(0,0,0);var n=new THREE.PerspectiveCamera;n.target=new THREE.Vector3(0,0,0);c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();m.fov=e.fov;m.aspect=0.5*e.aspect;m.near=e.near;m.far=
 e.far;m.updateProjectionMatrix();m.position.copy(e.position);m.target.copy(e.target);m.translateX(c.separation);m.lookAt(m.target);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.copy(e.target);n.translateX(-c.separation);n.lookAt(n.target);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}};

+ 31 - 32
build/custom/ThreeCanvas.js

@@ -57,9 +57,9 @@ this.remove(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=l[h]=l[h]||new THREE.RenderableVertex;h++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0?!0:e<0&&f<0||g<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,h,l=[],k,o,i=[],n,j=[],r,s,w=[],u,M,R=[],B=[],N=[],O=new THREE.Vector4,t=new THREE.Vector4,
 m=new THREE.Matrix4,C=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],T=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(a,b){m.multiply(b.projectionMatrix,b.matrixWorldInverse);m.multiplyVector3(a);return a};this.unprojectVector=function(a,b){m.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));m.multiplyVector3(a);return a};this.projectObjects=function(a,c,g){var h,j;f=B.length=0;
 h=a.objects;a=0;for(c=h.length;a<c;a++){j=h[a];var i;if(!(i=!j.visible))if(i=j instanceof THREE.Mesh)if(i=j.frustumCulled){a:{i=void 0;for(var k=j.matrixWorld,l=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),n=0;n<6;n++)if(i=D[n].x*k.n14+D[n].y*k.n24+D[n].z*k.n34+D[n].w,i<=l){i=!1;break a}i=!0}i=!i}if(!i)i=e[f]=e[f]||new THREE.RenderableObject,f++,d=i,O.copy(j.position),m.multiplyVector3(O),d.object=j,d.z=O.z,B.push(d)}g&&B.sort(b);return B};this.projectScene=
-function(d,e,f){var J=e.near,P=e.far,Q,V,E,B,y,L,H,z,x,q,v,G,O,ea,Z,ba,W;M=s=n=o=N.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);m.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);D[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);D[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);D[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);D[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);D[5].set(m.n41+
-m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);for(Q=0;Q<6;Q++)x=D[Q],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(Q=x.length;d<Q;d++)if(q=x[d].object,q.visible)if(v=q.matrixWorld,G=q.matrixRotationWorld,O=q.materials,ea=q.overdraw,h=0,q instanceof THREE.Mesh){Z=q.geometry;B=Z.vertices;ba=Z.faces;Z=Z.faceVertexUvs;V=0;for(E=B.length;V<E;V++)g=a(),g.positionWorld.copy(B[V].position),v.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),m.multiplyVector4(g.positionScreen),
-g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>J&&g.positionScreen.z<P;B=0;for(V=ba.length;B<V;B++){E=ba[B];if(E instanceof THREE.Face3)if(y=l[E.a],L=l[E.b],H=l[E.c],y.visible&&L.visible&&H.visible&&(q.doubleSided||q.flipSided!=(H.positionScreen.x-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(H.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0))z=i[o]=i[o]||new THREE.RenderableFace3,o++,k=z,k.v1.copy(y),
+function(d,e,f){var J=e.near,P=e.far,Q,V,E,B,y,L,H,z,x,q,v,G,O,ea,Z,aa,W;M=s=n=o=N.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);m.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);D[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);D[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);D[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);D[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);D[5].set(m.n41+
+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);for(Q=0;Q<6;Q++)x=D[Q],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(Q=x.length;d<Q;d++)if(q=x[d].object,q.visible)if(v=q.matrixWorld,G=q.matrixRotationWorld,O=q.materials,ea=q.overdraw,h=0,q instanceof THREE.Mesh){Z=q.geometry;B=Z.vertices;aa=Z.faces;Z=Z.faceVertexUvs;V=0;for(E=B.length;V<E;V++)g=a(),g.positionWorld.copy(B[V].position),v.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),m.multiplyVector4(g.positionScreen),
+g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>J&&g.positionScreen.z<P;B=0;for(V=aa.length;B<V;B++){E=aa[B];if(E instanceof THREE.Face3)if(y=l[E.a],L=l[E.b],H=l[E.c],y.visible&&L.visible&&H.visible&&(q.doubleSided||q.flipSided!=(H.positionScreen.x-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(H.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0))z=i[o]=i[o]||new THREE.RenderableFace3,o++,k=z,k.v1.copy(y),
 k.v2.copy(L),k.v3.copy(H);else continue;else if(E instanceof THREE.Face4)if(y=l[E.a],L=l[E.b],H=l[E.c],z=l[E.d],y.visible&&L.visible&&H.visible&&z.visible&&(q.doubleSided||q.flipSided!=((z.positionScreen.x-y.positionScreen.x)*(L.positionScreen.y-y.positionScreen.y)-(z.positionScreen.y-y.positionScreen.y)*(L.positionScreen.x-y.positionScreen.x)<0||(L.positionScreen.x-H.positionScreen.x)*(z.positionScreen.y-H.positionScreen.y)-(L.positionScreen.y-H.positionScreen.y)*(z.positionScreen.x-H.positionScreen.x)<
 0)))W=j[n]=j[n]||new THREE.RenderableFace4,n++,k=W,k.v1.copy(y),k.v2.copy(L),k.v3.copy(H),k.v4.copy(z);else continue;k.normalWorld.copy(E.normal);G.multiplyVector3(k.normalWorld);k.centroidWorld.copy(E.centroid);v.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);m.multiplyVector3(k.centroidScreen);H=E.vertexNormals;y=0;for(L=H.length;y<L;y++)z=k.vertexNormalsWorld[y],z.copy(H[y]),G.multiplyVector3(z);y=0;for(L=Z.length;y<L;y++)if(W=Z[y][B]){H=0;for(z=W.length;H<z;H++)k.uvs[y][H]=
 W[H]}k.meshMaterials=O;k.faceMaterials=E.materials;k.overdraw=ea;k.z=k.centroidScreen.z;N.push(k)}}else if(q instanceof THREE.Line){C.multiply(m,v);B=q.geometry.vertices;y=a();y.positionScreen.copy(B[0].position);C.multiplyVector4(y.positionScreen);V=1;for(E=B.length;V<E;V++)if(y=a(),y.positionScreen.copy(B[V].position),C.multiplyVector4(y.positionScreen),L=l[h-2],T.copy(y.positionScreen),U.copy(L.positionScreen),c(T,U))T.multiplyScalar(1/T.w),U.multiplyScalar(1/U.w),v=w[s]=w[s]||new THREE.RenderableLine,
@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,k=l*c+g*f-h*d,o=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
-c-g*d-h*f;b.x=k*l+c*-e+o*-h-i*-g;b.y=o*l+c*-g+i*-e-k*-h;b.z=i*l+c*-h+k*-g-o*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
+c-g*d-h*f;b.x=k*l+c*-e+o*-h-i*-g;b.y=o*l+c*-g+i*-e-k*-h;b.z=i*l+c*-h+k*-g-o*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
@@ -117,41 +117,40 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.origin=new THREE.Vector3;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
-THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.ambientColor=new THREE.Color;this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
+THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){a instanceof THREE.AmbientLight?(console.warn("DEPRECATED: AmbientLight( hex ) is now scene.ambientColor.setHex( hex )."),this.ambientColor.setHex(a.color.getHex())):(this.supr.add.call(this,a),this.addChildRecurse(a))};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
 THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};
 THREE.CanvasRenderer=function(a){function b(a){if(w!=a)j.globalAlpha=w=a}function c(a){if(u!=a){switch(a){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}u=a}}function d(a){if(M!=a)j.strokeStyle=M=a}function f(a){if(R!=a)j.fillStyle=R=a}var e=this,g=null,h=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-k,o,i,n,j=l.getContext("2d"),r=new THREE.Color(0),s=0,w=1,u=0,M=null,R=null,B=null,N=null,O=null,t,m,C,D,T=new THREE.RenderableVertex,U=new THREE.RenderableVertex,F,K,I,J,P,Q,V,E,pa,y,L,H,z=new THREE.Color(0),x=new THREE.Color(0),q=new THREE.Color(0),v=new THREE.Color(0),G=new THREE.Color(0),za=[],ea,Z,ba,W,Da,Ea,Fa,Ga,Ha,Ia,ka=new THREE.Rectangle,$=new THREE.Rectangle,Y=new THREE.Rectangle,Aa=!1,ca=new THREE.Color,aa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,S=new THREE.Vector3,qa,ra,
+k,o,i,n,j=l.getContext("2d"),r=new THREE.Color(0),s=0,w=1,u=0,M=null,R=null,B=null,N=null,O=null,t,m,C,D,T=new THREE.RenderableVertex,U=new THREE.RenderableVertex,F,K,I,J,P,Q,V,E,pa,y,L,H,z=new THREE.Color(0),x=new THREE.Color(0),q=new THREE.Color(0),v=new THREE.Color(0),G=new THREE.Color(0),za=[],ea,Z,aa,W,Da,Ea,Fa,Ga,Ha,Ia,ka=new THREE.Rectangle,$=new THREE.Rectangle,Y=new THREE.Rectangle,Aa=!1,ba=new THREE.Color,ca=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,S=new THREE.Vector3,qa,ra,
 Ba,da,sa,va,a=16;qa=document.createElement("canvas");qa.width=qa.height=2;ra=qa.getContext("2d");ra.fillStyle="rgba(0,0,0,1)";ra.fillRect(0,0,2,2);Ba=ra.getImageData(0,0,2,2);da=Ba.data;sa=document.createElement("canvas");sa.width=sa.height=a;va=sa.getContext("2d");va.translate(-a/2,-a/2);va.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){k=a;o=b;i=Math.floor(k/2);n=Math.floor(o/2);l.width=k;l.height=
 o;ka.set(-i,-n,i,n);$.set(-i,-n,i,n);w=1;u=0;O=N=B=R=M=null};this.setClearColor=function(a,b){r.copy(a);s=b;$.set(-i,-n,i,n)};this.setClearColorHex=function(a,b){r.setHex(a);s=b;$.set(-i,-n,i,n)};this.clear=function(){j.setTransform(1,0,0,-1,i,n);$.isEmpty()||($.minSelf(ka),$.inflate(2),s<1&&j.clearRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight())),s>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*
-255)+","+s+")"),j.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(a,k){function l(a){var b,c,d,e=a.lights;aa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.AmbientLight?(aa.r+=d.r,aa.g+=d.g,aa.b+=d.b):c instanceof THREE.DirectionalLight?(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b):c instanceof THREE.PointLight&&(ua.r+=d.r,ua.g+=d.g,ua.b+=d.b)}function o(a,b,c,
-d){var e,f,g,h,j=a.lights,a=0;for(e=j.length;a<e;a++)f=j[a],g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(S.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,k,l,o,p,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)o=
-g.map.image,p=o.width>>1,m=o.height>>1,g=e.scale.x*i,l=e.scale.y*n,h=g*p,k=l*m,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(g,-l),j.translate(-p,-m),j.drawImage(o,0,0),j.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*i,k=e.scale.y*n,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(h,k),g.program(j),
-j.restore()))}function s(a,e,f,g){b(g.opacity);c(g.blending);j.beginPath();j.moveTo(a.positionScreen.x,a.positionScreen.y);j.lineTo(e.positionScreen.x,e.positionScreen.y);j.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)j.lineWidth=B=a;a=g.linecap;if(N!=a)j.lineCap=N=a;a=g.linejoin;if(O!=a)j.lineJoin=O=a;d(g.color.getContextStyle());j.stroke();Y.inflate(g.linewidth*2)}}function u(a,d,f,g,h,j,i,p,l){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);
-F=a.positionScreen.x;K=a.positionScreen.y;I=d.positionScreen.x;J=d.positionScreen.y;P=f.positionScreen.x;Q=f.positionScreen.y;M(F,K,I,J,P,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,W[h].u,W[h].v,W[j].u,W[j].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,S.copy(i.vertexNormalsWorld[0]),Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+
-S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[1]),Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[2]),Ha=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ia=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Ca(F,K,I,J,P,Q,Da,Ea,Fa,Ga,Ha,Ia,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
-THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,W[h].u,W[h].v,W[j].u,W[j].v,p.map)),c(THREE.SubtractiveBlending)),Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(x.r=q.r=v.r=aa.r,x.g=q.g=v.g=aa.g,x.b=q.b=v.b=aa.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],v),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,
-Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,o(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,
-Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(f.positionScreen.z,ea,Z),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,ba=wa(x,
-q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,ba);else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)}function w(a,d,f,g,h,j,i,p,l){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)u(a,d,g,0,1,3,i,p,l),u(h,f,j,1,2,3,i,p,l);else if(F=a.positionScreen.x,K=a.positionScreen.y,I=d.positionScreen.x,J=d.positionScreen.y,P=f.positionScreen.x,
-Q=f.positionScreen.y,V=g.positionScreen.x,E=g.positionScreen.y,pa=h.positionScreen.x,y=h.positionScreen.y,L=j.positionScreen.x,H=j.positionScreen.y,p instanceof THREE.MeshBasicMaterial)R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(x.r=q.r=v.r=G.r=aa.r,x.g=q.g=v.g=G.g=aa.g,x.b=q.b=v.b=G.b=aa.b,o(l,i.v1.positionWorld,
-i.vertexNormalsWorld[0],x),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),o(l,i.v4.positionWorld,i.vertexNormalsWorld[3],v),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],G),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*
-v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=Math.max(0,Math.min(p.color.r*G.r,1)),G.g=Math.max(0,Math.min(p.color.g*G.g,1)),G.b=Math.max(0,Math.min(p.color.b*G.b,1)),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)):(ca.r=aa.r,ca.g=aa.g,ca.b=aa.b,o(l,i.centroidWorld,i.normalWorld,ca),z.r=Math.max(0,Math.min(p.color.r*ca.r,1)),z.g=Math.max(0,Math.min(p.color.g*ca.g,1)),z.b=Math.max(0,Math.min(p.color.b*ca.b,1)),R(F,K,I,J,P,Q,V,E),
-p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):(R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,
-ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(g.positionScreen.z,ea,Z),G.r=G.g=G.b=1-la(f.positionScreen.z,ea,Z),ba=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,ba),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,ba)}function M(a,b,c,d,e,f){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(a,b);j.closePath()}function R(a,b,c,d,e,f,g,h){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(g,h);j.lineTo(a,b);j.closePath()}function ga(a,b,c,e){if(B!=
-b)j.lineWidth=B=b;if(N!=c)j.lineCap=N=c;if(O!=e)j.lineJoin=O=e;d(a.getContextStyle());j.stroke();Y.inflate(b*2)}function ha(a){f(a.getContextStyle());j.fill()}function Ca(a,b,c,d,e,g,h,i,k,l,o,n,m){if(m.image.width!=0){if(m.needsUpdate==!0||za[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;za[m.id]=j.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(za[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,
-s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,k=(k+q)*s,l=(l+r)*m,o=(o+q)*s,n=(n+r)*m;c-=a;d-=b;e-=a;g-=b;k-=h;l-=i;o-=h;n-=i;q=1/(k*n-o*l);m=(n*c-l*e)*q;l=(n*d-l*g)*q;c=(k*e-o*c)*q;d=(k*g-o*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;j.save();j.transform(m,l,c,d,a,b);j.fill();j.restore()}}function ma(a,b,c,d,e,f,g,h,i,k,l,m,o){var n,q;n=o.width-1;q=o.height-1;g*=n;h*=q;i*=n;k*=q;l*=n;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;k-=h;l-=g;m-=h;q=1/(i*m-l*k);n=(m*c-k*e)*q;k=(m*d-k*f)*q;c=(i*
-e-l*c)*q;d=(i*f-l*d)*q;a=a-n*g-c*h;b=b-k*g-d*h;j.save();j.transform(n,k,c,d,a,b);j.clip();j.drawImage(o,0,0);j.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:
-j;da[10]=c<0?0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,n);e.info.render.vertices=0;e.info.render.faces=0;
-g=h.projectScene(a,k,this.sortElements);(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=g.length;xa<Ja;xa++){A=g[xa];Y.empty();if(A instanceof THREE.RenderableParticle){t=A;t.x*=i;t.y*=n;fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&r(t,A,X,a)}else if(A instanceof THREE.RenderableLine){if(t=A.v1,m=A.v2,t.positionScreen.x*=i,t.positionScreen.y*=n,m.positionScreen.x*=i,m.positionScreen.y*=n,Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),
-ka.intersects(Y)){fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&s(t,m,A,X,a)}}else if(A instanceof THREE.RenderableFace3){if(t=A.v1,m=A.v2,C=A.v3,t.positionScreen.x*=i,t.positionScreen.y*=n,m.positionScreen.x*=i,m.positionScreen.y*=n,C.positionScreen.x*=i,C.positionScreen.y*=n,A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,C.positionScreen),ia(C.positionScreen,t.positionScreen)),Y.add3Points(t.positionScreen.x,t.positionScreen.y,m.positionScreen.x,
-m.positionScreen.y,C.positionScreen.x,C.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}else X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}}else if(A instanceof THREE.RenderableFace4&&(t=A.v1,m=A.v2,C=A.v3,D=A.v4,t.positionScreen.x*=i,t.positionScreen.y*=n,m.positionScreen.x*=i,m.positionScreen.y*=n,C.positionScreen.x*=
-i,C.positionScreen.y*=n,D.positionScreen.x*=i,D.positionScreen.y*=n,T.positionScreen.copy(m.positionScreen),U.positionScreen.copy(D.positionScreen),A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,D.positionScreen),ia(D.positionScreen,t.positionScreen),ia(C.positionScreen,T.positionScreen),ia(C.positionScreen,U.positionScreen)),Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),Y.addPoint(C.positionScreen.x,C.positionScreen.y),
-Y.addPoint(D.positionScreen.x,D.positionScreen.y),ka.intersects(Y))){fa=0;for(ja=A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}else X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}$.addRectangle(Y)}j.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};
-THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+255)+","+s+")"),j.fillRect(Math.floor($.getX()),Math.floor($.getY()),Math.floor($.getWidth()),Math.floor($.getHeight()))),$.empty())};this.render=function(a,k){function l(a){var b,c,d,e=a.lights;ca.copy(a.ambientColor);ta.setRGB(0,0,0);ua.setRGB(0,0,0);a=0;for(b=e.length;a<b;a++)c=e[a],d=c.color,c instanceof THREE.DirectionalLight?(ta.r+=d.r,ta.g+=d.g,ta.b+=d.b):c instanceof THREE.PointLight&&(ua.r+=d.r,ua.g+=d.g,ua.b+=d.b)}function o(a,b,c,d){var e,f,g,h,j=a.lights,a=0;for(e=j.length;a<e;a++)f=j[a],
+g=f.color,f instanceof THREE.DirectionalLight?(h=c.dot(f.position),h<=0||(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)):f instanceof THREE.PointLight&&(h=c.dot(S.sub(f.position,b).normalize()),h<=0||(h*=f.distance==0?1:1-Math.min(b.distanceTo(f.position)/f.distance,1),h!=0&&(h*=f.intensity,d.r+=g.r*h,d.g+=g.g*h,d.b+=g.b*h)))}function r(a,e,g){b(g.opacity);c(g.blending);var h,k,l,o,p,m;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)o=g.map.image,p=o.width>>1,m=o.height>>1,g=e.scale.x*i,
+l=e.scale.y*n,h=g*p,k=l*m,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(g,-l),j.translate(-p,-m),j.drawImage(o,0,0),j.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(h=e.scale.x*i,k=e.scale.y*n,Y.set(a.x-h,a.y-k,a.x+h,a.y+k),ka.intersects(Y)&&(d(g.color.getContextStyle()),f(g.color.getContextStyle()),j.save(),j.translate(a.x,a.y),j.rotate(-e.rotation),j.scale(h,k),g.program(j),j.restore()))}function s(a,e,f,g){b(g.opacity);
+c(g.blending);j.beginPath();j.moveTo(a.positionScreen.x,a.positionScreen.y);j.lineTo(e.positionScreen.x,e.positionScreen.y);j.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(B!=a)j.lineWidth=B=a;a=g.linecap;if(N!=a)j.lineCap=N=a;a=g.linejoin;if(O!=a)j.lineJoin=O=a;d(g.color.getContextStyle());j.stroke();Y.inflate(g.linewidth*2)}}function u(a,d,f,g,h,j,i,p,l){e.info.render.vertices+=3;e.info.render.faces++;b(p.opacity);c(p.blending);F=a.positionScreen.x;K=a.positionScreen.y;I=
+d.positionScreen.x;J=d.positionScreen.y;P=f.positionScreen.x;Q=f.positionScreen.y;M(F,K,I,J,P,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,W[h].u,W[h].v,W[j].u,W[j].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,S.copy(i.vertexNormalsWorld[0]),Da=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ea=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[1]),
+Fa=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ga=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,S.copy(i.vertexNormalsWorld[2]),Ha=(S.x*a.n11+S.y*a.n12+S.z*a.n13)*0.5+0.5,Ia=-(S.x*a.n21+S.y*a.n22+S.z*a.n23)*0.5+0.5,Ca(F,K,I,J,P,Q,Da,Ea,Fa,Ga,Ha,Ia,p.envMap)}else p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(W=i.uvs[0],Ca(F,K,I,J,P,Q,W[g].u,W[g].v,
+W[h].u,W[h].v,W[j].u,W[j].v,p.map)),c(THREE.SubtractiveBlending)),Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==3?(x.r=q.r=v.r=ca.r,x.g=q.g=v.g=ca.g,x.b=q.b=v.b=ca.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],q),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],v),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*
+q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,aa=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,aa)):(ba.r=ca.r,ba.g=ca.g,ba.b=ca.b,o(l,i.centroidWorld,i.normalWorld,ba),z.r=Math.max(0,Math.min(p.color.r*ba.r,1)),z.g=Math.max(0,Math.min(p.color.g*ba.g,1)),z.b=Math.max(0,Math.min(p.color.b*
+ba.b,1)),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(f.positionScreen.z,ea,Z),G.r=(q.r+v.r)*0.5,G.g=(q.g+v.g)*0.5,G.b=(q.b+v.b)*0.5,aa=wa(x,q,v,G),ma(F,K,I,J,P,Q,0,0,1,0,0,1,aa);else if(p instanceof THREE.MeshNormalMaterial)z.r=
+na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)}function w(a,d,f,g,h,j,i,p,l){e.info.render.vertices+=4;e.info.render.faces++;b(p.opacity);c(p.blending);if(p.map||p.envMap)u(a,d,g,0,1,3,i,p,l),u(h,f,j,1,2,3,i,p,l);else if(F=a.positionScreen.x,K=a.positionScreen.y,I=d.positionScreen.x,J=d.positionScreen.y,P=f.positionScreen.x,Q=f.positionScreen.y,V=g.positionScreen.x,E=g.positionScreen.y,pa=h.positionScreen.x,
+y=h.positionScreen.y,L=j.positionScreen.x,H=j.positionScreen.y,p instanceof THREE.MeshBasicMaterial)R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color);else if(p instanceof THREE.MeshLambertMaterial)Aa?!p.wireframe&&p.shading==THREE.SmoothShading&&i.vertexNormalsWorld.length==4?(x.r=q.r=v.r=G.r=ca.r,x.g=q.g=v.g=G.g=ca.g,x.b=q.b=v.b=G.b=ca.b,o(l,i.v1.positionWorld,i.vertexNormalsWorld[0],x),o(l,i.v2.positionWorld,i.vertexNormalsWorld[1],
+q),o(l,i.v4.positionWorld,i.vertexNormalsWorld[3],v),o(l,i.v3.positionWorld,i.vertexNormalsWorld[2],G),x.r=Math.max(0,Math.min(p.color.r*x.r,1)),x.g=Math.max(0,Math.min(p.color.g*x.g,1)),x.b=Math.max(0,Math.min(p.color.b*x.b,1)),q.r=Math.max(0,Math.min(p.color.r*q.r,1)),q.g=Math.max(0,Math.min(p.color.g*q.g,1)),q.b=Math.max(0,Math.min(p.color.b*q.b,1)),v.r=Math.max(0,Math.min(p.color.r*v.r,1)),v.g=Math.max(0,Math.min(p.color.g*v.g,1)),v.b=Math.max(0,Math.min(p.color.b*v.b,1)),G.r=Math.max(0,Math.min(p.color.r*
+G.r,1)),G.g=Math.max(0,Math.min(p.color.g*G.g,1)),G.b=Math.max(0,Math.min(p.color.b*G.b,1)),aa=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,aa),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,aa)):(ba.r=ca.r,ba.g=ca.g,ba.b=ca.b,o(l,i.centroidWorld,i.normalWorld,ba),z.r=Math.max(0,Math.min(p.color.r*ba.r,1)),z.g=Math.max(0,Math.min(p.color.g*ba.g,1)),z.b=Math.max(0,Math.min(p.color.b*ba.b,1)),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z)):
+(R(F,K,I,J,P,Q,V,E),p.wireframe?ga(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(p.color));else if(p instanceof THREE.MeshNormalMaterial)z.r=na(i.normalWorld.x),z.g=na(i.normalWorld.y),z.b=na(i.normalWorld.z),R(F,K,I,J,P,Q,V,E),p.wireframe?ga(z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):ha(z);else if(p instanceof THREE.MeshDepthMaterial)ea=k.near,Z=k.far,x.r=x.g=x.b=1-la(a.positionScreen.z,ea,Z),q.r=q.g=q.b=1-la(d.positionScreen.z,ea,Z),v.r=v.g=v.b=1-la(g.positionScreen.z,
+ea,Z),G.r=G.g=G.b=1-la(f.positionScreen.z,ea,Z),aa=wa(x,q,v,G),M(F,K,I,J,V,E),ma(F,K,I,J,V,E,0,0,1,0,0,1,aa),M(pa,y,P,Q,L,H),ma(pa,y,P,Q,L,H,1,0,1,1,0,1,aa)}function M(a,b,c,d,e,f){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(a,b);j.closePath()}function R(a,b,c,d,e,f,g,h){j.beginPath();j.moveTo(a,b);j.lineTo(c,d);j.lineTo(e,f);j.lineTo(g,h);j.lineTo(a,b);j.closePath()}function ga(a,b,c,e){if(B!=b)j.lineWidth=B=b;if(N!=c)j.lineCap=N=c;if(O!=e)j.lineJoin=O=e;d(a.getContextStyle());
+j.stroke();Y.inflate(b*2)}function ha(a){f(a.getContextStyle());j.fill()}function Ca(a,b,c,d,e,g,h,i,k,l,o,n,m){if(m.image.width!=0){if(m.needsUpdate==!0||za[m.id]==void 0){var q=m.wrapS==THREE.RepeatWrapping,r=m.wrapT==THREE.RepeatWrapping;za[m.id]=j.createPattern(m.image,q&&r?"repeat":q&&!r?"repeat-x":!q&&r?"repeat-y":"no-repeat");m.needsUpdate=!1}f(za[m.id]);var q=m.offset.x/m.repeat.x,r=m.offset.y/m.repeat.y,s=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+q)*s,i=(i+r)*m,k=
+(k+q)*s,l=(l+r)*m,o=(o+q)*s,n=(n+r)*m;c-=a;d-=b;e-=a;g-=b;k-=h;l-=i;o-=h;n-=i;q=1/(k*n-o*l);m=(n*c-l*e)*q;l=(n*d-l*g)*q;c=(k*e-o*c)*q;d=(k*g-o*d)*q;a=a-m*h-c*i;b=b-l*h-d*i;j.save();j.transform(m,l,c,d,a,b);j.fill();j.restore()}}function ma(a,b,c,d,e,f,g,h,i,k,l,m,o){var n,q;n=o.width-1;q=o.height-1;g*=n;h*=q;i*=n;k*=q;l*=n;m*=q;c-=a;d-=b;e-=a;f-=b;i-=g;k-=h;l-=g;m-=h;q=1/(i*m-l*k);n=(m*c-k*e)*q;k=(m*d-k*f)*q;c=(i*e-l*c)*q;d=(i*f-l*d)*q;a=a-n*g-c*h;b=b-k*g-d*h;j.save();j.transform(n,k,c,d,a,b);j.clip();
+j.drawImage(o,0,0);j.restore()}function wa(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),i=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);da[0]=e<0?0:e>255?255:e;da[1]=f<0?0:f>255?255:f;da[2]=a<0?0:a>255?255:a;da[4]=g<0?0:g>255?255:g;da[5]=h<0?0:h>255?255:h;da[6]=b<0?0:b>255?255:b;da[8]=i<0?0:i>255?255:i;da[9]=j<0?0:j>255?255:j;da[10]=c<0?0:c>255?255:c;da[12]=k<0?0:k>255?255:k;da[13]=l<0?0:l>255?255:l;da[14]=d<0?
+0:d>255?255:d;ra.putImageData(Ba,0,0);va.drawImage(qa,0,0);return sa}function la(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function ia(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var xa,Ja,A,fa,ja,oa,ya,X;this.autoClear?this.clear():j.setTransform(1,0,0,-1,i,n);e.info.render.vertices=0;e.info.render.faces=0;g=h.projectScene(a,k,this.sortElements);(Aa=a.lights.length>0)&&l(a);xa=0;for(Ja=g.length;xa<
+Ja;xa++){A=g[xa];Y.empty();if(A instanceof THREE.RenderableParticle){t=A;t.x*=i;t.y*=n;fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=0&&r(t,A,X,a)}else if(A instanceof THREE.RenderableLine){if(t=A.v1,m=A.v2,t.positionScreen.x*=i,t.positionScreen.y*=n,m.positionScreen.x*=i,m.positionScreen.y*=n,Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=A.materials.length;fa<ja;)X=A.materials[fa++],X.opacity!=
+0&&s(t,m,A,X,a)}}else if(A instanceof THREE.RenderableFace3){if(t=A.v1,m=A.v2,C=A.v3,t.positionScreen.x*=i,t.positionScreen.y*=n,m.positionScreen.x*=i,m.positionScreen.y*=n,C.positionScreen.x*=i,C.positionScreen.y*=n,A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,C.positionScreen),ia(C.positionScreen,t.positionScreen)),Y.add3Points(t.positionScreen.x,t.positionScreen.y,m.positionScreen.x,m.positionScreen.y,C.positionScreen.x,C.positionScreen.y),ka.intersects(Y)){fa=0;for(ja=
+A.meshMaterials.length;fa<ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}else X.opacity!=0&&u(t,m,C,0,1,2,A,X,a)}}else if(A instanceof THREE.RenderableFace4&&(t=A.v1,m=A.v2,C=A.v3,D=A.v4,t.positionScreen.x*=i,t.positionScreen.y*=n,m.positionScreen.x*=i,m.positionScreen.y*=n,C.positionScreen.x*=i,C.positionScreen.y*=n,D.positionScreen.x*=i,D.positionScreen.y*=n,T.positionScreen.copy(m.positionScreen),
+U.positionScreen.copy(D.positionScreen),A.overdraw&&(ia(t.positionScreen,m.positionScreen),ia(m.positionScreen,D.positionScreen),ia(D.positionScreen,t.positionScreen),ia(C.positionScreen,T.positionScreen),ia(C.positionScreen,U.positionScreen)),Y.addPoint(t.positionScreen.x,t.positionScreen.y),Y.addPoint(m.positionScreen.x,m.positionScreen.y),Y.addPoint(C.positionScreen.x,C.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),ka.intersects(Y))){fa=0;for(ja=A.meshMaterials.length;fa<
+ja;)if(X=A.meshMaterials[fa++],X instanceof THREE.MeshFaceMaterial){oa=0;for(ya=A.faceMaterials.length;oa<ya;)(X=A.faceMaterials[oa++])&&X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}else X.opacity!=0&&w(t,m,C,D,T,U,A,X,a)}$.addRectangle(Y)}j.setTransform(1,0,0,1,0,0)}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 3 - 3
build/custom/ThreeDOM.js

@@ -69,7 +69,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,g=a.x,f=a.y,h=a.z,a=a.w;this.x=b*a+e*g+c*h-d*f;this.y=c*a+e*f+d*g-b*h;this.z=d*a+e*h+b*f-c*g;this.w=e*a-b*g-c*f-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,g=this.x,f=this.y,h=this.z,j=this.w,i=j*c+f*e-h*d,k=j*d+h*c-g*e,l=j*e+g*d-f*c,c=-g*
-c-f*d-h*e;b.x=i*j+c*-g+k*-h-l*-f;b.y=k*j+c*-f+l*-g-i*-h;b.z=l*j+c*-h+i*-f-k*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+c-f*d-h*e;b.x=i*j+c*-g+k*-h-l*-f;b.y=k*j+c*-f+l*-g-i*-h;b.z=l*j+c*-h+i*-f-k*-g;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(e),f=Math.sqrt(1-e*e);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;e=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,e,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,g,f){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Camera=function(){THREE.Object3D.call(this);arguments.length&&console.warn("DEPRECATED: Camera() is now PerspectiveCamera().");this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
@@ -81,8 +81,8 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.full
 this.far)};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=g;this.updateProjectionMatrix()};THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.origin=new THREE.Vector3;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
-THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.ambientColor=new THREE.Color;this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
+THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){a instanceof THREE.AmbientLight?(console.warn("DEPRECATED: AmbientLight( hex ) is now scene.ambientColor.setHex( hex )."),this.ambientColor.setHex(a.color.getHex())):(this.supr.add.call(this,a),this.addChildRecurse(a))};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};

+ 4 - 4
build/custom/ThreeExtras.js

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

+ 18 - 18
build/custom/ThreeSVG.js

@@ -27,8 +27,8 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,i,
 b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,b).normalize();if(e.length()===0)e.z=1;d.cross(c,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(c,e).normalize());f.cross(e,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=e.x;this.n21=d.y;this.n22=f.y;this.n23=e.y;this.n31=d.z;this.n32=f.z;this.n33=e.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;
 a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+
 c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,e=a.n14,g=a.n21,i=a.n22,k=a.n23,h=a.n24,l=a.n31,j=a.n32,m=a.n33,n=a.n34,p=a.n41,q=a.n42,v=a.n43,u=a.n44,C=b.n11,K=b.n12,
-t=b.n13,w=b.n14,z=b.n21,y=b.n22,o=b.n23,E=b.n24,D=b.n31,F=b.n32,G=b.n33,A=b.n34,M=b.n41,N=b.n42,O=b.n43,S=b.n44;this.n11=c*C+d*z+f*D+e*M;this.n12=c*K+d*y+f*F+e*N;this.n13=c*t+d*o+f*G+e*O;this.n14=c*w+d*E+f*A+e*S;this.n21=g*C+i*z+k*D+h*M;this.n22=g*K+i*y+k*F+h*N;this.n23=g*t+i*o+k*G+h*O;this.n24=g*w+i*E+k*A+h*S;this.n31=l*C+j*z+m*D+n*M;this.n32=l*K+j*y+m*F+n*N;this.n33=l*t+j*o+m*G+n*O;this.n34=l*w+j*E+m*A+n*S;this.n41=p*C+q*z+v*D+u*M;this.n42=p*K+q*y+v*F+u*N;this.n43=p*t+q*o+v*G+u*O;this.n44=p*w+q*
-E+v*A+u*S;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=
+t=b.n13,w=b.n14,z=b.n21,y=b.n22,o=b.n23,E=b.n24,D=b.n31,F=b.n32,G=b.n33,A=b.n34,M=b.n41,N=b.n42,O=b.n43,R=b.n44;this.n11=c*C+d*z+f*D+e*M;this.n12=c*K+d*y+f*F+e*N;this.n13=c*t+d*o+f*G+e*O;this.n14=c*w+d*E+f*A+e*R;this.n21=g*C+i*z+k*D+h*M;this.n22=g*K+i*y+k*F+h*N;this.n23=g*t+i*o+k*G+h*O;this.n24=g*w+i*E+k*A+h*R;this.n31=l*C+j*z+m*D+n*M;this.n32=l*K+j*y+m*F+n*N;this.n33=l*t+j*o+m*G+n*O;this.n34=l*w+j*E+m*A+n*R;this.n41=p*C+q*z+v*D+u*M;this.n42=p*K+q*y+v*F+u*N;this.n43=p*t+q*o+v*G+u*O;this.n44=p*w+q*
+E+v*A+u*R;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=
 a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,e=this.n22,g=this.n23,i=this.n24,k=this.n31,h=this.n32,l=this.n33,j=this.n34,m=this.n41,n=this.n42,p=this.n43,q=this.n44;return d*g*h*m-c*i*h*m-d*e*l*m+b*i*l*m+c*e*j*m-b*g*j*m-d*g*k*n+c*i*k*n+d*f*l*n-a*i*l*n-c*f*j*n+a*g*j*n+d*e*k*p-b*i*k*p-d*f*h*p+a*i*h*p+b*f*j*p-a*e*j*p-c*e*k*q+b*g*k*q+c*f*h*q-a*g*h*q-b*f*l*q+a*e*l*q},
 transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
 a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;
@@ -57,19 +57,19 @@ this.remove(a)}};THREE.Object3DCount=0;
 THREE.Projector=function(){function a(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,i=-b.z+b.w;return e>=0&&f>=0&&g>=0&&i>=0?!0:e<0&&f<0||g<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-i)):i<0&&(d=Math.min(d,g/(g-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var d,f,e=[],g,i,k=[],h,l,j=[],m,n=[],p,q,v=[],u,C,K=[],t=[],w=[],z=new THREE.Vector4,y=new THREE.Vector4,
 o=new THREE.Matrix4,E=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,G=new THREE.Vector4;this.projectVector=function(a,b){o.multiply(b.projectionMatrix,b.matrixWorldInverse);o.multiplyVector3(a);return a};this.unprojectVector=function(a,b){o.multiply(b.matrixWorld,THREE.Matrix4.makeInvert(b.projectionMatrix));o.multiplyVector3(a);return a};this.projectObjects=function(a,c,g){var i,h;f=t.length=0;
 i=a.objects;a=0;for(c=i.length;a<c;a++){h=i[a];var k;if(!(k=!h.visible))if(k=h instanceof THREE.Mesh)if(k=h.frustumCulled){a:{k=void 0;for(var j=h.matrixWorld,l=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),m=0;m<6;m++)if(k=D[m].x*j.n14+D[m].y*j.n24+D[m].z*j.n34+D[m].w,k<=l){k=!1;break a}k=!0}k=!k}if(!k)k=e[f]=e[f]||new THREE.RenderableObject,f++,d=k,z.copy(h.position),o.multiplyVector3(z),d.object=h,d.z=z.z,t.push(d)}g&&t.sort(b);return t};this.projectScene=
-function(d,e,f){var t=e.near,S=e.far,z,P,I,L,r,J,H,s,x,B,Q,U,W,X,R,V,T;C=q=m=l=w.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+
-o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(z=0;z<6;z++)x=D[z],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(z=x.length;d<z;d++)if(B=x[d].object,B.visible)if(Q=B.matrixWorld,U=B.matrixRotationWorld,W=B.materials,X=B.overdraw,i=0,B instanceof THREE.Mesh){R=B.geometry;L=R.vertices;V=R.faces;R=R.faceVertexUvs;P=0;for(I=L.length;P<I;P++)g=a(),g.positionWorld.copy(L[P].position),Q.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),
-g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>t&&g.positionScreen.z<S;L=0;for(P=V.length;L<P;L++){I=V[L];if(I instanceof THREE.Face3)if(r=k[I.a],J=k[I.b],H=k[I.c],r.visible&&J.visible&&H.visible&&(B.doubleSided||B.flipSided!=(H.positionScreen.x-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(H.positionScreen.y-r.positionScreen.y)*(J.positionScreen.x-r.positionScreen.x)<0))s=j[l]=j[l]||new THREE.RenderableFace3,l++,h=s,h.v1.copy(r),
-h.v2.copy(J),h.v3.copy(H);else continue;else if(I instanceof THREE.Face4)if(r=k[I.a],J=k[I.b],H=k[I.c],s=k[I.d],r.visible&&J.visible&&H.visible&&s.visible&&(B.doubleSided||B.flipSided!=((s.positionScreen.x-r.positionScreen.x)*(J.positionScreen.y-r.positionScreen.y)-(s.positionScreen.y-r.positionScreen.y)*(J.positionScreen.x-r.positionScreen.x)<0||(J.positionScreen.x-H.positionScreen.x)*(s.positionScreen.y-H.positionScreen.y)-(J.positionScreen.y-H.positionScreen.y)*(s.positionScreen.x-H.positionScreen.x)<
-0)))T=n[m]=n[m]||new THREE.RenderableFace4,m++,h=T,h.v1.copy(r),h.v2.copy(J),h.v3.copy(H),h.v4.copy(s);else continue;h.normalWorld.copy(I.normal);U.multiplyVector3(h.normalWorld);h.centroidWorld.copy(I.centroid);Q.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);o.multiplyVector3(h.centroidScreen);H=I.vertexNormals;r=0;for(J=H.length;r<J;r++)s=h.vertexNormalsWorld[r],s.copy(H[r]),U.multiplyVector3(s);r=0;for(J=R.length;r<J;r++)if(T=R[r][L]){H=0;for(s=T.length;H<s;H++)h.uvs[r][H]=
-T[H]}h.meshMaterials=W;h.faceMaterials=I.materials;h.overdraw=X;h.z=h.centroidScreen.z;w.push(h)}}else if(B instanceof THREE.Line){E.multiply(o,Q);L=B.geometry.vertices;r=a();r.positionScreen.copy(L[0].position);E.multiplyVector4(r.positionScreen);P=1;for(I=L.length;P<I;P++)if(r=a(),r.positionScreen.copy(L[P].position),E.multiplyVector4(r.positionScreen),J=k[i-2],F.copy(r.positionScreen),G.copy(J.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),Q=v[q]=v[q]||new THREE.RenderableLine,
-q++,p=Q,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(G),p.z=Math.max(F.z,G.z),p.materials=B.materials,w.push(p)}else if(B instanceof THREE.Particle&&(y.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34,1),o.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))Q=K[C]=K[C]||new THREE.RenderableParticle,C++,u=Q,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+
+function(d,e,f){var t=e.near,R=e.far,S,P,I,L,s,J,H,r,x,B,z,U,W,X,Q,V,T;C=q=m=l=w.length=0;e.matrixAutoUpdate&&e.update(void 0,!0);d.update(void 0,!1,e);o.multiply(e.projectionMatrix,e.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);D[5].set(o.n41+
+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(S=0;S<6;S++)x=D[S],x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z));x=this.projectObjects(d,e,!0);d=0;for(S=x.length;d<S;d++)if(B=x[d].object,B.visible)if(z=B.matrixWorld,U=B.matrixRotationWorld,W=B.materials,X=B.overdraw,i=0,B instanceof THREE.Mesh){Q=B.geometry;L=Q.vertices;V=Q.faces;Q=Q.faceVertexUvs;P=0;for(I=L.length;P<I;P++)g=a(),g.positionWorld.copy(L[P].position),z.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),o.multiplyVector4(g.positionScreen),
+g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>t&&g.positionScreen.z<R;L=0;for(P=V.length;L<P;L++){I=V[L];if(I instanceof THREE.Face3)if(s=k[I.a],J=k[I.b],H=k[I.c],s.visible&&J.visible&&H.visible&&(B.doubleSided||B.flipSided!=(H.positionScreen.x-s.positionScreen.x)*(J.positionScreen.y-s.positionScreen.y)-(H.positionScreen.y-s.positionScreen.y)*(J.positionScreen.x-s.positionScreen.x)<0))r=j[l]=j[l]||new THREE.RenderableFace3,l++,h=r,h.v1.copy(s),
+h.v2.copy(J),h.v3.copy(H);else continue;else if(I instanceof THREE.Face4)if(s=k[I.a],J=k[I.b],H=k[I.c],r=k[I.d],s.visible&&J.visible&&H.visible&&r.visible&&(B.doubleSided||B.flipSided!=((r.positionScreen.x-s.positionScreen.x)*(J.positionScreen.y-s.positionScreen.y)-(r.positionScreen.y-s.positionScreen.y)*(J.positionScreen.x-s.positionScreen.x)<0||(J.positionScreen.x-H.positionScreen.x)*(r.positionScreen.y-H.positionScreen.y)-(J.positionScreen.y-H.positionScreen.y)*(r.positionScreen.x-H.positionScreen.x)<
+0)))T=n[m]=n[m]||new THREE.RenderableFace4,m++,h=T,h.v1.copy(s),h.v2.copy(J),h.v3.copy(H),h.v4.copy(r);else continue;h.normalWorld.copy(I.normal);U.multiplyVector3(h.normalWorld);h.centroidWorld.copy(I.centroid);z.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);o.multiplyVector3(h.centroidScreen);H=I.vertexNormals;s=0;for(J=H.length;s<J;s++)r=h.vertexNormalsWorld[s],r.copy(H[s]),U.multiplyVector3(r);s=0;for(J=Q.length;s<J;s++)if(T=Q[s][L]){H=0;for(r=T.length;H<r;H++)h.uvs[s][H]=
+T[H]}h.meshMaterials=W;h.faceMaterials=I.materials;h.overdraw=X;h.z=h.centroidScreen.z;w.push(h)}}else if(B instanceof THREE.Line){E.multiply(o,z);L=B.geometry.vertices;s=a();s.positionScreen.copy(L[0].position);E.multiplyVector4(s.positionScreen);P=1;for(I=L.length;P<I;P++)if(s=a(),s.positionScreen.copy(L[P].position),E.multiplyVector4(s.positionScreen),J=k[i-2],F.copy(s.positionScreen),G.copy(J.positionScreen),c(F,G))F.multiplyScalar(1/F.w),G.multiplyScalar(1/G.w),z=v[q]=v[q]||new THREE.RenderableLine,
+q++,p=z,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(G),p.z=Math.max(F.z,G.z),p.materials=B.materials,w.push(p)}else if(B instanceof THREE.Particle&&(y.set(B.matrixWorld.n14,B.matrixWorld.n24,B.matrixWorld.n34,1),o.multiplyVector4(y),y.z/=y.w,y.z>0&&y.z<1))z=K[C]=K[C]||new THREE.RenderableParticle,C++,u=z,u.x=y.x/y.w,u.y=y.y/y.w,u.z=y.z,u.rotation=B.rotation.z,u.scale.x=B.scale.x*Math.abs(u.x-(y.x+e.projectionMatrix.n11)/(y.w+e.projectionMatrix.n14)),u.scale.y=B.scale.y*Math.abs(u.y-(y.y+
 e.projectionMatrix.n22)/(y.w+e.projectionMatrix.n24)),u.materials=B.materials,w.push(u);f&&w.sort(b);return w}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),e=Math.cos(c),c=Math.sin(c),g=a*b,i=d*f;this.w=g*e-i*c;this.x=g*c+i*e;this.y=d*b*e+a*f*c;this.z=a*f*e-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a==0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,i=a.z,a=a.w;this.x=b*a+f*e+c*i-d*g;this.y=c*a+f*g+d*e-b*i;this.z=d*a+f*i+b*g-c*e;this.w=f*a-b*e-c*g-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,i=this.z,k=this.w,h=k*c+g*f-i*d,l=k*d+i*c-e*f,j=k*f+e*d-g*c,c=-e*
-c-g*d-i*f;b.x=h*k+c*-e+l*-i-j*-g;b.y=l*k+c*-g+j*-e-h*-i;b.z=j*k+c*-i+h*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
+c-g*d-i*f;b.x=h*k+c*-e+l*-i-j*-g;b.y=l*k+c*-g+j*-e-h*-i;b.z=j*k+c*-i+h*-g-l*-e;return b}};THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),g=Math.sqrt(1-f*f);if(Math.abs(g)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=e instanceof Array?e:[e];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
@@ -112,8 +112,8 @@ THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material
 c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++)a=this.children[d],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.origin=new THREE.Vector3;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
-THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
+b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};THREE.Scene=function(){THREE.Object3D.call(this);this.ambientColor=new THREE.Color;this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;
+THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(a){a instanceof THREE.AmbientLight?(console.warn("DEPRECATED: AmbientLight( hex ) is now scene.ambientColor.setHex( hex )."),this.ambientColor.setHex(a.color.getHex())):(this.supr.add.call(this,a),this.addChildRecurse(a))};
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
 THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
@@ -125,12 +125,12 @@ i.z*h.__farMinusNear),t.setRGB(E,E,E)):h instanceof THREE.MeshNormalMaterial&&t.
 t.copy(j.color):j instanceof THREE.MeshDepthMaterial?(E=1-j.__2near/(j.__farPlusNear-h.z*j.__farMinusNear),t.setRGB(E,E,E)):j instanceof THREE.MeshNormalMaterial&&t.setRGB(f(h.normalWorld.x),f(h.normalWorld.y),f(h.normalWorld.z));j.wireframe?A.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+j.wireframeLinewidth+"; stroke-opacity: "+j.opacity+"; stroke-linecap: "+j.wireframeLinecap+"; stroke-linejoin: "+j.wireframeLinejoin):A.setAttribute("style","fill: "+t.getContextStyle()+
 "; fill-opacity: "+j.opacity);k.appendChild(A)}function d(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),O==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,g=null,i=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,l,j,m,n,p,q,v,u=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,t=new THREE.Color(16777215),w=new THREE.Color(16777215),z=new THREE.Color(0),
 y=new THREE.Color(0),o=new THREE.Color(0),E,D=new THREE.Vector3,F=[],G=[],A,M,N,O=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){h=a;l=b;j=h/2;m=l/2;k.setAttribute("viewBox",-j+" "+-m+" "+h+" "+l);k.setAttribute("width",h);k.setAttribute("height",l);u.set(-j,-m,j,m)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(a,d){var f,h,l,r,t,w,s,x;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;g=i.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){s=a.lights;z.setRGB(0,0,0);y.setRGB(0,0,0);o.setRGB(0,0,0);f=0;for(h=s.length;f<h;f++)l=s[f],r=l.color,l instanceof THREE.AmbientLight?(z.r+=r.r,z.g+=r.g,z.b+=r.b):l instanceof THREE.DirectionalLight?(y.r+=r.r,y.g+=r.g,y.b+=r.b):l instanceof THREE.PointLight&&(o.r+=r.r,o.g+=r.g,o.b+=r.b)}f=0;for(h=g.length;f<
-h;f++)if(s=g[f],C.empty(),s instanceof THREE.RenderableParticle){n=s;n.x*=j;n.y*=-m;l=0;for(r=s.materials.length;l<r;)l++}else if(s instanceof THREE.RenderableLine){if(n=s.v1,p=s.v2,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(C)){l=0;for(r=s.materials.length;l<r;)if((x=s.materials[l++])&&x.opacity!=0){t=n;w=p;var B=N++;G[B]==null&&(G[B]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),O==0&&G[B].setAttribute("shape-rendering","crispEdges"));A=G[B];A.setAttribute("x1",t.positionScreen.x);A.setAttribute("y1",t.positionScreen.y);A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.positionScreen.y);x instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+x.color.getContextStyle()+"; stroke-width: "+x.linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.linecap+"; stroke-linejoin: "+x.linejoin),k.appendChild(A))}}}else if(s instanceof
-THREE.RenderableFace3){if(n=s.v1,p=s.v2,q=s.v3,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(C)){l=0;for(r=s.meshMaterials.length;l<r;)if(x=s.meshMaterials[l++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&
-x.opacity!=0&&b(n,p,q,s,x,a)}else x&&x.opacity!=0&&b(n,p,q,s,x,a)}}else if(s instanceof THREE.RenderableFace4&&(n=s.v1,p=s.v2,q=s.v3,v=s.v4,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,v.positionScreen.x*=j,v.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),
-u.intersects(C))){l=0;for(r=s.meshMaterials.length;l<r;)if(x=s.meshMaterials[l++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=s.faceMaterials.length;t<w;)(x=s.faceMaterials[t++])&&x.opacity!=0&&c(n,p,q,v,s,x,a)}else x&&x.opacity!=0&&c(n,p,q,v,s,x,a)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
+this.render=function(a,d){var f,h,l,s,t,w,r,x;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;g=i.projectScene(a,d,this.sortElements);N=M=0;if(K=a.lights.length>0){r=a.lights;z.copy(a.ambientColor);y.setRGB(0,0,0);o.setRGB(0,0,0);f=0;for(h=r.length;f<h;f++)l=r[f],s=l.color,l instanceof THREE.DirectionalLight?(y.r+=s.r,y.g+=s.g,y.b+=s.b):l instanceof THREE.PointLight&&(o.r+=s.r,o.g+=s.g,o.b+=s.b)}f=0;for(h=g.length;f<h;f++)if(r=g[f],C.empty(),r instanceof THREE.RenderableParticle){n=
+r;n.x*=j;n.y*=-m;l=0;for(s=r.materials.length;l<s;)l++}else if(r instanceof THREE.RenderableLine){if(n=r.v1,p=r.v2,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),u.intersects(C)){l=0;for(s=r.materials.length;l<s;)if((x=r.materials[l++])&&x.opacity!=0){t=n;w=p;var B=N++;G[B]==null&&(G[B]=document.createElementNS("http://www.w3.org/2000/svg","line"),O==0&&G[B].setAttribute("shape-rendering",
+"crispEdges"));A=G[B];A.setAttribute("x1",t.positionScreen.x);A.setAttribute("y1",t.positionScreen.y);A.setAttribute("x2",w.positionScreen.x);A.setAttribute("y2",w.positionScreen.y);x instanceof THREE.LineBasicMaterial&&(A.setAttribute("style","fill: none; stroke: "+x.color.getContextStyle()+"; stroke-width: "+x.linewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.linecap+"; stroke-linejoin: "+x.linejoin),k.appendChild(A))}}}else if(r instanceof THREE.RenderableFace3){if(n=r.v1,p=r.v2,
+q=r.v3,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(C)){l=0;for(s=r.meshMaterials.length;l<s;)if(x=r.meshMaterials[l++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=r.faceMaterials.length;t<w;)(x=r.faceMaterials[t++])&&x.opacity!=0&&b(n,p,q,r,x,a)}else x&&
+x.opacity!=0&&b(n,p,q,r,x,a)}}else if(r instanceof THREE.RenderableFace4&&(n=r.v1,p=r.v2,q=r.v3,v=r.v4,n.positionScreen.x*=j,n.positionScreen.y*=-m,p.positionScreen.x*=j,p.positionScreen.y*=-m,q.positionScreen.x*=j,q.positionScreen.y*=-m,v.positionScreen.x*=j,v.positionScreen.y*=-m,C.addPoint(n.positionScreen.x,n.positionScreen.y),C.addPoint(p.positionScreen.x,p.positionScreen.y),C.addPoint(q.positionScreen.x,q.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),u.intersects(C))){l=
+0;for(s=r.meshMaterials.length;l<s;)if(x=r.meshMaterials[l++],x instanceof THREE.MeshFaceMaterial){t=0;for(w=r.faceMaterials.length;t<w;)(x=r.faceMaterials[t++])&&x.opacity!=0&&c(n,p,q,v,r,x,a)}else x&&x.opacity!=0&&c(n,p,q,v,r,x,a)}}};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};

+ 145 - 144
build/custom/ThreeWebGL.js

@@ -16,37 +16,37 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
 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,f=[];c=0;for(d=b.length;c<d;c++)Array.prototype.push.apply(f,this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,d){var f;f=d.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return d.distanceTo(b)}function d(b,c,d,f){var f=f.clone().subSelf(c),
 d=d.clone().subSelf(c),i=b.clone().subSelf(c),b=f.dot(f),c=f.dot(d),f=f.dot(i),h=d.dot(d),d=d.dot(i),i=1/(b*h-c*c),h=(h*f-c*d)*i,b=(b*d-c*f)*i;return h>0&&b>0&&h+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 i,h,j,k,p,o,q,m,t,w,y=b.geometry,C=y.vertices,E=[],f=0;for(i=y.faces.length;f<i;f++)if(h=y.faces[f],t=this.origin.clone(),w=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(h.centroid.clone()).subSelf(t),m=j.dot(w),!(m<=0)&&(j=o.multiplyVector3(C[h.a].position.clone()),k=o.multiplyVector3(C[h.b].position.clone()),p=o.multiplyVector3(C[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(C[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
-m=w.dot(q),b.doubleSided||(b.flipSided?m>0:m<0)))if(m=q.dot((new THREE.Vector3).sub(j,t))/m,t=t.addSelf(w.multiplyScalar(m)),h instanceof THREE.Face3)d(t,j,k,p)&&(h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(t,j,k,o)||d(t,k,p,o)))h={distance:this.origin.distanceTo(t),point:t,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=f-c;j=i-d}var c,d,f,i,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(h,j,q,m){k=!1;c=h;d=j;f=q;i=m;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,f=h,i=j):(c=c<h?c:h,d=d<j?d:j,f=f>h?f:h,i=i>j?i:j);b()};this.add3Points=
-function(h,j,q,m,t,w){k?(k=!1,c=h<q?h<t?h:t:q<t?q:t,d=j<m?j<w?j:w:m<w?m:w,f=h>q?h>t?h:t:q>t?q:t,i=j>m?j>w?j:w:m>w?m:w):(c=h<q?h<t?h<c?h:c:t<c?t:c:q<t?q<c?q:c:t<c?t:c,d=j<m?j<w?j<d?j:d:w<d?w:d:m<w?m<d?m:d:w<d?w:d,f=h>q?h>t?h>f?h:f:t>f?t:f:q>t?q>f?q:f:t>f?t:f,i=j>m?j>w?j>i?j:i:w>i?w:i:m>w?m>i?m:i:w>i?w:i);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),i=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),i=i>
+Math.max(b.scale.y,b.scale.z)))return[];var i,h,j,k,q,o,p,m,t,v,y=b.geometry,D=y.vertices,F=[],f=0;for(i=y.faces.length;f<i;f++)if(h=y.faces[f],t=this.origin.clone(),v=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(h.centroid.clone()).subSelf(t),m=j.dot(v),!(m<=0)&&(j=o.multiplyVector3(D[h.a].position.clone()),k=o.multiplyVector3(D[h.b].position.clone()),q=o.multiplyVector3(D[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(D[h.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
+m=v.dot(p),b.doubleSided||(b.flipSided?m>0:m<0)))if(m=p.dot((new THREE.Vector3).sub(j,t))/m,t=t.addSelf(v.multiplyScalar(m)),h instanceof THREE.Face3)d(t,j,k,q)&&(h={distance:this.origin.distanceTo(t),point:t,face:h,object:b},F.push(h));else if(h instanceof THREE.Face4&&(d(t,j,k,o)||d(t,k,q,o)))h={distance:this.origin.distanceTo(t),point:t,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=f-c;j=i-d}var c,d,f,i,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(h,j,p,m){k=!1;c=h;d=j;f=p;i=m;b()};this.addPoint=function(h,j){k?(k=!1,c=h,d=j,f=h,i=j):(c=c<h?c:h,d=d<j?d:j,f=f>h?f:h,i=i>j?i:j);b()};this.add3Points=
+function(h,j,p,m,t,v){k?(k=!1,c=h<p?h<t?h:t:p<t?p:t,d=j<m?j<v?j:v:m<v?m:v,f=h>p?h>t?h:t:p>t?p:t,i=j>m?j>v?j:v:m>v?m:v):(c=h<p?h<t?h<c?h:c:t<c?t:c:p<t?p<c?p:c:t<c?t:c,d=j<m?j<v?j<d?j:d:v<d?v:d:m<v?m<d?m:d:v<d?v:d,f=h>p?h>t?h>f?h:f:t>f?t:f:p>t?p>f?p:f:t>f?t:f,i=j>m?j>v?j>i?j:i:v>i?v:i:m>v?m>i?m:i:v>i?v:i);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),i=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),f=f>h.getRight()?f:h.getRight(),i=i>
 h.getBottom()?i:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;i+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f<h.getRight()?f:h.getRight();i=i<h.getBottom()?i:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(i,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;i=f=d=c=0;b()};this.isEmpty=function(){return k}};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,f,i,h,j,k,p,o,q,m,t,w,y,C){this.set(b!==void 0?b:1,c||0,d||0,f||0,i||0,h!==void 0?h:1,j||0,k||0,p||0,o||0,q!==void 0?q:1,m||0,t||0,w||0,y||0,C!==void 0?C:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,p,o,q,m,t,w,y,C){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=h;this.n23=j;this.n24=k;this.n31=p;this.n32=o;this.n33=q;this.n34=m;this.n41=t;this.n42=w;this.n43=y;this.n44=C;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.Matrix4=function(b,c,d,f,i,h,j,k,q,o,p,m,t,v,y,D){this.set(b!==void 0?b:1,c||0,d||0,f||0,i||0,h!==void 0?h:1,j||0,k||0,q||0,o||0,p!==void 0?p:1,m||0,t||0,v||0,y||0,D!==void 0?D:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,i,h,j,k,q,o,p,m,t,v,y,D){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=h;this.n23=j;this.n24=k;this.n31=q;this.n32=o;this.n33=p;this.n34=m;this.n41=t;this.n42=v;this.n43=y;this.n44=D;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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 f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());i.cross(h,f).normalize();this.n11=f.x;this.n12=i.x;this.n13=h.x;this.n21=f.y;this.n22=i.y;this.n23=h.y;this.n31=f.z;this.n32=i.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,i=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*i;
 b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*i;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*i;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,i=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*i;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*i;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*i;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*i;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+
-d*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 d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,p=b.n23,o=b.n24,q=b.n31,m=b.n32,t=b.n33,w=b.n34,y=b.n41,C=b.n42,E=b.n43,D=b.n44,wa=c.n11,xa=
-c.n12,qa=c.n13,sa=c.n14,ja=c.n21,G=c.n22,r=c.n23,T=c.n24,R=c.n31,ka=c.n32,$=c.n33,ya=c.n34,S=c.n41,M=c.n42,e=c.n43,ua=c.n44;this.n11=d*wa+f*ja+i*R+h*S;this.n12=d*xa+f*G+i*ka+h*M;this.n13=d*qa+f*r+i*$+h*e;this.n14=d*sa+f*T+i*ya+h*ua;this.n21=j*wa+k*ja+p*R+o*S;this.n22=j*xa+k*G+p*ka+o*M;this.n23=j*qa+k*r+p*$+o*e;this.n24=j*sa+k*T+p*ya+o*ua;this.n31=q*wa+m*ja+t*R+w*S;this.n32=q*xa+m*G+t*ka+w*M;this.n33=q*qa+m*r+t*$+w*e;this.n34=q*sa+m*T+t*ya+w*ua;this.n41=y*wa+C*ja+E*R+D*S;this.n42=y*xa+C*G+E*ka+D*M;
-this.n43=y*qa+C*r+E*$+D*e;this.n44=y*sa+C*T+E*ya+D*ua;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,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,p=this.n31,o=this.n32,q=this.n33,m=this.n34,t=this.n41,w=this.n42,y=this.n43,C=this.n44;return f*j*o*t-d*k*o*t-f*h*q*t+c*k*q*t+d*h*m*t-c*j*m*t-f*j*p*w+d*k*p*w+f*i*q*w-b*k*q*w-d*i*m*w+b*j*m*w+f*h*p*y-c*k*p*y-f*i*o*y+b*k*o*y+c*i*m*y-b*h*m*y-
-d*h*p*C+c*j*p*C+d*i*o*C-b*j*o*C-c*i*q*C+b*h*q*C},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),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,p=i*h,o=i*j;this.set(p*h+d,p*j-f*k,p*k+f*j,0,p*j+f*k,o*j+d,o*k-f*h,0,p*k-f*j,o*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,i=b.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(f),f=Math.sin(f),k=Math.cos(i),i=Math.sin(i);switch(c){case "YXZ":var p=
-j*k,o=j*i,q=f*k,m=f*i;this.n11=p+m*d;this.n12=q*d-o;this.n13=h*f;this.n21=h*i;this.n22=h*k;this.n23=-d;this.n31=o*d-q;this.n32=m+p*d;this.n33=h*j;break;case "ZXY":p=j*k;o=j*i;q=f*k;m=f*i;this.n11=p-m*d;this.n12=-h*i;this.n13=q+o*d;this.n21=o+q*d;this.n22=h*k;this.n23=m-p*d;this.n31=-h*f;this.n32=d;this.n33=h*j;break;case "ZYX":p=h*k;o=h*i;q=d*k;m=d*i;this.n11=j*k;this.n12=q*f-o;this.n13=p*f+m;this.n21=j*i;this.n22=m*f+p;this.n23=o*f-q;this.n31=-f;this.n32=d*j;this.n33=h*j;break;case "YZX":p=h*j;o=
-h*f;q=d*j;m=d*f;this.n11=j*k;this.n12=m-p*i;this.n13=q*i+o;this.n21=i;this.n22=h*k;this.n23=-d*k;this.n31=-f*k;this.n32=o*i+q;this.n33=p-m*i;break;case "XZY":p=h*j;o=h*f;q=d*j;m=d*f;this.n11=j*k;this.n12=-i;this.n13=f*k;this.n21=p*i+m;this.n22=h*k;this.n23=o*i-q;this.n31=q*i-o;this.n32=d*k;this.n33=m*i+p;break;default:p=h*k,o=h*i,q=d*k,m=d*i,this.n11=j*k,this.n12=-j*i,this.n13=f,this.n21=o+q*f,this.n22=p-m*f,this.n23=-d*j,this.n31=m-p*f,this.n32=q+o*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=
-b.x,d=b.y,f=b.z,i=b.w,h=c+c,j=d+d,k=f+f,b=c*h,p=c*j;c*=k;var o=d*j;d*=k;f*=k;h*=i;j*=i;i*=k;this.n11=1-(o+f);this.n12=p-i;this.n13=c+j;this.n21=p+i;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+o);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 f=THREE.Matrix4.__m1,i=THREE.Matrix4.__m2;
-f.identity();f.setRotationFromQuaternion(c);i.setScale(d.x,d.y,d.z);this.multiply(f,i);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);i.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=f.length();
-d.y=i.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);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,f=1/c.y,i=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*i;this.n23=
-b.n23*i;this.n33=b.n33*i}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,p=b.n23,o=b.n24,q=b.n31,m=b.n32,t=b.n33,w=b.n34,y=b.n41,C=b.n42,E=b.n43,D=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*w*C-o*t*C+o*m*E-k*w*E-p*m*D+k*t*D;c.n12=h*t*C-i*w*C-h*m*E+f*w*E+i*m*D-f*t*D;c.n13=i*o*C-h*p*C+h*k*E-f*o*E-i*k*D+f*p*D;c.n14=h*p*m-i*o*m-h*k*t+f*o*t+i*k*w-f*p*w;c.n21=o*t*y-p*w*y-o*q*E+j*w*E+p*q*D-j*t*D;c.n22=i*w*y-h*t*y+h*q*E-d*w*E-i*q*D+d*t*D;c.n23=h*p*y-i*o*y-h*j*E+d*o*E+i*j*D-d*p*D;c.n24=
-i*o*q-h*p*q+h*j*t-d*o*t-i*j*w+d*p*w;c.n31=k*w*y-o*m*y+o*q*C-j*w*C-k*q*D+j*m*D;c.n32=h*m*y-f*w*y-h*q*C+d*w*C+f*q*D-d*m*D;c.n33=i*o*y-h*k*y+h*j*C-d*o*C-f*j*D+d*k*D;c.n34=h*k*q-f*o*q-h*j*m+d*o*m+f*j*w-d*k*w;c.n41=p*m*y-k*t*y-p*q*C+j*t*C+k*q*E-j*m*E;c.n42=f*t*y-i*m*y+i*q*C-d*t*C-f*q*E+d*m*E;c.n43=i*k*y-f*p*y-i*j*C+d*p*C+f*j*E-d*k*E;c.n44=f*p*q-i*k*q+i*j*m-d*p*m-f*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,i=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,m=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;d[0]=b*f;d[1]=b*i;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*p;d[6]=b*o;d[7]=b*q;d[8]=b*m;return c};
+d*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 d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,q=b.n23,o=b.n24,p=b.n31,m=b.n32,t=b.n33,v=b.n34,y=b.n41,D=b.n42,F=b.n43,E=b.n44,xa=c.n11,ya=
+c.n12,ra=c.n13,ta=c.n14,ka=c.n21,K=c.n22,u=c.n23,U=c.n24,S=c.n31,la=c.n32,aa=c.n33,za=c.n34,T=c.n41,M=c.n42,e=c.n43,va=c.n44;this.n11=d*xa+f*ka+i*S+h*T;this.n12=d*ya+f*K+i*la+h*M;this.n13=d*ra+f*u+i*aa+h*e;this.n14=d*ta+f*U+i*za+h*va;this.n21=j*xa+k*ka+q*S+o*T;this.n22=j*ya+k*K+q*la+o*M;this.n23=j*ra+k*u+q*aa+o*e;this.n24=j*ta+k*U+q*za+o*va;this.n31=p*xa+m*ka+t*S+v*T;this.n32=p*ya+m*K+t*la+v*M;this.n33=p*ra+m*u+t*aa+v*e;this.n34=p*ta+m*U+t*za+v*va;this.n41=y*xa+D*ka+F*S+E*T;this.n42=y*ya+D*K+F*la+
+E*M;this.n43=y*ra+D*u+F*aa+E*e;this.n44=y*ta+D*U+F*za+E*va;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,f=this.n14,i=this.n21,h=this.n22,j=this.n23,k=this.n24,q=this.n31,o=this.n32,p=this.n33,m=this.n34,t=this.n41,v=this.n42,y=this.n43,D=this.n44;return f*j*o*t-d*k*o*t-f*h*p*t+c*k*p*t+d*h*m*t-c*j*m*t-f*j*q*v+d*k*q*v+f*i*p*v-b*k*p*v-d*i*m*v+b*j*m*v+f*h*q*y-c*k*q*y-f*i*o*y+b*k*o*y+c*i*m*
+y-b*h*m*y-d*h*q*D+c*j*q*D+d*i*o*D-b*j*o*D-c*i*p*D+b*h*p*D},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),f=Math.sin(c),i=1-d,h=b.x,j=b.y,k=b.z,q=i*h,o=i*j;this.set(q*h+d,q*j-f*k,q*k+f*j,0,q*j+f*k,o*j+d,o*k-f*h,0,q*k-f*j,o*k+f*h,i*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},
+getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,i=b.z,h=Math.cos(d),d=Math.sin(d),j=Math.cos(f),
+f=Math.sin(f),k=Math.cos(i),i=Math.sin(i);switch(c){case "YXZ":var q=j*k,o=j*i,p=f*k,m=f*i;this.n11=q+m*d;this.n12=p*d-o;this.n13=h*f;this.n21=h*i;this.n22=h*k;this.n23=-d;this.n31=o*d-p;this.n32=m+q*d;this.n33=h*j;break;case "ZXY":q=j*k;o=j*i;p=f*k;m=f*i;this.n11=q-m*d;this.n12=-h*i;this.n13=p+o*d;this.n21=o+p*d;this.n22=h*k;this.n23=m-q*d;this.n31=-h*f;this.n32=d;this.n33=h*j;break;case "ZYX":q=h*k;o=h*i;p=d*k;m=d*i;this.n11=j*k;this.n12=p*f-o;this.n13=q*f+m;this.n21=j*i;this.n22=m*f+q;this.n23=
+o*f-p;this.n31=-f;this.n32=d*j;this.n33=h*j;break;case "YZX":q=h*j;o=h*f;p=d*j;m=d*f;this.n11=j*k;this.n12=m-q*i;this.n13=p*i+o;this.n21=i;this.n22=h*k;this.n23=-d*k;this.n31=-f*k;this.n32=o*i+p;this.n33=q-m*i;break;case "XZY":q=h*j;o=h*f;p=d*j;m=d*f;this.n11=j*k;this.n12=-i;this.n13=f*k;this.n21=q*i+m;this.n22=h*k;this.n23=o*i-p;this.n31=p*i-o;this.n32=d*k;this.n33=m*i+q;break;default:q=h*k,o=h*i,p=d*k,m=d*i,this.n11=j*k,this.n12=-j*i,this.n13=f,this.n21=o+p*f,this.n22=q-m*f,this.n23=-d*j,this.n31=
+m-q*f,this.n32=p+o*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,i=b.w,h=c+c,j=d+d,k=f+f,b=c*h,q=c*j;c*=k;var o=d*j;d*=k;f*=k;h*=i;j*=i;i*=k;this.n11=1-(o+f);this.n12=q-i;this.n13=c+j;this.n21=q+i;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+o);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 f=THREE.Matrix4.__m1,i=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(c);i.setScale(d.x,d.y,d.z);this.multiply(f,i);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,i=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);i.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=f.length();d.y=i.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);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,f=1/c.y,i=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=
+b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*i;this.n23=b.n23*i;this.n33=b.n33*i}};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,i=b.n13,h=b.n14,j=b.n21,k=b.n22,q=b.n23,o=b.n24,p=b.n31,m=b.n32,t=b.n33,v=b.n34,y=b.n41,D=b.n42,F=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*v*D-o*t*D+o*m*F-k*v*F-q*m*E+k*t*E;c.n12=h*t*D-i*v*D-h*m*F+f*v*F+i*m*E-f*t*E;c.n13=i*o*D-h*q*D+h*k*F-f*o*F-i*k*E+f*q*E;c.n14=h*q*m-i*o*m-h*k*t+f*o*t+i*k*v-f*q*v;c.n21=o*t*y-q*v*y-o*p*F+j*v*F+q*p*E-j*t*E;c.n22=i*v*y-h*t*y+h*p*F-d*v*F-i*p*E+d*t*E;c.n23=h*q*y-i*o*y-h*j*F+d*o*F+i*j*E-d*q*E;c.n24=
+i*o*p-h*q*p+h*j*t-d*o*t-i*j*v+d*q*v;c.n31=k*v*y-o*m*y+o*p*D-j*v*D-k*p*E+j*m*E;c.n32=h*m*y-f*v*y-h*p*D+d*v*D+f*p*E-d*m*E;c.n33=i*o*y-h*k*y+h*j*D-d*o*D-f*j*E+d*k*E;c.n34=h*k*p-f*o*p-h*j*m+d*o*m+f*j*v-d*k*v;c.n41=q*m*y-k*t*y-q*p*D+j*t*D+k*p*F-j*m*F;c.n42=f*t*y-i*m*y+i*p*D-d*t*D-f*p*F+d*m*F;c.n43=i*k*y-f*q*y-i*j*D+d*q*D+f*j*F-d*k*F;c.n44=f*q*p-i*k*p+i*j*m-d*q*m-f*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,i=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,m=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;d[0]=b*f;d[1]=b*i;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*q;d[6]=b*o;d[7]=b*p;d[8]=b*m;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,f,i,h){var j;j=new THREE.Matrix4;j.n11=2*i/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*i/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+i)/(h-i);j.n34=-2*h*i/(h-i);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var i,b=d*Math.tan(b*Math.PI/360);i=-b;return THREE.Matrix4.makeFrustum(i*c,b*c,i,b,d,f)};
-THREE.Matrix4.makeOrtho=function(b,c,d,f,i,h){var j,k,p,o;j=new THREE.Matrix4;k=c-b;p=d-f;o=h-i;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+f)/p);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+i)/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.Matrix4.makeOrtho=function(b,c,d,f,i,h){var j,k,q,o;j=new THREE.Matrix4;k=c-b;q=d-f;o=h-i;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/q;j.n23=0;j.n24=-((d+f)/q);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+i)/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.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(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)},add:function(b){if(this.children.indexOf(b)===
@@ -54,39 +54,39 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
 b)return i;if(c&&(i=i.getChildByName(b,c),i!==void 0))return i}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,d)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
 this.remove(b)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function b(){var b=p[k]=p[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,h=c.z+c.w,i=-b.z+b.w,j=-c.z+c.w;return f>=0&&h>=0&&i>=0&&j>=0?!0:f<0&&h<0||i<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),i<0?d=Math.max(d,i/(i-j)):j<0&&(e=Math.min(e,i/(i-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,p=[],o,q,m=[],t,w=[],y,C,E=[],D,wa,xa=[],qa=[],sa=[],ja=new THREE.Vector4,
-G=new THREE.Vector4,r=new THREE.Matrix4,T=new THREE.Matrix4,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Vector4,$=new THREE.Vector4;this.projectVector=function(b,c){r.multiply(c.projectionMatrix,c.matrixWorldInverse);r.multiplyVector3(b);return b};this.unprojectVector=function(b,c){r.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));r.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
-k;i=qa.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh)if(o=k.frustumCulled){a:{o=void 0;for(var p=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),q=0;q<6;q++)if(o=R[q].x*p.n14+R[q].y*p.n24+R[q].z*p.n34+R[q].w,o<=m){o=!1;break a}o=!0}o=!o}if(!o)o=h[i]=h[i]||new THREE.RenderableObject,i++,f=o,ja.copy(k.position),r.multiplyVector3(ja),f.object=k,f.z=ja.z,qa.push(f)}j&&qa.sort(c);return qa};
-this.projectScene=function(f,h,i){var e=h.near,qa=h.far,ja,va,N,Y,I,V,W,la,aa,J,Aa,Ia,Sa,Ja,Ba,Da,za;wa=C=t=q=sa.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);r.multiply(h.projectionMatrix,h.matrixWorldInverse);R[0].set(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);R[1].set(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);R[2].set(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);R[3].set(r.n41-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);R[4].set(r.n41-r.n31,r.n42-r.n32,
-r.n43-r.n33,r.n44-r.n34);R[5].set(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);for(ja=0;ja<6;ja++)aa=R[ja],aa.divideScalar(Math.sqrt(aa.x*aa.x+aa.y*aa.y+aa.z*aa.z));aa=this.projectObjects(f,h,!0);f=0;for(ja=aa.length;f<ja;f++)if(J=aa[f].object,J.visible)if(Aa=J.matrixWorld,Ia=J.matrixRotationWorld,Sa=J.materials,Ja=J.overdraw,k=0,J instanceof THREE.Mesh){Ba=J.geometry;Y=Ba.vertices;Da=Ba.faces;Ba=Ba.faceVertexUvs;va=0;for(N=Y.length;va<N;va++)j=b(),j.positionWorld.copy(Y[va].position),Aa.multiplyVector3(j.positionWorld),
-j.positionScreen.copy(j.positionWorld),r.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<qa;Y=0;for(va=Da.length;Y<va;Y++){N=Da[Y];if(N instanceof THREE.Face3)if(I=p[N.a],V=p[N.b],W=p[N.c],I.visible&&V.visible&&W.visible&&(J.doubleSided||J.flipSided!=(W.positionScreen.x-I.positionScreen.x)*(V.positionScreen.y-I.positionScreen.y)-(W.positionScreen.y-I.positionScreen.y)*(V.positionScreen.x-
-I.positionScreen.x)<0))la=m[q]=m[q]||new THREE.RenderableFace3,q++,o=la,o.v1.copy(I),o.v2.copy(V),o.v3.copy(W);else continue;else if(N instanceof THREE.Face4)if(I=p[N.a],V=p[N.b],W=p[N.c],la=p[N.d],I.visible&&V.visible&&W.visible&&la.visible&&(J.doubleSided||J.flipSided!=((la.positionScreen.x-I.positionScreen.x)*(V.positionScreen.y-I.positionScreen.y)-(la.positionScreen.y-I.positionScreen.y)*(V.positionScreen.x-I.positionScreen.x)<0||(V.positionScreen.x-W.positionScreen.x)*(la.positionScreen.y-W.positionScreen.y)-
-(V.positionScreen.y-W.positionScreen.y)*(la.positionScreen.x-W.positionScreen.x)<0)))za=w[t]=w[t]||new THREE.RenderableFace4,t++,o=za,o.v1.copy(I),o.v2.copy(V),o.v3.copy(W),o.v4.copy(la);else continue;o.normalWorld.copy(N.normal);Ia.multiplyVector3(o.normalWorld);o.centroidWorld.copy(N.centroid);Aa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);r.multiplyVector3(o.centroidScreen);W=N.vertexNormals;I=0;for(V=W.length;I<V;I++)la=o.vertexNormalsWorld[I],la.copy(W[I]),Ia.multiplyVector3(la);
-I=0;for(V=Ba.length;I<V;I++)if(za=Ba[I][Y]){W=0;for(la=za.length;W<la;W++)o.uvs[I][W]=za[W]}o.meshMaterials=Sa;o.faceMaterials=N.materials;o.overdraw=Ja;o.z=o.centroidScreen.z;sa.push(o)}}else if(J instanceof THREE.Line){T.multiply(r,Aa);Y=J.geometry.vertices;I=b();I.positionScreen.copy(Y[0].position);T.multiplyVector4(I.positionScreen);va=1;for(N=Y.length;va<N;va++)if(I=b(),I.positionScreen.copy(Y[va].position),T.multiplyVector4(I.positionScreen),V=p[k-2],ka.copy(I.positionScreen),$.copy(V.positionScreen),
-d(ka,$))ka.multiplyScalar(1/ka.w),$.multiplyScalar(1/$.w),Aa=E[C]=E[C]||new THREE.RenderableLine,C++,y=Aa,y.v1.positionScreen.copy(ka),y.v2.positionScreen.copy($),y.z=Math.max(ka.z,$.z),y.materials=J.materials,sa.push(y)}else if(J instanceof THREE.Particle&&(G.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),r.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))Aa=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,D=Aa,D.x=G.x/G.w,D.y=G.y/G.w,D.z=G.z,D.rotation=J.rotation.z,D.scale.x=J.scale.x*Math.abs(D.x-
-(G.x+h.projectionMatrix.n11)/(G.w+h.projectionMatrix.n14)),D.scale.y=J.scale.y*Math.abs(D.y-(G.y+h.projectionMatrix.n22)/(G.w+h.projectionMatrix.n24)),D.materials=J.materials,sa.push(D);i&&sa.sort(c);return sa}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
+THREE.Projector=function(){function b(){var b=q[k]=q[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,h=c.z+c.w,i=-b.z+b.w,j=-c.z+c.w;return f>=0&&h>=0&&i>=0&&j>=0?!0:f<0&&h<0||i<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),i<0?d=Math.max(d,i/(i-j)):j<0&&(e=Math.min(e,i/(i-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var f,i,h=[],j,k,q=[],o,p,m=[],t,v=[],y,D,F=[],E,xa,ya=[],ra=[],ta=[],ka=new THREE.Vector4,
+K=new THREE.Vector4,u=new THREE.Matrix4,U=new THREE.Matrix4,S=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],la=new THREE.Vector4,aa=new THREE.Vector4;this.projectVector=function(b,c){u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){u.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));u.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var e,
+k;i=ra.length=0;e=b.objects;b=0;for(d=e.length;b<d;b++){k=e[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh)if(o=k.frustumCulled){a:{o=void 0;for(var q=k.matrixWorld,m=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++)if(o=S[p].x*q.n14+S[p].y*q.n24+S[p].z*q.n34+S[p].w,o<=m){o=!1;break a}o=!0}o=!o}if(!o)o=h[i]=h[i]||new THREE.RenderableObject,i++,f=o,ka.copy(k.position),u.multiplyVector3(ka),f.object=k,f.z=ka.z,ra.push(f)}j&&ra.sort(c);return ra};
+this.projectScene=function(f,h,i){var e=h.near,ra=h.far,ka,wa,N,Z,I,W,X,ma,ca,J,Ba,Ja,Ta,Ka,Ca,Ea,Aa;xa=D=t=p=ta.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);u.multiply(h.projectionMatrix,h.matrixWorldInverse);S[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);S[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);S[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);S[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);S[4].set(u.n41-u.n31,u.n42-u.n32,
+u.n43-u.n33,u.n44-u.n34);S[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(ka=0;ka<6;ka++)ca=S[ka],ca.divideScalar(Math.sqrt(ca.x*ca.x+ca.y*ca.y+ca.z*ca.z));ca=this.projectObjects(f,h,!0);f=0;for(ka=ca.length;f<ka;f++)if(J=ca[f].object,J.visible)if(Ba=J.matrixWorld,Ja=J.matrixRotationWorld,Ta=J.materials,Ka=J.overdraw,k=0,J instanceof THREE.Mesh){Ca=J.geometry;Z=Ca.vertices;Ea=Ca.faces;Ca=Ca.faceVertexUvs;wa=0;for(N=Z.length;wa<N;wa++)j=b(),j.positionWorld.copy(Z[wa].position),Ba.multiplyVector3(j.positionWorld),
+j.positionScreen.copy(j.positionWorld),u.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>e&&j.positionScreen.z<ra;Z=0;for(wa=Ea.length;Z<wa;Z++){N=Ea[Z];if(N instanceof THREE.Face3)if(I=q[N.a],W=q[N.b],X=q[N.c],I.visible&&W.visible&&X.visible&&(J.doubleSided||J.flipSided!=(X.positionScreen.x-I.positionScreen.x)*(W.positionScreen.y-I.positionScreen.y)-(X.positionScreen.y-I.positionScreen.y)*(W.positionScreen.x-
+I.positionScreen.x)<0))ma=m[p]=m[p]||new THREE.RenderableFace3,p++,o=ma,o.v1.copy(I),o.v2.copy(W),o.v3.copy(X);else continue;else if(N instanceof THREE.Face4)if(I=q[N.a],W=q[N.b],X=q[N.c],ma=q[N.d],I.visible&&W.visible&&X.visible&&ma.visible&&(J.doubleSided||J.flipSided!=((ma.positionScreen.x-I.positionScreen.x)*(W.positionScreen.y-I.positionScreen.y)-(ma.positionScreen.y-I.positionScreen.y)*(W.positionScreen.x-I.positionScreen.x)<0||(W.positionScreen.x-X.positionScreen.x)*(ma.positionScreen.y-X.positionScreen.y)-
+(W.positionScreen.y-X.positionScreen.y)*(ma.positionScreen.x-X.positionScreen.x)<0)))Aa=v[t]=v[t]||new THREE.RenderableFace4,t++,o=Aa,o.v1.copy(I),o.v2.copy(W),o.v3.copy(X),o.v4.copy(ma);else continue;o.normalWorld.copy(N.normal);Ja.multiplyVector3(o.normalWorld);o.centroidWorld.copy(N.centroid);Ba.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);u.multiplyVector3(o.centroidScreen);X=N.vertexNormals;I=0;for(W=X.length;I<W;I++)ma=o.vertexNormalsWorld[I],ma.copy(X[I]),Ja.multiplyVector3(ma);
+I=0;for(W=Ca.length;I<W;I++)if(Aa=Ca[I][Z]){X=0;for(ma=Aa.length;X<ma;X++)o.uvs[I][X]=Aa[X]}o.meshMaterials=Ta;o.faceMaterials=N.materials;o.overdraw=Ka;o.z=o.centroidScreen.z;ta.push(o)}}else if(J instanceof THREE.Line){U.multiply(u,Ba);Z=J.geometry.vertices;I=b();I.positionScreen.copy(Z[0].position);U.multiplyVector4(I.positionScreen);wa=1;for(N=Z.length;wa<N;wa++)if(I=b(),I.positionScreen.copy(Z[wa].position),U.multiplyVector4(I.positionScreen),W=q[k-2],la.copy(I.positionScreen),aa.copy(W.positionScreen),
+d(la,aa))la.multiplyScalar(1/la.w),aa.multiplyScalar(1/aa.w),Ba=F[D]=F[D]||new THREE.RenderableLine,D++,y=Ba,y.v1.positionScreen.copy(la),y.v2.positionScreen.copy(aa),y.z=Math.max(la.z,aa.z),y.materials=J.materials,ta.push(y)}else if(J instanceof THREE.Particle&&(K.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),u.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))Ba=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,E=Ba,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=J.rotation.z,E.scale.x=J.scale.x*
+Math.abs(E.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),E.scale.y=J.scale.y*Math.abs(E.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),E.materials=J.materials,ta.push(E);i&&ta.sort(c);return ta}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;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=Math.PI/360,d=b.x*c,f=b.y*c,i=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-i),i=Math.sin(-i),h=Math.cos(d),d=Math.sin(d),j=b*c,k=f*i;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*i*d;this.z=b*i*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;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,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,p=this.w,o=p*d+j*i-k*f,q=p*f+k*d-h*i,m=p*i+h*f-j*d,d=-h*
-d-j*f-k*i;c.x=o*p+d*-h+q*-k-m*-j;c.y=q*p+d*-j+m*-h-o*-k;c.z=m*p+d*-k+o*-j-q*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
+this.x,d=this.y,f=this.z,i=this.w,h=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+i*h+d*k-f*j;this.y=d*b+i*j+f*h-c*k;this.z=f*b+i*k+c*j-d*h;this.w=i*b-c*h-d*j-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,i=b.z,h=this.x,j=this.y,k=this.z,q=this.w,o=q*d+j*i-k*f,p=q*f+k*d-h*i,m=q*i+h*f-j*d,d=-h*
+d-j*f-k*i;c.x=o*q+d*-h+p*-k-m*-j;c.y=p*q+d*-j+m*-h-o*-k;c.z=m*q+d*-k+o*-j-p*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var i=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(i)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(i),j=Math.sqrt(1-i*i);if(Math.abs(j)<0.001)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;i=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*i+c.w*f;d.x=b.x*i+c.x*f;d.y=b.y*i+c.y*f;d.z=b.z*i+c.z*f;return d};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,i,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,f,i,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];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)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,f=this.vertices.length;d<f;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(f=this.faces.length;d<f;d++){var i=this.faces[d];c.multiplyVector3(i.normal);for(var h=0,j=i.vertexNormals.length;h<j;h++)c.multiplyVector3(i.vertexNormals[h]);b.multiplyVector3(i.centroid)}},computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<
 c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
-d,f,i,h,j,k=new THREE.Vector3,p=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),p.sub(c.position,d.position),k.crossSelf(p);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
+d,f,i,h,j,k=new THREE.Vector3,q=new THREE.Vector3;f=0;for(i=this.faces.length;f<i;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],j=this.vertices[h.c],k.sub(j.position,d.position),q.sub(c.position,d.position),k.crossSelf(q);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,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(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{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++)d=this.faces[b],d instanceof
 THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),
-d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,h,i){k=b.vertices[e].position;p=b.vertices[c].position;o=b.vertices[d].position;q=j[f];m=j[h];t=j[i];w=p.x-k.x;y=o.x-k.x;C=p.y-k.y;E=o.y-k.y;D=p.z-k.z;wa=o.z-k.z;xa=m.u-q.u;qa=t.u-q.u;sa=m.v-q.v;ja=t.v-q.v;G=1/(xa*ja-qa*sa);ka.set((ja*w-sa*y)*G,(ja*C-sa*E)*G,(ja*D-sa*wa)*G);$.set((xa*y-qa*w)*G,(xa*E-qa*C)*G,(xa*wa-qa*D)*G);T[e].addSelf(ka);T[c].addSelf(ka);
-T[d].addSelf(ka);R[e].addSelf($);R[c].addSelf($);R[d].addSelf($)}var c,d,f,i,h,j,k,p,o,q,m,t,w,y,C,E,D,wa,xa,qa,sa,ja,G,r,T=[],R=[],ka=new THREE.Vector3,$=new THREE.Vector3,ya=new THREE.Vector3,S=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)T[c]=new THREE.Vector3,R[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=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 e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],r=T[i],ya.copy(r),ya.subSelf(M.multiplyScalar(M.dot(r))).normalize(),S.cross(h.vertexNormals[f],r),i=S.dot(R[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(ya.x,ya.y,ya.z,i)}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],
+d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,h,i){k=b.vertices[e].position;q=b.vertices[c].position;o=b.vertices[d].position;p=j[f];m=j[h];t=j[i];v=q.x-k.x;y=o.x-k.x;D=q.y-k.y;F=o.y-k.y;E=q.z-k.z;xa=o.z-k.z;ya=m.u-p.u;ra=t.u-p.u;ta=m.v-p.v;ka=t.v-p.v;K=1/(ya*ka-ra*ta);la.set((ka*v-ta*y)*K,(ka*D-ta*F)*K,(ka*E-ta*xa)*K);aa.set((ya*y-ra*v)*K,(ya*F-ra*D)*K,(ya*xa-ra*E)*K);U[e].addSelf(la);U[c].addSelf(la);
+U[d].addSelf(la);S[e].addSelf(aa);S[c].addSelf(aa);S[d].addSelf(aa)}var c,d,f,i,h,j,k,q,o,p,m,t,v,y,D,F,E,xa,ya,ra,ta,ka,K,u,U=[],S=[],la=new THREE.Vector3,aa=new THREE.Vector3,za=new THREE.Vector3,T=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)U[c]=new THREE.Vector3,S[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],j=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 e=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)M.copy(h.vertexNormals[f]),i=h[e[f]],u=U[i],za.copy(u),za.subSelf(M.multiplyScalar(M.dot(u))).normalize(),T.cross(h.vertexNormals[f],u),i=T.dot(S[i]),i=i<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(za.x,za.y,za.z,i)}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}},mergeVertices:function(){var b={},c=[],d=[],f,i=Math.pow(10,4),h,j;h=0;for(j=this.vertices.length;h<j;h++)f=this.vertices[h].position,f=[Math.round(f.x*i),Math.round(f.y*i),Math.round(f.z*i)].join("_"),
 b[f]===void 0?(b[f]=h,c.push(this.vertices[h]),d[h]=c.length-1):d[h]=d[b[f]];h=0;for(j=this.faces.length;h<j;h++){b=this.faces[h];if(b instanceof THREE.Face3)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c];if(b instanceof THREE.Face4)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c],b.d=d[b.d]}this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,f,h,i,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*i+b*h+c}this.points=b;var d=[],f={x:0,y:0,z:0},i,h,j,k,p,o,q,m,t;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){i=(this.points.length-1)*b;h=Math.floor(i);j=i-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;o=this.points[d[0]];q=this.points[d[1]];
-m=this.points[d[2]];t=this.points[d[3]];k=j*j;p=j*k;f.x=c(o.x,q.x,m.x,t.x,j,k,p);f.y=c(o.y,q.y,m.y,t.y,j,k,p);f.z=c(o.z,q.z,m.z,t.z,j,k,p);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,h=new THREE.Vector3,i=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;h.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),i.copy(position),
-k+=i.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,f,h,i,j,k=[],o=new THREE.Vector3,p=this.getLength();k.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=p.chunks[c]-p.chunks[c-1];j=Math.ceil(b*d/p.total);h=(c-1)/(this.points.length-1);i=c/(this.points.length-1);for(d=1;d<j-1;d++)f=h+d*(1/j)*(i-h),position=this.getPoint(f),k.push(o.copy(position).clone());
+THREE.Spline=function(b){function c(b,c,d,f,h,i,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*i+b*h+c}this.points=b;var d=[],f={x:0,y:0,z:0},i,h,j,k,q,o,p,m,t;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){i=(this.points.length-1)*b;h=Math.floor(i);j=i-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;o=this.points[d[0]];p=this.points[d[1]];
+m=this.points[d[2]];t=this.points[d[3]];k=j*j;q=j*k;f.x=c(o.x,p.x,m.x,t.x,j,k,q);f.y=c(o.y,p.y,m.y,t.y,j,k,q);f.z=c(o.z,p.z,m.z,t.z,j,k,q);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b<d;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,d,f=c=c=0,h=new THREE.Vector3,i=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;h.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),i.copy(position),
+k+=i.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,f,h,i,j,k=[],o=new THREE.Vector3,q=this.getLength();k.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=q.chunks[c]-q.chunks[c-1];j=Math.ceil(b*d/q.total);h=(c-1)/(this.points.length-1);i=c/(this.points.length-1);for(d=1;d<j-1;d++)f=h+d*(1/j)*(i-h),position=this.getPoint(f),k.push(o.copy(position).clone());
 k.push(o.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){THREE.Object3D.call(this);arguments.length&&console.warn("DEPRECATED: Camera() is now PerspectiveCamera().");this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
 THREE.Camera.prototype.update=function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
@@ -117,7 +117,7 @@ void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.ve
 THREE.Texture=function(b,c,d,f,i,h){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=i!==void 0?i:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,i,h,j,k,p){THREE.Texture.call(this,null,i,h,j,k,p);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,d,f,i,h,j,k,q){THREE.Texture.call(this,null,i,h,j,k,q);this.image={data:b,width:c,height:d};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
@@ -139,7 +139,8 @@ THREE.Sprite=function(b){THREE.Object3D.call(this);this.color=b.color!==void 0?n
 !this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
 THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
-THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.origin=new THREE.Vector3;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(b){this.supr.add.call(this,b);this.addChildRecurse(b)};
+THREE.Scene=function(){THREE.Object3D.call(this);this.ambientColor=new THREE.Color;this.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.Scene.prototype.add=function(b){b instanceof THREE.AmbientLight?(console.warn("DEPRECATED: AmbientLight( hex ) is now scene.ambientColor.setHex( hex )."),this.ambientColor.setHex(b.color.getHex())):(this.supr.add.call(this,b),this.addChildRecurse(b))};
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b);var c=this.__objectsRemoved.indexOf(b);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.remove=function(b){this.supr.remove.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),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
@@ -176,120 +177,120 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),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"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
 "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(b){function c(b,c,d){var f,h,i,j=b.vertices,L=j.length,z=b.colors,k=z.length,o=b.__vertexArray,p=b.__colorArray,q=b.__sortArray,v=b.__dirtyVertices,m=b.__dirtyColors,t=b.__webglCustomAttributes,u,r;if(t)for(u in t)t[u].offset=0;if(d.sortParticles){Fa.multiplySelf(d.matrixWorld);for(f=0;f<L;f++)h=j[f].position,Ra.copy(h),Fa.multiplyVector3(Ra),q[f]=[Ra.z,f];q.sort(function(b,e){return e[0]-b[0]});for(f=0;f<L;f++)h=j[q[f][1]].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;
-for(f=0;f<k;f++)i=f*3,color=z[q[f][1]],p[i]=color.r,p[i+1]=color.g,p[i+2]=color.b;if(t)for(u in t){f=t[u];z=f.value.length;for(i=0;i<z;i++){index=q[i][1];k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")r=f.value[index];f.size===2?(f.array[k]=r.x,f.array[k+1]=r.y):f.size===3?f.type==="c"?(f.array[k]=r.r,f.array[k+1]=r.g,f.array[k+2]=r.b):(f.array[k]=r.x,f.array[k+1]=r.y,f.array[k+2]=r.z):(f.array[k]=
-r.x,f.array[k+1]=r.y,f.array[k+2]=r.z,f.array[k+3]=r.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<L;f++)h=j[f].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;if(m)for(f=0;f<k;f++)color=z[f],i=f*3,p[i]=color.r,p[i+1]=color.g,p[i+2]=color.b;if(t)for(u in t)if(f=t[u],f.__original.needsUpdate){z=f.value.length;for(i=0;i<z;i++){k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[i]}else{if(f.boundTo===void 0||f.boundTo==="vertices")r=f.value[i];f.size===2?(f.array[k]=
-r.x,f.array[k+1]=r.y):f.size===3?f.type==="c"?(f.array[k]=r.r,f.array[k+1]=r.g,f.array[k+2]=r.b):(f.array[k]=r.x,f.array[k+1]=r.y,f.array[k+2]=r.z):(f.array[k]=r.x,f.array[k+1]=r.y,f.array[k+2]=r.z,f.array[k+3]=r.w)}f.offset+=f.size}}}if(v||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,o,c);if(m||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,p,c);if(t)for(u in t)if(f=t[u],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
-f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,h){f.program||M.initMaterial(f,c,d,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var i=0,j=M.maxMorphTargets;i<j;i++)h.__webglMorphTargetInfluences[i]=0}var k=!1,i=f.program,j=i.uniforms,z=f.uniforms;i!=Wa&&(e.useProgram(i),Wa=i,k=!0);if(f.id!=N)N=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Ua);if(d&&f.fog)if(z.fogColor.value=d.color,d instanceof
-THREE.Fog)z.fogNear.value=d.near,z.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)z.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var o,p,q=0,m=0,v=0,t,u,w,y=Ya,F=y.directional.colors,C=y.directional.positions,A=y.point.colors,D=y.point.positions,E=y.point.distances,G=0,K=0,d=o=w=0,k=c.length;d<k;d++)if(o=c[d],p=o.color,t=o.position,u=o.intensity,w=o.distance,o instanceof THREE.AmbientLight)q+=p.r,m+=p.g,v+=p.b;else if(o instanceof
-THREE.DirectionalLight)w=G*3,F[w]=p.r*u,F[w+1]=p.g*u,F[w+2]=p.b*u,C[w]=t.x,C[w+1]=t.y,C[w+2]=t.z,G+=1;else if(o instanceof THREE.SpotLight)w=G*3,F[w]=p.r*u,F[w+1]=p.g*u,F[w+2]=p.b*u,p=1/t.length(),C[w]=t.x*p,C[w+1]=t.y*p,C[w+2]=t.z*p,G+=1;else if(o instanceof THREE.PointLight)o=K*3,A[o]=p.r*u,A[o+1]=p.g*u,A[o+2]=p.b*u,D[o]=t.x,D[o+1]=t.y,D[o+2]=t.z,E[K]=w,K+=1;d=G*3;for(k=F.length;d<k;d++)F[d]=0;d=K*3;for(k=A.length;d<k;d++)A[d]=0;y.point.length=K;y.directional.length=G;y.ambient[0]=q;y.ambient[1]=
-m;y.ambient[2]=v;c=Ya;z.enableLighting.value=c.directional.length+c.point.length;z.ambientLightColor.value=c.ambient;z.directionalLightColor.value=c.directional.colors;z.directionalLightDirection.value=c.directional.positions;z.pointLightColor.value=c.point.colors;z.pointLightPosition.value=c.point.positions;z.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)z.diffuse.value=f.color,z.opacity.value=
-f.opacity,(z.map.texture=f.map)&&z.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),z.lightMap.texture=f.lightMap,z.envMap.texture=f.envMap,z.reflectivity.value=f.reflectivity,z.refractionRatio.value=f.refractionRatio,z.combine.value=f.combine,z.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)z.psColor.value=
-f.color,z.opacity.value=f.opacity,z.size.value=f.size,z.scale.value=Ca.height/2,z.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)z.ambient.value=f.ambient,z.specular.value=f.specular,z.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)z.mNear.value=b.near,z.mFar.value=b.far,z.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)z.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&z.shadowMatrix){for(c=0;c<Ta.length;c++)z.shadowMatrix.value[c]=
-Ta[c],z.shadowMap.texture[c]=M.shadowMap[c];z.shadowDarkness.value=M.shadowMapDarkness;z.shadowBias.value=M.shadowMapBias}c=f.uniformsList;z=0;for(d=c.length;z<d;z++)if(m=i.uniforms[c[z][1]])if(q=c[z][0],v=q.type,k=q.value,v=="i")e.uniform1i(m,k);else if(v=="f")e.uniform1f(m,k);else if(v=="v2")e.uniform2f(m,k.x,k.y);else if(v=="v3")e.uniform3f(m,k.x,k.y,k.z);else if(v=="v4")e.uniform4f(m,k.x,k.y,k.z,k.w);else if(v=="c")e.uniform3f(m,k.r,k.g,k.b);else if(v=="fv1")e.uniform1fv(m,k);else if(v=="fv")e.uniform3fv(m,
-k);else if(v=="v3v"){if(!q._array)q._array=new Float32Array(3*k.length);v=0;for(t=k.length;v<t;v++)y=v*3,q._array[y]=k[v].x,q._array[y+1]=k[v].y,q._array[y+2]=k[v].z;e.uniform3fv(m,q._array)}else if(v=="m4"){if(!q._array)q._array=new Float32Array(16);k.flattenToArray(q._array);e.uniformMatrix4fv(m,!1,q._array)}else if(v=="m4v"){if(!q._array)q._array=new Float32Array(16*k.length);v=0;for(t=k.length;v<t;v++)k[v].flattenToArrayOffset(q._array,v*16);e.uniformMatrix4fv(m,!1,q._array)}else if(v=="t"){if(e.uniform1i(m,
-k),m=q.texture)if(m.image instanceof Array&&m.image.length==6){if(q=m,q.image.length==6)if(q.needsUpdate){if(!q.image.__webglTextureCube)q.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,q.image.__webglTextureCube);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,q.image[k]);r(e.TEXTURE_CUBE_MAP,q,q.image[0]);q.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,q.image.__webglTextureCube)}else m instanceof
-THREE.WebGLRenderTargetCube?(q=m,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,q.__webglTexture)):T(m,k)}else if(v=="tv"){if(!q._array){q._array=[];v=0;for(t=q.texture.length;v<t;v++)q._array[v]=k+v}e.uniform1iv(m,q._array);v=0;for(t=q.texture.length;v<t;v++)(m=q.texture[v])&&T(m,q._array[v])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&e.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
-THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Va);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Va),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&
-j.objectMatrix!==null&&e.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);return i}function f(b,c,f,h,i,j){if(h.opacity!=0){var k,f=d(b,c,f,h,j),b=f.attributes,c=!1,f=i.id*16777215+f.id;f!=Y&&(Y=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=h.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[j.morphTargetBase]),
-e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var o=0,z=j.morphTargetForcedOrder,q=j.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<z.length;)e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[z[o]]),e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[o]=q[z[o]],o++;else{var z=[],p=-1,
-m=0,q=j.morphTargetInfluences,t,v=q.length,o=0;for(j.morphTargetBase!==-1&&(z[j.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(t=0;t<v;t++)!z[t]&&q[t]>p&&(m=t,p=q[m]);e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[m]);e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[o]=p;z[m]=1;p=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(i.__webglCustomAttributes)for(k in i.__webglCustomAttributes)b[k]>=
+THREE.WebGLRenderer=function(b){function c(b,c,d){var f,h,i,j=b.vertices,L=j.length,z=b.colors,k=z.length,o=b.__vertexArray,G=b.__colorArray,q=b.__sortArray,Fa=b.__dirtyVertices,A=b.__dirtyColors,x=b.__webglCustomAttributes,p,m;if(x)for(p in x)x[p].offset=0;if(d.sortParticles){Ga.multiplySelf(d.matrixWorld);for(f=0;f<L;f++)h=j[f].position,Sa.copy(h),Ga.multiplyVector3(Sa),q[f]=[Sa.z,f];q.sort(function(b,e){return e[0]-b[0]});for(f=0;f<L;f++)h=j[q[f][1]].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;
+for(f=0;f<k;f++)i=f*3,color=z[q[f][1]],G[i]=color.r,G[i+1]=color.g,G[i+2]=color.b;if(x)for(p in x){f=x[p];z=f.value.length;for(i=0;i<z;i++){index=q[i][1];k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")m=f.value[index];f.size===2?(f.array[k]=m.x,f.array[k+1]=m.y):f.size===3?f.type==="c"?(f.array[k]=m.r,f.array[k+1]=m.g,f.array[k+2]=m.b):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z):(f.array[k]=
+m.x,f.array[k+1]=m.y,f.array[k+2]=m.z,f.array[k+3]=m.w)}f.offset+=f.size}}}else{if(Fa)for(f=0;f<L;f++)h=j[f].position,i=f*3,o[i]=h.x,o[i+1]=h.y,o[i+2]=h.z;if(A)for(f=0;f<k;f++)color=z[f],i=f*3,G[i]=color.r,G[i+1]=color.g,G[i+2]=color.b;if(x)for(p in x)if(f=x[p],f.__original.needsUpdate){z=f.value.length;for(i=0;i<z;i++){k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[i]}else{if(f.boundTo===void 0||f.boundTo==="vertices")m=f.value[i];f.size===2?(f.array[k]=
+m.x,f.array[k+1]=m.y):f.size===3?f.type==="c"?(f.array[k]=m.r,f.array[k+1]=m.g,f.array[k+2]=m.b):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z):(f.array[k]=m.x,f.array[k+1]=m.y,f.array[k+2]=m.z,f.array[k+3]=m.w)}f.offset+=f.size}}}if(Fa||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,o,c);if(A||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,b.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,G,c);if(x)for(p in x)if(f=x[p],f.__original.needsUpdate||d.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,
+f.buffer),e.bufferData(e.ARRAY_BUFFER,f.array,c)}function d(b,c,d,f,h){f.program||M.initMaterial(f,c,d,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);for(var i=0,j=M.maxMorphTargets;i<j;i++)h.__webglMorphTargetInfluences[i]=0}var k=!1,i=f.program,j=i.uniforms,z=f.uniforms;i!=Xa&&(e.useProgram(i),Xa=i,k=!0);if(f.id!=N)N=f.id,k=!0;if(k){e.uniformMatrix4fv(j.projectionMatrix,!1,Va);if(d&&f.fog)if(z.fogColor.value=d.color,d instanceof
+THREE.Fog)z.fogNear.value=d.near,z.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)z.fogDensity.value=d.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var o,m,G,q,p,A=Za,x=A.directional.colors,t=A.directional.positions,r=A.point.colors,v=A.point.positions,y=A.point.distances,B=0,D=0,d=o=p=0,k=c.length;d<k;d++)if(o=c[d],m=o.color,G=o.position,q=o.intensity,p=o.distance,o instanceof THREE.DirectionalLight)p=B*3,x[p]=m.r*q,x[p+1]=m.g*q,x[p+
+2]=m.b*q,t[p]=G.x,t[p+1]=G.y,t[p+2]=G.z,B+=1;else if(o instanceof THREE.SpotLight)p=B*3,x[p]=m.r*q,x[p+1]=m.g*q,x[p+2]=m.b*q,m=1/G.length(),t[p]=G.x*m,t[p+1]=G.y*m,t[p+2]=G.z*m,B+=1;else if(o instanceof THREE.PointLight)o=D*3,r[o]=m.r*q,r[o+1]=m.g*q,r[o+2]=m.b*q,v[o]=G.x,v[o+1]=G.y,v[o+2]=G.z,y[D]=p,D+=1;d=B*3;for(k=x.length;d<k;d++)x[d]=0;d=D*3;for(k=r.length;d<k;d++)r[d]=0;A.point.length=D;A.directional.length=B;A.ambient[0]=0;A.ambient[1]=0;A.ambient[2]=0;c=Za;z.enableLighting.value=c.directional.length+
+c.point.length;z.ambientLightColor.value=c.ambient;z.directionalLightColor.value=c.directional.colors;z.directionalLightDirection.value=c.directional.positions;z.pointLightColor.value=c.point.colors;z.pointLightPosition.value=c.point.positions;z.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity,(z.map.texture=f.map)&&z.offsetRepeat.value.set(f.map.offset.x,
+f.map.offset.y,f.map.repeat.x,f.map.repeat.y),z.lightMap.texture=f.lightMap,z.envMap.texture=f.envMap,z.reflectivity.value=f.reflectivity,z.refractionRatio.value=f.refractionRatio,z.combine.value=f.combine,z.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)z.diffuse.value=f.color,z.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)z.psColor.value=f.color,z.opacity.value=f.opacity,z.size.value=f.size,z.scale.value=
+Da.height/2,z.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)z.ambient.value=f.ambient,z.specular.value=f.specular,z.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)z.mNear.value=b.near,z.mFar.value=b.far,z.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)z.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&z.shadowMatrix){for(c=0;c<Ua.length;c++)z.shadowMatrix.value[c]=Ua[c],z.shadowMap.texture[c]=M.shadowMap[c];z.shadowDarkness.value=
+M.shadowMapDarkness;z.shadowBias.value=M.shadowMapBias}c=f.uniformsList;z=0;for(d=c.length;z<d;z++)if(A=i.uniforms[c[z][1]])if(G=c[z][0],x=G.type,k=G.value,x=="i")e.uniform1i(A,k);else if(x=="f")e.uniform1f(A,k);else if(x=="v2")e.uniform2f(A,k.x,k.y);else if(x=="v3")e.uniform3f(A,k.x,k.y,k.z);else if(x=="v4")e.uniform4f(A,k.x,k.y,k.z,k.w);else if(x=="c")e.uniform3f(A,k.r,k.g,k.b);else if(x=="fv1")e.uniform1fv(A,k);else if(x=="fv")e.uniform3fv(A,k);else if(x=="v3v"){if(!G._array)G._array=new Float32Array(3*
+k.length);x=0;for(t=k.length;x<t;x++)r=x*3,G._array[r]=k[x].x,G._array[r+1]=k[x].y,G._array[r+2]=k[x].z;e.uniform3fv(A,G._array)}else if(x=="m4"){if(!G._array)G._array=new Float32Array(16);k.flattenToArray(G._array);e.uniformMatrix4fv(A,!1,G._array)}else if(x=="m4v"){if(!G._array)G._array=new Float32Array(16*k.length);x=0;for(t=k.length;x<t;x++)k[x].flattenToArrayOffset(G._array,x*16);e.uniformMatrix4fv(A,!1,G._array)}else if(x=="t"){if(e.uniform1i(A,k),A=G.texture)if(A.image instanceof Array&&A.image.length==
+6){if(G=A,G.image.length==6)if(G.needsUpdate){if(!G.image.__webglTextureCube)G.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,G.image.__webglTextureCube);for(k=0;k<6;k++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,G.image[k]);u(e.TEXTURE_CUBE_MAP,G,G.image[0]);G.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,G.image.__webglTextureCube)}else A instanceof THREE.WebGLRenderTargetCube?
+(G=A,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,G.__webglTexture)):U(A,k)}else if(x=="tv"){if(!G._array){G._array=[];x=0;for(t=G.texture.length;x<t;x++)G._array[x]=k+x}e.uniform1iv(A,G._array);x=0;for(t=G.texture.length;x<t;x++)(A=G.texture[x])&&U(A,G._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&e.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshPhongMaterial||
+f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&j.viewMatrix!==null&&e.uniformMatrix4fv(j.viewMatrix,!1,Wa);f.skinning&&(e.uniformMatrix4fv(j.cameraInverseMatrix,!1,Wa),e.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices))}e.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);j.normalMatrix&&e.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==
+null&&e.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);return i}function f(b,c,f,h,i,j){if(h.opacity!=0){var k,f=d(b,c,f,h,j),b=f.attributes,c=!1,f=i.id*16777215+f.id;f!=Z&&(Z=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(j.morphTargetBase){f=h.program.attributes;j.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[j.morphTargetBase]),e.vertexAttribPointer(f.position,
+3,e.FLOAT,!1,0,0)):f.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer),e.vertexAttribPointer(f.position,3,e.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var o=0,z=j.morphTargetForcedOrder,m=j.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<z.length;)e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[z[o]]),e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[o]=m[z[o]],o++;else{var z=[],q=-1,p=0,m=j.morphTargetInfluences,t,Fa=
+m.length,o=0;for(j.morphTargetBase!==-1&&(z[j.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(t=0;t<Fa;t++)!z[t]&&m[t]>q&&(p=t,q=m[p]);e.bindBuffer(e.ARRAY_BUFFER,i.__webglMorphTargetsBuffers[p]);e.vertexAttribPointer(f["morphTarget"+o],3,e.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[o]=q;z[p]=1;q=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(c){if(i.__webglCustomAttributes)for(k in i.__webglCustomAttributes)b[k]>=
 0&&(f=i.__webglCustomAttributes[k],e.bindBuffer(e.ARRAY_BUFFER,f.buffer),e.vertexAttribPointer(b[k],f.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(i.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,
 i.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));b.uv2>=0&&(i.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,i.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,i.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,
 e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,i.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,i.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,i.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}j instanceof THREE.Mesh?(h.wireframe?(e.lineWidth(h.wireframeLinewidth),c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.__webglLineBuffer),e.drawElements(e.LINES,i.__webglLineCount,
 e.UNSIGNED_SHORT,0)):(c&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),e.drawElements(e.TRIANGLES,i.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=i.__webglFaceCount,M.info.render.faces+=i.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(h.linewidth),e.drawArrays(j,0,i.__webglLineCount),M.info.render.calls++):j instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,i.__webglParticleCount),M.info.render.calls++):
 j instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,i.__webglVertexCount),M.info.render.calls++)}}function i(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,z,o,q,p,m,v=b.count*3;for(m=0;m<v;m+=9)d=b.normalArray,f=d[m],h=d[m+1],i=d[m+2],j=d[m+3],z=d[m+4],q=d[m+5],k=d[m+6],o=d[m+7],p=d[m+8],f=(f+j+k)/3,h=(h+z+o)/3,i=(i+q+p)/3,d[m]=f,d[m+1]=h,d[m+2]=i,d[m+3]=f,d[m+4]=h,d[m+5]=i,d[m+6]=f,d[m+7]=h,d[m+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
-0,b.count);b.count=0}function h(b){if(V!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),V=b.doubleSided;if(W!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),W=b.flipSided}function j(b){aa!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),aa=b)}function k(b){J!=b&&(e.depthMask(b),J=b)}function p(b,c,d){Aa!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Aa=b);if(b&&(Ia!=c||Sa!=d))e.polygonOffset(c,d),Ia=c,Sa=d}function o(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 q(b){for(var c=b.matrixWorld,e=-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<=e)return!1;return!0}function m(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,d=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=d.materials.length;b<c;b++)e=d.materials[b],e.transparent?m(h,e):m(f,e)}function w(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
-0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?m(k,f):m(j,f))}else(f=c)&&(f.transparent?m(k,f):m(j,f))}function y(b,c){return c.z-b.z}function C(b){var c,k,m,H=0,p,t,L,z,r=b.lights;ra||(ra=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=r.length;c<k;c++)if(m=r[c],m instanceof THREE.SpotLight&&m.castShadow){N=-1;M.shadowMap[H]||(M.shadowMap[H]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ta[H]||(Ta[H]=new THREE.Matrix4);p=M.shadowMap[H];t=Ta[H];ra.position.copy(m.position);ra.lookAt(m.target.position);ra.update(void 0,!0);b.update(void 0,!1,ra);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(ra.projectionMatrix);t.multiplySelf(ra.matrixWorldInverse);ra.matrixWorldInverse.flattenToArray(Va);ra.projectionMatrix.flattenToArray(Ua);Fa.multiply(ra.projectionMatrix,ra.matrixWorldInverse);
-o(Fa);M.initWebGLObjects(b);R(p);e.clearColor(1,1,1,1);M.clear();e.clearColor(X.r,X.g,X.b,Ga);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(p=0;p<t;p++)L=b.__webglObjects[p],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||q(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),D(z,ra,!1),L.render=!0):L.render=!1:L.render=!1;j(!0);G(THREE.NormalBlending);for(p=0;p<t;p++)if(L=b.__webglObjects[p],L.render)z=L.object,buffer=L.buffer,h(z),L=z.customDepthMaterial?
-z.customDepthMaterial:z.geometry.morphTargets.length?Za:Ka,f(ra,r,null,L,buffer,z);for(p=0;p<m;p++)L=b.__webglObjectsImmediate[p],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),D(z,ra,!1),h(z),program=d(ra,r,null,Ka,z),z.immediateRenderCallback?z.immediateRenderCallback(program,e,ha):z.render(function(b){i(b,program,Ka.shading)}));H++}}function E(b,c){var d,f,h;d=u.attributes;var i=u.uniforms,j=za/Da,k,z=[],o=Da*0.5,m=za*0.5,p=!0;e.useProgram(u.program);
-Wa=u.program;Y=aa=la=-1;$a||(e.enableVertexAttribArray(u.attributes.position),e.enableVertexAttribArray(u.attributes.uv),$a=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,u.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Ua);e.activeTexture(e.TEXTURE0);e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<
+b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,i,j,k,z,o,m,q,p,t=b.count*3;for(p=0;p<t;p+=9)d=b.normalArray,f=d[p],h=d[p+1],i=d[p+2],j=d[p+3],z=d[p+4],m=d[p+5],k=d[p+6],o=d[p+7],q=d[p+8],f=(f+j+k)/3,h=(h+z+o)/3,i=(i+m+q)/3,d[p]=f,d[p+1]=h,d[p+2]=i,d[p+3]=f,d[p+4]=h,d[p+5]=i,d[p+6]=f,d[p+7]=h,d[p+8]=i}e.bufferData(e.ARRAY_BUFFER,b.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(c.attributes.normal);e.vertexAttribPointer(c.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,
+0,b.count);b.count=0}function h(b){if(W!=b.doubleSided)b.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),W=b.doubleSided;if(X!=b.flipSided)b.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),X=b.flipSided}function j(b){ca!=b&&(b?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),ca=b)}function k(b){J!=b&&(e.depthMask(b),J=b)}function q(b,c,d){Ba!=b&&(b?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),Ba=b);if(b&&(Ja!=c||Ta!=d))e.polygonOffset(c,d),Ja=c,Ta=d}function o(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,e=-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<=e)return!1;return!0}function m(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,d=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=d.materials.length;b<c;b++)e=d.materials[b],e.transparent?m(h,e):m(f,e)}function v(b){var c,e,d,f,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=
+0;for(e=i.materials.length;c<e;c++)(f=i.materials[c])&&(f.transparent?m(k,f):m(j,f))}else(f=c)&&(f.transparent?m(k,f):m(j,f))}function y(b,c){return c.z-b.z}function D(b){var c,k,m,H=0,q,t,L,z,r=b.lights;sa||(sa=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));c=0;for(k=r.length;c<k;c++)if(m=r[c],m instanceof THREE.SpotLight&&m.castShadow){N=-1;M.shadowMap[H]||(M.shadowMap[H]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ua[H]||(Ua[H]=new THREE.Matrix4);q=M.shadowMap[H];t=Ua[H];sa.position.copy(m.position);sa.lookAt(m.target.position);sa.update(void 0,!0);b.update(void 0,!1,sa);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(sa.projectionMatrix);t.multiplySelf(sa.matrixWorldInverse);sa.matrixWorldInverse.flattenToArray(Wa);sa.projectionMatrix.flattenToArray(Va);Ga.multiply(sa.projectionMatrix,sa.matrixWorldInverse);
+o(Ga);M.initWebGLObjects(b);S(q);e.clearColor(1,1,1,1);M.clear();e.clearColor(Y.r,Y.g,Y.b,Ha);t=b.__webglObjects.length;m=b.__webglObjectsImmediate.length;for(q=0;q<t;q++)L=b.__webglObjects[q],z=L.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||p(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,sa,!1),L.render=!0):L.render=!1:L.render=!1;j(!0);K(THREE.NormalBlending);for(q=0;q<t;q++)if(L=b.__webglObjects[q],L.render)z=L.object,buffer=L.buffer,h(z),L=z.customDepthMaterial?
+z.customDepthMaterial:z.geometry.morphTargets.length?$a:Ma,f(sa,r,null,L,buffer,z);for(q=0;q<m;q++)L=b.__webglObjectsImmediate[q],z=L.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,sa,!1),h(z),program=d(sa,r,null,Ma,z),z.immediateRenderCallback?z.immediateRenderCallback(program,e,ia):z.render(function(b){i(b,program,Ma.shading)}));H++}}function F(b,c){var d,f,h;d=r.attributes;var i=r.uniforms,j=Aa/Ea,k,z=[],o=Ea*0.5,m=Aa*0.5,p=!0;e.useProgram(r.program);
+Xa=r.program;Z=ca=ma=-1;ab||(e.enableVertexAttribArray(r.attributes.position),e.enableVertexAttribArray(r.attributes.uv),ab=!0);e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.uniformMatrix4fv(i.projectionMatrix,!1,Va);e.activeTexture(e.TEXTURE0);e.uniform1i(i.map,0);d=0;for(f=b.__webglSprites.length;d<
 f;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);d=0;for(f=b.__webglSprites.length;d<f;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(e.uniform1i(i.useScreenCoordinates,1),e.uniform3f(i.screenPosition,(h.position.x-o)/o,(m-h.position.y)/
-m,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?za:1),z[0]=k*j*h.scale.x,z[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),e.uniform3f(i.color,h.color.r,h.color.g,
-h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,z),h.mergeWith3D&&!p?(e.enable(e.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(e.disable(e.DEPTH_TEST),p=!1),G(h.blending),T(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(J)}function D(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function wa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function qa(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function sa(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);
+m,Math.max(0,Math.min(1,h.position.z)))):(e.uniform1i(i.useScreenCoordinates,0),e.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),e.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?Aa:1),z[0]=k*j*h.scale.x,z[1]=k*h.scale.y,e.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),e.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),e.uniform2f(i.alignment,h.alignment.x,h.alignment.y),e.uniform1f(i.opacity,h.opacity),e.uniform3f(i.color,h.color.r,h.color.g,
+h.color.b),e.uniform1f(i.rotation,h.rotation),e.uniform2fv(i.scale,z),h.mergeWith3D&&!p?(e.enable(e.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(e.disable(e.DEPTH_TEST),p=!1),K(h.blending),U(h.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0));e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(J)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function xa(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function ya(b){var c,e,d,f;f=b.__materials;b=0;for(e=f.length;b<e;b++)if(d=f[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function ra(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function ta(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);
 return f.join("_")}var e,d,f,h,i,j,k,o,m={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(h=b.faces.length;f<h;f++)i=b.faces[f],j=i.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:p}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+i>65535&&(m[k].counter+=1,o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]=
-{faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=I++,b.geometryGroupsList.push(b.geometryGroups[q])}function ja(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=la){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
-e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}la=b}}function r(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,S(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,S(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,S(c.magFilter)),
-e.texParameteri(b,e.TEXTURE_MIN_FILTER,S(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ya(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,ya(c.minFilter)))}function T(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof
-THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);r(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function R(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=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);r(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),r(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,S(b.format),
-b.width,b.height,0,S(b.format),S(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
+{faces:[],materials:j,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=i;b.geometryGroupsList=[];for(var q in b.geometryGroups)b.geometryGroups[q].id=I++,b.geometryGroupsList.push(b.geometryGroups[q])}function ka(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ma){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
+e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ma=b}}function u(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,T(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,T(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,T(c.magFilter)),
+e.texParameteri(b,e.TEXTURE_MIN_FILTER,T(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,za(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,za(c.minFilter)))}function U(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof
+THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,T(b.format),b.image.width,b.image.height,0,T(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);u(e.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function S(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=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);u(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(),e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),u(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,T(b.format),
+b.width,b.height,0,T(b.format),T(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
 e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
-null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Da,b=za,f=Ja,h=Ba);c!=va&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),va=c)}function ka(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),
-e.bindTexture(e.TEXTURE_2D,null))}function $(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function ya(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
+null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=Aa,f=Ka,h=Ca);c!=wa&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),wa=c)}function la(b){b instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),
+e.bindTexture(e.TEXTURE_2D,null))}function aa(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)),console.error(c),null;return d}function za(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;
 case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
-case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,ua=[],Wa=
-null,va=null,N=-1,Y=null,I=0,V=null,W=null,la=null,aa=null,J=null,Aa=null,Ia=null,Sa=null,Ja=0,Ba=0,Da=0,za=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Fa=new THREE.Matrix4,Ua=new Float32Array(16),Va=new Float32Array(16),Ra=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ca=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-U=b.stencil!==void 0?b.stencil:!0,cb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,db=b.antialias!==void 0?b.antialias:!1,X=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ga=b.clearAlpha!==void 0?b.clearAlpha:0,Xa=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 ra,Ta=[],b=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(b.uniforms),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ab}),Za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
-uniforms:ab,morphTargets:!0});Ka._shadowPass=!0;Za._shadowPass=!0;try{if(!(e=Ca.getContext("experimental-webgl",{antialias:db,stencil:U,preserveDrawingBuffer:cb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(eb){console.error(eb)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);
-e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(X.r,X.g,X.b,Ga);this.context=e;var bb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);U=0;u.vertices[U++]=-1;u.vertices[U++]=-1;u.vertices[U++]=0;u.vertices[U++]=1;u.vertices[U++]=1;u.vertices[U++]=-1;u.vertices[U++]=1;u.vertices[U++]=1;u.vertices[U++]=1;u.vertices[U++]=
-1;u.vertices[U++]=1;u.vertices[U++]=0;u.vertices[U++]=-1;u.vertices[U++]=1;u.vertices[U++]=0;U=u.vertices[U++]=0;u.faces[U++]=0;u.faces[U++]=1;u.faces[U++]=2;u.faces[U++]=0;u.faces[U++]=2;u.faces[U++]=3;u.vertexBuffer=e.createBuffer();u.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,u.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,u.faces,e.STATIC_DRAW);u.program=e.createProgram();
-e.attachShader(u.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(u.program,$("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=e.getAttribLocation(u.program,"position");u.attributes.uv=e.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=e.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=e.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=e.getUniformLocation(u.program,"rotation");
-u.uniforms.scale=e.getUniformLocation(u.program,"scale");u.uniforms.alignment=e.getUniformLocation(u.program,"alignment");u.uniforms.color=e.getUniformLocation(u.program,"color");u.uniforms.map=e.getUniformLocation(u.program,"map");u.uniforms.opacity=e.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=e.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=e.getUniformLocation(u.program,"affectedByDistance");u.uniforms.screenPosition=e.getUniformLocation(u.program,
-"screenPosition");u.uniforms.modelViewMatrix=e.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=e.getUniformLocation(u.program,"projectionMatrix");var $a=!1;this.setSize=function(b,c){Ca.width=b;Ca.height=c;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(b,c,d,f){Ja=b;Ba=c;Da=d;za=f;e.viewport(Ja,Ba,Da,za)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=
-function(b,c){X.setHex(b);Ga=c;e.clearColor(X.r,X.g,X.b,Ga)};this.setClearColor=function(b,c){X.copy(b);Ga=c;e.clearColor(X.r,X.g,X.b,Ga)};this.getClearColor=function(){return X};this.getClearAlpha=function(){return Ga};this.clear=function(b,c,d){var f=0;if(b==void 0||b)f|=e.COLOR_BUFFER_BIT;if(c==void 0||c)f|=e.DEPTH_BUFFER_BIT;if(d==void 0||d)f|=e.STENCIL_BUFFER_BIT;e.clear(f)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,
+case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=this,e,va=[],Xa=
+null,wa=null,N=-1,Z=null,I=0,W=null,X=null,ma=null,ca=null,J=null,Ba=null,Ja=null,Ta=null,Ka=0,Ca=0,Ea=0,Aa=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Va=new Float32Array(16),Wa=new Float32Array(16),Sa=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Da=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+V=b.stencil!==void 0?b.stencil:!0,db=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,eb=b.antialias!==void 0?b.antialias:!1,Y=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0,Ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Da;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 sa,Ua=[],b=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(b.uniforms),Ma=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
+uniforms:bb,morphTargets:!0});Ma._shadowPass=!0;$a._shadowPass=!0;try{if(!(e=Da.getContext("experimental-webgl",{antialias:eb,stencil:V,preserveDrawingBuffer:db})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(fb){console.error(fb)}e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);
+e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(Y.r,Y.g,Y.b,Ha);this.context=e;var cb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);V=0;r.vertices[V++]=-1;r.vertices[V++]=-1;r.vertices[V++]=0;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=-1;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=1;r.vertices[V++]=
+1;r.vertices[V++]=1;r.vertices[V++]=0;r.vertices[V++]=-1;r.vertices[V++]=1;r.vertices[V++]=0;V=r.vertices[V++]=0;r.faces[V++]=0;r.faces[V++]=1;r.faces[V++]=2;r.faces[V++]=0;r.faces[V++]=2;r.faces[V++]=3;r.vertexBuffer=e.createBuffer();r.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,r.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,r.faces,e.STATIC_DRAW);r.program=e.createProgram();
+e.attachShader(r.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(r.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=e.getAttribLocation(r.program,"position");r.attributes.uv=e.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=e.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=e.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=e.getUniformLocation(r.program,"rotation");
+r.uniforms.scale=e.getUniformLocation(r.program,"scale");r.uniforms.alignment=e.getUniformLocation(r.program,"alignment");r.uniforms.color=e.getUniformLocation(r.program,"color");r.uniforms.map=e.getUniformLocation(r.program,"map");r.uniforms.opacity=e.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=e.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=e.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=e.getUniformLocation(r.program,
+"screenPosition");r.uniforms.modelViewMatrix=e.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=e.getUniformLocation(r.program,"projectionMatrix");var ab=!1;this.setSize=function(b,c){Da.width=b;Da.height=c;this.setViewport(0,0,Da.width,Da.height)};this.setViewport=function(b,c,d,f){Ka=b;Ca=c;Ea=d;Aa=f;e.viewport(Ka,Ca,Ea,Aa)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest=function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=
+function(b,c){Y.setHex(b);Ha=c;e.clearColor(Y.r,Y.g,Y.b,Ha)};this.setClearColor=function(b,c){Y.copy(b);Ha=c;e.clearColor(Y.r,Y.g,Y.b,Ha)};this.getClearColor=function(){return Y};this.getClearAlpha=function(){return Ha};this.clear=function(b,c,d){var f=0;if(b==void 0||b)f|=e.COLOR_BUFFER_BIT;if(c==void 0||c)f|=e.DEPTH_BUFFER_BIT;if(d==void 0||d)f|=e.STENCIL_BUFFER_BIT;e.clear(f)};this.getContext=function(){return e};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];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);
 e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),
 M.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,e.deleteBuffer(b.__webglVertexBuffer),e.deleteBuffer(b.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,e.deleteTexture(b.__webglTexture),M.info.memory.textures--};this.initMaterial=function(b,c,d,f){var h,i,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 o=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(o.uniforms);b.vertexShader=o.vertexShader;b.fragmentShader=o.fragmentShader}var m,p,q;m=q=o=0;for(p=c.length;m<p;m++)j=c[m],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&q++,j instanceof THREE.PointLight&&
-o++;o+q<=Xa?m=q:(m=Math.ceil(Xa*q/(o+q)),o=Xa-m);j={directional:m,point:o};o=q=0;for(m=c.length;o<m;o++)p=c[o],p instanceof THREE.SpotLight&&p.castShadow&&q++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var v;a:{m=b.fragmentShader;p=b.vertexShader;var o=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
-maxDirLights:j.directional,maxPointLights:j.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},r,f=[];k?f.push(k):(f.push(m),f.push(p));for(r in d)f.push(r),f.push(d[r]);k=f.join();r=0;for(f=ua.length;r<f;r++)if(ua[r].code==k){v=ua[r].program;break a}r=e.createProgram();f=[bb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,
+o++;o+q<=Ya?m=q:(m=Math.ceil(Ya*q/(o+q)),o=Ya-m);j={directional:m,point:o};o=q=0;for(m=c.length;o<m;o++)p=c[o],p instanceof THREE.SpotLight&&p.castShadow&&q++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var r;a:{m=b.fragmentShader;p=b.vertexShader;var o=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
+maxDirLights:j.directional,maxPointLights:j.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},A,f=[];k?f.push(k):(f.push(m),f.push(p));for(A in d)f.push(A),f.push(d[A]);k=f.join();A=0;for(f=va.length;A<f;A++)if(va[A].code==k){r=va[A].program;break a}A=e.createProgram();f=[cb?"#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.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&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");e.attachShader(r,$("fragment",j+m));e.attachShader(r,$("vertex",f+p));e.linkProgram(r);e.getProgramParameter(r,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(r,e.VALIDATE_STATUS)+", gl error ["+
-e.getError()+"]");r.uniforms={};r.attributes={};var u,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in o)f.push(u);u=f;f=0;for(o=u.length;f<o;f++)m=u[f],r.uniforms[m]=e.getUniformLocation(r,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)f.push("morphTarget"+u);for(v in c)f.push(v);
-v=f;u=0;for(c=v.length;u<c;u++)d=v[u],r.attributes[d]=e.getAttribLocation(r,d);r.id=ua.length;ua.push({program:r,code:k});M.info.memory.programs=ua.length;v=r}b.program=v;v=b.program.attributes;v.position>=0&&e.enableVertexAttribArray(v.position);v.color>=0&&e.enableVertexAttribArray(v.color);v.normal>=0&&e.enableVertexAttribArray(v.normal);v.tangent>=0&&e.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(e.enableVertexAttribArray(v.skinVertexA),
-e.enableVertexAttribArray(v.skinVertexB),e.enableVertexAttribArray(v.skinIndex),e.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(i in b.attributes)v[i]!==void 0&&v[i]>=0&&e.enableVertexAttribArray(v[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)u="morphTarget"+i,v[u]>=0&&(e.enableVertexAttribArray(v[u]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){R(b);
-this.clear(c,d,e)};this.render=function(b,c,m,r){var H,u,Ea,L,z,I,Q,Pa,Qa=b.lights,v=b.fog;N=-1;this.shadowMapEnabled&&C(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Va);c.projectionMatrix.flattenToArray(Ua);Fa.multiply(c.projectionMatrix,c.matrixWorldInverse);o(Fa);this.initWebGLObjects(b);R(m);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
-z=b.__webglObjects.length;for(r=0;r<z;r++)if(H=b.__webglObjects[r],Q=H.object,Q.visible)if(!(Q instanceof THREE.Mesh)||!Q.frustumCulled||q(Q)){if(Q.matrixWorld.flattenToArray(Q._objectMatrixArray),D(Q,c,!0),w(H),H.render=!0,this.sortObjects)H.object.renderDepth?H.z=H.object.renderDepth:(Ra.copy(Q.position),Fa.multiplyVector3(Ra),H.z=Ra.z)}else H.render=!1;else H.render=!1;this.sortObjects&&b.__webglObjects.sort(y);I=b.__webglObjectsImmediate.length;for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=
-H.object,Q.visible&&(Q.matrixAutoUpdate&&Q.matrixWorld.flattenToArray(Q._objectMatrixArray),D(Q,c,!0),t(H));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render)Q=H.object,Pa=H.buffer,h(Q),f(c,Qa,v,b.overrideMaterial,Pa,Q);for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible&&(h(Q),u=d(c,Qa,v,b.overrideMaterial,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(u,e,ha):Q.render(function(b){i(b,u,
-Ka.shading)}))}else{G(THREE.NormalBlending);for(r=z-1;r>=0;r--)if(H=b.__webglObjects[r],H.render){Q=H.object;Pa=H.buffer;Ea=H.opaque;h(Q);for(H=0;H<Ea.count;H++)L=Ea.list[H],j(L.depthTest),k(L.depthWrite),p(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Qa,v,L,Pa,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){Ea=H.opaque;h(Q);for(H=0;H<Ea.count;H++)L=Ea.list[H],j(L.depthTest),k(L.depthWrite),p(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),
-u=d(c,Qa,v,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(u,e,ha):Q.render(function(b){i(b,u,Ka.shading)})}for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render){Q=H.object;Pa=H.buffer;Ea=H.transparent;h(Q);for(H=0;H<Ea.count;H++)L=Ea.list[H],G(L.blending),j(L.depthTest),k(L.depthWrite),p(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Qa,v,L,Pa,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){Ea=H.transparent;h(Q);for(H=0;H<Ea.count;H++)L=Ea.list[H],
-G(L.blending),j(L.depthTest),k(L.depthWrite),p(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),u=d(c,Qa,v,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(u,e,ha):Q.render(function(b){i(b,u,Ka.shading)})}}b.__webglSprites.length&&E(b,c);m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter&&ka(m)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
-f=b,h=void 0,i=void 0,j=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 i=d.geometry,i.geometryGroups==void 0&&sa(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();
+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");e.attachShader(A,aa("fragment",j+m));e.attachShader(A,aa("vertex",f+p));e.linkProgram(A);e.getProgramParameter(A,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(A,e.VALIDATE_STATUS)+", gl error ["+
+e.getError()+"]");A.uniforms={};A.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in o)f.push(x);x=f;f=0;for(o=x.length;f<o;f++)m=x[f],A.uniforms[m]=e.getUniformLocation(A,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<d.maxMorphTargets;x++)f.push("morphTarget"+x);for(r in c)f.push(r);
+r=f;x=0;for(c=r.length;x<c;x++)d=r[x],A.attributes[d]=e.getAttribLocation(A,d);A.id=va.length;va.push({program:A,code:k});M.info.memory.programs=va.length;r=A}b.program=r;r=b.program.attributes;r.position>=0&&e.enableVertexAttribArray(r.position);r.color>=0&&e.enableVertexAttribArray(r.color);r.normal>=0&&e.enableVertexAttribArray(r.normal);r.tangent>=0&&e.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(e.enableVertexAttribArray(r.skinVertexA),
+e.enableVertexAttribArray(r.skinVertexB),e.enableVertexAttribArray(r.skinIndex),e.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(i in b.attributes)r[i]!==void 0&&r[i]>=0&&e.enableVertexAttribArray(r[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)x="morphTarget"+i,r[x]>=0&&(e.enableVertexAttribArray(r[x]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,e){S(b);
+this.clear(c,d,e)};this.render=function(b,c,m,r){var H,La,u,L,z,I,Q,G,Ra=b.lights,Fa=b.fog;N=-1;this.shadowMapEnabled&&D(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Wa);c.projectionMatrix.flattenToArray(Va);Ga.multiply(c.projectionMatrix,c.matrixWorldInverse);o(Ga);this.initWebGLObjects(b);S(m);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
+z=b.__webglObjects.length;for(r=0;r<z;r++)if(H=b.__webglObjects[r],Q=H.object,Q.visible)if(!(Q instanceof THREE.Mesh)||!Q.frustumCulled||p(Q)){if(Q.matrixWorld.flattenToArray(Q._objectMatrixArray),E(Q,c,!0),v(H),H.render=!0,this.sortObjects)H.object.renderDepth?H.z=H.object.renderDepth:(Sa.copy(Q.position),Ga.multiplyVector3(Sa),H.z=Sa.z)}else H.render=!1;else H.render=!1;this.sortObjects&&b.__webglObjects.sort(y);I=b.__webglObjectsImmediate.length;for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=
+H.object,Q.visible&&(Q.matrixAutoUpdate&&Q.matrixWorld.flattenToArray(Q._objectMatrixArray),E(Q,c,!0),t(H));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render)Q=H.object,G=H.buffer,h(Q),f(c,Ra,Fa,b.overrideMaterial,G,Q);for(r=0;r<I;r++)H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible&&(h(Q),La=d(c,Ra,Fa,b.overrideMaterial,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(La,e,ia):Q.render(function(b){i(b,
+La,Ma.shading)}))}else{K(THREE.NormalBlending);for(r=z-1;r>=0;r--)if(H=b.__webglObjects[r],H.render){Q=H.object;G=H.buffer;u=H.opaque;h(Q);for(H=0;H<u.count;H++)L=u.list[H],j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Ra,Fa,L,G,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){u=H.opaque;h(Q);for(H=0;H<u.count;H++)L=u.list[H],j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),La=
+d(c,Ra,Fa,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(La,e,ia):Q.render(function(b){i(b,La,Ma.shading)})}for(r=0;r<z;r++)if(H=b.__webglObjects[r],H.render){Q=H.object;G=H.buffer;u=H.transparent;h(Q);for(H=0;H<u.count;H++)L=u.list[H],K(L.blending),j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),f(c,Ra,Fa,L,G,Q)}for(r=0;r<I;r++)if(H=b.__webglObjectsImmediate[r],Q=H.object,Q.visible){u=H.transparent;h(Q);for(H=0;H<u.count;H++)L=u.list[H],K(L.blending),
+j(L.depthTest),k(L.depthWrite),q(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),La=d(c,Ra,Fa,L,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(La,e,ia):Q.render(function(b){i(b,La,Ma.shading)})}}b.__webglSprites.length&&F(b,c);m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter&&la(m)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
+f=b,h=void 0,i=void 0,j=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 i=d.geometry,i.geometryGroups==void 0&&ta(i),i.geometryGroups){if(j=i.geometryGroups[h],!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=e.createBuffer();k.__webglNormalBuffer=e.createBuffer();
 k.__webglTangentBuffer=e.createBuffer();k.__webglColorBuffer=e.createBuffer();k.__webglUVBuffer=e.createBuffer();k.__webglUV2Buffer=e.createBuffer();k.__webglSkinVertexABuffer=e.createBuffer();k.__webglSkinVertexBBuffer=e.createBuffer();k.__webglSkinIndicesBuffer=e.createBuffer();k.__webglSkinWeightsBuffer=e.createBuffer();k.__webglFaceBuffer=e.createBuffer();k.__webglLineBuffer=e.createBuffer();if(k.numMorphTargets){var o=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];o=0;for(m=k.numMorphTargets;o<
-m;o++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,r=void 0,t=r=void 0,v=void 0,u=void 0,w=u=o=0,y=r=q=void 0,r=m=y=q=p=void 0,t=k.geometry,v=t.faces,y=j.faces,p=0,q=y.length;p<q;p++)r=y[p],r=v[r],r instanceof THREE.Face3?(o+=3,u+=1,w+=3):r instanceof THREE.Face4&&(o+=4,u+=2,w+=4);for(var p=j,q=k,C=y=v=void 0,F=void 0,C=void 0,r=[],v=0,y=q.materials.length;v<y;v++)if(C=q.materials[v],C instanceof THREE.MeshFaceMaterial){C=0;for(l=p.materials.length;C<
-l;C++)(F=p.materials[C])&&r.push(F)}else(F=C)&&r.push(F);p=r;j.__materials=p;a:{v=q=void 0;y=p.length;for(q=0;q<y;q++)if(v=p[q],v.map||v.lightMap||v instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=v=void 0;r=p.length;for(v=0;v<r;v++)if(y=p[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:{r=v=void 0;C=p.length;for(v=0;v<C;v++)if(r=p[v],r.vertexColors){r=
-r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(o*3);if(y)j.__normalArray=new Float32Array(o*3);if(t.hasTangents)j.__tangentArray=new Float32Array(o*4);if(r)j.__colorArray=new Float32Array(o*3);if(q){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(o*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(o*4),j.__skinVertexBArray=
-new Float32Array(o*4),j.__skinIndexArray=new Float32Array(o*4),j.__skinWeightArray=new Float32Array(o*4);j.__faceArray=new Uint16Array(u*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(w*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(v=j.numMorphTargets;t<v;t++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=r;j.__normalType=y;j.__webglFaceCount=u*3+(k.geometry.edgeFaces?
-k.geometry.edgeFaces.length*6:0);j.__webglLineCount=w*2;t=0;for(v=p.length;t<v;t++)if(q=p[t],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){r=q.attributes[a];y={};for(m in r)y[m]=r[m];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,u=1,y.type==="v2"?u=2:y.type==="v3"?u=3:y.type==="v4"?u=4:y.type==="c"&&(u=3),y.size=u,y.array=new Float32Array(o*u),y.buffer=e.createBuffer(),y.buffer.belongsToAttribute=a,r.needsUpdate=!0,
-y.__original=r;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=
+m;o++)k.__webglMorphTargetsBuffers.push(e.createBuffer())}M.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,r=void 0,t=r=void 0,u=void 0,A=void 0,x=A=o=0,v=r=q=void 0,r=m=v=q=p=void 0,t=k.geometry,u=t.faces,v=j.faces,p=0,q=v.length;p<q;p++)r=v[p],r=u[r],r instanceof THREE.Face3?(o+=3,A+=1,x+=3):r instanceof THREE.Face4&&(o+=4,A+=2,x+=4);for(var p=j,q=k,D=v=u=void 0,y=void 0,D=void 0,r=[],u=0,v=q.materials.length;u<v;u++)if(D=q.materials[u],D instanceof THREE.MeshFaceMaterial){D=0;for(l=p.materials.length;D<
+l;D++)(y=p.materials[D])&&r.push(y)}else(y=D)&&r.push(y);p=r;j.__materials=p;a:{u=q=void 0;v=p.length;for(q=0;q<v;q++)if(u=p[q],u.map||u.lightMap||u instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{v=u=void 0;r=p.length;for(u=0;u<r;u++)if(v=p[u],!(v instanceof THREE.MeshBasicMaterial&&!v.envMap||v instanceof THREE.MeshDepthMaterial)){v=v&&v.shading!=void 0&&v.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}v=!1}a:{r=u=void 0;D=p.length;for(u=0;u<D;u++)if(r=p[u],r.vertexColors){r=
+r.vertexColors;break a}r=!1}j.__vertexArray=new Float32Array(o*3);if(v)j.__normalArray=new Float32Array(o*3);if(t.hasTangents)j.__tangentArray=new Float32Array(o*4);if(r)j.__colorArray=new Float32Array(o*3);if(q){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(o*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(o*4),j.__skinVertexBArray=
+new Float32Array(o*4),j.__skinIndexArray=new Float32Array(o*4),j.__skinWeightArray=new Float32Array(o*4);j.__faceArray=new Uint16Array(A*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(x*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__needsSmoothNormals=v==THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=r;j.__normalType=v;j.__webglFaceCount=A*3+(k.geometry.edgeFaces?
+k.geometry.edgeFaces.length*6:0);j.__webglLineCount=x*2;t=0;for(u=p.length;t<u;t++)if(q=p[t],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){r=q.attributes[a];v={};for(m in r)v[m]=r[m];if(!v.__webglInitialized||v.createUniqueBuffers)v.__webglInitialized=!0,A=1,v.type==="v2"?A=2:v.type==="v3"?A=3:v.type==="v4"?A=4:v.type==="c"&&(A=3),v.size=A,v.array=new Float32Array(o*A),v.buffer=e.createBuffer(),v.buffer.belongsToAttribute=a,r.needsUpdate=!0,
+v.__original=r;j.__webglCustomAttributes[a]=v}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(d instanceof THREE.Ribbon){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=
 k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.Line){if(i=d.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=e.createBuffer(),j.__webglColorBuffer=e.createBuffer(),M.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(d instanceof THREE.ParticleSystem&&(i=d.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=e.createBuffer();
-j.__webglColorBuffer=e.createBuffer();M.info.geometries++;j=i;k=d;o=j.vertices.length;j.__vertexArray=new Float32Array(o*3);j.__colorArray=new Float32Array(o*3);j.__sortArray=[];j.__webglParticleCount=o;j.__materials=k.materials;w=u=m=void 0;m=0;for(u=k.materials.length;m<u;m++)if(w=k.materials[m],w.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in w.attributes){originalAttribute=w.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
+j.__webglColorBuffer=e.createBuffer();M.info.geometries++;j=i;k=d;o=j.vertices.length;j.__vertexArray=new Float32Array(o*3);j.__colorArray=new Float32Array(o*3);j.__sortArray=[];j.__webglParticleCount=o;j.__materials=k.materials;x=A=m=void 0;m=0;for(A=k.materials.length;m<A;m++)if(x=k.materials[m],x.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in x.attributes){originalAttribute=x.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(o*size),attribute.buffer=e.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}i.__dirtyVertices=
-!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ja(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ja(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&
-f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)qa(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&qa(f.__webglObjectsImmediate,d);d.__webglActive=
-!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(o=h.geometryGroupsList.length;k<o;k++)if(j=h.geometryGroupsList[k],m=wa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,u=e.DYNAMIC_DRAW,w=!h.dynamic,m.__inittedArrays){var D=p=t=void 0,A=void 0,G=D=void 0,E=void 0,I=void 0,K=void 0,O=F=C=r=
-y=v=q=void 0,P=void 0,J=void 0,s=A=K=A=I=E=void 0,n=void 0,B=n=s=E=void 0,R=void 0,U=B=n=s=D=D=G=K=A=B=n=s=R=B=n=s=R=B=n=s=void 0,ia=0,N=0,W=0,$=0,V=0,S=0,Z=0,T=0,ma=0,x=0,na=0,B=s=0,B=void 0,oa=m.__vertexArray,ka=m.__uvArray,la=m.__uv2Array,Y=m.__normalArray,ca=m.__tangentArray,pa=m.__colorArray,da=m.__skinVertexAArray,ea=m.__skinVertexBArray,fa=m.__skinIndexArray,ga=m.__skinWeightArray,ra=m.__morphTargetsArrays,aa=m.__webglCustomAttributes,n=void 0,ha=m.__faceArray,X=m.__lineArray,ya=m.__needsSmoothNormals,
-v=m.__vertexColorType,q=m.__uvType,y=m.__normalType,ta=i.geometry,va=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ba=ta.__dirtyTangents,Da=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ca=ta.vertices,Ga=m.faces,Ka=ta.faces,Ia=ta.faceVertexUvs[0],Ja=ta.faceVertexUvs[1],Ma=ta.skinVerticesA,Na=ta.skinVerticesB,Oa=ta.skinIndices,La=ta.skinWeights,Ha=ta.morphTargets;if(aa)for(U in aa)aa[U].offset=0,aa[U].offsetSrc=0;t=0;for(p=Ga.length;t<p;t++)if(D=Ga[t],A=Ka[D],Ia&&(r=Ia[D]),
-Ja&&(C=Ja[D]),D=A.vertexNormals,G=A.normal,E=A.vertexColors,I=A.color,K=A.vertexTangents,A instanceof THREE.Face3){if(va)F=Ca[A.a].position,O=Ca[A.b].position,P=Ca[A.c].position,oa[N]=F.x,oa[N+1]=F.y,oa[N+2]=F.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,N+=9;if(aa)for(U in aa)if(n=aa[U],n.__original.needsUpdate)s=n.offset,B=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[A.a],n.array[s+1]=n.value[A.b],n.array[s+2]=n.value[A.c]):
-n.boundTo==="faces"?(B=n.value[B],n.array[s]=B,n.array[s+1]=B,n.array[s+2]=B,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[B],n.array[s+1]=n.value[B+1],n.array[s+2]=n.value[B+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(F=n.value[A.a],O=n.value[A.b],P=n.value[A.c]):n.boundTo==="faces"?(P=O=F=B=n.value[B],n.offsetSrc++):n.boundTo==="faceVertices"&&(F=n.value[B],O=n.value[B+1],P=n.value[B+2],n.offsetSrc+=3),n.size===2?(n.array[s]=F.x,n.array[s+1]=F.y,
-n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=P.x,n.array[s+5]=P.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=F.r,n.array[s+1]=F.g,n.array[s+2]=F.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b):(n.array[s]=F.x,n.array[s+1]=F.y,n.array[s+2]=F.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z),n.offset+=9):(n.array[s]=F.x,n.array[s+1]=F.y,n.array[s+2]=F.z,n.array[s+3]=F.w,n.array[s+
-4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.offset+=12));if(Fa){s=0;for(n=Ha.length;s<n;s++)F=Ha[s].vertices[A.a].position,O=Ha[s].vertices[A.b].position,P=Ha[s].vertices[A.c].position,B=ra[s],B[na]=F.x,B[na+1]=F.y,B[na+2]=F.z,B[na+3]=O.x,B[na+4]=O.y,B[na+5]=O.z,B[na+6]=P.x,B[na+7]=P.y,B[na+8]=P.z;na+=9}if(La.length)s=La[A.a],n=La[A.b],B=La[A.c],ga[x]=s.x,ga[x+1]=s.y,ga[x+2]=s.z,ga[x+3]=s.w,ga[x+4]=n.x,ga[x+5]=n.y,
-ga[x+6]=n.z,ga[x+7]=n.w,ga[x+8]=B.x,ga[x+9]=B.y,ga[x+10]=B.z,ga[x+11]=B.w,s=Oa[A.a],n=Oa[A.b],B=Oa[A.c],fa[x]=s.x,fa[x+1]=s.y,fa[x+2]=s.z,fa[x+3]=s.w,fa[x+4]=n.x,fa[x+5]=n.y,fa[x+6]=n.z,fa[x+7]=n.w,fa[x+8]=B.x,fa[x+9]=B.y,fa[x+10]=B.z,fa[x+11]=B.w,s=Ma[A.a],n=Ma[A.b],B=Ma[A.c],da[x]=s.x,da[x+1]=s.y,da[x+2]=s.z,da[x+3]=1,da[x+4]=n.x,da[x+5]=n.y,da[x+6]=n.z,da[x+7]=1,da[x+8]=B.x,da[x+9]=B.y,da[x+10]=B.z,da[x+11]=1,s=Na[A.a],n=Na[A.b],B=Na[A.c],ea[x]=s.x,ea[x+1]=s.y,ea[x+2]=s.z,ea[x+3]=1,ea[x+4]=n.x,
-ea[x+5]=n.y,ea[x+6]=n.z,ea[x+7]=1,ea[x+8]=B.x,ea[x+9]=B.y,ea[x+10]=B.z,ea[x+11]=1,x+=12;if(Da&&v)E.length==3&&v==THREE.VertexColors?(A=E[0],s=E[1],n=E[2]):n=s=A=I,pa[ma]=A.r,pa[ma+1]=A.g,pa[ma+2]=A.b,pa[ma+3]=s.r,pa[ma+4]=s.g,pa[ma+5]=s.b,pa[ma+6]=n.r,pa[ma+7]=n.g,pa[ma+8]=n.b,ma+=9;if(Ba&&ta.hasTangents)E=K[0],I=K[1],A=K[2],ca[Z]=E.x,ca[Z+1]=E.y,ca[Z+2]=E.z,ca[Z+3]=E.w,ca[Z+4]=I.x,ca[Z+5]=I.y,ca[Z+6]=I.z,ca[Z+7]=I.w,ca[Z+8]=A.x,ca[Z+9]=A.y,ca[Z+10]=A.z,ca[Z+11]=A.w,Z+=12;if(Aa&&y)if(D.length==3&&
-ya)for(K=0;K<3;K++)G=D[K],Y[S]=G.x,Y[S+1]=G.y,Y[S+2]=G.z,S+=3;else for(K=0;K<3;K++)Y[S]=G.x,Y[S+1]=G.y,Y[S+2]=G.z,S+=3;if(ua&&r!==void 0&&q)for(K=0;K<3;K++)D=r[K],ka[W]=D.u,ka[W+1]=D.v,W+=2;if(ua&&C!==void 0&&q)for(K=0;K<3;K++)D=C[K],la[$]=D.u,la[$+1]=D.v,$+=2;za&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+2,V+=3,X[T]=ia,X[T+1]=ia+1,X[T+2]=ia,X[T+3]=ia+2,X[T+4]=ia+1,X[T+5]=ia+2,T+=6,ia+=3)}else if(A instanceof THREE.Face4){if(va)F=Ca[A.a].position,O=Ca[A.b].position,P=Ca[A.c].position,J=Ca[A.d].position,oa[N]=
-F.x,oa[N+1]=F.y,oa[N+2]=F.z,oa[N+3]=O.x,oa[N+4]=O.y,oa[N+5]=O.z,oa[N+6]=P.x,oa[N+7]=P.y,oa[N+8]=P.z,oa[N+9]=J.x,oa[N+10]=J.y,oa[N+11]=J.z,N+=12;if(aa)for(U in aa)if(n=aa[U],n.__original.needsUpdate)s=n.offset,B=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[A.a],n.array[s+1]=n.value[A.b],n.array[s+2]=n.value[A.c],n.array[s+3]=n.value[A.d]):n.boundTo==="faces"?(B=n.value[B],n.array[s]=B,n.array[s+1]=B,n.array[s+2]=B,n.array[s+3]=B,n.offsetSrc++):n.boundTo===
-"faceVertices"&&(n.array[s]=n.value[B],n.array[s+1]=n.value[B+1],n.array[s+2]=n.value[B+2],n.array[s+3]=n.value[B+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(F=n.value[A.a],O=n.value[A.b],P=n.value[A.c],J=n.value[A.d]):n.boundTo==="faces"?(J=P=O=F=B=n.value[B],n.offsetSrc++):n.boundTo==="faceVertices"&&(F=n.value[B],O=n.value[B+1],P=n.value[B+2],J=n.value[B+3],n.offsetSrc+=4),n.size===2?(n.array[s]=F.x,n.array[s+1]=F.y,n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=
-P.x,n.array[s+5]=P.y,n.array[s+6]=J.x,n.array[s+7]=J.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=F.r,n.array[s+1]=F.g,n.array[s+2]=F.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b,n.array[s+9]=J.r,n.array[s+10]=J.g,n.array[s+11]=J.b):(n.array[s]=F.x,n.array[s+1]=F.y,n.array[s+2]=F.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z,n.array[s+9]=J.x,n.array[s+10]=J.y,n.array[s+11]=J.z),
-n.offset+=12):(n.array[s]=F.x,n.array[s+1]=F.y,n.array[s+2]=F.z,n.array[s+3]=F.w,n.array[s+4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.array[s+12]=J.x,n.array[s+13]=J.y,n.array[s+14]=J.z,n.array[s+15]=J.w,n.offset+=16));if(Fa){s=0;for(n=Ha.length;s<n;s++)F=Ha[s].vertices[A.a].position,O=Ha[s].vertices[A.b].position,P=Ha[s].vertices[A.c].position,J=Ha[s].vertices[A.d].position,B=ra[s],B[na]=F.x,B[na+1]=F.y,B[na+2]=
-F.z,B[na+3]=O.x,B[na+4]=O.y,B[na+5]=O.z,B[na+6]=P.x,B[na+7]=P.y,B[na+8]=P.z,B[na+9]=J.x,B[na+10]=J.y,B[na+11]=J.z;na+=12}if(La.length)s=La[A.a],n=La[A.b],B=La[A.c],R=La[A.d],ga[x]=s.x,ga[x+1]=s.y,ga[x+2]=s.z,ga[x+3]=s.w,ga[x+4]=n.x,ga[x+5]=n.y,ga[x+6]=n.z,ga[x+7]=n.w,ga[x+8]=B.x,ga[x+9]=B.y,ga[x+10]=B.z,ga[x+11]=B.w,ga[x+12]=R.x,ga[x+13]=R.y,ga[x+14]=R.z,ga[x+15]=R.w,s=Oa[A.a],n=Oa[A.b],B=Oa[A.c],R=Oa[A.d],fa[x]=s.x,fa[x+1]=s.y,fa[x+2]=s.z,fa[x+3]=s.w,fa[x+4]=n.x,fa[x+5]=n.y,fa[x+6]=n.z,fa[x+7]=n.w,
-fa[x+8]=B.x,fa[x+9]=B.y,fa[x+10]=B.z,fa[x+11]=B.w,fa[x+12]=R.x,fa[x+13]=R.y,fa[x+14]=R.z,fa[x+15]=R.w,s=Ma[A.a],n=Ma[A.b],B=Ma[A.c],R=Ma[A.d],da[x]=s.x,da[x+1]=s.y,da[x+2]=s.z,da[x+3]=1,da[x+4]=n.x,da[x+5]=n.y,da[x+6]=n.z,da[x+7]=1,da[x+8]=B.x,da[x+9]=B.y,da[x+10]=B.z,da[x+11]=1,da[x+12]=R.x,da[x+13]=R.y,da[x+14]=R.z,da[x+15]=1,s=Na[A.a],n=Na[A.b],B=Na[A.c],A=Na[A.d],ea[x]=s.x,ea[x+1]=s.y,ea[x+2]=s.z,ea[x+3]=1,ea[x+4]=n.x,ea[x+5]=n.y,ea[x+6]=n.z,ea[x+7]=1,ea[x+8]=B.x,ea[x+9]=B.y,ea[x+10]=B.z,ea[x+
-11]=1,ea[x+12]=A.x,ea[x+13]=A.y,ea[x+14]=A.z,ea[x+15]=1,x+=16;if(Da&&v)E.length==4&&v==THREE.VertexColors?(A=E[0],s=E[1],n=E[2],E=E[3]):E=n=s=A=I,pa[ma]=A.r,pa[ma+1]=A.g,pa[ma+2]=A.b,pa[ma+3]=s.r,pa[ma+4]=s.g,pa[ma+5]=s.b,pa[ma+6]=n.r,pa[ma+7]=n.g,pa[ma+8]=n.b,pa[ma+9]=E.r,pa[ma+10]=E.g,pa[ma+11]=E.b,ma+=12;if(Ba&&ta.hasTangents)E=K[0],I=K[1],A=K[2],K=K[3],ca[Z]=E.x,ca[Z+1]=E.y,ca[Z+2]=E.z,ca[Z+3]=E.w,ca[Z+4]=I.x,ca[Z+5]=I.y,ca[Z+6]=I.z,ca[Z+7]=I.w,ca[Z+8]=A.x,ca[Z+9]=A.y,ca[Z+10]=A.z,ca[Z+11]=A.w,
-ca[Z+12]=K.x,ca[Z+13]=K.y,ca[Z+14]=K.z,ca[Z+15]=K.w,Z+=16;if(Aa&&y)if(D.length==4&&ya)for(K=0;K<4;K++)G=D[K],Y[S]=G.x,Y[S+1]=G.y,Y[S+2]=G.z,S+=3;else for(K=0;K<4;K++)Y[S]=G.x,Y[S+1]=G.y,Y[S+2]=G.z,S+=3;if(ua&&r!==void 0&&q)for(K=0;K<4;K++)D=r[K],ka[W]=D.u,ka[W+1]=D.v,W+=2;if(ua&&C!==void 0&&q)for(K=0;K<4;K++)D=C[K],la[$]=D.u,la[$+1]=D.v,$+=2;za&&(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,X[T]=ia,X[T+1]=ia+1,X[T+2]=ia,X[T+3]=ia+3,X[T+4]=ia+1,X[T+5]=ia+2,X[T+6]=
-ia+2,X[T+7]=ia+3,T+=8,ia+=4)}va&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,oa,u));if(aa)for(U in aa)n=aa[U],n.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.bufferData(e.ARRAY_BUFFER,n.array,u));if(Fa){s=0;for(n=Ha.length;s<n;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,ra[s],u)}Da&&ma>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,pa,u));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,
-m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,Y,u));Ba&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,ca,u));ua&&W>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ka,u));ua&&$>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,la,u));za&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ha,u),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,X,u));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,da,u),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ea,u),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,fa,u),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ga,u));w&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
-delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;xa(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=w=w=void 0;p=i.vertices;o=
-i.colors;q=p.length;m=o.length;v=i.__vertexArray;u=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<q;w++)t=p[w].position,k=w*3,v[k]=t.x,v[k+1]=t.y,v[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}if(y){for(w=0;w<m;w++)color=o[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
-if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=w=w=void 0;p=i.vertices;o=i.colors;q=p.length;m=o.length;v=i.__vertexArray;u=i.__colorArray;y=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<q;w++)t=p[w].position,k=w*3,v[k]=t.x,v[k+1]=t.y,v[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,v,j)}if(y){for(w=0;w<m;w++)color=o[w],k=w*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
-u,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=wa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,xa(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return bb}};
+!0;i.__dirtyColors=!0}if(!d.__webglActive){if(d instanceof THREE.Mesh)for(h in i=d.geometry,i.geometryGroups)j=i.geometryGroups[h],ka(f.__webglObjects,j,d);else d instanceof THREE.Ribbon||d instanceof THREE.Line||d instanceof THREE.ParticleSystem?(i=d.geometry,ka(f.__webglObjects,i,d)):THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes||d.immediateRenderCallback?f.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&
+f.__webglSprites.push(d);d.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){d=b.__objectsRemoved[0];f=b;if(d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line)ra(f.__webglObjects,d);else if(d instanceof THREE.Sprite){f=f.__webglSprites;h=d;i=void 0;for(i=f.length-1;i>=0;i--)f[i]==h&&f.splice(i,1)}else(d instanceof THREE.MarchingCubes||d.immediateRenderCallback)&&ra(f.__webglObjectsImmediate,d);d.__webglActive=
+!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d<f;d++)if(i=b.__webglObjects[d].object,m=j=h=void 0,i instanceof THREE.Mesh){h=i.geometry;k=0;for(o=h.geometryGroupsList.length;k<o;k++)if(j=h.geometryGroupsList[k],m=xa(j),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=j,A=e.DYNAMIC_DRAW,x=!h.dynamic,m.__inittedArrays){var E=p=t=void 0,B=void 0,I=E=void 0,F=void 0,K=void 0,R=void 0,O=y=D=r=
+v=u=q=void 0,P=void 0,J=void 0,s=B=R=B=K=F=void 0,n=void 0,C=n=s=F=void 0,S=void 0,V=C=n=s=E=E=I=R=B=C=n=s=S=C=n=s=S=C=n=s=void 0,ja=0,N=0,X=0,aa=0,W=0,T=0,$=0,U=0,na=0,w=0,oa=0,C=s=0,C=void 0,pa=m.__vertexArray,la=m.__uvArray,ma=m.__uv2Array,Z=m.__normalArray,da=m.__tangentArray,qa=m.__colorArray,ea=m.__skinVertexAArray,fa=m.__skinVertexBArray,ga=m.__skinIndexArray,ha=m.__skinWeightArray,sa=m.__morphTargetsArrays,ca=m.__webglCustomAttributes,n=void 0,ia=m.__faceArray,Y=m.__lineArray,za=m.__needsSmoothNormals,
+u=m.__vertexColorType,q=m.__uvType,v=m.__normalType,ua=i.geometry,wa=ua.__dirtyVertices,Aa=ua.__dirtyElements,va=ua.__dirtyUvs,Ba=ua.__dirtyNormals,Ca=ua.__dirtyTangents,Ea=ua.__dirtyColors,Ga=ua.__dirtyMorphTargets,Da=ua.vertices,Ha=m.faces,Ma=ua.faces,Ja=ua.faceVertexUvs[0],Ka=ua.faceVertexUvs[1],Oa=ua.skinVerticesA,Pa=ua.skinVerticesB,Qa=ua.skinIndices,Na=ua.skinWeights,Ia=ua.morphTargets;if(ca)for(V in ca)ca[V].offset=0,ca[V].offsetSrc=0;t=0;for(p=Ha.length;t<p;t++)if(E=Ha[t],B=Ma[E],Ja&&(r=Ja[E]),
+Ka&&(D=Ka[E]),E=B.vertexNormals,I=B.normal,F=B.vertexColors,K=B.color,R=B.vertexTangents,B instanceof THREE.Face3){if(wa)y=Da[B.a].position,O=Da[B.b].position,P=Da[B.c].position,pa[N]=y.x,pa[N+1]=y.y,pa[N+2]=y.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=P.x,pa[N+7]=P.y,pa[N+8]=P.z,N+=9;if(ca)for(V in ca)if(n=ca[V],n.__original.needsUpdate)s=n.offset,C=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[B.a],n.array[s+1]=n.value[B.b],n.array[s+2]=n.value[B.c]):
+n.boundTo==="faces"?(C=n.value[C],n.array[s]=C,n.array[s+1]=C,n.array[s+2]=C,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[C],n.array[s+1]=n.value[C+1],n.array[s+2]=n.value[C+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(y=n.value[B.a],O=n.value[B.b],P=n.value[B.c]):n.boundTo==="faces"?(P=O=y=C=n.value[C],n.offsetSrc++):n.boundTo==="faceVertices"&&(y=n.value[C],O=n.value[C+1],P=n.value[C+2],n.offsetSrc+=3),n.size===2?(n.array[s]=y.x,n.array[s+1]=y.y,
+n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=P.x,n.array[s+5]=P.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=y.r,n.array[s+1]=y.g,n.array[s+2]=y.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z),n.offset+=9):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=y.w,n.array[s+
+4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.offset+=12));if(Ga){s=0;for(n=Ia.length;s<n;s++)y=Ia[s].vertices[B.a].position,O=Ia[s].vertices[B.b].position,P=Ia[s].vertices[B.c].position,C=sa[s],C[oa]=y.x,C[oa+1]=y.y,C[oa+2]=y.z,C[oa+3]=O.x,C[oa+4]=O.y,C[oa+5]=O.z,C[oa+6]=P.x,C[oa+7]=P.y,C[oa+8]=P.z;oa+=9}if(Na.length)s=Na[B.a],n=Na[B.b],C=Na[B.c],ha[w]=s.x,ha[w+1]=s.y,ha[w+2]=s.z,ha[w+3]=s.w,ha[w+4]=n.x,ha[w+5]=n.y,
+ha[w+6]=n.z,ha[w+7]=n.w,ha[w+8]=C.x,ha[w+9]=C.y,ha[w+10]=C.z,ha[w+11]=C.w,s=Qa[B.a],n=Qa[B.b],C=Qa[B.c],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=n.x,ga[w+5]=n.y,ga[w+6]=n.z,ga[w+7]=n.w,ga[w+8]=C.x,ga[w+9]=C.y,ga[w+10]=C.z,ga[w+11]=C.w,s=Oa[B.a],n=Oa[B.b],C=Oa[B.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=1,ea[w+8]=C.x,ea[w+9]=C.y,ea[w+10]=C.z,ea[w+11]=1,s=Pa[B.a],n=Pa[B.b],C=Pa[B.c],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=1,fa[w+4]=n.x,
+fa[w+5]=n.y,fa[w+6]=n.z,fa[w+7]=1,fa[w+8]=C.x,fa[w+9]=C.y,fa[w+10]=C.z,fa[w+11]=1,w+=12;if(Ea&&u)F.length==3&&u==THREE.VertexColors?(B=F[0],s=F[1],n=F[2]):n=s=B=K,qa[na]=B.r,qa[na+1]=B.g,qa[na+2]=B.b,qa[na+3]=s.r,qa[na+4]=s.g,qa[na+5]=s.b,qa[na+6]=n.r,qa[na+7]=n.g,qa[na+8]=n.b,na+=9;if(Ca&&ua.hasTangents)F=R[0],K=R[1],B=R[2],da[$]=F.x,da[$+1]=F.y,da[$+2]=F.z,da[$+3]=F.w,da[$+4]=K.x,da[$+5]=K.y,da[$+6]=K.z,da[$+7]=K.w,da[$+8]=B.x,da[$+9]=B.y,da[$+10]=B.z,da[$+11]=B.w,$+=12;if(Ba&&v)if(E.length==3&&
+za)for(R=0;R<3;R++)I=E[R],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;else for(R=0;R<3;R++)Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;if(va&&r!==void 0&&q)for(R=0;R<3;R++)E=r[R],la[X]=E.u,la[X+1]=E.v,X+=2;if(va&&D!==void 0&&q)for(R=0;R<3;R++)E=D[R],ma[aa]=E.u,ma[aa+1]=E.v,aa+=2;Aa&&(ia[W]=ja,ia[W+1]=ja+1,ia[W+2]=ja+2,W+=3,Y[U]=ja,Y[U+1]=ja+1,Y[U+2]=ja,Y[U+3]=ja+2,Y[U+4]=ja+1,Y[U+5]=ja+2,U+=6,ja+=3)}else if(B instanceof THREE.Face4){if(wa)y=Da[B.a].position,O=Da[B.b].position,P=Da[B.c].position,J=Da[B.d].position,
+pa[N]=y.x,pa[N+1]=y.y,pa[N+2]=y.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=P.x,pa[N+7]=P.y,pa[N+8]=P.z,pa[N+9]=J.x,pa[N+10]=J.y,pa[N+11]=J.z,N+=12;if(ca)for(V in ca)if(n=ca[V],n.__original.needsUpdate)s=n.offset,C=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[B.a],n.array[s+1]=n.value[B.b],n.array[s+2]=n.value[B.c],n.array[s+3]=n.value[B.d]):n.boundTo==="faces"?(C=n.value[C],n.array[s]=C,n.array[s+1]=C,n.array[s+2]=C,n.array[s+3]=C,n.offsetSrc++):n.boundTo===
+"faceVertices"&&(n.array[s]=n.value[C],n.array[s+1]=n.value[C+1],n.array[s+2]=n.value[C+2],n.array[s+3]=n.value[C+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(y=n.value[B.a],O=n.value[B.b],P=n.value[B.c],J=n.value[B.d]):n.boundTo==="faces"?(J=P=O=y=C=n.value[C],n.offsetSrc++):n.boundTo==="faceVertices"&&(y=n.value[C],O=n.value[C+1],P=n.value[C+2],J=n.value[C+3],n.offsetSrc+=4),n.size===2?(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=O.x,n.array[s+3]=O.y,n.array[s+4]=
+P.x,n.array[s+5]=P.y,n.array[s+6]=J.x,n.array[s+7]=J.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=y.r,n.array[s+1]=y.g,n.array[s+2]=y.b,n.array[s+3]=O.r,n.array[s+4]=O.g,n.array[s+5]=O.b,n.array[s+6]=P.r,n.array[s+7]=P.g,n.array[s+8]=P.b,n.array[s+9]=J.r,n.array[s+10]=J.g,n.array[s+11]=J.b):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=O.x,n.array[s+4]=O.y,n.array[s+5]=O.z,n.array[s+6]=P.x,n.array[s+7]=P.y,n.array[s+8]=P.z,n.array[s+9]=J.x,n.array[s+10]=J.y,n.array[s+11]=J.z),
+n.offset+=12):(n.array[s]=y.x,n.array[s+1]=y.y,n.array[s+2]=y.z,n.array[s+3]=y.w,n.array[s+4]=O.x,n.array[s+5]=O.y,n.array[s+6]=O.z,n.array[s+7]=O.w,n.array[s+8]=P.x,n.array[s+9]=P.y,n.array[s+10]=P.z,n.array[s+11]=P.w,n.array[s+12]=J.x,n.array[s+13]=J.y,n.array[s+14]=J.z,n.array[s+15]=J.w,n.offset+=16));if(Ga){s=0;for(n=Ia.length;s<n;s++)y=Ia[s].vertices[B.a].position,O=Ia[s].vertices[B.b].position,P=Ia[s].vertices[B.c].position,J=Ia[s].vertices[B.d].position,C=sa[s],C[oa]=y.x,C[oa+1]=y.y,C[oa+2]=
+y.z,C[oa+3]=O.x,C[oa+4]=O.y,C[oa+5]=O.z,C[oa+6]=P.x,C[oa+7]=P.y,C[oa+8]=P.z,C[oa+9]=J.x,C[oa+10]=J.y,C[oa+11]=J.z;oa+=12}if(Na.length)s=Na[B.a],n=Na[B.b],C=Na[B.c],S=Na[B.d],ha[w]=s.x,ha[w+1]=s.y,ha[w+2]=s.z,ha[w+3]=s.w,ha[w+4]=n.x,ha[w+5]=n.y,ha[w+6]=n.z,ha[w+7]=n.w,ha[w+8]=C.x,ha[w+9]=C.y,ha[w+10]=C.z,ha[w+11]=C.w,ha[w+12]=S.x,ha[w+13]=S.y,ha[w+14]=S.z,ha[w+15]=S.w,s=Qa[B.a],n=Qa[B.b],C=Qa[B.c],S=Qa[B.d],ga[w]=s.x,ga[w+1]=s.y,ga[w+2]=s.z,ga[w+3]=s.w,ga[w+4]=n.x,ga[w+5]=n.y,ga[w+6]=n.z,ga[w+7]=n.w,
+ga[w+8]=C.x,ga[w+9]=C.y,ga[w+10]=C.z,ga[w+11]=C.w,ga[w+12]=S.x,ga[w+13]=S.y,ga[w+14]=S.z,ga[w+15]=S.w,s=Oa[B.a],n=Oa[B.b],C=Oa[B.c],S=Oa[B.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=1,ea[w+4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=1,ea[w+8]=C.x,ea[w+9]=C.y,ea[w+10]=C.z,ea[w+11]=1,ea[w+12]=S.x,ea[w+13]=S.y,ea[w+14]=S.z,ea[w+15]=1,s=Pa[B.a],n=Pa[B.b],C=Pa[B.c],B=Pa[B.d],fa[w]=s.x,fa[w+1]=s.y,fa[w+2]=s.z,fa[w+3]=1,fa[w+4]=n.x,fa[w+5]=n.y,fa[w+6]=n.z,fa[w+7]=1,fa[w+8]=C.x,fa[w+9]=C.y,fa[w+10]=C.z,fa[w+
+11]=1,fa[w+12]=B.x,fa[w+13]=B.y,fa[w+14]=B.z,fa[w+15]=1,w+=16;if(Ea&&u)F.length==4&&u==THREE.VertexColors?(B=F[0],s=F[1],n=F[2],F=F[3]):F=n=s=B=K,qa[na]=B.r,qa[na+1]=B.g,qa[na+2]=B.b,qa[na+3]=s.r,qa[na+4]=s.g,qa[na+5]=s.b,qa[na+6]=n.r,qa[na+7]=n.g,qa[na+8]=n.b,qa[na+9]=F.r,qa[na+10]=F.g,qa[na+11]=F.b,na+=12;if(Ca&&ua.hasTangents)F=R[0],K=R[1],B=R[2],R=R[3],da[$]=F.x,da[$+1]=F.y,da[$+2]=F.z,da[$+3]=F.w,da[$+4]=K.x,da[$+5]=K.y,da[$+6]=K.z,da[$+7]=K.w,da[$+8]=B.x,da[$+9]=B.y,da[$+10]=B.z,da[$+11]=B.w,
+da[$+12]=R.x,da[$+13]=R.y,da[$+14]=R.z,da[$+15]=R.w,$+=16;if(Ba&&v)if(E.length==4&&za)for(R=0;R<4;R++)I=E[R],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;else for(R=0;R<4;R++)Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;if(va&&r!==void 0&&q)for(R=0;R<4;R++)E=r[R],la[X]=E.u,la[X+1]=E.v,X+=2;if(va&&D!==void 0&&q)for(R=0;R<4;R++)E=D[R],ma[aa]=E.u,ma[aa+1]=E.v,aa+=2;Aa&&(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,Y[U]=ja,Y[U+1]=ja+1,Y[U+2]=ja,Y[U+3]=ja+3,Y[U+4]=ja+1,Y[U+5]=ja+2,Y[U+
+6]=ja+2,Y[U+7]=ja+3,U+=8,ja+=4)}wa&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,pa,A));if(ca)for(V in ca)n=ca[V],n.__original.needsUpdate&&(e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.bufferData(e.ARRAY_BUFFER,n.array,A));if(Ga){s=0;for(n=Ia.length;s<n;s++)e.bindBuffer(e.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),e.bufferData(e.ARRAY_BUFFER,sa[s],A)}Ea&&na>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,qa,A));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,
+m.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,Z,A));Ca&&ua.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,da,A));va&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,la,A));va&&aa>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ma,A));Aa&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ia,A),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,Y,A));w>0&&(e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,ea,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,fa,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,ga,A),e.bindBuffer(e.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ha,A));x&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
+delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ya(j)}else if(i instanceof THREE.Ribbon){h=i.geometry;if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=x=x=void 0;p=i.vertices;o=
+i.colors;q=p.length;m=o.length;u=i.__vertexArray;A=i.__colorArray;v=i.__dirtyColors;if(i.__dirtyVertices){for(x=0;x<q;x++)t=p[x].position,k=x*3,u[k]=t.x,u[k+1]=t.y,u[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}if(v){for(x=0;x<m;x++)color=o[x],k=x*3,A[k]=color.r,A[k+1]=color.g,A[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,A,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){h=i.geometry;
+if(h.__dirtyVertices||h.__dirtyColors){i=h;j=e.DYNAMIC_DRAW;k=t=x=x=void 0;p=i.vertices;o=i.colors;q=p.length;m=o.length;u=i.__vertexArray;A=i.__colorArray;v=i.__dirtyColors;if(i.__dirtyVertices){for(x=0;x<q;x++)t=p[x].position,k=x*3,u[k]=t.x,u[k+1]=t.y,u[k+2]=t.z;e.bindBuffer(e.ARRAY_BUFFER,i.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,u,j)}if(v){for(x=0;x<m;x++)color=o[x],k=x*3,A[k]=color.r,A[k+1]=color.g,A[k+2]=color.b;e.bindBuffer(e.ARRAY_BUFFER,i.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,
+A,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)h=i.geometry,m=xa(h),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||m)&&c(h,e.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW),b=="back"?e.cullFace(e.BACK):b=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return cb}};
 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};

+ 1 - 1
examples/canvas_camera_orthographic.html

@@ -136,7 +136,7 @@
 
 				camera.position.x = Math.cos( timer ) * 200;
 				camera.position.z = Math.sin( timer ) * 200;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_geometry_earth.html

@@ -110,7 +110,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				mesh.rotation.y -= 0.005;
 

+ 1 - 1
examples/canvas_geometry_hierarchy.html

@@ -107,7 +107,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				group.rotation.x = Math.sin( new Date().getTime() * 0.0007 ) * 0.5;
 				group.rotation.y = Math.sin( new Date().getTime() * 0.0003 ) * 0.5;

+ 1 - 1
examples/canvas_geometry_terrain.html

@@ -195,7 +195,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_interactive_cubes.html

@@ -154,7 +154,7 @@
 				camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
 				camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
 				camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_interactive_cubes_tween.html

@@ -142,7 +142,7 @@
 				camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
 				camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
 				camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_interactive_particles.html

@@ -129,7 +129,7 @@
 				camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
 				camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
 				camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				// find intersections
 

+ 1 - 1
examples/canvas_lines.html

@@ -147,7 +147,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY + 200 - camera.position.y ) * .05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_lines_sphere.html

@@ -161,7 +161,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY + 200 - camera.position.y ) * .05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_materials.html

@@ -195,7 +195,7 @@
 
 				camera.position.x = Math.cos( timer ) * 1000;
 				camera.position.z = Math.sin( timer ) * 1000;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				for ( var i = 0, l = objects.length; i < l; i++ ) {
 

+ 1 - 1
examples/canvas_materials_video.html

@@ -189,7 +189,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				if ( video.readyState === video.HAVE_ENOUGH_DATA ) {
 

+ 1 - 1
examples/canvas_particles_floor.html

@@ -134,7 +134,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_particles_random.html

@@ -127,7 +127,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				group.rotation.x += 0.01;
 				group.rotation.y += 0.02;

+ 1 - 1
examples/canvas_particles_sprites.html

@@ -173,7 +173,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * 0.05;
 				camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/canvas_particles_waves.html

@@ -145,7 +145,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				var i = 0;
 

+ 1 - 1
examples/canvas_performance.html

@@ -128,7 +128,7 @@
 
 			function render() {
 
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 1 - 1
examples/misc_lookat.html

@@ -133,7 +133,7 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-				camera.lookAt( scene.origin );
+				camera.lookAt( scene.position );
 
 				renderer.render( scene, camera );
 

+ 17 - 36
examples/webgl_geometry_subdivison.html

@@ -110,7 +110,7 @@
 
 			function nextSubdivision( x ) {
 
-				subdivisions += x;
+				subdivisions = Math.max( 0, subdivisions + x );
 				addStuff();
 
 			}
@@ -144,22 +144,11 @@
 
 				var params = geometriesParams[ geometryIndex ];
 
-
-				//geometry = new THREE.CubeGeometry( 200, 200, 200, 2, 2, 2, materials );
 				geometry = createSomething( THREE[ params.type ], params.args );
 
 				// Cloning original geometry for debuging
 
-				smooth = geometry;
-
-				if ( subdivisions > 0 ) {
-
-					// Really werid, you get an error after
-					// you clone an object with no subdivisions
-
-					geometry = THREE.GeometryUtils.clone( geometry );
-
-				}
+				smooth = THREE.GeometryUtils.clone( geometry );
 
 				// mergeVertices(); is run in case of duplicated vertices
 				smooth.mergeVertices();
@@ -167,10 +156,10 @@
 
 				info.innerHTML = 'Drag to spin the geometry THREE.' + params.type
 				 	+ ' with ' + modifier.subdivisions + ' subdivisions'  +
-					'<br/>Subdivision <a href="#" onclick="nextSubdivision(1); return false;">+</a>/<a href="#" onclick="nextSubdivision(-1); return false;">-</a>' +
-					'<br/>Geometry: <a href="#" onclick="nextGeometry();return false;">next</a>' +
-					'<br/>vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length +
-					'<br/>face count: before ' + geometry.faces.length + ' after ' + smooth.faces.length
+					'<br>Subdivision <a href="#" onclick="nextSubdivision(1); return false;">+</a>/<a href="#" onclick="nextSubdivision(-1); return false;">-</a>' +
+					'<br>Geometry: <a href="#" onclick="nextGeometry();return false;">next</a>' +
+					'<br>vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length +
+					'<br>face count: before ' + geometry.faces.length + ' after ' + smooth.faces.length
 				; //+ params.args;
 
 				var faceABCD = "abcd";
@@ -200,7 +189,7 @@
 
 
 				group = new THREE.Object3D();
-				group.position.y = 150;
+				group.add( new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x0000ff, wireframe: true } ) ) );
 				scene.add( group );
 
 				// Debug new Points
@@ -247,19 +236,9 @@
 				// }
 				//
 
-				var meshmaterials = [
-				 	// new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
-					new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
-					new THREE.MeshBasicMaterial( { color: 0x405040, wireframe:true,  opacity:0.8 } )
-				];
-
-				// new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading, vertexColors: THREE.VertexColors } ),
-				// new THREE.MeshBasicMaterial( { color: 0x000000, shading: THREE.FlatShading, wireframe: true } )
-				// new THREE.MeshFaceMaterial()
-				// new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.FlatShading } );
-				// new THREE.MeshPhongMaterial( { color: 0xffffff, shading: THREE.SmoothShading } );
+				var material = new THREE.MeshLambertMaterial( { color: 0xffffff, vertexColors: THREE.VertexColors } );
 
-				 cube = new THREE.Mesh( smooth, meshmaterials );
+				cube = new THREE.Mesh( smooth, material );
 
 				var toscale =  params.scale ? params.scale : 1;
 
@@ -267,10 +246,10 @@
 				cube.scale.y = toscale;
 				cube.scale.z = toscale;
 
-				cube.position.y = 150;
-
 				scene.add( cube );
 
+				group.scale.copy( cube.scale );
+
 			}
 
 			function init() {
@@ -287,11 +266,14 @@
 				container.appendChild( info );
 
 				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
-				camera.position.y = 150;
 				camera.position.z = 500;
 
 				scene = new THREE.Scene();
 
+				var light = new THREE.PointLight( 0xffffff, 1.5 );
+				light.position.set( 1000, 1000, 2000 );
+				scene.add( light );
+
 				addStuff();
 
 				renderer = new THREE.WebGLRenderer(); // WebGLRenderer CanvasRenderer
@@ -387,11 +369,10 @@
 
 			function render() {
 
+				group.rotation.x = cube.rotation.x += ( targetXRotation - cube.rotation.x ) * 0.05;
 				group.rotation.y = cube.rotation.y += ( targetYRotation - cube.rotation.y ) * 0.05;
-				renderer.render( scene, camera );
 
-				group.rotation.x = cube.rotation.x += ( targetXRotation - cube.rotation.x ) * 0.05;
-				//console.log(cube.rotation.x);
+				renderer.render( scene, camera );
 
 			}
 

+ 2 - 8
src/renderers/CanvasRenderer.js

@@ -374,7 +374,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 			var l, ll, light, lightColor,
 			lights = scene.lights;
 
-			_ambientLight.setRGB( 0, 0, 0 );
+			_ambientLight.copy( scene.ambientColor );
 			_directionalLights.setRGB( 0, 0, 0 );
 			_pointLights.setRGB( 0, 0, 0 );
 
@@ -383,13 +383,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 				light = lights[ l ];
 				lightColor = light.color;
 
-				if ( light instanceof THREE.AmbientLight ) {
-
-					_ambientLight.r += lightColor.r;
-					_ambientLight.g += lightColor.g;
-					_ambientLight.b += lightColor.b;
-
-				} else if ( light instanceof THREE.DirectionalLight ) {
+				if ( light instanceof THREE.DirectionalLight ) {
 
 					// for particles
 

+ 2 - 8
src/renderers/SVGRenderer.js

@@ -245,7 +245,7 @@ THREE.SVGRenderer = function () {
 		var l, ll, light, lightColor,
 		lights = scene.lights;
 
-		_ambientLight.setRGB( 0, 0, 0 );
+		_ambientLight.copy( scene.ambientColor );
 		_directionalLights.setRGB( 0, 0, 0 );
 		_pointLights.setRGB( 0, 0, 0 );
 
@@ -254,13 +254,7 @@ THREE.SVGRenderer = function () {
 			light = lights[ l ];
 			lightColor = light.color;
 
-			if ( light instanceof THREE.AmbientLight ) {
-
-				_ambientLight.r += lightColor.r;
-				_ambientLight.g += lightColor.g;
-				_ambientLight.b += lightColor.b;
-
-			} else if ( light instanceof THREE.DirectionalLight ) {
+			if ( light instanceof THREE.DirectionalLight ) {
 
 				_directionalLights.r += lightColor.r;
 				_directionalLights.g += lightColor.g;

+ 3 - 3
src/renderers/WebGLRenderer.js

@@ -380,7 +380,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	//
 
-	function setupLights ( program, lights ) {
+	function setupLights( program, lights ) {
 
 		var l, ll, light, n,
 		r = 0, g = 0, b = 0,
@@ -410,13 +410,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 			intensity = light.intensity;
 			distance = light.distance;
 
-			if ( light instanceof THREE.AmbientLight ) {
+			if ( /*light instanceof THREE.AmbientLight ) {
 
 				r += color.r;
 				g += color.g;
 				b += color.b;
 
-			} else if ( light instanceof THREE.DirectionalLight ) {
+			} else if (*/ light instanceof THREE.DirectionalLight ) {
 
 				doffset = dlength * 3;
 

+ 10 - 3
src/scenes/Scene.js

@@ -7,11 +7,10 @@ THREE.Scene = function () {
 
 	THREE.Object3D.call( this );
 
-	this.matrixAutoUpdate = false;
-
+	this.ambientColor = new THREE.Color();
 	this.fog = null;
 
-	this.origin = new THREE.Vector3();
+	this.matrixAutoUpdate = false;
 
 	this.overrideMaterial = null;
 
@@ -31,6 +30,14 @@ THREE.Scene.prototype.supr = THREE.Object3D.prototype;
 
 THREE.Scene.prototype.add = function ( object ) {
 
+	if ( object instanceof THREE.AmbientLight ) {
+
+		console.warn( 'DEPRECATED: AmbientLight( hex ) is now scene.ambientColor.setHex( hex ).' );
+		this.ambientColor.setHex( object.color.getHex() );
+		return;
+
+	}
+
 	this.supr.add.call( this, object );
 	this.addChildRecurse( object );