Browse Source

Added renderer.shadowMapAutoUpdate parameter.

This is for being able to render shadowmap just once per frame - all dynamic cubemap faces and full scene can share the same shadowmap (at least until we don't have camera-specific fine-tuned shadowmaps).
alteredq 14 years ago
parent
commit
15c899b46f
4 changed files with 182 additions and 171 deletions
  1. 143 143
      build/Three.js
  2. 27 27
      build/custom/ThreeWebGL.js
  3. 3 0
      examples/webgl_shading_physical.html
  4. 9 1
      src/renderers/WebGLRenderer.js

+ 143 - 143
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}for(var f,h=[],k=0,m=b.children.length;k<m;k++)Array.prototype.push.apply(h,this.intersectObject(b.children[k]));if(b instanceof THREE.Particle){k=c(this.origin,this.direction,b.matrixWorld.getPosition());if(k==null||k>b.scale.x)return[];f={distance:k,point:b.position,face:null,object:b};h.push(f)}else if(b instanceof THREE.Mesh){k=c(this.origin,
-this.direction,b.matrixWorld.getPosition());if(k==null||k>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var n,u,t,w,o,x,v,z,A=b.geometry,y=A.vertices,k=0,m=A.faces.length;k<m;k++)if(f=A.faces[k],v=this.origin.clone(),z=this.direction.clone(),w=b.matrixWorld,n=w.multiplyVector3(f.centroid.clone()).subSelf(v),x=n.dot(z),!(x<=0)&&(n=w.multiplyVector3(y[f.a].position.clone()),u=w.multiplyVector3(y[f.b].position.clone()),t=w.multiplyVector3(y[f.c].position.clone()),
-w=f instanceof THREE.Face4?w.multiplyVector3(y[f.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(f.normal.clone()),x=z.dot(o),b.doubleSided||(b.flipSided?x>0:x<0)))if(x=o.dot((new THREE.Vector3).sub(n,v))/x,v=v.addSelf(z.multiplyScalar(x)),f instanceof THREE.Face3)e(v,n,u,t)&&(f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f));else if(f instanceof THREE.Face4&&(e(v,n,u,w)||e(v,u,t,w)))f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f)}return h}};
+this.direction,b.matrixWorld.getPosition());if(k==null||k>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var n,u,t,w,o,x,v,A,z=b.geometry,y=z.vertices,k=0,m=z.faces.length;k<m;k++)if(f=z.faces[k],v=this.origin.clone(),A=this.direction.clone(),w=b.matrixWorld,n=w.multiplyVector3(f.centroid.clone()).subSelf(v),x=n.dot(A),!(x<=0)&&(n=w.multiplyVector3(y[f.a].position.clone()),u=w.multiplyVector3(y[f.b].position.clone()),t=w.multiplyVector3(y[f.c].position.clone()),
+w=f instanceof THREE.Face4?w.multiplyVector3(y[f.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(f.normal.clone()),x=A.dot(o),b.doubleSided||(b.flipSided?x>0:x<0)))if(x=o.dot((new THREE.Vector3).sub(n,v))/x,v=v.addSelf(A.multiplyScalar(x)),f instanceof THREE.Face3)e(v,n,u,t)&&(f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f));else if(f instanceof THREE.Face4&&(e(v,n,u,w)||e(v,u,t,w)))f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f)}return h}};
 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,o){n=!1;c=k;e=m;f=w;h=o;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,o,x,v){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<o?m<v?m:v:o<v?o:v,f=k>w?k>x?k:x:w>x?w:x,h=m>o?m>v?m:v:o>v?o: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<o?m<v?m<e?m:e:v<e?v:e:o<v?o<e?o: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>o?m>v?m>h?m:h:v>h?v:h:o>v?o>h?o: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,u,t,w,o,x,v,z,A){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,u||0,t||0,w!==void 0?w:1,o||0,x||0,v||0,z||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,u,t,w,o,x,v,z,A){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=u;this.n32=t;this.n33=w;this.n34=o;this.n41=x;this.n42=v;this.n43=z;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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,u,t,w,o,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,u||0,t||0,w!==void 0?w:1,o||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,u,t,w,o,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=u;this.n32=t;this.n33=w;this.n34=o;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,
 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,u=b.n23,t=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,z=b.n41,A=b.n42,y=b.n43,E=b.n44,F=c.n11,C=c.n12,
-G=c.n13,J=c.n14,M=c.n21,K=c.n22,B=c.n23,L=c.n24,Y=c.n31,H=c.n32,T=c.n33,Q=c.n34,Z=c.n41,$=c.n42,P=c.n43,p=c.n44;this.n11=e*F+f*M+h*Y+k*Z;this.n12=e*C+f*K+h*H+k*$;this.n13=e*G+f*B+h*T+k*P;this.n14=e*J+f*L+h*Q+k*p;this.n21=m*F+n*M+u*Y+t*Z;this.n22=m*C+n*K+u*H+t*$;this.n23=m*G+n*B+u*T+t*P;this.n24=m*J+n*L+u*Q+t*p;this.n31=w*F+o*M+x*Y+v*Z;this.n32=w*C+o*K+x*H+v*$;this.n33=w*G+o*B+x*T+v*P;this.n34=w*J+o*L+x*Q+v*p;this.n41=z*F+A*M+y*Y+E*Z;this.n42=z*C+A*K+y*H+E*$;this.n43=z*G+A*B+y*T+E*P;this.n44=z*J+A*
+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,u=b.n23,t=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44,F=c.n11,C=c.n12,
+G=c.n13,J=c.n14,M=c.n21,K=c.n22,B=c.n23,L=c.n24,Y=c.n31,H=c.n32,T=c.n33,Q=c.n34,Z=c.n41,$=c.n42,P=c.n43,p=c.n44;this.n11=e*F+f*M+h*Y+k*Z;this.n12=e*C+f*K+h*H+k*$;this.n13=e*G+f*B+h*T+k*P;this.n14=e*J+f*L+h*Q+k*p;this.n21=m*F+n*M+u*Y+t*Z;this.n22=m*C+n*K+u*H+t*$;this.n23=m*G+n*B+u*T+t*P;this.n24=m*J+n*L+u*Q+t*p;this.n31=w*F+o*M+x*Y+v*Z;this.n32=w*C+o*K+x*H+v*$;this.n33=w*G+o*B+x*T+v*P;this.n34=w*J+o*L+x*Q+v*p;this.n41=A*F+z*M+y*Y+E*Z;this.n42=A*C+z*K+y*H+E*$;this.n43=A*G+z*B+y*T+E*P;this.n44=A*J+z*
 L+y*Q+E*p;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,u=this.n31,t=this.n32,w=this.n33,o=this.n34,x=this.n41,v=this.n42,z=this.n43,A=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*o*x-c*m*o*x-f*m*u*v+e*n*u*v+f*h*w*v-b*n*w*v-e*h*o*v+b*m*o*v+f*k*u*z-c*n*u*z-f*h*t*z+b*n*t*z+c*h*o*z-b*k*o*z-e*k*u*A+c*m*u*A+e*h*t*A-b*m*t*A-c*h*w*A+b*k*w*A},
+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,u=this.n31,t=this.n32,w=this.n33,o=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*o*x-c*m*o*x-f*m*u*v+e*n*u*v+f*h*w*v-b*n*w*v-e*h*o*v+b*m*o*v+f*k*u*A-c*n*u*A-f*h*t*A+b*n*t*A+c*h*o*A-b*k*o*A-e*k*u*z+c*m*u*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]=this.n34;
@@ -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,u=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,u=b.n23,t=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,z=b.n41,A=b.n42,y=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=u*v*A-t*x*A+t*o*y-n*v*y-u*o*E+n*x*E;c.n12=k*x*A-h*v*A-k*o*y+f*v*y+h*o*E-f*x*E;c.n13=h*t*A-k*u*A+k*n*y-f*t*y-h*n*E+f*u*E;c.n14=k*u*o-h*t*o-k*n*x+f*t*x+h*n*v-f*u*v;c.n21=t*x*z-u*v*z-t*w*y+m*v*y+u*w*E-m*x*E;c.n22=h*v*z-k*x*z+k*w*y-e*v*y-h*w*E+e*x*E;c.n23=k*u*z-h*t*z-k*m*y+e*t*y+h*m*E-e*u*E;c.n24=
-h*t*w-k*u*w+k*m*x-e*t*x-h*m*v+e*u*v;c.n31=n*v*z-t*o*z+t*w*A-m*v*A-n*w*E+m*o*E;c.n32=k*o*z-f*v*z-k*w*A+e*v*A+f*w*E-e*o*E;c.n33=h*t*z-k*n*z+k*m*A-e*t*A-f*m*E+e*n*E;c.n34=k*n*w-f*t*w-k*m*o+e*t*o+f*m*v-e*n*v;c.n41=u*o*z-n*x*z-u*w*A+m*x*A+n*w*y-m*o*y;c.n42=f*x*z-h*o*z+h*w*A-e*x*A-f*w*y+e*o*y;c.n43=h*n*z-f*u*z-h*m*A+e*u*A+f*m*y-e*n*y;c.n44=f*u*w-h*n*w+h*m*o-e*u*o-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,u=b.n23,t=b.n24,w=b.n31,o=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=u*v*z-t*x*z+t*o*y-n*v*y-u*o*E+n*x*E;c.n12=k*x*z-h*v*z-k*o*y+f*v*y+h*o*E-f*x*E;c.n13=h*t*z-k*u*z+k*n*y-f*t*y-h*n*E+f*u*E;c.n14=k*u*o-h*t*o-k*n*x+f*t*x+h*n*v-f*u*v;c.n21=t*x*A-u*v*A-t*w*y+m*v*y+u*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*u*A-h*t*A-k*m*y+e*t*y+h*m*E-e*u*E;c.n24=
+h*t*w-k*u*w+k*m*x-e*t*x-h*m*v+e*u*v;c.n31=n*v*A-t*o*A+t*w*z-m*v*z-n*w*E+m*o*E;c.n32=k*o*A-f*v*A-k*w*z+e*v*z+f*w*E-e*o*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*o+e*t*o+f*m*v-e*n*v;c.n41=u*o*A-n*x*A-u*w*z+m*x*z+n*w*y-m*o*y;c.n42=f*x*A-h*o*A+h*w*z-e*x*z-f*w*y+e*o*y;c.n43=h*n*A-f*u*A-h*m*z+e*u*z+f*m*y-e*n*y;c.n44=f*u*w-h*n*w+h*m*o-e*u*o-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,u=-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,o=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*u;e[6]=b*t;e[7]=b*w;e[8]=b*o;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,u,t;m=new THREE.Matrix4;n=c-b;u=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/u;m.n23=0;m.n24=-((e+f)/u);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,16 +54,16 @@ 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=u[n]=u[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,u=[],t,w,o=[],x,v=[],z,A,y=[],E,F,C=[],G=[],J=[],M=new THREE.Vector4,K=new THREE.Vector4,
+THREE.Projector=function(){function b(){var b=u[n]=u[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,u=[],t,w,o=[],x,v=[],A,z,y=[],E,F,C=[],G=[],J=[],M=new THREE.Vector4,K=new THREE.Vector4,
 B=new THREE.Matrix4,L=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,T=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.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,
 b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectObjects=function(b,e,m){var n,p;h=G.length=0;n=b.objects;b=0;for(e=n.length;b<e;b++){p=n[b];var u;if(!(u=!p.visible))if(u=p instanceof THREE.Mesh)if(u=p.frustumCulled){a:{u=void 0;for(var t=p.matrixWorld,v=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),o=0;o<6;o++)if(u=Y[o].x*t.n14+Y[o].y*t.n24+Y[o].z*t.n34+Y[o].w,u<=v){u=!1;break a}u=!0}u=
-!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,M.copy(p.position),B.multiplyVector3(M),f.object=p,f.z=M.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=function(f,k,h){var G=k.near,p=k.far,M,fa,ea,ha,ga,ka,na,aa,W,U,ia,ja,ta,la,ca,pa,ra;F=A=x=w=J.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);Y[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);Y[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);
+!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,M.copy(p.position),B.multiplyVector3(M),f.object=p,f.z=M.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=function(f,k,h){var G=k.near,p=k.far,M,fa,ea,ha,ga,ka,na,aa,W,U,ia,ja,ta,la,ca,pa,ra;F=z=x=w=J.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);Y[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);Y[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);
 Y[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);Y[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);Y[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);Y[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(M=0;M<6;M++)W=Y[M],W.divideScalar(Math.sqrt(W.x*W.x+W.y*W.y+W.z*W.z));W=this.projectObjects(f,k,!0);f=0;for(M=W.length;f<M;f++)if(U=W[f].object,U.visible)if(ia=U.matrixWorld,ja=U.matrixRotationWorld,ta=U.materials,la=U.overdraw,n=0,U instanceof THREE.Mesh){ca=U.geometry;
 ha=ca.vertices;pa=ca.faces;ca=ca.faceVertexUvs;fa=0;for(ea=ha.length;fa<ea;fa++)m=b(),m.positionWorld.copy(ha[fa].position),ia.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>G&&m.positionScreen.z<p;ha=0;for(fa=pa.length;ha<fa;ha++){ea=pa[ha];if(ea instanceof THREE.Face3)if(ga=u[ea.a],ka=u[ea.b],na=u[ea.c],ga.visible&&ka.visible&&na.visible&&
 (U.doubleSided||U.flipSided!=(na.positionScreen.x-ga.positionScreen.x)*(ka.positionScreen.y-ga.positionScreen.y)-(na.positionScreen.y-ga.positionScreen.y)*(ka.positionScreen.x-ga.positionScreen.x)<0))aa=o[w]=o[w]||new THREE.RenderableFace3,w++,t=aa,t.v1.copy(ga),t.v2.copy(ka),t.v3.copy(na);else continue;else if(ea instanceof THREE.Face4)if(ga=u[ea.a],ka=u[ea.b],na=u[ea.c],aa=u[ea.d],ga.visible&&ka.visible&&na.visible&&aa.visible&&(U.doubleSided||U.flipSided!=((aa.positionScreen.x-ga.positionScreen.x)*
 (ka.positionScreen.y-ga.positionScreen.y)-(aa.positionScreen.y-ga.positionScreen.y)*(ka.positionScreen.x-ga.positionScreen.x)<0||(ka.positionScreen.x-na.positionScreen.x)*(aa.positionScreen.y-na.positionScreen.y)-(ka.positionScreen.y-na.positionScreen.y)*(aa.positionScreen.x-na.positionScreen.x)<0)))ra=v[x]=v[x]||new THREE.RenderableFace4,x++,t=ra,t.v1.copy(ga),t.v2.copy(ka),t.v3.copy(na),t.v4.copy(aa);else continue;t.normalWorld.copy(ea.normal);ja.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ea.centroid);
 ia.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);B.multiplyVector3(t.centroidScreen);na=ea.vertexNormals;ga=0;for(ka=na.length;ga<ka;ga++)aa=t.vertexNormalsWorld[ga],aa.copy(na[ga]),ja.multiplyVector3(aa);ga=0;for(ka=ca.length;ga<ka;ga++)if(ra=ca[ga][ha]){na=0;for(aa=ra.length;na<aa;na++)t.uvs[ga][na]=ra[na]}t.meshMaterials=ta;t.faceMaterials=ea.materials;t.overdraw=la;t.z=t.centroidScreen.z;J.push(t)}}else if(U instanceof THREE.Line){L.multiply(B,ia);ha=U.geometry.vertices;
-ga=b();ga.positionScreen.copy(ha[0].position);L.multiplyVector4(ga.positionScreen);fa=1;for(ea=ha.length;fa<ea;fa++)if(ga=b(),ga.positionScreen.copy(ha[fa].position),L.multiplyVector4(ga.positionScreen),ka=u[n-2],H.copy(ga.positionScreen),T.copy(ka.positionScreen),e(H,T))H.multiplyScalar(1/H.w),T.multiplyScalar(1/T.w),ia=y[A]=y[A]||new THREE.RenderableLine,A++,z=ia,z.v1.positionScreen.copy(H),z.v2.positionScreen.copy(T),z.z=Math.max(H.z,T.z),z.materials=U.materials,J.push(z)}else if(U instanceof THREE.Particle&&
+ga=b();ga.positionScreen.copy(ha[0].position);L.multiplyVector4(ga.positionScreen);fa=1;for(ea=ha.length;fa<ea;fa++)if(ga=b(),ga.positionScreen.copy(ha[fa].position),L.multiplyVector4(ga.positionScreen),ka=u[n-2],H.copy(ga.positionScreen),T.copy(ka.positionScreen),e(H,T))H.multiplyScalar(1/H.w),T.multiplyScalar(1/T.w),ia=y[z]=y[z]||new THREE.RenderableLine,z++,A=ia,A.v1.positionScreen.copy(H),A.v2.positionScreen.copy(T),A.z=Math.max(H.z,T.z),A.materials=U.materials,J.push(A)}else if(U instanceof THREE.Particle&&
 (K.set(U.matrixWorld.n14,U.matrixWorld.n24,U.matrixWorld.n34,1),B.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ia=C[F]=C[F]||new THREE.RenderableParticle,F++,E=ia,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=U.rotation.z,E.scale.x=U.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=U.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=U.materials,J.push(E);h&&J.sort(c);return J}};
 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);
@@ -79,8 +79,8 @@ 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,u=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),u.sub(c.position,e.position),n.crossSelf(u);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,B){n=b.vertices[c].position;u=b.vertices[e].position;t=b.vertices[f].position;w=m[k];o=m[h];x=m[B];v=u.x-n.x;z=t.x-n.x;A=u.y-n.y;y=t.y-n.y;E=u.z-n.z;F=t.z-n.z;C=o.u-w.u;G=x.u-w.u;J=o.v-w.v;M=x.v-w.v;K=1/(C*M-G*J);H.set((M*v-J*z)*K,(M*A-J*y)*K,(M*E-J*F)*K);T.set((C*z-G*v)*K,(C*y-G*A)*K,(C*F-G*E)*K);L[c].addSelf(H);L[e].addSelf(H);L[f].addSelf(H);Y[c].addSelf(T);
-Y[e].addSelf(T);Y[f].addSelf(T)}var c,e,f,h,k,m,n,u,t,w,o,x,v,z,A,y,E,F,C,G,J,M,K,B,L=[],Y=[],H=new THREE.Vector3,T=new THREE.Vector3,Q=new THREE.Vector3,Z=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)L[c]=new THREE.Vector3,Y[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 P=["a","b",
+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,B){n=b.vertices[c].position;u=b.vertices[e].position;t=b.vertices[f].position;w=m[k];o=m[h];x=m[B];v=u.x-n.x;A=t.x-n.x;z=u.y-n.y;y=t.y-n.y;E=u.z-n.z;F=t.z-n.z;C=o.u-w.u;G=x.u-w.u;J=o.v-w.v;M=x.v-w.v;K=1/(C*M-G*J);H.set((M*v-J*A)*K,(M*z-J*y)*K,(M*E-J*F)*K);T.set((C*A-G*v)*K,(C*y-G*z)*K,(C*F-G*E)*K);L[c].addSelf(H);L[e].addSelf(H);L[f].addSelf(H);Y[c].addSelf(T);
+Y[e].addSelf(T);Y[f].addSelf(T)}var c,e,f,h,k,m,n,u,t,w,o,x,v,A,z,y,E,F,C,G,J,M,K,B,L=[],Y=[],H=new THREE.Vector3,T=new THREE.Vector3,Q=new THREE.Vector3,Z=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)L[c]=new THREE.Vector3,Y[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 P=["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++)$.copy(k.vertexNormals[f]),h=k[P[f]],B=L[h],Q.copy(B),Q.subSelf($.multiplyScalar($.dot(B))).normalize(),Z.cross(k.vertexNormals[f],B),h=Z.dot(Y[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]),
@@ -150,13 +150,13 @@ THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)th
 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 u,t,w,o,x,v,z,A;b=c.projectScene(e,f);u=0;for(t=b.length;u<t;u++)if(x=b[u],x instanceof THREE.RenderableParticle){z=x.x*h+h;A=x.y*k+k;w=0;for(o=x.material.length;w<o;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=A+"px"}}};
+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 u,t,w,o,x,v,A,z;b=c.projectScene(e,f);u=0;for(t=b.length;u<t;u++)if(x=b[u],x instanceof THREE.RenderableParticle){A=x.x*h+h;z=x.y*k+k;w=0;for(o=x.material.length;w<o;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(C!=b)v.fillStyle=C=b}var k=this,m=null,n=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-t,w,o,x,v=u.getContext("2d"),z=new THREE.Color(0),A=0,y=1,E=0,F=null,C=null,G=null,J=null,M=null,K,B,L,Y,H=new THREE.RenderableVertex,T=new THREE.RenderableVertex,Q,Z,$,P,p,V,fa,ea,ha,ga,ka,na,aa=new THREE.Color(0),W=new THREE.Color(0),U=new THREE.Color(0),ia=new THREE.Color(0),ja=new THREE.Color(0),ta=[],la,ca,pa,ra,sa,ya,Ca,Ga,Fa,Da,za=new THREE.Rectangle,S=new THREE.Rectangle,O=new THREE.Rectangle,da=!1,qa=new THREE.Color,N=new THREE.Color,ma=new THREE.Color,ua=new THREE.Color,oa=new THREE.Vector3,
+t,w,o,x,v=u.getContext("2d"),A=new THREE.Color(0),z=0,y=1,E=0,F=null,C=null,G=null,J=null,M=null,K,B,L,Y,H=new THREE.RenderableVertex,T=new THREE.RenderableVertex,Q,Z,$,P,p,V,fa,ea,ha,ga,ka,na,aa=new THREE.Color(0),W=new THREE.Color(0),U=new THREE.Color(0),ia=new THREE.Color(0),ja=new THREE.Color(0),ta=[],la,ca,pa,ra,sa,ya,Ca,Ga,Fa,Da,za=new THREE.Rectangle,S=new THREE.Rectangle,O=new THREE.Rectangle,da=!1,qa=new THREE.Color,N=new THREE.Color,ma=new THREE.Color,ua=new THREE.Color,oa=new THREE.Vector3,
 Ea,Ia,Ba,va,Ka,Ha,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;Ia=Ea.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Ba=Ia.getImageData(0,0,2,2);va=Ba.data;Ka=document.createElement("canvas");Ka.width=Ka.height=b;Ha=Ka.getContext("2d");Ha.translate(-b/2,-b/2);Ha.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){t=b;w=c;o=Math.floor(t/2);x=Math.floor(w/2);u.width=
-t;u.height=w;za.set(-o,-x,o,x);S.set(-o,-x,o,x);y=1;E=0;M=J=G=C=F=null};this.setClearColor=function(b,c){z.copy(b);A=c;S.set(-o,-x,o,x)};this.setClearColorHex=function(b,c){z.setHex(b);A=c;S.set(-o,-x,o,x)};this.clear=function(){v.setTransform(1,0,0,-1,o,x);S.isEmpty()||(S.minSelf(za),S.inflate(2),A<1&&v.clearRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight())),A>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+
-Math.floor(z.b*255)+","+A+")"),v.fillRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight()))),S.empty())};this.render=function(b,u){function t(b){var c,e,f,k=b.lights;N.setRGB(0,0,0);ma.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(N.r+=f.r,N.g+=f.g,N.b+=f.b):e instanceof THREE.DirectionalLight?(ma.r+=f.r,ma.g+=f.g,ma.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function w(b,
-c,e,f){var k,h,m,p,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(p=e.dot(h.position),p<=0||(p*=h.intensity,f.r+=m.r*p,f.g+=m.g*p,f.b+=m.b*p)):h instanceof THREE.PointLight&&(p=e.dot(oa.sub(h.position,c).normalize()),p<=0||(p*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),p!=0&&(p*=h.intensity,f.r+=m.r*p,f.g+=m.g*p,f.b+=m.b*p)))}function A(b,k,m){c(m.opacity);e(m.blending);var p,n,u,t,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=
+t;u.height=w;za.set(-o,-x,o,x);S.set(-o,-x,o,x);y=1;E=0;M=J=G=C=F=null};this.setClearColor=function(b,c){A.copy(b);z=c;S.set(-o,-x,o,x)};this.setClearColorHex=function(b,c){A.setHex(b);z=c;S.set(-o,-x,o,x)};this.clear=function(){v.setTransform(1,0,0,-1,o,x);S.isEmpty()||(S.minSelf(za),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,u){function t(b){var c,e,f,k=b.lights;N.setRGB(0,0,0);ma.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(N.r+=f.r,N.g+=f.g,N.b+=f.b):e instanceof THREE.DirectionalLight?(ma.r+=f.r,ma.g+=f.g,ma.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function w(b,
+c,e,f){var k,h,m,p,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(p=e.dot(h.position),p<=0||(p*=h.intensity,f.r+=m.r*p,f.g+=m.g*p,f.b+=m.b*p)):h instanceof THREE.PointLight&&(p=e.dot(oa.sub(h.position,c).normalize()),p<=0||(p*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),p!=0&&(p*=h.intensity,f.r+=m.r*p,f.g+=m.g*p,f.b+=m.b*p)))}function z(b,k,m){c(m.opacity);e(m.blending);var p,n,u,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*o,u=k.scale.y*x,p=m*w,n=u*xa,O.set(b.x-p,b.y-n,b.x+p,b.y+n),za.intersects(O)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-u),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(p=k.scale.x*o,n=k.scale.y*x,O.set(b.x-p,b.y-n,b.x+p,b.y+n),za.intersects(O)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(p,n),m.program(v),
 v.restore()))}function eb(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(J!=b)v.lineCap=J=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();O.inflate(m.linewidth*2)}}function y(b,f,h,m,n,t,o,v,xa){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);
 Q=b.positionScreen.x;Z=b.positionScreen.y;$=f.positionScreen.x;P=f.positionScreen.y;p=h.positionScreen.x;V=h.positionScreen.y;F(Q,Z,$,P,p,V);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(ra=o.uvs[0],ab(Q,Z,$,P,p,V,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(o.vertexNormalsWorld[0]),sa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,ya=
@@ -164,35 +164,35 @@ Q=b.positionScreen.x;Z=b.positionScreen.y;$=f.positionScreen.x;P=f.positionScree
 (v.map.mapping instanceof THREE.UVMapping&&(ra=o.uvs[0],ab(Q,Z,$,P,p,V,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map)),e(THREE.SubtractiveBlending)),da?!v.wireframe&&v.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(W.r=U.r=ia.r=N.r,W.g=U.g=ia.g=N.g,W.b=U.b=ia.b=N.b,w(xa,o.v1.positionWorld,o.vertexNormalsWorld[0],W),w(xa,o.v2.positionWorld,o.vertexNormalsWorld[1],U),w(xa,o.v3.positionWorld,o.vertexNormalsWorld[2],ia),W.r=Math.max(0,Math.min(v.color.r*W.r,1)),W.g=Math.max(0,Math.min(v.color.g*
 W.g,1)),W.b=Math.max(0,Math.min(v.color.b*W.b,1)),U.r=Math.max(0,Math.min(v.color.r*U.r,1)),U.g=Math.max(0,Math.min(v.color.g*U.g,1)),U.b=Math.max(0,Math.min(v.color.b*U.b,1)),ia.r=Math.max(0,Math.min(v.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(v.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(v.color.b*ia.b,1)),ja.r=(U.r+ia.r)*0.5,ja.g=(U.g+ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,P,p,V,0,0,1,0,0,1,pa)):(qa.r=N.r,qa.g=N.g,qa.b=N.b,w(xa,o.centroidWorld,o.normalWorld,qa),aa.r=Math.max(0,Math.min(v.color.r*
 qa.r,1)),aa.g=Math.max(0,Math.min(v.color.g*qa.g,1)),aa.b=Math.max(0,Math.min(v.color.b*qa.b,1)),v.wireframe?Na(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(aa)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(v.color);else if(v instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,W.r=W.g=W.b=1-Qa(b.positionScreen.z,la,ca),U.r=U.g=U.b=1-Qa(f.positionScreen.z,la,ca),ia.r=ia.g=ia.b=1-Qa(h.positionScreen.z,la,ca),ja.r=(U.r+ia.r)*0.5,ja.g=(U.g+
-ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,P,p,V,0,0,1,0,0,1,pa);else if(v instanceof THREE.MeshNormalMaterial)aa.r=Va(o.normalWorld.x),aa.g=Va(o.normalWorld.y),aa.b=Va(o.normalWorld.z),v.wireframe?Na(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(aa)}function z(b,f,h,m,n,t,v,o,xa){k.info.render.vertices+=4;k.info.render.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)y(b,f,m,0,1,3,v,o,xa),y(n,h,t,1,2,3,v,o,xa);else if(Q=b.positionScreen.x,Z=b.positionScreen.y,
+ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,P,p,V,0,0,1,0,0,1,pa);else if(v instanceof THREE.MeshNormalMaterial)aa.r=Va(o.normalWorld.x),aa.g=Va(o.normalWorld.y),aa.b=Va(o.normalWorld.z),v.wireframe?Na(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(aa)}function A(b,f,h,m,n,t,v,o,xa){k.info.render.vertices+=4;k.info.render.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)y(b,f,m,0,1,3,v,o,xa),y(n,h,t,1,2,3,v,o,xa);else if(Q=b.positionScreen.x,Z=b.positionScreen.y,
 $=f.positionScreen.x,P=f.positionScreen.y,p=h.positionScreen.x,V=h.positionScreen.y,fa=m.positionScreen.x,ea=m.positionScreen.y,ha=n.positionScreen.x,ga=n.positionScreen.y,ka=t.positionScreen.x,na=t.positionScreen.y,o instanceof THREE.MeshBasicMaterial)E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):C(o.color);else if(o instanceof THREE.MeshLambertMaterial)da?!o.wireframe&&o.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?(W.r=
 U.r=ia.r=ja.r=N.r,W.g=U.g=ia.g=ja.g=N.g,W.b=U.b=ia.b=ja.b=N.b,w(xa,v.v1.positionWorld,v.vertexNormalsWorld[0],W),w(xa,v.v2.positionWorld,v.vertexNormalsWorld[1],U),w(xa,v.v4.positionWorld,v.vertexNormalsWorld[3],ia),w(xa,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),W.r=Math.max(0,Math.min(o.color.r*W.r,1)),W.g=Math.max(0,Math.min(o.color.g*W.g,1)),W.b=Math.max(0,Math.min(o.color.b*W.b,1)),U.r=Math.max(0,Math.min(o.color.r*U.r,1)),U.g=Math.max(0,Math.min(o.color.g*U.g,1)),U.b=Math.max(0,Math.min(o.color.b*
 U.b,1)),ia.r=Math.max(0,Math.min(o.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(o.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(o.color.b*ia.b,1)),ja.r=Math.max(0,Math.min(o.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(o.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(o.color.b*ja.b,1)),pa=Ya(W,U,ia,ja),F(Q,Z,$,P,fa,ea),Ua(Q,Z,$,P,fa,ea,0,0,1,0,0,1,pa),F(ha,ga,p,V,ka,na),Ua(ha,ga,p,V,ka,na,1,0,1,1,0,1,pa)):(qa.r=N.r,qa.g=N.g,qa.b=N.b,w(xa,v.centroidWorld,v.normalWorld,qa),aa.r=Math.max(0,Math.min(o.color.r*qa.r,
 1)),aa.g=Math.max(0,Math.min(o.color.g*qa.g,1)),aa.b=Math.max(0,Math.min(o.color.b*qa.b,1)),E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(aa,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):C(aa)):(E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):C(o.color));else if(o instanceof THREE.MeshNormalMaterial)aa.r=Va(v.normalWorld.x),aa.g=Va(v.normalWorld.y),aa.b=Va(v.normalWorld.z),E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(aa,o.wireframeLinewidth,o.wireframeLinecap,
 o.wireframeLinejoin):C(aa);else if(o instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,W.r=W.g=W.b=1-Qa(b.positionScreen.z,la,ca),U.r=U.g=U.b=1-Qa(f.positionScreen.z,la,ca),ia.r=ia.g=ia.b=1-Qa(m.positionScreen.z,la,ca),ja.r=ja.g=ja.b=1-Qa(h.positionScreen.z,la,ca),pa=Ya(W,U,ia,ja),F(Q,Z,$,P,fa,ea),Ua(Q,Z,$,P,fa,ea,0,0,1,0,0,1,pa),F(ha,ga,p,V,ka,na),Ua(ha,ga,p,V,ka,na,1,0,1,1,0,1,pa)}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 E(b,
 c,e,f,k,h,m,p){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,p);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(J!=e)v.lineCap=J=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();O.inflate(c*2)}function C(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,p,n,u,o,t,xa,w){if(w.image.width!=0){if(w.needsUpdate==!0||ta[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,S=w.wrapT==THREE.RepeatWrapping;ta[w.id]=v.createPattern(w.image,x&&
-S?"repeat":x&&!S?"repeat-x":!x&&S?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,S=w.offset.y/w.repeat.y,A=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,p=(p+x)*A,n=(n+S)*w,u=(u+x)*A,o=(o+S)*w,t=(t+x)*A,xa=(xa+S)*w;e-=b;f-=c;k-=b;m-=c;u-=p;o-=n;t-=p;xa-=n;x=1/(u*xa-t*o);w=(xa*e-o*k)*x;o=(xa*f-o*m)*x;e=(u*k-t*e)*x;f=(u*m-t*f)*x;b=b-w*p-e*n;c=c-o*p-f*n;v.save();v.transform(w,o,e,f,b,c);v.fill();v.restore()}}function Ua(b,c,e,f,k,h,m,p,n,u,o,t,w){var xa,
+S?"repeat":x&&!S?"repeat-x":!x&&S?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,S=w.offset.y/w.repeat.y,z=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,p=(p+x)*z,n=(n+S)*w,u=(u+x)*z,o=(o+S)*w,t=(t+x)*z,xa=(xa+S)*w;e-=b;f-=c;k-=b;m-=c;u-=p;o-=n;t-=p;xa-=n;x=1/(u*xa-t*o);w=(xa*e-o*k)*x;o=(xa*f-o*m)*x;e=(u*k-t*e)*x;f=(u*m-t*f)*x;b=b-w*p-e*n;c=c-o*p-f*n;v.save();v.transform(w,o,e,f,b,c);v.fill();v.restore()}}function Ua(b,c,e,f,k,h,m,p,n,u,o,t,w){var xa,
 x;xa=w.width-1;x=w.height-1;m*=xa;p*=x;n*=xa;u*=x;o*=xa;t*=x;e-=b;f-=c;k-=b;h-=c;n-=m;u-=p;o-=m;t-=p;x=1/(n*t-o*u);xa=(t*e-u*k)*x;u=(t*f-u*h)*x;e=(n*k-o*e)*x;f=(n*h-o*f)*x;b=b-xa*m-e*p;c=c-u*m-f*p;v.save();v.transform(xa,u,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),p=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),u=~~(e.g*255),e=~~(e.b*255),o=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);va[0]=k<0?0:k>255?255:k;va[1]=h<0?0:
 h>255?255:h;va[2]=b<0?0:b>255?255:b;va[4]=m<0?0:m>255?255:m;va[5]=p<0?0:p>255?255:p;va[6]=c<0?0:c>255?255:c;va[8]=n<0?0:n>255?255:n;va[9]=u<0?0:u>255?255:u;va[10]=e<0?0:e>255?255:e;va[12]=o<0?0:o>255?255:o;va[13]=t<0?0:t>255?255:t;va[14]=f<0?0:f>255?255:f;Ia.putImageData(Ba,0,0);Ha.drawImage(Ea,0,0);return Ka}function Qa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Va(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Oa(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,wa,Ja,Pa,Wa,$a,Aa;this.autoClear?this.clear():v.setTransform(1,0,0,-1,o,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,u,this.sortElements);(da=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){wa=m[Za];O.empty();if(wa instanceof THREE.RenderableParticle){K=wa;K.x*=o;K.y*=x;Ja=0;for(Pa=wa.materials.length;Ja<Pa;)Aa=wa.materials[Ja++],Aa.opacity!=0&&A(K,wa,Aa,b)}else if(wa instanceof THREE.RenderableLine){if(K=wa.v1,B=wa.v2,K.positionScreen.x*=
+e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,wa,Ja,Pa,Wa,$a,Aa;this.autoClear?this.clear():v.setTransform(1,0,0,-1,o,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,u,this.sortElements);(da=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){wa=m[Za];O.empty();if(wa instanceof THREE.RenderableParticle){K=wa;K.x*=o;K.y*=x;Ja=0;for(Pa=wa.materials.length;Ja<Pa;)Aa=wa.materials[Ja++],Aa.opacity!=0&&z(K,wa,Aa,b)}else if(wa instanceof THREE.RenderableLine){if(K=wa.v1,B=wa.v2,K.positionScreen.x*=
 o,K.positionScreen.y*=x,B.positionScreen.x*=o,B.positionScreen.y*=x,O.addPoint(K.positionScreen.x,K.positionScreen.y),O.addPoint(B.positionScreen.x,B.positionScreen.y),za.intersects(O)){Ja=0;for(Pa=wa.materials.length;Ja<Pa;)Aa=wa.materials[Ja++],Aa.opacity!=0&&eb(K,B,wa,Aa,b)}}else if(wa instanceof THREE.RenderableFace3){if(K=wa.v1,B=wa.v2,L=wa.v3,K.positionScreen.x*=o,K.positionScreen.y*=x,B.positionScreen.x*=o,B.positionScreen.y*=x,L.positionScreen.x*=o,L.positionScreen.y*=x,wa.overdraw&&(Oa(K.positionScreen,
 B.positionScreen),Oa(B.positionScreen,L.positionScreen),Oa(L.positionScreen,K.positionScreen)),O.add3Points(K.positionScreen.x,K.positionScreen.y,B.positionScreen.x,B.positionScreen.y,L.positionScreen.x,L.positionScreen.y),za.intersects(O)){Ja=0;for(Pa=wa.meshMaterials.length;Ja<Pa;)if(Aa=wa.meshMaterials[Ja++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for($a=wa.faceMaterials.length;Wa<$a;)(Aa=wa.faceMaterials[Wa++])&&Aa.opacity!=0&&y(K,B,L,0,1,2,wa,Aa,b)}else Aa.opacity!=0&&y(K,B,L,0,1,2,wa,Aa,
 b)}}else if(wa instanceof THREE.RenderableFace4&&(K=wa.v1,B=wa.v2,L=wa.v3,Y=wa.v4,K.positionScreen.x*=o,K.positionScreen.y*=x,B.positionScreen.x*=o,B.positionScreen.y*=x,L.positionScreen.x*=o,L.positionScreen.y*=x,Y.positionScreen.x*=o,Y.positionScreen.y*=x,H.positionScreen.copy(B.positionScreen),T.positionScreen.copy(Y.positionScreen),wa.overdraw&&(Oa(K.positionScreen,B.positionScreen),Oa(B.positionScreen,Y.positionScreen),Oa(Y.positionScreen,K.positionScreen),Oa(L.positionScreen,H.positionScreen),
-Oa(L.positionScreen,T.positionScreen)),O.addPoint(K.positionScreen.x,K.positionScreen.y),O.addPoint(B.positionScreen.x,B.positionScreen.y),O.addPoint(L.positionScreen.x,L.positionScreen.y),O.addPoint(Y.positionScreen.x,Y.positionScreen.y),za.intersects(O))){Ja=0;for(Pa=wa.meshMaterials.length;Ja<Pa;)if(Aa=wa.meshMaterials[Ja++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for($a=wa.faceMaterials.length;Wa<$a;)(Aa=wa.faceMaterials[Wa++])&&Aa.opacity!=0&&z(K,B,L,Y,H,T,wa,Aa,b)}else Aa.opacity!=0&&z(K,
+Oa(L.positionScreen,T.positionScreen)),O.addPoint(K.positionScreen.x,K.positionScreen.y),O.addPoint(B.positionScreen.x,B.positionScreen.y),O.addPoint(L.positionScreen.x,L.positionScreen.y),O.addPoint(Y.positionScreen.x,Y.positionScreen.y),za.intersects(O))){Ja=0;for(Pa=wa.meshMaterials.length;Ja<Pa;)if(Aa=wa.meshMaterials[Ja++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for($a=wa.faceMaterials.length;Wa<$a;)(Aa=wa.faceMaterials[Wa++])&&Aa.opacity!=0&&A(K,B,L,Y,H,T,wa,Aa,b)}else Aa.opacity!=0&&A(K,
 B,L,Y,H,T,wa,Aa,b)}S.addRectangle(O)}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&&(Y.sub(h.position,c.centroidWorld),Y.normalize(),m=c.normalWorld.dot(Y)*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,n,o,t){k.info.render.vertices+=3;k.info.render.faces++;Q=f(Z++);
 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");o instanceof THREE.MeshBasicMaterial?G.copy(o.color):o instanceof THREE.MeshLambertMaterial?C?(J.r=M.r,J.g=M.g,J.b=M.b,b(t,n,J),G.r=Math.max(0,Math.min(o.color.r*J.r,1)),G.g=Math.max(0,Math.min(o.color.g*J.g,1)),G.b=Math.max(0,Math.min(o.color.b*J.b,1))):G.copy(o.color):o instanceof THREE.MeshDepthMaterial?(L=1-o.__2near/(o.__farPlusNear-
 n.z*o.__farMinusNear),G.setRGB(L,L,L)):o instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));o.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+o.opacity);u.appendChild(Q)}function e(c,e,m,n,o,t,v){k.info.render.vertices+=
 4;k.info.render.faces++;Q=f(Z++);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 "+n.positionScreen.x+","+n.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?C?(J.r=M.r,J.g=M.g,J.b=M.b,b(v,o,J),G.r=Math.max(0,Math.min(t.color.r*J.r,1)),G.g=Math.max(0,Math.min(t.color.g*J.g,1)),G.b=Math.max(0,Math.min(t.color.b*J.b,1))):
 G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(L=1-t.__2near/(t.__farPlusNear-o.z*t.__farMinusNear),G.setRGB(L,L,L)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.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);u.appendChild(Q)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[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,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,o,x,v,z,A,y,E=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,G=new THREE.Color(16777215),J=new THREE.Color(16777215),M=new THREE.Color(0),
+"; fill-opacity: "+t.opacity);u.appendChild(Q)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[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,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,o,x,v,A,z,y,E=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,G=new THREE.Color(16777215),J=new THREE.Color(16777215),M=new THREE.Color(0),
 K=new THREE.Color(0),B=new THREE.Color(0),L,Y=new THREE.Vector3,H=[],T=[],Q,Z,$,P=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":P=1;break;case "low":P=0}};this.setSize=function(b,c){t=b;w=c;o=t/2;x=w/2;u.setAttribute("viewBox",-o+" "+-x+" "+t+" "+w);u.setAttribute("width",t);u.setAttribute("height",w);E.set(-o,-x,o,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])};
 this.render=function(b,f){var h,t,w,G,H,L,J,W;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);$=Z=0;if(C=b.lights.length>0){J=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);B.setRGB(0,0,0);h=0;for(t=J.length;h<t;h++)w=J[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&&(B.r+=G.r,B.g+=G.g,B.b+=G.b)}h=0;for(t=m.length;h<
-t;h++)if(J=m[h],F.empty(),J instanceof THREE.RenderableParticle){v=J;v.x*=o;v.y*=-x;w=0;for(G=J.materials.length;w<G;)w++}else if(J instanceof THREE.RenderableLine){if(v=J.v1,z=J.v2,v.positionScreen.x*=o,v.positionScreen.y*=-x,z.positionScreen.x*=o,z.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(F)){w=0;for(G=J.materials.length;w<G;)if((W=J.materials[w++])&&W.opacity!=0){H=v;L=z;var U=$++;T[U]==null&&(T[U]=document.createElementNS("http://www.w3.org/2000/svg",
+t;h++)if(J=m[h],F.empty(),J instanceof THREE.RenderableParticle){v=J;v.x*=o;v.y*=-x;w=0;for(G=J.materials.length;w<G;)w++}else if(J instanceof THREE.RenderableLine){if(v=J.v1,A=J.v2,v.positionScreen.x*=o,v.positionScreen.y*=-x,A.positionScreen.x*=o,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=J.materials.length;w<G;)if((W=J.materials[w++])&&W.opacity!=0){H=v;L=A;var U=$++;T[U]==null&&(T[U]=document.createElementNS("http://www.w3.org/2000/svg",
 "line"),P==0&&T[U].setAttribute("shape-rendering","crispEdges"));Q=T[U];Q.setAttribute("x1",H.positionScreen.x);Q.setAttribute("y1",H.positionScreen.y);Q.setAttribute("x2",L.positionScreen.x);Q.setAttribute("y2",L.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin),u.appendChild(Q))}}}else if(J instanceof
-THREE.RenderableFace3){if(v=J.v1,z=J.v2,A=J.v3,v.positionScreen.x*=o,v.positionScreen.y*=-x,z.positionScreen.x*=o,z.positionScreen.y*=-x,A.positionScreen.x*=o,A.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),E.intersects(F)){w=0;for(G=J.meshMaterials.length;w<G;)if(W=J.meshMaterials[w++],W instanceof THREE.MeshFaceMaterial){H=0;for(L=J.faceMaterials.length;H<L;)(W=J.faceMaterials[H++])&&
-W.opacity!=0&&c(v,z,A,J,W,b)}else W&&W.opacity!=0&&c(v,z,A,J,W,b)}}else if(J instanceof THREE.RenderableFace4&&(v=J.v1,z=J.v2,A=J.v3,y=J.v4,v.positionScreen.x*=o,v.positionScreen.y*=-x,z.positionScreen.x*=o,z.positionScreen.y*=-x,A.positionScreen.x*=o,A.positionScreen.y*=-x,y.positionScreen.x*=o,y.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),
-E.intersects(F))){w=0;for(G=J.meshMaterials.length;w<G;)if(W=J.meshMaterials[w++],W instanceof THREE.MeshFaceMaterial){H=0;for(L=J.faceMaterials.length;H<L;)(W=J.faceMaterials[H++])&&W.opacity!=0&&e(v,z,A,y,J,W,b)}else W&&W.opacity!=0&&e(v,z,A,y,J,W,b)}}};
+THREE.RenderableFace3){if(v=J.v1,A=J.v2,z=J.v3,v.positionScreen.x*=o,v.positionScreen.y*=-x,A.positionScreen.x*=o,A.positionScreen.y*=-x,z.positionScreen.x*=o,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=J.meshMaterials.length;w<G;)if(W=J.meshMaterials[w++],W instanceof THREE.MeshFaceMaterial){H=0;for(L=J.faceMaterials.length;H<L;)(W=J.faceMaterials[H++])&&
+W.opacity!=0&&c(v,A,z,J,W,b)}else W&&W.opacity!=0&&c(v,A,z,J,W,b)}}else if(J instanceof THREE.RenderableFace4&&(v=J.v1,A=J.v2,z=J.v3,y=J.v4,v.positionScreen.x*=o,v.positionScreen.y*=-x,A.positionScreen.x*=o,A.positionScreen.y*=-x,z.positionScreen.x*=o,z.positionScreen.y*=-x,y.positionScreen.x*=o,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=J.meshMaterials.length;w<G;)if(W=J.meshMaterials[w++],W instanceof THREE.MeshFaceMaterial){H=0;for(L=J.faceMaterials.length;H<L;)(W=J.faceMaterials[H++])&&W.opacity!=0&&e(v,A,z,y,J,W,b)}else W&&W.opacity!=0&&e(v,A,z,y,J,W,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 float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 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\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -225,25 +225,25 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.Shader
 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,u=b.colors,o=u.length,t=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,S=b.__dirtyColors,A=b.__webglCustomAttributes,y,z;if(A)for(y in A)A[y].offset=0;if(e.sortParticles){Ca.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Da.copy(k),Ca.multiplyVector3(Da),w[f]=[Da.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,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;
-for(f=0;f<o;f++)h=f*3,color=u[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(A)for(y in A){f=A[y];u=f.value.length;for(h=0;h<u;h++){index=w[h][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[index];f.size===2?(f.array[o]=z.x,f.array[o+1]=z.y):f.size===3?f.type==="c"?(f.array[o]=z.r,f.array[o+1]=z.g,f.array[o+2]=z.b):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z):(f.array[o]=
-z.x,f.array[o+1]=z.y,f.array[o+2]=z.z,f.array[o+3]=z.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;if(S)for(f=0;f<o;f++)color=u[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(A)for(y in A)if(f=A[y],f.__original.needsUpdate){u=f.value.length;for(h=0;h<u;h++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[h];f.size===2?(f.array[o]=
-z.x,f.array[o+1]=z.y):f.size===3?f.type==="c"?(f.array[o]=z.r,f.array[o+1]=z.g,f.array[o+2]=z.b):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z,f.array[o+3]=z.w)}f.offset+=f.size}}}if(x||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,b.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,t,c);if(S||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,b.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,v,c);if(A)for(y in A)if(f=A[y],f.__original.needsUpdate||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,
+THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,u=b.colors,o=u.length,t=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,S=b.__dirtyColors,z=b.__webglCustomAttributes,y,A;if(z)for(y in z)z[y].offset=0;if(e.sortParticles){Ca.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Da.copy(k),Ca.multiplyVector3(Da),w[f]=[Da.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,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;
+for(f=0;f<o;f++)h=f*3,color=u[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(z)for(y in z){f=z[y];u=f.value.length;for(h=0;h<u;h++){index=w[h][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[index];f.size===2?(f.array[o]=A.x,f.array[o+1]=A.y):f.size===3?f.type==="c"?(f.array[o]=A.r,f.array[o+1]=A.g,f.array[o+2]=A.b):(f.array[o]=A.x,f.array[o+1]=A.y,f.array[o+2]=A.z):(f.array[o]=
+A.x,f.array[o+1]=A.y,f.array[o+2]=A.z,f.array[o+3]=A.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;if(S)for(f=0;f<o;f++)color=u[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(z)for(y in z)if(f=z[y],f.__original.needsUpdate){u=f.value.length;for(h=0;h<u;h++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")A=f.value[h];f.size===2?(f.array[o]=
+A.x,f.array[o+1]=A.y):f.size===3?f.type==="c"?(f.array[o]=A.r,f.array[o+1]=A.g,f.array[o+2]=A.b):(f.array[o]=A.x,f.array[o+1]=A.y,f.array[o+2]=A.z):(f.array[o]=A.x,f.array[o+1]=A.y,f.array[o+2]=A.z,f.array[o+3]=A.w)}f.offset+=f.size}}}if(x||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,b.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,t,c);if(S||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,b.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,v,c);if(z)for(y in z)if(f=z[y],f.__original.needsUpdate||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,
 f.buffer),p.bufferData(p.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||P.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var k=0,m=P.maxMorphTargets;k<m;k++)h.__webglMorphTargetInfluences[k]=0}var n=!1,k=f.program,m=k.uniforms,o=f.uniforms;k!=fa&&(p.useProgram(k),fa=k,n=!0);if(f.id!=ha)ha=f.id,n=!0;if(n){p.uniformMatrix4fv(m.projectionMatrix,!1,Ga);if(e&&f.fog)if(o.fogColor.value=e.color,e instanceof
-THREE.Fog)o.fogNear.value=e.near,o.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)o.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var u,t,v=0,w=0,x=0,A,y,z,O=za,da=O.directional.colors,F=O.directional.positions,E=O.point.colors,C=O.point.positions,G=O.point.distances,qa=0,la=0,e=u=z=0,n=c.length;e<n;e++)if(u=c[e],t=u.color,A=u.position,y=u.intensity,z=u.distance,u instanceof THREE.AmbientLight)P.gammaInput?(v+=t.r*
-t.r,w+=t.g*t.g,x+=t.b*t.b):(v+=t.r,w+=t.g,x+=t.b);else if(u instanceof THREE.DirectionalLight)z=qa*3,P.gammaInput?(da[z]=t.r*t.r*y*y,da[z+1]=t.g*t.g*y*y,da[z+2]=t.b*t.b*y*y):(da[z]=t.r*y,da[z+1]=t.g*y,da[z+2]=t.b*y),F[z]=A.x,F[z+1]=A.y,F[z+2]=A.z,qa+=1;else if(u instanceof THREE.SpotLight)z=qa*3,P.gammaInput?(da[z]=t.r*t.r*y*y,da[z+1]=t.g*t.g*y*y,da[z+2]=t.b*t.b*y*y):(da[z]=t.r*y,da[z+1]=t.g*y,da[z+2]=t.b*y),t=1/A.length(),F[z]=A.x*t,F[z+1]=A.y*t,F[z+2]=A.z*t,qa+=1;else if(u instanceof THREE.PointLight)u=
-la*3,P.gammaInput?(E[u]=t.r*t.r*y*y,E[u+1]=t.g*t.g*y*y,E[u+2]=t.b*t.b*y*y):(E[u]=t.r*y,E[u+1]=t.g*y,E[u+2]=t.b*y),C[u]=A.x,C[u+1]=A.y,C[u+2]=A.z,G[la]=z,la+=1;e=qa*3;for(n=da.length;e<n;e++)da[e]=0;e=la*3;for(n=E.length;e<n;e++)E[e]=0;O.point.length=la;O.directional.length=qa;O.ambient[0]=v;O.ambient[1]=w;O.ambient[2]=x;c=za;o.enableLighting.value=c.directional.length+c.point.length;o.ambientLightColor.value=c.ambient;o.directionalLightColor.value=c.directional.colors;o.directionalLightDirection.value=
+THREE.Fog)o.fogNear.value=e.near,o.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)o.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var u,t,v=0,w=0,x=0,z,y,A,O=za,da=O.directional.colors,F=O.directional.positions,E=O.point.colors,C=O.point.positions,G=O.point.distances,qa=0,la=0,e=u=A=0,n=c.length;e<n;e++)if(u=c[e],t=u.color,z=u.position,y=u.intensity,A=u.distance,u instanceof THREE.AmbientLight)P.gammaInput?(v+=t.r*
+t.r,w+=t.g*t.g,x+=t.b*t.b):(v+=t.r,w+=t.g,x+=t.b);else if(u instanceof THREE.DirectionalLight)A=qa*3,P.gammaInput?(da[A]=t.r*t.r*y*y,da[A+1]=t.g*t.g*y*y,da[A+2]=t.b*t.b*y*y):(da[A]=t.r*y,da[A+1]=t.g*y,da[A+2]=t.b*y),F[A]=z.x,F[A+1]=z.y,F[A+2]=z.z,qa+=1;else if(u instanceof THREE.SpotLight)A=qa*3,P.gammaInput?(da[A]=t.r*t.r*y*y,da[A+1]=t.g*t.g*y*y,da[A+2]=t.b*t.b*y*y):(da[A]=t.r*y,da[A+1]=t.g*y,da[A+2]=t.b*y),t=1/z.length(),F[A]=z.x*t,F[A+1]=z.y*t,F[A+2]=z.z*t,qa+=1;else if(u instanceof THREE.PointLight)u=
+la*3,P.gammaInput?(E[u]=t.r*t.r*y*y,E[u+1]=t.g*t.g*y*y,E[u+2]=t.b*t.b*y*y):(E[u]=t.r*y,E[u+1]=t.g*y,E[u+2]=t.b*y),C[u]=z.x,C[u+1]=z.y,C[u+2]=z.z,G[la]=A,la+=1;e=qa*3;for(n=da.length;e<n;e++)da[e]=0;e=la*3;for(n=E.length;e<n;e++)E[e]=0;O.point.length=la;O.directional.length=qa;O.ambient[0]=v;O.ambient[1]=w;O.ambient[2]=x;c=za;o.enableLighting.value=c.directional.length+c.point.length;o.ambientLightColor.value=c.ambient;o.directionalLightColor.value=c.directional.colors;o.directionalLightDirection.value=
 c.directional.positions;o.pointLightColor.value=c.point.colors;o.pointLightPosition.value=c.point.positions;o.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)o.opacity.value=f.opacity,P.gammaInput?o.diffuse.value.copyGammaToLinear(f.color):o.diffuse.value=f.color,(o.map.texture=f.map)&&o.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),o.lightMap.texture=
 f.lightMap,o.envMap.texture=f.envMap,o.flipEnvMap.value=f.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,o.reflectivity.value=f.reflectivity,o.refractionRatio.value=f.refractionRatio,o.combine.value=f.combine,o.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)o.diffuse.value=f.color,o.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)o.psColor.value=f.color,o.opacity.value=f.opacity,o.size.value=f.size,
 o.scale.value=S.height/2,o.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)o.shininess.value=f.shininess,P.gammaInput?(o.ambient.value.copyGammaToLinear(f.ambient),o.specular.value.copyGammaToLinear(f.specular)):(o.ambient.value=f.ambient,o.specular.value=f.specular);else if(f instanceof THREE.MeshDepthMaterial)o.mNear.value=b.near,o.mFar.value=b.far,o.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)o.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&
 o.shadowMatrix){for(c=0;c<Ea.length;c++)o.shadowMatrix.value[c]=Ea[c],o.shadowMap.texture[c]=P.shadowMap[c];o.shadowDarkness.value=P.shadowMapDarkness;o.shadowBias.value=P.shadowMapBias}c=f.uniformsList;o=0;for(e=c.length;o<e;o++)if(w=k.uniforms[c[o][1]])if(v=c[o][0],x=v.type,n=v.value,x=="i")p.uniform1i(w,n);else if(x=="f")p.uniform1f(w,n);else if(x=="v2")p.uniform2f(w,n.x,n.y);else if(x=="v3")p.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")p.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")p.uniform3f(w,
-n.r,n.g,n.b);else if(x=="fv1")p.uniform1fv(w,n);else if(x=="fv")p.uniform3fv(w,n);else if(x=="v3v"){if(!v._array)v._array=new Float32Array(3*n.length);x=0;for(A=n.length;x<A;x++)O=x*3,v._array[O]=n[x].x,v._array[O+1]=n[x].y,v._array[O+2]=n[x].z;p.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);p.uniformMatrix4fv(w,!1,v._array)}else if(x=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);x=0;for(A=n.length;x<A;x++)n[x].flattenToArrayOffset(v._array,
+n.r,n.g,n.b);else if(x=="fv1")p.uniform1fv(w,n);else if(x=="fv")p.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++)O=x*3,v._array[O]=n[x].x,v._array[O+1]=n[x].y,v._array[O+2]=n[x].z;p.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);p.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);p.uniformMatrix4fv(w,!1,v._array)}else if(x=="t"){if(p.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=p.createTexture();p.activeTexture(p.TEXTURE0+n);p.bindTexture(p.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,v.image[n]);B(p.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else p.activeTexture(p.TEXTURE0+
-n),p.bindTexture(p.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof THREE.WebGLRenderTargetCube?(v=w,p.activeTexture(p.TEXTURE0+n),p.bindTexture(p.TEXTURE_CUBE_MAP,v.__webglTexture)):L(w,n)}else if(x=="tv"){if(!v._array){v._array=[];x=0;for(A=v.texture.length;x<A;x++)v._array[x]=n+x}p.uniform1iv(w,v._array);x=0;for(A=v.texture.length;x<A;x++)(w=v.texture[x])&&L(w,v._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&
+n),p.bindTexture(p.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof THREE.WebGLRenderTargetCube?(v=w,p.activeTexture(p.TEXTURE0+n),p.bindTexture(p.TEXTURE_CUBE_MAP,v.__webglTexture)):L(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}p.uniform1iv(w,v._array);x=0;for(z=v.texture.length;x<z;x++)(w=v.texture[x])&&L(w,v._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&
 p.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&&p.uniformMatrix4fv(m.viewMatrix,!1,Fa);f.skinning&&(p.uniformMatrix4fv(m.cameraInverseMatrix,!1,Fa),p.uniformMatrix4fv(m.boneGlobalMatrices,!1,h.boneMatrices))}p.uniformMatrix4fv(m.modelViewMatrix,!1,h._modelViewMatrixArray);m.normalMatrix&&p.uniformMatrix3fv(m.normalMatrix,!1,h._normalMatrixArray);
 (f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&m.objectMatrix!==null&&p.uniformMatrix4fv(m.objectMatrix,!1,h._objectMatrixArray);return k}function f(b,c,f,h,k,m){if(h.opacity!=0){var n,f=e(b,c,f,h,m),b=f.attributes,c=!1,f=k.id*16777215+f.id*2+(h.wireframe?1:0);f!=ga&&(ga=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglVertexBuffer),p.vertexAttribPointer(b.position,3,p.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==
 -1?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0)):f.position>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglVertexBuffer),p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var o=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<t.length;)p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[t[o]]),p.vertexAttribPointer(f["morphTarget"+o],3,
-p.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[o]=u[t[o]],o++;else{var t=[],v=-1,w=0,u=m.morphTargetInfluences,x,A=u.length,o=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(x=0;x<A;x++)!t[x]&&u[x]>v&&(w=x,v=u[w]);p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[w]);p.vertexAttribPointer(f["morphTarget"+o],3,p.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[o]=v;t[w]=1;v=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&p.uniform1fv(h.program.uniforms.morphTargetInfluences,
+p.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[o]=u[t[o]],o++;else{var t=[],v=-1,w=0,u=m.morphTargetInfluences,x,z=u.length,o=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(x=0;x<z;x++)!t[x]&&u[x]>v&&(w=x,v=u[w]);p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[w]);p.vertexAttribPointer(f["morphTarget"+o],3,p.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[o]=v;t[w]=1;v=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&p.uniform1fv(h.program.uniforms.morphTargetInfluences,
 m.__webglMorphTargetInfluences)}if(c){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(f=k.__webglCustomAttributes[n],p.bindBuffer(p.ARRAY_BUFFER,f.buffer),p.vertexAttribPointer(b[n],f.size,p.FLOAT,!1,0,0));b.color>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglColorBuffer),p.vertexAttribPointer(b.color,3,p.FLOAT,!1,0,0));b.normal>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglNormalBuffer),p.vertexAttribPointer(b.normal,3,p.FLOAT,!1,0,0));b.tangent>=0&&(p.bindBuffer(p.ARRAY_BUFFER,
 k.__webglTangentBuffer),p.vertexAttribPointer(b.tangent,4,p.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglUVBuffer),p.vertexAttribPointer(b.uv,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv)):p.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglUV2Buffer),p.vertexAttribPointer(b.uv2,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv2)):p.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
 0&&b.skinIndex>=0&&b.skinWeight>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinVertexABuffer),p.vertexAttribPointer(b.skinVertexA,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),p.vertexAttribPointer(b.skinVertexB,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),p.vertexAttribPointer(b.skinIndex,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),p.vertexAttribPointer(b.skinWeight,4,p.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?
@@ -253,12 +253,12 @@ p.DYNAMIC_DRAW),p.enableVertexAttribArray(c.attributes.position),p.vertexAttribP
 b.normalArray,p.DYNAMIC_DRAW);p.enableVertexAttribArray(c.attributes.normal);p.vertexAttribPointer(c.attributes.normal,3,p.FLOAT,!1,0,0)}p.drawArrays(p.TRIANGLES,0,b.count);b.count=0}function k(b){if(na!=b.doubleSided)b.doubleSided?p.disable(p.CULL_FACE):p.enable(p.CULL_FACE),na=b.doubleSided;if(aa!=b.flipSided)b.flipSided?p.frontFace(p.CW):p.frontFace(p.CCW),aa=b.flipSided}function m(b){U!=b&&(b?p.enable(p.DEPTH_TEST):p.disable(p.DEPTH_TEST),U=b)}function n(b){ia!=b&&(p.depthMask(b),ia=b)}function u(b,
 c,e){ja!=b&&(b?p.enable(p.POLYGON_OFFSET_FILL):p.disable(p.POLYGON_OFFSET_FILL),ja=b);if(b&&(ta!=c||la!=e))p.polygonOffset(c,e),ta=c,la=e}function t(b){ya[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ya[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ya[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ya[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ya[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ya[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=ya[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=ya[f].x*c.n14+ya[f].y*c.n24+ya[f].z*c.n34+ya[f].w,b<=e)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,k=b.opaque,h=b.transparent;h.count=0;b=k.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?o(h,e):o(k,e)}function v(b){var c,
-e,f,k,h=b.object,m=b.buffer,n=b.opaque,p=b.transparent;p.count=0;b=n.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=m.materials.length;c<e;c++)(k=m.materials[c])&&(k.transparent?o(p,k):o(n,k))}else(k=c)&&(k.transparent?o(p,k):o(n,k))}function z(b,c){return c.z-b.z}function A(b){var c,n,o,u=0,v,x,A,y,S=b.lights;oa||(oa=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));
+e,f,k,h=b.object,m=b.buffer,n=b.opaque,p=b.transparent;p.count=0;b=n.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=m.materials.length;c<e;c++)(k=m.materials[c])&&(k.transparent?o(p,k):o(n,k))}else(k=c)&&(k.transparent?o(p,k):o(n,k))}function A(b,c){return c.z-b.z}function z(b){var c,n,o,u=0,v,x,z,y,S=b.lights;oa||(oa=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));
 c=0;for(n=S.length;c<n;c++)if(o=S[c],o instanceof THREE.SpotLight&&o.castShadow){ha=-1;P.shadowMap[u]||(P.shadowMap[u]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ea[u]||(Ea[u]=new THREE.Matrix4);v=P.shadowMap[u];x=Ea[u];oa.position.copy(o.position);oa.lookAt(o.target.position);oa.update(void 0,!0);b.update(void 0,!1,oa);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(oa.projectionMatrix);
-x.multiplySelf(oa.matrixWorldInverse);oa.matrixWorldInverse.flattenToArray(Fa);oa.projectionMatrix.flattenToArray(Ga);Ca.multiply(oa.projectionMatrix,oa.matrixWorldInverse);t(Ca);P.initWebGLObjects(b);H(v);p.clearColor(1,1,1,1);P.clear();p.clearColor(N.r,N.g,N.b,ma);x=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)A=b.__webglObjects[v],y=A.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||w(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),
-E(y,oa,!1),A.render=!0):A.render=!1:A.render=!1;m(!0);K(THREE.NormalBlending);for(v=0;v<x;v++)if(A=b.__webglObjects[v],A.render)y=A.object,buffer=A.buffer,k(y),A=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?va:Ba,f(oa,S,null,A,buffer,y);for(v=0;v<o;v++)A=b.__webglObjectsImmediate[v],y=A.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),ga=-1,E(y,oa,!1),k(y),program=e(oa,S,null,Ba,y),y.immediateRenderCallback?y.immediateRenderCallback(program,
+x.multiplySelf(oa.matrixWorldInverse);oa.matrixWorldInverse.flattenToArray(Fa);oa.projectionMatrix.flattenToArray(Ga);Ca.multiply(oa.projectionMatrix,oa.matrixWorldInverse);t(Ca);P.initWebGLObjects(b);H(v);p.clearColor(1,1,1,1);P.clear();p.clearColor(N.r,N.g,N.b,ma);x=b.__webglObjects.length;o=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,oa,!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?va:Ba,f(oa,S,null,z,buffer,y);for(v=0;v<o;v++)z=b.__webglObjectsImmediate[v],y=z.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),ga=-1,E(y,oa,!1),k(y),program=e(oa,S,null,Ba,y),y.immediateRenderCallback?y.immediateRenderCallback(program,
 p,ya):y.render(function(b){h(b,program,Ba.shading)}));u++}}function y(b,c){var e,f,k;e=X.attributes;var h=X.uniforms,m=sa/ra,n,o=[],t=ra*0.5,u=sa*0.5,v=!0;p.useProgram(X.program);fa=X.program;ga=U=W=-1;Xa||(p.enableVertexAttribArray(X.attributes.position),p.enableVertexAttribArray(X.attributes.uv),Xa=!0);p.disable(p.CULL_FACE);p.enable(p.BLEND);p.depthMask(!0);p.bindBuffer(p.ARRAY_BUFFER,X.vertexBuffer);p.vertexAttribPointer(e.position,2,p.FLOAT,!1,16,0);p.vertexAttribPointer(e.uv,2,p.FLOAT,!1,16,
-8);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,X.elementBuffer);p.uniformMatrix4fv(h.projectionMatrix,!1,Ga);p.activeTexture(p.TEXTURE0);p.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)if(k=b.__webglSprites[e],k.visible&&k.opacity!=0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);b.__webglSprites.sort(z);e=0;for(f=b.__webglSprites.length;e<f;e++)k=b.__webglSprites[e],k.visible&&
+8);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,X.elementBuffer);p.uniformMatrix4fv(h.projectionMatrix,!1,Ga);p.activeTexture(p.TEXTURE0);p.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)if(k=b.__webglSprites[e],k.visible&&k.opacity!=0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);b.__webglSprites.sort(A);e=0;for(f=b.__webglSprites.length;e<f;e++)k=b.__webglSprites[e],k.visible&&
 k.opacity!=0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(p.uniform1i(h.useScreenCoordinates,1),p.uniform3f(h.screenPosition,(k.position.x-t)/t,(u-k.position.y)/u,Math.max(0,Math.min(1,k.position.z)))):(p.uniform1i(h.useScreenCoordinates,0),p.uniform1i(h.affectedByDistance,k.affectedByDistance?1:0),p.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray)),n=k.map.image.width/(k.scaleByViewport?sa:1),o[0]=n*m*k.scale.x,o[1]=n*k.scale.y,p.uniform2f(h.uvScale,k.uvScale.x,
 k.uvScale.y),p.uniform2f(h.uvOffset,k.uvOffset.x,k.uvOffset.y),p.uniform2f(h.alignment,k.alignment.x,k.alignment.y),p.uniform1f(h.opacity,k.opacity),p.uniform3f(h.color,k.color.r,k.color.g,k.color.b),p.uniform1f(h.rotation,k.rotation),p.uniform2fv(h.scale,o),k.mergeWith3D&&!v?(p.enable(p.DEPTH_TEST),v=!0):!k.mergeWith3D&&v&&(p.disable(p.DEPTH_TEST),v=!1),K(k.blending),L(k.map,0),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0));p.enable(p.CULL_FACE);p.enable(p.DEPTH_TEST);p.depthMask(ia)}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,k;k=b.__materials;b=0;for(e=k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function C(b){var c,e,f,k;k=b.__materials;b=0;for(e=k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,
@@ -277,8 +277,8 @@ case THREE.NearestFilter:return p.NEAREST;case THREE.NearestMipMapNearestFilter:
 case THREE.IntType:return p.INT;case THREE.UnsignedShortType:return p.UNSIGNED_INT;case THREE.FloatType:return p.FLOAT;case THREE.AlphaFormat:return p.ALPHA;case THREE.RGBFormat:return p.RGB;case THREE.RGBAFormat:return p.RGBA;case THREE.LuminanceFormat:return p.LUMINANCE;case THREE.LuminanceAlphaFormat:return p.LUMINANCE_ALPHA}return 0}var P=this,p,V=[],fa=null,ea=null,ha=-1,ga=null,ka=0,na=null,aa=null,W=null,U=null,ia=null,ja=null,ta=null,la=null,ca=0,pa=0,ra=0,sa=0,ya=[new THREE.Vector4,new THREE.Vector4,
 new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ga=new Float32Array(16),Fa=new Float32Array(16),Da=new THREE.Vector4,za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},S=b.canvas!==void 0?b.canvas:document.createElement("canvas"),O=b.stencil!==void 0?b.stencil:!0,da=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,qa=b.antialias!==void 0?b.antialias:!1,N=b.clearColor!==
 void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ma=b.clearAlpha!==void 0?b.clearAlpha:0,ua=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=S;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=
-this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var oa,Ea=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia,morphTargets:!0});Ba._shadowPass=!0;va._shadowPass=!0;
-try{if(!(p=S.getContext("experimental-webgl",{antialias:qa,stencil:O,preserveDrawingBuffer:da})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+p.getParameter(p.VERSION)+" | "+p.getParameter(p.VENDOR)+" | "+p.getParameter(p.RENDERER)+" | "+p.getParameter(p.SHADING_LANGUAGE_VERSION))}catch(Ka){console.error(Ka)}p.clearColor(0,0,0,1);p.clearDepth(1);p.clearStencil(0);p.enable(p.DEPTH_TEST);p.depthFunc(p.LEQUAL);p.frontFace(p.CCW);p.cullFace(p.BACK);p.enable(p.CULL_FACE);
+this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var oa,Ea=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia,morphTargets:!0});Ba._shadowPass=
+!0;va._shadowPass=!0;try{if(!(p=S.getContext("experimental-webgl",{antialias:qa,stencil:O,preserveDrawingBuffer:da})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+p.getParameter(p.VERSION)+" | "+p.getParameter(p.VENDOR)+" | "+p.getParameter(p.RENDERER)+" | "+p.getParameter(p.SHADING_LANGUAGE_VERSION))}catch(Ka){console.error(Ka)}p.clearColor(0,0,0,1);p.clearDepth(1);p.clearStencil(0);p.enable(p.DEPTH_TEST);p.depthFunc(p.LEQUAL);p.frontFace(p.CCW);p.cullFace(p.BACK);p.enable(p.CULL_FACE);
 p.enable(p.BLEND);p.blendEquation(p.FUNC_ADD);p.blendFunc(p.SRC_ALPHA,p.ONE_MINUS_SRC_ALPHA);p.clearColor(N.r,N.g,N.b,ma);this.context=p;var Ha=p.getParameter(p.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);O=0;X.vertices[O++]=-1;X.vertices[O++]=-1;X.vertices[O++]=0;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=-1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=0;X.vertices[O++]=-1;
 X.vertices[O++]=1;X.vertices[O++]=0;O=X.vertices[O++]=0;X.faces[O++]=0;X.faces[O++]=1;X.faces[O++]=2;X.faces[O++]=0;X.faces[O++]=2;X.faces[O++]=3;X.vertexBuffer=p.createBuffer();X.elementBuffer=p.createBuffer();p.bindBuffer(p.ARRAY_BUFFER,X.vertexBuffer);p.bufferData(p.ARRAY_BUFFER,X.vertices,p.STATIC_DRAW);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,X.elementBuffer);p.bufferData(p.ELEMENT_ARRAY_BUFFER,X.faces,p.STATIC_DRAW);X.program=p.createProgram();p.attachShader(X.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));
 p.attachShader(X.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));p.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=p.getAttribLocation(X.program,"position");X.attributes.uv=p.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=p.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=p.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=p.getUniformLocation(X.program,"rotation");X.uniforms.scale=p.getUniformLocation(X.program,"scale");X.uniforms.alignment=
@@ -290,58 +290,58 @@ p.deleteBuffer(c.__webglFaceBuffer);p.deleteBuffer(c.__webglLineBuffer);if(c.num
 else if(b instanceof THREE.ParticleSystem)b=b.geometry,p.deleteBuffer(b.__webglVertexBuffer),p.deleteBuffer(b.__webglColorBuffer),P.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,p.deleteTexture(b.__webglTexture),P.info.memory.textures--};this.initMaterial=function(b,c,e,f){var k,h,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 o=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(o.uniforms);b.vertexShader=o.vertexShader;b.fragmentShader=o.fragmentShader}var t,u,v;t=v=o=0;for(u=c.length;t<u;t++)m=c[t],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&o++;o+v<=ua?t=v:(t=Math.ceil(ua*v/
 (o+v)),o=ua-t);m={directional:t,point:o};o=v=0;for(t=c.length;o<t;o++)u=c[o],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:{t=b.fragmentShader;u=b.vertexShader;var o=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},y,f=[];n?f.push(n):(f.push(t),f.push(u));for(y in e)f.push(y),f.push(e[y]);n=f.join();y=0;for(f=V.length;y<f;y++)if(V[y].code==n){x=V[y].program;break a}y=p.createProgram();f=[Ha?"#define VERTEX_TEXTURES":"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":
+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(t),f.push(u));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=V.length;z<f;z++)if(V[z].code==n){x=V[z].program;break a}z=p.createProgram();f=[Ha?"#define VERTEX_TEXTURES":"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":
 "",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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:"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":"",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",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");p.attachShader(y,Q("fragment",m+t));p.attachShader(y,Q("vertex",f+u));p.linkProgram(y);p.getProgramParameter(y,p.LINK_STATUS)||
-console.error("Could not initialise shader\nVALIDATE_STATUS: "+p.getProgramParameter(y,p.VALIDATE_STATUS)+", gl error ["+p.getError()+"]");y.uniforms={};y.attributes={};var A,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(A in o)f.push(A);A=f;f=0;for(o=A.length;f<o;f++)t=A[f],y.uniforms[t]=p.getUniformLocation(y,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA",
-"skinVertexB","skinIndex","skinWeight"];for(A=0;A<e.maxMorphTargets;A++)f.push("morphTarget"+A);for(x in c)f.push(x);x=f;A=0;for(c=x.length;A<c;A++)e=x[A],y.attributes[e]=p.getAttribLocation(y,e);y.id=V.length;V.push({program:y,code:n});P.info.memory.programs=V.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&p.enableVertexAttribArray(x.position);x.color>=0&&p.enableVertexAttribArray(x.color);x.normal>=0&&p.enableVertexAttribArray(x.normal);x.tangent>=0&&p.enableVertexAttribArray(x.tangent);
-b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(p.enableVertexAttribArray(x.skinVertexA),p.enableVertexAttribArray(x.skinVertexB),p.enableVertexAttribArray(x.skinIndex),p.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(h in b.attributes)x[h]!==void 0&&x[h]>=0&&p.enableVertexAttribArray(x[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)A="morphTarget"+h,x[A]>=0&&(p.enableVertexAttribArray(x[A]),b.numSupportedMorphTargets++);
-b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,c,e,f){H(b);this.clear(c,e,f)};this.render=function(b,c,o,S){var O,da,F,C,G,qa,B,la,J=b.lights,ca=b.fog;ha=-1;this.shadowMapEnabled&&A(b,c);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Fa);c.projectionMatrix.flattenToArray(Ga);Ca.multiply(c.projectionMatrix,
-c.matrixWorldInverse);t(Ca);this.initWebGLObjects(b);H(o);(this.autoClear||S)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(S=0;S<G;S++)if(O=b.__webglObjects[S],B=O.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),v(O),O.render=!0,this.sortObjects)O.object.renderDepth?O.z=O.object.renderDepth:(Da.copy(B.position),Ca.multiplyVector3(Da),O.z=Da.z)}else O.render=
-!1;else O.render=!1;this.sortObjects&&b.__webglObjects.sort(z);qa=b.__webglObjectsImmediate.length;for(S=0;S<qa;S++)O=b.__webglObjectsImmediate[S],B=O.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(O));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(S=0;S<G;S++)if(O=b.__webglObjects[S],O.render)B=O.object,la=O.buffer,k(B),f(c,J,ca,b.overrideMaterial,la,B);for(S=0;S<qa;S++)O=b.__webglObjectsImmediate[S],
-B=O.object,B.visible&&(ga=-1,k(B),da=e(c,J,ca,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(da,p,ya):B.render(function(c){h(c,da,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(S=G-1;S>=0;S--)if(O=b.__webglObjects[S],O.render){B=O.object;la=O.buffer;F=O.opaque;k(B);for(O=0;O<F.count;O++)C=F.list[O],m(C.depthTest),n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,J,ca,C,la,B)}for(S=0;S<qa;S++)if(O=b.__webglObjectsImmediate[S],
-B=O.object,B.visible){ga=-1;F=O.opaque;k(B);for(O=0;O<F.count;O++)C=F.list[O],m(C.depthTest),n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,J,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,p,ya):B.render(function(b){h(b,da,C.shading)})}for(S=0;S<G;S++)if(O=b.__webglObjects[S],O.render){B=O.object;la=O.buffer;F=O.transparent;k(B);for(O=0;O<F.count;O++)C=F.list[O],K(C.blending),m(C.depthTest),n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,
-C.polygonOffsetUnits),f(c,J,ca,C,la,B)}for(S=0;S<qa;S++)if(O=b.__webglObjectsImmediate[S],B=O.object,B.visible){ga=-1;F=O.transparent;k(B);for(O=0;O<F.count;O++)C=F.list[O],K(C.blending),m(C.depthTest),n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,J,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,p,ya):B.render(function(b){h(b,da,C.shading)})}}b.__webglSprites.length&&y(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&
-T(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,k=void 0,h=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(k in h=
-e.geometry,h.geometryGroups==void 0&&J(h),h.geometryGroups){if(m=h.geometryGroups[k],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=p.createBuffer();n.__webglNormalBuffer=p.createBuffer();n.__webglTangentBuffer=p.createBuffer();n.__webglColorBuffer=p.createBuffer();n.__webglUVBuffer=p.createBuffer();n.__webglUV2Buffer=p.createBuffer();n.__webglSkinVertexABuffer=p.createBuffer();n.__webglSkinVertexBBuffer=p.createBuffer();n.__webglSkinIndicesBuffer=p.createBuffer();n.__webglSkinWeightsBuffer=
-p.createBuffer();n.__webglFaceBuffer=p.createBuffer();n.__webglLineBuffer=p.createBuffer();if(n.numMorphTargets){var o=void 0,t=void 0;n.__webglMorphTargetsBuffers=[];o=0;for(t=n.numMorphTargets;o<t;o++)n.__webglMorphTargetsBuffers.push(p.createBuffer())}P.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,y=void 0,A=void 0,S=A=o=0,z=w=v=void 0,w=t=z=v=u=void 0,x=n.geometry,y=x.faces,z=m.faces,u=0,v=z.length;u<v;u++)w=z[u],w=y[w],w instanceof THREE.Face3?(o+=3,A+=1,S+=3):w instanceof
-THREE.Face4&&(o+=4,A+=2,S+=4);for(var u=m,v=n,O=z=y=void 0,da=void 0,O=void 0,w=[],y=0,z=v.materials.length;y<z;y++)if(O=v.materials[y],O instanceof THREE.MeshFaceMaterial){O=0;for(l=u.materials.length;O<l;O++)(da=u.materials[O])&&w.push(da)}else(da=O)&&w.push(da);u=w;m.__materials=u;a:{y=v=void 0;z=u.length;for(v=0;v<z;v++)if(y=u[v],y.map||y.lightMap||y instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{z=y=void 0;w=u.length;for(y=0;y<w;y++)if(z=u[y],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||
-z instanceof THREE.MeshDepthMaterial)){z=z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{w=y=void 0;O=u.length;for(y=0;y<O;y++)if(w=u[y],w.vertexColors){w=w.vertexColors;break a}w=!1}m.__vertexArray=new Float32Array(o*3);if(z)m.__normalArray=new Float32Array(o*3);if(x.hasTangents)m.__tangentArray=new Float32Array(o*4);if(w)m.__colorArray=new Float32Array(o*3);if(v){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)m.__uvArray=new Float32Array(o*
-2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(o*4),m.__skinVertexBArray=new Float32Array(o*4),m.__skinIndexArray=new Float32Array(o*4),m.__skinWeightArray=new Float32Array(o*4);m.__faceArray=new Uint16Array(A*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(S*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(y=
-m.numMorphTargets;x<y;x++)m.__morphTargetsArrays.push(new Float32Array(o*3))}m.__needsSmoothNormals=z==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=w;m.__normalType=z;m.__webglFaceCount=A*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=S*2;x=0;for(y=u.length;x<y;x++)if(v=u[x],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){w=v.attributes[a];z={};for(t in w)z[t]=w[t];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=
-!0,A=1,z.type==="v2"?A=2:z.type==="v3"?A=3:z.type==="v4"?A=4:z.type==="c"&&(A=3),z.size=A,z.array=new Float32Array(o*A),z.buffer=p.createBuffer(),z.buffer.belongsToAttribute=a,w.needsUpdate=!0,z.__original=w;m.__webglCustomAttributes[a]=z}}m.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=
+"",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");p.attachShader(z,Q("fragment",m+t));p.attachShader(z,Q("vertex",f+u));p.linkProgram(z);p.getProgramParameter(z,p.LINK_STATUS)||
+console.error("Could not initialise shader\nVALIDATE_STATUS: "+p.getProgramParameter(z,p.VALIDATE_STATUS)+", gl error ["+p.getError()+"]");z.uniforms={};z.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in o)f.push(y);y=f;f=0;for(o=y.length;f<o;f++)t=y[f],z.uniforms[t]=p.getUniformLocation(z,t);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]=p.getAttribLocation(z,e);z.id=V.length;V.push({program:z,code:n});P.info.memory.programs=V.length;x=z}b.program=x;x=b.program.attributes;x.position>=0&&p.enableVertexAttribArray(x.position);x.color>=0&&p.enableVertexAttribArray(x.color);x.normal>=0&&p.enableVertexAttribArray(x.normal);x.tangent>=0&&p.enableVertexAttribArray(x.tangent);
+b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(p.enableVertexAttribArray(x.skinVertexA),p.enableVertexAttribArray(x.skinVertexB),p.enableVertexAttribArray(x.skinIndex),p.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(h in b.attributes)x[h]!==void 0&&x[h]>=0&&p.enableVertexAttribArray(x[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)y="morphTarget"+h,x[y]>=0&&(p.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);
+b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,c,e,f){H(b);this.clear(c,e,f)};this.updateShadowMap=function(b,c){z(b,c)};this.render=function(b,c,o,S){var O,da,F,C,G,qa,B,la,J=b.lights,ca=b.fog;ha=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&z(b,c);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Fa);
+c.projectionMatrix.flattenToArray(Ga);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);t(Ca);this.initWebGLObjects(b);H(o);(this.autoClear||S)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(S=0;S<G;S++)if(O=b.__webglObjects[S],B=O.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),v(O),O.render=!0,this.sortObjects)O.object.renderDepth?O.z=O.object.renderDepth:
+(Da.copy(B.position),Ca.multiplyVector3(Da),O.z=Da.z)}else O.render=!1;else O.render=!1;this.sortObjects&&b.__webglObjects.sort(A);qa=b.__webglObjectsImmediate.length;for(S=0;S<qa;S++)O=b.__webglObjectsImmediate[S],B=O.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(O));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(S=0;S<G;S++)if(O=b.__webglObjects[S],O.render)B=O.object,la=O.buffer,k(B),f(c,J,ca,b.overrideMaterial,
+la,B);for(S=0;S<qa;S++)O=b.__webglObjectsImmediate[S],B=O.object,B.visible&&(ga=-1,k(B),da=e(c,J,ca,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(da,p,ya):B.render(function(c){h(c,da,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(S=G-1;S>=0;S--)if(O=b.__webglObjects[S],O.render){B=O.object;la=O.buffer;F=O.opaque;k(B);for(O=0;O<F.count;O++)C=F.list[O],m(C.depthTest),n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,J,ca,C,
+la,B)}for(S=0;S<qa;S++)if(O=b.__webglObjectsImmediate[S],B=O.object,B.visible){ga=-1;F=O.opaque;k(B);for(O=0;O<F.count;O++)C=F.list[O],m(C.depthTest),n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,J,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,p,ya):B.render(function(b){h(b,da,C.shading)})}for(S=0;S<G;S++)if(O=b.__webglObjects[S],O.render){B=O.object;la=O.buffer;F=O.transparent;k(B);for(O=0;O<F.count;O++)C=F.list[O],K(C.blending),m(C.depthTest),
+n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,J,ca,C,la,B)}for(S=0;S<qa;S++)if(O=b.__webglObjectsImmediate[S],B=O.object,B.visible){ga=-1;F=O.transparent;k(B);for(O=0;O<F.count;O++)C=F.list[O],K(C.blending),m(C.depthTest),n(C.depthWrite),u(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),da=e(c,J,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(da,p,ya):B.render(function(b){h(b,da,C.shading)})}}b.__webglSprites.length&&y(b,c);o&&o.minFilter!==
+THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&T(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,k=void 0,h=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(k in h=e.geometry,h.geometryGroups==void 0&&J(h),h.geometryGroups){if(m=h.geometryGroups[k],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=p.createBuffer();n.__webglNormalBuffer=p.createBuffer();n.__webglTangentBuffer=p.createBuffer();n.__webglColorBuffer=p.createBuffer();n.__webglUVBuffer=p.createBuffer();n.__webglUV2Buffer=p.createBuffer();n.__webglSkinVertexABuffer=p.createBuffer();n.__webglSkinVertexBBuffer=p.createBuffer();n.__webglSkinIndicesBuffer=p.createBuffer();
+n.__webglSkinWeightsBuffer=p.createBuffer();n.__webglFaceBuffer=p.createBuffer();n.__webglLineBuffer=p.createBuffer();if(n.numMorphTargets){var o=void 0,t=void 0;n.__webglMorphTargetsBuffers=[];o=0;for(t=n.numMorphTargets;o<t;o++)n.__webglMorphTargetsBuffers.push(p.createBuffer())}P.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,S=y=o=0,A=w=v=void 0,w=t=A=v=u=void 0,x=n.geometry,z=x.faces,A=m.faces,u=0,v=A.length;u<v;u++)w=A[u],w=z[w],w instanceof THREE.Face3?
+(o+=3,y+=1,S+=3):w instanceof THREE.Face4&&(o+=4,y+=2,S+=4);for(var u=m,v=n,O=A=z=void 0,da=void 0,O=void 0,w=[],z=0,A=v.materials.length;z<A;z++)if(O=v.materials[z],O instanceof THREE.MeshFaceMaterial){O=0;for(l=u.materials.length;O<l;O++)(da=u.materials[O])&&w.push(da)}else(da=O)&&w.push(da);u=w;m.__materials=u;a:{z=v=void 0;A=u.length;for(v=0;v<A;v++)if(z=u[v],z.map||z.lightMap||z instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{A=z=void 0;w=u.length;for(z=0;z<w;z++)if(A=u[z],!(A instanceof
+THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{w=z=void 0;O=u.length;for(z=0;z<O;z++)if(w=u[z],w.vertexColors){w=w.vertexColors;break a}w=!1}m.__vertexArray=new Float32Array(o*3);if(A)m.__normalArray=new Float32Array(o*3);if(x.hasTangents)m.__tangentArray=new Float32Array(o*4);if(w)m.__colorArray=new Float32Array(o*3);if(v){if(x.faceUvs.length>0||x.faceVertexUvs.length>
+0)m.__uvArray=new Float32Array(o*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(o*4),m.__skinVertexBArray=new Float32Array(o*4),m.__skinIndexArray=new Float32Array(o*4),m.__skinWeightArray=new Float32Array(o*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(S*2);if(m.numMorphTargets){m.__morphTargetsArrays=
+[];x=0;for(z=m.numMorphTargets;x<z;x++)m.__morphTargetsArrays.push(new Float32Array(o*3))}m.__needsSmoothNormals=A==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=w;m.__normalType=A;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=S*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];A={};for(t in w)A[t]=w[t];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=
+!0,y=1,A.type==="v2"?y=2:A.type==="v3"?y=3:A.type==="v4"?y=4:A.type==="c"&&(y=3),A.size=y,A.array=new Float32Array(o*y),A.buffer=p.createBuffer(),A.buffer.belongsToAttribute=a,w.needsUpdate=!0,A.__original=w;m.__webglCustomAttributes[a]=A}}m.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=
 p.createBuffer(),m.__webglColorBuffer=p.createBuffer(),P.info.memory.geometries++,m=h,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=p.createBuffer(),m.__webglColorBuffer=p.createBuffer(),P.info.memory.geometries++,m=h,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=
-new Float32Array(n*3),m.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){m=h;m.__webglVertexBuffer=p.createBuffer();m.__webglColorBuffer=p.createBuffer();P.info.geometries++;m=h;n=e;o=m.vertices.length;m.__vertexArray=new Float32Array(o*3);m.__colorArray=new Float32Array(o*3);m.__sortArray=[];m.__webglParticleCount=o;m.__materials=n.materials;S=A=t=void 0;t=0;for(A=n.materials.length;t<A;t++)if(S=n.materials[t],
+new Float32Array(n*3),m.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){m=h;m.__webglVertexBuffer=p.createBuffer();m.__webglColorBuffer=p.createBuffer();P.info.geometries++;m=h;n=e;o=m.vertices.length;m.__vertexArray=new Float32Array(o*3);m.__colorArray=new Float32Array(o*3);m.__sortArray=[];m.__webglParticleCount=o;m.__materials=n.materials;S=y=t=void 0;t=0;for(y=n.materials.length;t<y;t++)if(S=n.materials[t],
 S.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in S.attributes){originalAttribute=S.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=p.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)m=h.geometryGroups[k],M(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,M(f.__webglObjects,h,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;
 k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,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(h=b.__webglObjects[e].object,t=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(o=k.geometryGroupsList.length;n<o;n++)if(m=k.geometryGroupsList[n],t=F(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||
-k.__dirtyColors||k.__dirtyTangents||t)if(t=m,A=p.DYNAMIC_DRAW,S=!k.dynamic,t.__inittedArrays){var E=u=x=void 0,B=void 0,qa=E=void 0,la=void 0,K=void 0,H=void 0,ca=da=O=w=z=y=v=void 0,ma=void 0,L=void 0,I=B=H=B=K=la=void 0,D=void 0,N=D=I=la=void 0,Q=void 0,W=N=D=I=E=E=qa=H=B=N=D=I=Q=N=D=I=Q=N=D=I=void 0,U=0,pa=0,ra=0,T=0,Y=0,V=0,ua=0,oa=0,Z=0,R=0,X=0,N=I=0,N=void 0,$=t.__vertexArray,ia=t.__uvArray,Ea=t.__uv2Array,ga=t.__normalArray,ha=t.__tangentArray,ea=t.__colorArray,ja=t.__skinVertexAArray,sa=t.__skinVertexBArray,
-aa=t.__skinIndexArray,fa=t.__skinWeightArray,na=t.__morphTargetsArrays,ka=t.__webglCustomAttributes,D=void 0,Ba=t.__faceArray,ta=t.__lineArray,ya=t.__needsSmoothNormals,y=t.__vertexColorType,v=t.__uvType,z=t.__normalType,va=h.geometry,Ia=va.__dirtyVertices,Ca=va.__dirtyElements,Ha=va.__dirtyUvs,Ga=va.__dirtyNormals,Da=va.__dirtyTangents,Fa=va.__dirtyColors,Ka=va.__dirtyMorphTargets,za=va.vertices,Xa=t.faces,fb=va.faces,cb=va.faceVertexUvs[0],db=va.faceVertexUvs[1],Ra=va.skinVerticesA,Sa=va.skinVerticesB,
+k.__dirtyColors||k.__dirtyTangents||t)if(t=m,y=p.DYNAMIC_DRAW,S=!k.dynamic,t.__inittedArrays){var E=u=x=void 0,B=void 0,qa=E=void 0,la=void 0,K=void 0,H=void 0,ca=da=O=w=A=z=v=void 0,ma=void 0,L=void 0,I=B=H=B=K=la=void 0,D=void 0,N=D=I=la=void 0,Q=void 0,W=N=D=I=E=E=qa=H=B=N=D=I=Q=N=D=I=Q=N=D=I=void 0,U=0,pa=0,ra=0,T=0,Y=0,V=0,ua=0,oa=0,Z=0,R=0,X=0,N=I=0,N=void 0,$=t.__vertexArray,ia=t.__uvArray,Ea=t.__uv2Array,ga=t.__normalArray,ha=t.__tangentArray,ea=t.__colorArray,ja=t.__skinVertexAArray,sa=t.__skinVertexBArray,
+aa=t.__skinIndexArray,fa=t.__skinWeightArray,na=t.__morphTargetsArrays,ka=t.__webglCustomAttributes,D=void 0,Ba=t.__faceArray,ta=t.__lineArray,ya=t.__needsSmoothNormals,z=t.__vertexColorType,v=t.__uvType,A=t.__normalType,va=h.geometry,Ia=va.__dirtyVertices,Ca=va.__dirtyElements,Ha=va.__dirtyUvs,Ga=va.__dirtyNormals,Da=va.__dirtyTangents,Fa=va.__dirtyColors,Ka=va.__dirtyMorphTargets,za=va.vertices,Xa=t.faces,fb=va.faces,cb=va.faceVertexUvs[0],db=va.faceVertexUvs[1],Ra=va.skinVerticesA,Sa=va.skinVerticesB,
 Ta=va.skinIndices,Ma=va.skinWeights,La=va.morphTargets;if(ka)for(W in ka)ka[W].offset=0,ka[W].offsetSrc=0;x=0;for(u=Xa.length;x<u;x++)if(E=Xa[x],B=fb[E],cb&&(w=cb[E]),db&&(O=db[E]),E=B.vertexNormals,qa=B.normal,la=B.vertexColors,K=B.color,H=B.vertexTangents,B instanceof THREE.Face3){if(Ia)da=za[B.a].position,ca=za[B.b].position,ma=za[B.c].position,$[pa]=da.x,$[pa+1]=da.y,$[pa+2]=da.z,$[pa+3]=ca.x,$[pa+4]=ca.y,$[pa+5]=ca.z,$[pa+6]=ma.x,$[pa+7]=ma.y,$[pa+8]=ma.z,pa+=9;if(ka)for(W in ka)if(D=ka[W],D.__original.needsUpdate)I=
 D.offset,N=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[I]=D.value[B.a],D.array[I+1]=D.value[B.b],D.array[I+2]=D.value[B.c]):D.boundTo==="faces"?(N=D.value[N],D.array[I]=N,D.array[I+1]=N,D.array[I+2]=N,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[I]=D.value[N],D.array[I+1]=D.value[N+1],D.array[I+2]=D.value[N+2],D.offsetSrc+=3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(da=D.value[B.a],ca=D.value[B.b],ma=D.value[B.c]):D.boundTo==="faces"?(ma=ca=
 da=N=D.value[N],D.offsetSrc++):D.boundTo==="faceVertices"&&(da=D.value[N],ca=D.value[N+1],ma=D.value[N+2],D.offsetSrc+=3),D.size===2?(D.array[I]=da.x,D.array[I+1]=da.y,D.array[I+2]=ca.x,D.array[I+3]=ca.y,D.array[I+4]=ma.x,D.array[I+5]=ma.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[I]=da.r,D.array[I+1]=da.g,D.array[I+2]=da.b,D.array[I+3]=ca.r,D.array[I+4]=ca.g,D.array[I+5]=ca.b,D.array[I+6]=ma.r,D.array[I+7]=ma.g,D.array[I+8]=ma.b):(D.array[I]=da.x,D.array[I+1]=da.y,D.array[I+2]=da.z,D.array[I+
 3]=ca.x,D.array[I+4]=ca.y,D.array[I+5]=ca.z,D.array[I+6]=ma.x,D.array[I+7]=ma.y,D.array[I+8]=ma.z),D.offset+=9):(D.array[I]=da.x,D.array[I+1]=da.y,D.array[I+2]=da.z,D.array[I+3]=da.w,D.array[I+4]=ca.x,D.array[I+5]=ca.y,D.array[I+6]=ca.z,D.array[I+7]=ca.w,D.array[I+8]=ma.x,D.array[I+9]=ma.y,D.array[I+10]=ma.z,D.array[I+11]=ma.w,D.offset+=12));if(Ka){I=0;for(D=La.length;I<D;I++)da=La[I].vertices[B.a].position,ca=La[I].vertices[B.b].position,ma=La[I].vertices[B.c].position,N=na[I],N[X]=da.x,N[X+1]=da.y,
 N[X+2]=da.z,N[X+3]=ca.x,N[X+4]=ca.y,N[X+5]=ca.z,N[X+6]=ma.x,N[X+7]=ma.y,N[X+8]=ma.z;X+=9}if(Ma.length)I=Ma[B.a],D=Ma[B.b],N=Ma[B.c],fa[R]=I.x,fa[R+1]=I.y,fa[R+2]=I.z,fa[R+3]=I.w,fa[R+4]=D.x,fa[R+5]=D.y,fa[R+6]=D.z,fa[R+7]=D.w,fa[R+8]=N.x,fa[R+9]=N.y,fa[R+10]=N.z,fa[R+11]=N.w,I=Ta[B.a],D=Ta[B.b],N=Ta[B.c],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=I.w,aa[R+4]=D.x,aa[R+5]=D.y,aa[R+6]=D.z,aa[R+7]=D.w,aa[R+8]=N.x,aa[R+9]=N.y,aa[R+10]=N.z,aa[R+11]=N.w,I=Ra[B.a],D=Ra[B.b],N=Ra[B.c],ja[R]=I.x,ja[R+1]=I.y,
-ja[R+2]=I.z,ja[R+3]=1,ja[R+4]=D.x,ja[R+5]=D.y,ja[R+6]=D.z,ja[R+7]=1,ja[R+8]=N.x,ja[R+9]=N.y,ja[R+10]=N.z,ja[R+11]=1,I=Sa[B.a],D=Sa[B.b],N=Sa[B.c],sa[R]=I.x,sa[R+1]=I.y,sa[R+2]=I.z,sa[R+3]=1,sa[R+4]=D.x,sa[R+5]=D.y,sa[R+6]=D.z,sa[R+7]=1,sa[R+8]=N.x,sa[R+9]=N.y,sa[R+10]=N.z,sa[R+11]=1,R+=12;if(Fa&&y)la.length==3&&y==THREE.VertexColors?(B=la[0],I=la[1],D=la[2]):D=I=B=K,ea[Z]=B.r,ea[Z+1]=B.g,ea[Z+2]=B.b,ea[Z+3]=I.r,ea[Z+4]=I.g,ea[Z+5]=I.b,ea[Z+6]=D.r,ea[Z+7]=D.g,ea[Z+8]=D.b,Z+=9;if(Da&&va.hasTangents)la=
-H[0],K=H[1],B=H[2],ha[ua]=la.x,ha[ua+1]=la.y,ha[ua+2]=la.z,ha[ua+3]=la.w,ha[ua+4]=K.x,ha[ua+5]=K.y,ha[ua+6]=K.z,ha[ua+7]=K.w,ha[ua+8]=B.x,ha[ua+9]=B.y,ha[ua+10]=B.z,ha[ua+11]=B.w,ua+=12;if(Ga&&z)if(E.length==3&&ya)for(H=0;H<3;H++)qa=E[H],ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;else for(H=0;H<3;H++)ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;if(Ha&&w!==void 0&&v)for(H=0;H<3;H++)E=w[H],ia[ra]=E.u,ia[ra+1]=E.v,ra+=2;if(Ha&&O!==void 0&&v)for(H=0;H<3;H++)E=O[H],Ea[T]=E.u,Ea[T+1]=E.v,T+=2;Ca&&(Ba[Y]=U,
+ja[R+2]=I.z,ja[R+3]=1,ja[R+4]=D.x,ja[R+5]=D.y,ja[R+6]=D.z,ja[R+7]=1,ja[R+8]=N.x,ja[R+9]=N.y,ja[R+10]=N.z,ja[R+11]=1,I=Sa[B.a],D=Sa[B.b],N=Sa[B.c],sa[R]=I.x,sa[R+1]=I.y,sa[R+2]=I.z,sa[R+3]=1,sa[R+4]=D.x,sa[R+5]=D.y,sa[R+6]=D.z,sa[R+7]=1,sa[R+8]=N.x,sa[R+9]=N.y,sa[R+10]=N.z,sa[R+11]=1,R+=12;if(Fa&&z)la.length==3&&z==THREE.VertexColors?(B=la[0],I=la[1],D=la[2]):D=I=B=K,ea[Z]=B.r,ea[Z+1]=B.g,ea[Z+2]=B.b,ea[Z+3]=I.r,ea[Z+4]=I.g,ea[Z+5]=I.b,ea[Z+6]=D.r,ea[Z+7]=D.g,ea[Z+8]=D.b,Z+=9;if(Da&&va.hasTangents)la=
+H[0],K=H[1],B=H[2],ha[ua]=la.x,ha[ua+1]=la.y,ha[ua+2]=la.z,ha[ua+3]=la.w,ha[ua+4]=K.x,ha[ua+5]=K.y,ha[ua+6]=K.z,ha[ua+7]=K.w,ha[ua+8]=B.x,ha[ua+9]=B.y,ha[ua+10]=B.z,ha[ua+11]=B.w,ua+=12;if(Ga&&A)if(E.length==3&&ya)for(H=0;H<3;H++)qa=E[H],ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;else for(H=0;H<3;H++)ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;if(Ha&&w!==void 0&&v)for(H=0;H<3;H++)E=w[H],ia[ra]=E.u,ia[ra+1]=E.v,ra+=2;if(Ha&&O!==void 0&&v)for(H=0;H<3;H++)E=O[H],Ea[T]=E.u,Ea[T+1]=E.v,T+=2;Ca&&(Ba[Y]=U,
 Ba[Y+1]=U+1,Ba[Y+2]=U+2,Y+=3,ta[oa]=U,ta[oa+1]=U+1,ta[oa+2]=U,ta[oa+3]=U+2,ta[oa+4]=U+1,ta[oa+5]=U+2,oa+=6,U+=3)}else if(B instanceof THREE.Face4){if(Ia)da=za[B.a].position,ca=za[B.b].position,ma=za[B.c].position,L=za[B.d].position,$[pa]=da.x,$[pa+1]=da.y,$[pa+2]=da.z,$[pa+3]=ca.x,$[pa+4]=ca.y,$[pa+5]=ca.z,$[pa+6]=ma.x,$[pa+7]=ma.y,$[pa+8]=ma.z,$[pa+9]=L.x,$[pa+10]=L.y,$[pa+11]=L.z,pa+=12;if(ka)for(W in ka)if(D=ka[W],D.__original.needsUpdate)I=D.offset,N=D.offsetSrc,D.size===1?(D.boundTo===void 0||
 D.boundTo==="vertices"?(D.array[I]=D.value[B.a],D.array[I+1]=D.value[B.b],D.array[I+2]=D.value[B.c],D.array[I+3]=D.value[B.d]):D.boundTo==="faces"?(N=D.value[N],D.array[I]=N,D.array[I+1]=N,D.array[I+2]=N,D.array[I+3]=N,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[I]=D.value[N],D.array[I+1]=D.value[N+1],D.array[I+2]=D.value[N+2],D.array[I+3]=D.value[N+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(da=D.value[B.a],ca=D.value[B.b],ma=D.value[B.c],L=D.value[B.d]):
 D.boundTo==="faces"?(L=ma=ca=da=N=D.value[N],D.offsetSrc++):D.boundTo==="faceVertices"&&(da=D.value[N],ca=D.value[N+1],ma=D.value[N+2],L=D.value[N+3],D.offsetSrc+=4),D.size===2?(D.array[I]=da.x,D.array[I+1]=da.y,D.array[I+2]=ca.x,D.array[I+3]=ca.y,D.array[I+4]=ma.x,D.array[I+5]=ma.y,D.array[I+6]=L.x,D.array[I+7]=L.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[I]=da.r,D.array[I+1]=da.g,D.array[I+2]=da.b,D.array[I+3]=ca.r,D.array[I+4]=ca.g,D.array[I+5]=ca.b,D.array[I+6]=ma.r,D.array[I+7]=ma.g,D.array[I+
 8]=ma.b,D.array[I+9]=L.r,D.array[I+10]=L.g,D.array[I+11]=L.b):(D.array[I]=da.x,D.array[I+1]=da.y,D.array[I+2]=da.z,D.array[I+3]=ca.x,D.array[I+4]=ca.y,D.array[I+5]=ca.z,D.array[I+6]=ma.x,D.array[I+7]=ma.y,D.array[I+8]=ma.z,D.array[I+9]=L.x,D.array[I+10]=L.y,D.array[I+11]=L.z),D.offset+=12):(D.array[I]=da.x,D.array[I+1]=da.y,D.array[I+2]=da.z,D.array[I+3]=da.w,D.array[I+4]=ca.x,D.array[I+5]=ca.y,D.array[I+6]=ca.z,D.array[I+7]=ca.w,D.array[I+8]=ma.x,D.array[I+9]=ma.y,D.array[I+10]=ma.z,D.array[I+11]=
 ma.w,D.array[I+12]=L.x,D.array[I+13]=L.y,D.array[I+14]=L.z,D.array[I+15]=L.w,D.offset+=16));if(Ka){I=0;for(D=La.length;I<D;I++)da=La[I].vertices[B.a].position,ca=La[I].vertices[B.b].position,ma=La[I].vertices[B.c].position,L=La[I].vertices[B.d].position,N=na[I],N[X]=da.x,N[X+1]=da.y,N[X+2]=da.z,N[X+3]=ca.x,N[X+4]=ca.y,N[X+5]=ca.z,N[X+6]=ma.x,N[X+7]=ma.y,N[X+8]=ma.z,N[X+9]=L.x,N[X+10]=L.y,N[X+11]=L.z;X+=12}if(Ma.length)I=Ma[B.a],D=Ma[B.b],N=Ma[B.c],Q=Ma[B.d],fa[R]=I.x,fa[R+1]=I.y,fa[R+2]=I.z,fa[R+
 3]=I.w,fa[R+4]=D.x,fa[R+5]=D.y,fa[R+6]=D.z,fa[R+7]=D.w,fa[R+8]=N.x,fa[R+9]=N.y,fa[R+10]=N.z,fa[R+11]=N.w,fa[R+12]=Q.x,fa[R+13]=Q.y,fa[R+14]=Q.z,fa[R+15]=Q.w,I=Ta[B.a],D=Ta[B.b],N=Ta[B.c],Q=Ta[B.d],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=I.w,aa[R+4]=D.x,aa[R+5]=D.y,aa[R+6]=D.z,aa[R+7]=D.w,aa[R+8]=N.x,aa[R+9]=N.y,aa[R+10]=N.z,aa[R+11]=N.w,aa[R+12]=Q.x,aa[R+13]=Q.y,aa[R+14]=Q.z,aa[R+15]=Q.w,I=Ra[B.a],D=Ra[B.b],N=Ra[B.c],Q=Ra[B.d],ja[R]=I.x,ja[R+1]=I.y,ja[R+2]=I.z,ja[R+3]=1,ja[R+4]=D.x,ja[R+5]=D.y,
-ja[R+6]=D.z,ja[R+7]=1,ja[R+8]=N.x,ja[R+9]=N.y,ja[R+10]=N.z,ja[R+11]=1,ja[R+12]=Q.x,ja[R+13]=Q.y,ja[R+14]=Q.z,ja[R+15]=1,I=Sa[B.a],D=Sa[B.b],N=Sa[B.c],B=Sa[B.d],sa[R]=I.x,sa[R+1]=I.y,sa[R+2]=I.z,sa[R+3]=1,sa[R+4]=D.x,sa[R+5]=D.y,sa[R+6]=D.z,sa[R+7]=1,sa[R+8]=N.x,sa[R+9]=N.y,sa[R+10]=N.z,sa[R+11]=1,sa[R+12]=B.x,sa[R+13]=B.y,sa[R+14]=B.z,sa[R+15]=1,R+=16;if(Fa&&y)la.length==4&&y==THREE.VertexColors?(B=la[0],I=la[1],D=la[2],la=la[3]):la=D=I=B=K,ea[Z]=B.r,ea[Z+1]=B.g,ea[Z+2]=B.b,ea[Z+3]=I.r,ea[Z+4]=I.g,
-ea[Z+5]=I.b,ea[Z+6]=D.r,ea[Z+7]=D.g,ea[Z+8]=D.b,ea[Z+9]=la.r,ea[Z+10]=la.g,ea[Z+11]=la.b,Z+=12;if(Da&&va.hasTangents)la=H[0],K=H[1],B=H[2],H=H[3],ha[ua]=la.x,ha[ua+1]=la.y,ha[ua+2]=la.z,ha[ua+3]=la.w,ha[ua+4]=K.x,ha[ua+5]=K.y,ha[ua+6]=K.z,ha[ua+7]=K.w,ha[ua+8]=B.x,ha[ua+9]=B.y,ha[ua+10]=B.z,ha[ua+11]=B.w,ha[ua+12]=H.x,ha[ua+13]=H.y,ha[ua+14]=H.z,ha[ua+15]=H.w,ua+=16;if(Ga&&z)if(E.length==4&&ya)for(H=0;H<4;H++)qa=E[H],ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;else for(H=0;H<4;H++)ga[V]=qa.x,ga[V+1]=
-qa.y,ga[V+2]=qa.z,V+=3;if(Ha&&w!==void 0&&v)for(H=0;H<4;H++)E=w[H],ia[ra]=E.u,ia[ra+1]=E.v,ra+=2;if(Ha&&O!==void 0&&v)for(H=0;H<4;H++)E=O[H],Ea[T]=E.u,Ea[T+1]=E.v,T+=2;Ca&&(Ba[Y]=U,Ba[Y+1]=U+1,Ba[Y+2]=U+3,Ba[Y+3]=U+1,Ba[Y+4]=U+2,Ba[Y+5]=U+3,Y+=6,ta[oa]=U,ta[oa+1]=U+1,ta[oa+2]=U,ta[oa+3]=U+3,ta[oa+4]=U+1,ta[oa+5]=U+2,ta[oa+6]=U+2,ta[oa+7]=U+3,oa+=8,U+=4)}Ia&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,$,A));if(ka)for(W in ka)D=ka[W],D.__original.needsUpdate&&(p.bindBuffer(p.ARRAY_BUFFER,
-D.buffer),p.bufferData(p.ARRAY_BUFFER,D.array,A));if(Ka){I=0;for(D=La.length;I<D;I++)p.bindBuffer(p.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[I]),p.bufferData(p.ARRAY_BUFFER,na[I],A)}Fa&&Z>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,ea,A));Ga&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglNormalBuffer),p.bufferData(p.ARRAY_BUFFER,ga,A));Da&&va.hasTangents&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglTangentBuffer),p.bufferData(p.ARRAY_BUFFER,ha,A));Ha&&ra>0&&(p.bindBuffer(p.ARRAY_BUFFER,
-t.__webglUVBuffer),p.bufferData(p.ARRAY_BUFFER,ia,A));Ha&&T>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUV2Buffer),p.bufferData(p.ARRAY_BUFFER,Ea,A));Ca&&(p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,Ba,A),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,ta,A));R>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexABuffer),p.bufferData(p.ARRAY_BUFFER,ja,A),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),
-p.bufferData(p.ARRAY_BUFFER,sa,A),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),p.bufferData(p.ARRAY_BUFFER,aa,A),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),p.bufferData(p.ARRAY_BUFFER,fa,A));S&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices=
-!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=S=S=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;y=h.__vertexArray;A=h.__colorArray;z=h.__dirtyColors;if(h.__dirtyVertices){for(S=0;S<v;S++)x=u[S].position,n=S*3,y[n]=x.x,y[n+1]=x.y,y[n+2]=x.z;p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer);p.bufferData(p.ARRAY_BUFFER,
-y,m)}if(z){for(S=0;S<t;S++)color=o[S],n=S*3,A[n]=color.r,A[n+1]=color.g,A[n+2]=color.b;p.bindBuffer(p.ARRAY_BUFFER,h.__webglColorBuffer);p.bufferData(p.ARRAY_BUFFER,A,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=S=S=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;y=h.__vertexArray;A=h.__colorArray;z=h.__dirtyColors;if(h.__dirtyVertices){for(S=0;S<v;S++)x=u[S].position,n=S*3,y[n]=x.x,y[n+
-1]=x.y,y[n+2]=x.z;p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer);p.bufferData(p.ARRAY_BUFFER,y,m)}if(z){for(S=0;S<t;S++)color=o[S],n=S*3,A[n]=color.r,A[n+1]=color.g,A[n+2]=color.b;p.bindBuffer(p.ARRAY_BUFFER,h.__webglColorBuffer);p.bufferData(p.ARRAY_BUFFER,A,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,t=F(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&c(k,p.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,C(k)};this.setFaceCulling=
+ja[R+6]=D.z,ja[R+7]=1,ja[R+8]=N.x,ja[R+9]=N.y,ja[R+10]=N.z,ja[R+11]=1,ja[R+12]=Q.x,ja[R+13]=Q.y,ja[R+14]=Q.z,ja[R+15]=1,I=Sa[B.a],D=Sa[B.b],N=Sa[B.c],B=Sa[B.d],sa[R]=I.x,sa[R+1]=I.y,sa[R+2]=I.z,sa[R+3]=1,sa[R+4]=D.x,sa[R+5]=D.y,sa[R+6]=D.z,sa[R+7]=1,sa[R+8]=N.x,sa[R+9]=N.y,sa[R+10]=N.z,sa[R+11]=1,sa[R+12]=B.x,sa[R+13]=B.y,sa[R+14]=B.z,sa[R+15]=1,R+=16;if(Fa&&z)la.length==4&&z==THREE.VertexColors?(B=la[0],I=la[1],D=la[2],la=la[3]):la=D=I=B=K,ea[Z]=B.r,ea[Z+1]=B.g,ea[Z+2]=B.b,ea[Z+3]=I.r,ea[Z+4]=I.g,
+ea[Z+5]=I.b,ea[Z+6]=D.r,ea[Z+7]=D.g,ea[Z+8]=D.b,ea[Z+9]=la.r,ea[Z+10]=la.g,ea[Z+11]=la.b,Z+=12;if(Da&&va.hasTangents)la=H[0],K=H[1],B=H[2],H=H[3],ha[ua]=la.x,ha[ua+1]=la.y,ha[ua+2]=la.z,ha[ua+3]=la.w,ha[ua+4]=K.x,ha[ua+5]=K.y,ha[ua+6]=K.z,ha[ua+7]=K.w,ha[ua+8]=B.x,ha[ua+9]=B.y,ha[ua+10]=B.z,ha[ua+11]=B.w,ha[ua+12]=H.x,ha[ua+13]=H.y,ha[ua+14]=H.z,ha[ua+15]=H.w,ua+=16;if(Ga&&A)if(E.length==4&&ya)for(H=0;H<4;H++)qa=E[H],ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;else for(H=0;H<4;H++)ga[V]=qa.x,ga[V+1]=
+qa.y,ga[V+2]=qa.z,V+=3;if(Ha&&w!==void 0&&v)for(H=0;H<4;H++)E=w[H],ia[ra]=E.u,ia[ra+1]=E.v,ra+=2;if(Ha&&O!==void 0&&v)for(H=0;H<4;H++)E=O[H],Ea[T]=E.u,Ea[T+1]=E.v,T+=2;Ca&&(Ba[Y]=U,Ba[Y+1]=U+1,Ba[Y+2]=U+3,Ba[Y+3]=U+1,Ba[Y+4]=U+2,Ba[Y+5]=U+3,Y+=6,ta[oa]=U,ta[oa+1]=U+1,ta[oa+2]=U,ta[oa+3]=U+3,ta[oa+4]=U+1,ta[oa+5]=U+2,ta[oa+6]=U+2,ta[oa+7]=U+3,oa+=8,U+=4)}Ia&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,$,y));if(ka)for(W in ka)D=ka[W],D.__original.needsUpdate&&(p.bindBuffer(p.ARRAY_BUFFER,
+D.buffer),p.bufferData(p.ARRAY_BUFFER,D.array,y));if(Ka){I=0;for(D=La.length;I<D;I++)p.bindBuffer(p.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[I]),p.bufferData(p.ARRAY_BUFFER,na[I],y)}Fa&&Z>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,ea,y));Ga&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglNormalBuffer),p.bufferData(p.ARRAY_BUFFER,ga,y));Da&&va.hasTangents&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglTangentBuffer),p.bufferData(p.ARRAY_BUFFER,ha,y));Ha&&ra>0&&(p.bindBuffer(p.ARRAY_BUFFER,
+t.__webglUVBuffer),p.bufferData(p.ARRAY_BUFFER,ia,y));Ha&&T>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUV2Buffer),p.bufferData(p.ARRAY_BUFFER,Ea,y));Ca&&(p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,Ba,y),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,ta,y));R>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexABuffer),p.bufferData(p.ARRAY_BUFFER,ja,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),
+p.bufferData(p.ARRAY_BUFFER,sa,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),p.bufferData(p.ARRAY_BUFFER,aa,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),p.bufferData(p.ARRAY_BUFFER,fa,y));S&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices=
+!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=S=S=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;z=h.__vertexArray;y=h.__colorArray;A=h.__dirtyColors;if(h.__dirtyVertices){for(S=0;S<v;S++)x=u[S].position,n=S*3,z[n]=x.x,z[n+1]=x.y,z[n+2]=x.z;p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer);p.bufferData(p.ARRAY_BUFFER,
+z,m)}if(A){for(S=0;S<t;S++)color=o[S],n=S*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;p.bindBuffer(p.ARRAY_BUFFER,h.__webglColorBuffer);p.bufferData(p.ARRAY_BUFFER,y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=S=S=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;z=h.__vertexArray;y=h.__colorArray;A=h.__dirtyColors;if(h.__dirtyVertices){for(S=0;S<v;S++)x=u[S].position,n=S*3,z[n]=x.x,z[n+
+1]=x.y,z[n+2]=x.z;p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer);p.bufferData(p.ARRAY_BUFFER,z,m)}if(A){for(S=0;S<t;S++)color=o[S],n=S*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;p.bindBuffer(p.ARRAY_BUFFER,h.__webglColorBuffer);p.bufferData(p.ARRAY_BUFFER,y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,t=F(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&c(k,p.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,C(k)};this.setFaceCulling=
 function(b,c){b?(!c||c=="ccw"?p.frontFace(p.CCW):p.frontFace(p.CW),b=="back"?p.cullFace(p.BACK):b=="front"?p.cullFace(p.FRONT):p.cullFace(p.FRONT_AND_BACK),p.enable(p.CULL_FACE)):p.disable(p.CULL_FACE)};this.supportsVertexTextures=function(){return Ha}};
 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};
@@ -352,8 +352,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,u=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 o=0,x=n.length;o<x;o++){var v=new THREE.Vertex(n[o].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}o=0;for(x=t.length;o<x;o++){var v=t[o],z,A,y=v.vertexNormals,
-E=v.vertexColors;v instanceof THREE.Face3?z=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(z=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));z.normal.copy(v.normal);f&&f.multiplyVector3(z.normal);m=0;for(n=y.length;m<n;m++)A=y[m].clone(),f&&f.multiplyVector3(A),z.vertexNormals.push(A);z.color.copy(v.color);m=0;for(n=E.length;m<n;m++)A=E[m],z.vertexColors.push(A.clone());z.materials=v.materials.slice();z.centroid.copy(v.centroid);e&&e.multiplyVector3(z.centroid);u.push(z)}o=0;for(x=k.length;o<
+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,u=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 o=0,x=n.length;o<x;o++){var v=new THREE.Vertex(n[o].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}o=0;for(x=t.length;o<x;o++){var v=t[o],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);u.push(A)}o=0;for(x=k.length;o<
 x;o++){e=k[o];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],u,t,w=n.vertexNormals,o=n.vertexColors;n instanceof THREE.Face3?u=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(u=new THREE.Face4(n.a,n.b,n.c,n.d));u.normal.copy(n.normal);f=0;
 for(m=w.length;f<m;f++)t=w[f],u.vertexNormals.push(t.clone());u.color.copy(n.color);f=0;for(m=o.length;f<m;f++)t=o[f],u.vertexColors.push(t.clone());u.materials=n.materials.slice();u.centroid.copy(n.centroid);c.faces.push(u)}b=0;for(e=k.length;b<e;b++){h=k[b];u=[];f=0;for(m=h.length;f<m;f++)u.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(u)}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,
@@ -362,8 +362,8 @@ b?c(e,k-1):t[k]<b?c(k+1,f):k}return c(0,t.length-1)}var f,h,k=b.faces,m=b.vertic
 t[h]=u}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*u,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 c=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
-b[2]*b[2]);return[b[0]/c,b[1]/c,b[2]/c]};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,u=m.createImageData(f,h),t=u.data,w=0;w<f;w++)for(var o=1;o<h;o++){var x=o-1<0?h-1:o-1,v=(o+1)%h,z=w-1<0?f-1:w-1,A=(w+1)%f,y=[],E=[0,0,n[(o*f+w)*4]/255*c];y.push([-1,0,n[(o*f+z)*4]/255*c]);y.push([-1,-1,n[(x*f+z)*4]/255*c]);y.push([0,-1,n[(x*f+w)*4]/255*c]);y.push([1,-1,n[(x*f+A)*4]/255*c]);
-y.push([1,0,n[(o*f+A)*4]/255*c]);y.push([1,1,n[(v*f+A)*4]/255*c]);y.push([0,1,n[(v*f+w)*4]/255*c]);y.push([-1,1,n[(v*f+z)*4]/255*c]);x=[];z=y.length;for(v=0;v<z;v++){var A=y[v],F=y[(v+1)%z],A=[A[0]-E[0],A[1]-E[1],A[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([A[1]*F[2]-A[2]*F[1],A[2]*F[0]-A[0]*F[2],A[0]*F[1]-A[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=(o*f+w)*4;t[E]=(y[0]+1)/2*255|0;t[E+1]=(y[1]+0.5)*
+b[2]*b[2]);return[b[0]/c,b[1]/c,b[2]/c]};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,u=m.createImageData(f,h),t=u.data,w=0;w<f;w++)for(var o=1;o<h;o++){var x=o-1<0?h-1:o-1,v=(o+1)%h,A=w-1<0?f-1:w-1,z=(w+1)%f,y=[],E=[0,0,n[(o*f+w)*4]/255*c];y.push([-1,0,n[(o*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[(o*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=(o*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(u,0,0);return k}};THREE.MathUtils={clamp:function(b,c,e){return b<c?c:b>e?e:b},mapLinear:function(b,c,e,f,h){return(b-c)*(h-f)/(e-c)+f}};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}"},
@@ -403,9 +403,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,u,t,w,o,x,v,z,A;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];u=k[3];o=k[0];x=k[1];e.length>0?(m=e[e.length-1],v=m.x,z=m.y):(m=this.actions[f-1].args,v=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b2(A,v,o,n),A=THREE.Shape.Utils.b2(A,z,x,
-u),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];u=k[5];o=k[0];x=k[1];t=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,z=m.y):(m=this.actions[f-1].args,v=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b3(A,v,o,t,n),A=THREE.Shape.Utils.b3(A,z,x,w,u),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];A=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
-for(m=1;m<=A;m++)e.push(k.getPointAt(m/A));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];u=k[1];t=k[2];o=k[3];A=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);z=A-o;var y=b*2;for(m=1;m<=y;m++)A=m/y,x||(A=1-A),A=o+A*z,k=w+n+t*Math.cos(A),A=v+u+t*Math.sin(A),e.push(new THREE.Vector2(k,A))}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,u,t,w,o,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];u=k[3];o=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,o,n),z=THREE.Shape.Utils.b2(z,A,x,
+u),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];u=k[5];o=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,o,t,n),z=THREE.Shape.Utils.b3(z,A,x,w,u),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];u=k[1];t=k[2];o=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-o;var y=b*2;for(m=1;m<=y;m++)z=m/y,x||(z=1-z),z=o+z*A,k=w+n+t*Math.cos(z),z=v+u+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,u,t,w,o;n=0;for(u=m.length;n<u;n++)t=m[n],w=t.x,o=t.y,t.x=b*w+c*o+e,t.y=f*o+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()};
@@ -413,9 +413,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,u,t,w,o,x,v,z=[];for(u=0;u<c.length;u++){t=c[u];Array.prototype.push.apply(f,t);k=Number.POSITIVE_INFINITY;for(h=0;h<t.length;h++){x=t[h];v=[];for(o=0;o<e.length;o++)w=e[o],w=x.distanceToSquared(w),v.push(w),w<k&&(k=w,m=h,n=o)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;var A=[t[m],e[n],e[h]];o=THREE.FontUtils.Triangulate.area(A);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;A=[t[m],e[n],e[h]];A=THREE.FontUtils.Triangulate.area(A);y=[t[m],t[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);o+x>A+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);o=e.slice(0,n);x=e.slice(n);v=t.slice(m);w=t.slice(0,m);k=[t[m],t[k],e[n]];z.push([t[m],e[n],e[h]]);z.push(k);e=o.concat(v).concat(w).concat(x)}return{shape:e,
-isolatedPts:z,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,u,t={};k=0;for(m=f.length;k<m;k++)u=f[k].x+":"+f[k].y,t[u]!==void 0&&console.log("Duplicate point",u),t[u]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)u=n[f].x+":"+n[f].y,u=t[u],u!==void 0&&(n[f]=u)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)u=n[f].x+":"+n[f].y,u=t[u],u!==void 0&&(n[f]=u)}return e.concat(h)},
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,m,n,u,t,w,o,x,v,A=[];for(u=0;u<c.length;u++){t=c[u];Array.prototype.push.apply(f,t);k=Number.POSITIVE_INFINITY;for(h=0;h<t.length;h++){x=t[h];v=[];for(o=0;o<e.length;o++)w=e[o],w=x.distanceToSquared(w),v.push(w),w<k&&(k=w,m=h,n=o)}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]];o=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);o+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);o=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=o.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,u,t={};k=0;for(m=f.length;k<m;k++)u=f[k].x+":"+f[k].y,t[u]!==void 0&&console.log("Duplicate point",u),t[u]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)u=n[f].x+":"+n[f].y,u=t[u],u!==void 0&&(n[f]=u)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)u=n[f].x+":"+n[f].y,u=t[u],u!==void 0&&(n[f]=u)}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};
@@ -428,8 +428,8 @@ 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,u,t,w=this.data.JIT.hierarchy,o,x;this.currentTime+=b*this.timeScale;x=this.currentTime;o=this.currentTime%=this.data.length;t=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,z=this.hierarchy.length;v<z;v++)if(b=this.hierarchy[v],u=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 A=0;A<3;A++){e=c[A];m=u.prevKey[e];n=u.nextKey[e];if(n.time<=x){if(o<x)if(this.loop){m=this.data.hierarchy[v].keys[0];for(n=this.getNextKeyWith(e,v,1);n.time<o;)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<
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,m,n,u,t,w=this.data.JIT.hierarchy,o,x;this.currentTime+=b*this.timeScale;x=this.currentTime;o=this.currentTime%=this.data.length;t=parseInt(Math.min(o*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],u=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=u.prevKey[e];n=u.nextKey[e];if(n.time<=x){if(o<x)if(this.loop){m=this.data.hierarchy[v].keys[0];for(n=this.getNextKeyWith(e,v,1);n.time<o;)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<
 o)}u.prevKey[e]=m;u.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(o-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===
 "rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&w[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)w[v][t]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
@@ -471,12 +471,12 @@ THREE.FlyControls=function(b,c){function e(b,c){return function(){c.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,u=0,t=0,w=0,o=0,x=0,v=window.innerWidth/2,z=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,u=0,t=0,w=0,o=0,x=0,v=window.innerWidth/2,A=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*o),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(u>0||this.autoForward&&!(u<0)?1:u));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){o=(b.clientX-v)/window.innerWidth;x=(b.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:u=1;break;case 2:u=-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){o=(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:u=1;break;case 2:u=-1}},!1);this.domElement.addEventListener("mouseup",
 function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:u=0;break;case 2:u=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:u=1;break;case 37:case 65:t=-1;break;case 40:case 83:u=-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:u=0;break;case 37:case 65:t=0;break;case 40:case 83:u=
 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,c){return function(){c.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,
@@ -488,22 +488,22 @@ 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&&(o=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?u=t=this.getMouseOnScreen(b.clientX,
 b.clientY):this.noPan||(w=o=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){function u(b,c,e,m,n,o,u,v){var w,x,z=f||1,Y=h||1,H=n/2,T=o/2,Q=t.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")w="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")w="y",Y=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")w="x",z=k||1;var Z=z+1,$=Y+1;n/=z;var P=o/Y;for(x=0;x<$;x++)for(o=0;o<Z;o++){var p=new THREE.Vector3;p[b]=(o*n-H)*e;p[c]=(x*P-T)*m;p[w]=u;t.vertices.push(new THREE.Vertex(p))}for(x=0;x<Y;x++)for(o=0;o<z;o++)t.faces.push(new THREE.Face4(o+Z*x+Q,
-o+Z*(x+1)+Q,o+1+Z*(x+1)+Q,o+1+Z*x+Q,null,null,v)),t.faceVertexUvs[0].push([new THREE.UV(o/z,x/Y),new THREE.UV(o/z,(x+1)/Y),new THREE.UV((o+1)/z,(x+1)/Y),new THREE.UV((o+1)/z,x/Y)])}THREE.Geometry.call(this);var t=this,w=b/2,o=c/2,x=e/2;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var z in n)this.sides[z]!=void 0&&(this.sides[z]=n[z]);
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n){function u(b,c,e,m,n,o,u,v){var w,x,A=f||1,Y=h||1,H=n/2,T=o/2,Q=t.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")w="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")w="y",Y=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")w="x",A=k||1;var Z=A+1,$=Y+1;n/=A;var P=o/Y;for(x=0;x<$;x++)for(o=0;o<Z;o++){var p=new THREE.Vector3;p[b]=(o*n-H)*e;p[c]=(x*P-T)*m;p[w]=u;t.vertices.push(new THREE.Vertex(p))}for(x=0;x<Y;x++)for(o=0;o<A;o++)t.faces.push(new THREE.Face4(o+Z*x+Q,
+o+Z*(x+1)+Q,o+1+Z*(x+1)+Q,o+1+Z*x+Q,null,null,v)),t.faceVertexUvs[0].push([new THREE.UV(o/A,x/Y),new THREE.UV(o/A,(x+1)/Y),new THREE.UV((o+1)/A,(x+1)/Y),new THREE.UV((o+1)/A,x/Y)])}THREE.Geometry.call(this);var t=this,w=b/2,o=c/2,x=e/2;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var A in n)this.sides[A]!=void 0&&(this.sides[A]=n[A]);
 this.sides.px&&u("z","y",-1,-1,e,c,w,this.materials[0]);this.sides.nx&&u("z","y",1,-1,e,c,-w,this.materials[1]);this.sides.py&&u("x","z",1,1,b,e,o,this.materials[2]);this.sides.ny&&u("x","z",1,-1,b,e,-o,this.materials[3]);this.sides.pz&&u("x","y",1,-1,b,c,x,this.materials[4]);this.sides.nz&&u("x","y",-1,-1,b,c,-x,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,u,t=[],w=[];for(u=0;u<=h;u++){var o=[],x=[],v=u/h,z=v*(c-b)+b;for(n=0;n<=f;n++){var A=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(A*Math.PI*2),-v*e+m,z*Math.cos(A*Math.PI*2))));o.push(this.vertices.length-1);x.push(new THREE.UV(A,v))}t.push(o);w.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=t[u][n],o=t[u+1][n],x=t[u+1][n+1],v=t[u][n+1],z=
-this.vertices[e].position.clone().setY(0).normalize(),A=this.vertices[o].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[u][n].clone(),C=w[u+1][n].clone(),G=w[u+1][n+1].clone(),J=w[u][n+1].clone();this.faces.push(new THREE.Face4(e,o,x,v,[z,A,y,E]));this.faceVertexUvs[0].push([F,C,G,J])}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],o=t[0][n+
-1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),F=w[0][n].clone(),C=w[0][n+1].clone(),G=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(e,o,x,[z,A,y])),this.faceVertexUvs[0].push([F,C,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[u][n+1],o=t[u][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),F=w[u][n+1].clone(),C=w[u][n].clone(),
-G=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(e,o,x,[z,A,y])),this.faceVertexUvs[0].push([F,C,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,u,t=[],w=[];for(u=0;u<=h;u++){var o=[],x=[],v=u/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))));o.push(this.vertices.length-1);x.push(new THREE.UV(z,v))}t.push(o);w.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=t[u][n],o=t[u+1][n],x=t[u+1][n+1],v=t[u][n+1],A=
+this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[o].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[u][n].clone(),C=w[u+1][n].clone(),G=w[u+1][n+1].clone(),J=w[u][n+1].clone();this.faces.push(new THREE.Face4(e,o,x,v,[A,z,y,E]));this.faceVertexUvs[0].push([F,C,G,J])}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],o=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(),C=w[0][n+1].clone(),G=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(e,o,x,[A,z,y])),this.faceVertexUvs[0].push([F,C,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[u][n+1],o=t[u][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[u][n+1].clone(),C=w[u][n].clone(),
+G=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(e,o,x,[A,z,y])),this.faceVertexUvs[0].push([F,C,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,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);k.set(b.x-e.x,b.y-e.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
 n.copy(c).addSelf(h);o.copy(e).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(H=b.length;--H>=0;){ka=H;na=H-1;na<0&&(na=b.length-
 1);for(var c=0,e=v+w*2,c=0;c<e;c++){var f=p*c,k=p*(c+1),m=aa+ka+f,h=aa+ka+k,o=m,f=aa+na+f,k=aa+na+k,t=h;o+=Y;f+=Y;k+=Y;t+=Y;L.faces.push(new THREE.Face4(o,f,k,t,null,null,G));G&&(o=c/e,f=(c+1)/e,k=n+u*2,m=(L.vertices[m].position.z+u)/k,h=(L.vertices[h].position.z+u)/k,L.faceVertexUvs[0].push([new THREE.UV(m,o),new THREE.UV(h,o),new THREE.UV(h,f),new THREE.UV(m,f)]))}}}function k(b,c,e){L.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function m(b,c,e){b+=Y;c+=Y;e+=Y;L.faces.push(new THREE.Face3(b,
 c,e,null,null,C));if(C){var f=J.maxY,k=J.maxX,m=L.vertices[c].position.x,c=L.vertices[c].position.y,h=L.vertices[e].position.x,e=L.vertices[e].position.y;L.faceVertexUvs[0].push([new THREE.UV(L.vertices[b].position.x/k,L.vertices[b].position.y/f),new THREE.UV(m/k,c/f),new THREE.UV(h/k,e/f)])}}var n=c.amount!==void 0?c.amount:100,u=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:u-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,A=c.extrudePath,y,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,G=c.extrudeMaterial,J=this.shapebb;if(A)y=A.getPoints(x),v=y.length,E=!0,o=!1;o||(t=u=w=0);var M,K,B,L=this,Y=this.vertices.length;z&&b.addWrapPath(z);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(A=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();K=0;for(B=x.length;K<B;K++)M=x[K],THREE.Shape.Utils.isClockWise(M)&&
-(x[K]=M.reverse());A=!1}A=THREE.Shape.Utils.triangulateShape(z,x);F=z;K=0;for(B=x.length;K<B;K++)M=x[K],z=z.concat(M);var H,T,Q,Z,$,P,p=z.length,V=A.length,fa=[];H=0;T=F.length;ka=T-1;for(na=H+1;H<T;H++,ka++,na++)ka==T&&(ka=0),na==T&&(na=0),fa[H]=f(F[H],F[ka],F[na]);var ea=[],ha,ga=fa.concat();K=0;for(B=x.length;K<B;K++){M=x[K];ha=[];H=0;T=M.length;ka=T-1;for(na=H+1;H<T;H++,ka++,na++)ka==T&&(ka=0),na==T&&(na=0),ha[H]=f(M[H],M[ka],M[na]);ea.push(ha);ga=ga.concat(ha)}for(Q=0;Q<w;Q++){Z=Q/w;$=u*(1-Z);
-Z=t*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H<T;H++)P=e(F[H],fa[H],Z),k(P.x,P.y,-$);K=0;for(B=x.length;K<B;K++){M=x[K];ha=ea[K];H=0;for(T=M.length;H<T;H++)P=e(M[H],ha[H],Z),k(P.x,P.y,-$)}}Z=t;for(H=0;H<p;H++)P=o?e(z[H],ga[H],Z):z[H],E?k(P.x,P.y+y[0].y,y[0].x):k(P.x,P.y,0);for(Q=1;Q<=v;Q++)for(H=0;H<p;H++)P=o?e(z[H],ga[H],Z):z[H],E?k(P.x,P.y+y[Q-1].y,y[Q-1].x):k(P.x,P.y,n/v*Q);for(Q=w-1;Q>=0;Q--){Z=Q/w;$=u*(1-Z);Z=t*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H<T;H++)P=e(F[H],fa[H],Z),k(P.x,P.y,n+$);
-K=0;for(B=x.length;K<B;K++){M=x[K];ha=ea[K];H=0;for(T=M.length;H<T;H++)P=e(M[H],ha[H],Z),E?k(P.x,P.y+y[v-1].y,y[v-1].x+$):k(P.x,P.y,n+$)}}if(o){o=p*0;for(H=0;H<V;H++)t=A[H],m(t[2]+o,t[1]+o,t[0]+o);o=p*(v+w*2);for(H=0;H<V;H++)t=A[H],m(t[0]+o,t[1]+o,t[2]+o)}else{for(H=0;H<V;H++)t=A[H],m(t[2],t[1],t[0]);for(H=0;H<V;H++)t=A[H],m(t[0]+p*v,t[1]+p*v,t[2]+p*v)}var ka,na,aa=0;h(F);aa+=F.length;K=0;for(B=x.length;K<B;K++)M=x[K],h(M),aa+=M.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+!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,C=c.material,G=c.extrudeMaterial,J=this.shapebb;if(z)y=z.getPoints(x),v=y.length,E=!0,o=!1;o||(t=u=w=0);var M,K,B,L=this,Y=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(B=x.length;K<B;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(B=x.length;K<B;K++)M=x[K],A=A.concat(M);var H,T,Q,Z,$,P,p=A.length,V=z.length,fa=[];H=0;T=F.length;ka=T-1;for(na=H+1;H<T;H++,ka++,na++)ka==T&&(ka=0),na==T&&(na=0),fa[H]=f(F[H],F[ka],F[na]);var ea=[],ha,ga=fa.concat();K=0;for(B=x.length;K<B;K++){M=x[K];ha=[];H=0;T=M.length;ka=T-1;for(na=H+1;H<T;H++,ka++,na++)ka==T&&(ka=0),na==T&&(na=0),ha[H]=f(M[H],M[ka],M[na]);ea.push(ha);ga=ga.concat(ha)}for(Q=0;Q<w;Q++){Z=Q/w;$=u*(1-Z);
+Z=t*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H<T;H++)P=e(F[H],fa[H],Z),k(P.x,P.y,-$);K=0;for(B=x.length;K<B;K++){M=x[K];ha=ea[K];H=0;for(T=M.length;H<T;H++)P=e(M[H],ha[H],Z),k(P.x,P.y,-$)}}Z=t;for(H=0;H<p;H++)P=o?e(A[H],ga[H],Z):A[H],E?k(P.x,P.y+y[0].y,y[0].x):k(P.x,P.y,0);for(Q=1;Q<=v;Q++)for(H=0;H<p;H++)P=o?e(A[H],ga[H],Z):A[H],E?k(P.x,P.y+y[Q-1].y,y[Q-1].x):k(P.x,P.y,n/v*Q);for(Q=w-1;Q>=0;Q--){Z=Q/w;$=u*(1-Z);Z=t*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H<T;H++)P=e(F[H],fa[H],Z),k(P.x,P.y,n+$);
+K=0;for(B=x.length;K<B;K++){M=x[K];ha=ea[K];H=0;for(T=M.length;H<T;H++)P=e(M[H],ha[H],Z),E?k(P.x,P.y+y[v-1].y,y[v-1].x+$):k(P.x,P.y,n+$)}}if(o){o=p*0;for(H=0;H<V;H++)t=z[H],m(t[2]+o,t[1]+o,t[0]+o);o=p*(v+w*2);for(H=0;H<V;H++)t=z[H],m(t[0]+o,t[1]+o,t[2]+o)}else{for(H=0;H<V;H++)t=z[H],m(t[2],t[1],t[0]);for(H=0;H<V;H++)t=z[H],m(t[0]+p*v,t[1]+p*v,t[2]+p*v)}var ka,na,aa=0;h(F);aa+=F.length;K=0;for(B=x.length;K<B;K++)M=x[K],h(M),aa+=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,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,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 u=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,u,w,b);e(k.faces[n].b,t,
@@ -516,18 +516,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,u=f+1;b/=e;var t=c/f;for(h=0;h<u;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),u=b*Math.sin(f*h),t=[],w=0;for(f=0;f<k;f++){var o=2*f/k,x=u*Math.sin(o*h),o=u*Math.cos(o*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,n,x)))-1);t.push(w)}c.push(t)}for(var v,z,A,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];u=c[e-1][t?
-k-1:f];t=c[e-1][t?0:f+1];x=e/(h-1);v=(e-1)/(h-1);z=(f+1)/k;var o=f/k,w=new THREE.UV(1-z,x),x=new THREE.UV(1-o,x),o=new THREE.UV(1-o,v),y=new THREE.UV(1-z,v);e<c.length-1&&(v=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),A=this.vertices[u].position.clone(),v.normalize(),z.normalize(),A.normalize(),this.faces.push(new THREE.Face3(m,n,u,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([w,x,o]));e>1&&(v=
-this.vertices[m].position.clone(),z=this.vertices[u].position.clone(),A=this.vertices[t].position.clone(),v.normalize(),z.normalize(),A.normalize(),this.faces.push(new THREE.Face3(m,u,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([w,o,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),u=b*Math.sin(f*h),t=[],w=0;for(f=0;f<k;f++){var o=2*f/k,x=u*Math.sin(o*h),o=u*Math.cos(o*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,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];u=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 o=f/k,w=new THREE.UV(1-A,x),x=new THREE.UV(1-o,x),o=new THREE.UV(1-o,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[u].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,n,u,[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,o]));e>1&&(v=
+this.vertices[m].position.clone(),A=this.vertices[u].position.clone(),z=this.vertices[t].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,u,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,o,y]))}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,u,t,w,o,x,v,z,A,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));u=c.length;for(b=0;b<u;)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;o=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,o,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,z=c[b++]*e+f,A=c[b++]*-e,h.bezierCurveTo(n,t,
-x,v,z,A),m=k[k.length-1]){w=m.x;o=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,w,x,z,n),E=THREE.Shape.Utils.b3(E,o,v,A,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=[],u,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 o=2*h;for(t=h-1;h>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}u=t;h<=u&&(u=0);t=u+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=u,z=t,A=w,y=h,E=m,F=void 0,C=void 0,G=void 0,
-J=void 0,M=void 0,K=void 0,B=void 0,L=void 0,Y=void 0,C=x[E[v]].x,G=x[E[v]].y,J=x[E[z]].x,M=x[E[z]].y,K=x[E[A]].x,B=x[E[A]].y;if(1.0E-10>(J-C)*(B-G)-(M-G)*(K-C))x=!1;else{for(F=0;F<y;F++)if(!(F==v||F==z||F==A)){var L=x[E[F]].x,Y=x[E[F]].y,H=void 0,T=void 0,Q=void 0,Z=void 0,$=void 0,P=void 0,p=void 0,V=void 0,fa=void 0,ea=void 0,ha=void 0,ga=void 0,H=Q=$=void 0,H=K-J,T=B-M,Q=C-K,Z=G-B,$=J-C,P=M-G,p=L-C,V=Y-G,fa=L-J,ea=Y-M,ha=L-K,ga=Y-B,H=H*ea-T*fa,$=$*V-P*p,Q=Q*ga-Z*ha;if(H>=0&&Q>=0&&$>=0){x=!1;break a}}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,u,t,w,o,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(" "));u=c.length;for(b=0;b<u;)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;o=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,o,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;o=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,o,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=[],u,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 o=2*h;for(t=h-1;h>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}u=t;h<=u&&(u=0);t=u+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=u,A=t,z=w,y=h,E=m,F=void 0,C=void 0,G=void 0,
+J=void 0,M=void 0,K=void 0,B=void 0,L=void 0,Y=void 0,C=x[E[v]].x,G=x[E[v]].y,J=x[E[A]].x,M=x[E[A]].y,K=x[E[z]].x,B=x[E[z]].y;if(1.0E-10>(J-C)*(B-G)-(M-G)*(K-C))x=!1;else{for(F=0;F<y;F++)if(!(F==v||F==A||F==z)){var L=x[E[F]].x,Y=x[E[F]].y,H=void 0,T=void 0,Q=void 0,Z=void 0,$=void 0,P=void 0,p=void 0,V=void 0,fa=void 0,ea=void 0,ha=void 0,ga=void 0,H=Q=$=void 0,H=K-J,T=B-M,Q=C-K,Z=G-B,$=J-C,P=M-G,p=L-C,V=Y-G,fa=L-J,ea=Y-M,ha=L-K,ga=Y-B,H=H*ea-T*fa,$=$*V-P*p,Q=Q*ga-Z*ha;if(H>=0&&Q>=0&&$>=0){x=!1;break a}}x=
 !0}}if(x){k.push([b[m[u]],b[m[t]],b[m[w]]]);n.push([m[u],m[t],m[w]]);u=t;for(w=t+1;w<h;u++,w++)m[u]=m[w];h--;o=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,u=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);u.normal.addSelf(c[h]);u.normal.addSelf(c[k]);u.normal.addSelf(c[m]);u.normal.addSelf(c[n]);u.normal.normalize();this.faces.push(u);
@@ -537,12 +537,12 @@ this.segmentsT;++c){var u=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),u=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,u,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,c,e,f,n,t){var u=new THREE.Face4(b,c,e,f,null,n.color,n.material);if(m.useOldVertexColors){u.vertexColors=[];for(var v,p,w,x=0;x<4;x++){w=t[x];v=new THREE.Color;v.setRGB(0,0,0);for(var y=0;y<w.length;y++)p=n.vertexColors[w[y]-1],v.r+=p.r,v.g+=p.g,v.b+=p.b;v.r/=w.length;v.g/=w.length;v.b/=w.length;u.vertexColors[x]=v}}h.push(u);(!m.supportUVs||o.length!=0)&&k.push([o[b],o[c],o[e],o[f]])}function e(b,c){return Math.min(b,c)+"_"+Math.max(b,
-c)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,u=n.concat(),t=[],w={},o=[],x,v,z,A,y,E=b.faceVertexUvs[0];x=0;for(v=E.length;x<v;x++){z=0;for(A=E[x].length;z<A;z++)y=f[x]["abcd".charAt(z)],o[y]||(o[y]=E[x][z])}var F;x=0;for(v=f.length;x<v;x++)if(y=f[x],t.push(y.centroid),u.push(new THREE.Vertex(y.centroid)),m.supportUVs&&o.length!=0){F=new THREE.UV;if(y instanceof THREE.Face3)F.u=o[y.a].u+o[y.b].u+o[y.c].u,F.v=o[y.a].v+o[y.b].v+o[y.c].v,F.u/=3,F.v/=3;else if(y instanceof THREE.Face4)F.u=o[y.a].u+
-o[y.b].u+o[y.c].u+o[y.d].u,F.v=o[y.a].v+o[y.b].v+o[y.c].v+o[y.d].v,F.u/=4,F.v/=4;o.push(F)}A=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,k,m,h,n={};f=0;for(k=b.faces.length;f<k;f++)m=b.faces[f],m instanceof THREE.Face3?(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.a),c(n,h,f)):m instanceof THREE.Face4&&(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.d),c(n,h,f),h=e(m.d,m.a),c(n,h,f));return n}(b);var C,G,J=0,E=n.length,M;for(x in A)if(y=A[x],F=y[0],C=
+c)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,u=n.concat(),t=[],w={},o=[],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)],o[y]||(o[y]=E[x][A])}var F;x=0;for(v=f.length;x<v;x++)if(y=f[x],t.push(y.centroid),u.push(new THREE.Vertex(y.centroid)),m.supportUVs&&o.length!=0){F=new THREE.UV;if(y instanceof THREE.Face3)F.u=o[y.a].u+o[y.b].u+o[y.c].u,F.v=o[y.a].v+o[y.b].v+o[y.c].v,F.u/=3,F.v/=3;else if(y instanceof THREE.Face4)F.u=o[y.a].u+
+o[y.b].u+o[y.c].u+o[y.d].u,F.v=o[y.a].v+o[y.b].v+o[y.c].v+o[y.d].v,F.u/=4,F.v/=4;o.push(F)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,k,m,h,n={};f=0;for(k=b.faces.length;f<k;f++)m=b.faces[f],m instanceof THREE.Face3?(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.a),c(n,h,f)):m instanceof THREE.Face4&&(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.d),c(n,h,f),h=e(m.d,m.a),c(n,h,f));return n}(b);var C,G,J=0,E=n.length,M;for(x in z)if(y=z[x],F=y[0],C=
 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[C]),G.addSelf(n[v].position),G.addSelf(n[M].position),G.multiplyScalar(0.25)),w[x]=E+f.length+J,u.push(new THREE.Vertex(G)),J++,m.supportUVs&&o.length!=0)F=new THREE.UV,F.u=o[v].u+o[M].u,F.v=o[v].v+o[M].v,F.u/=2,F.v/=2,o.push(F);x=0;for(v=t.length;x<v;x++)y=f[x],F=E+x,y instanceof THREE.Face3?(C=e(y.a,y.b),M=e(y.b,y.c),J=e(y.c,y.a),
 c(F,w[C],y.b,w[M],y,["123","12","2","23"]),c(F,w[M],y.c,w[J],y,["123","23","3","31"]),c(F,w[J],y.a,w[C],y,["123","31","1","12"])):y instanceof THREE.Face4?(C=e(y.a,y.b),M=e(y.b,y.c),J=e(y.c,y.d),G=e(y.d,y.a),c(F,w[C],y.b,w[M],y,["1234","12","2","23"]),c(F,w[M],y.c,w[J],y,["1234","23","3","34"]),c(F,w[J],y.d,w[G],y,["1234","34","4","41"]),c(F,w[G],y.a,w[C],y,["1234","41","1","12"])):console.log("face should be a face!",y);var f=u,K={},B={},u=function(b,c){K[b]===void 0&&(K[b]=[]);K[b].push(c)},w=function(b,
-c){B[b]===void 0&&(B[b]={});B[b][c]=null};for(x in A)y=A[x],M=x.split("_"),v=M[0],M=M[1],u(v,[v,M]),u(M,[v,M]),F=y[0],C=y[1],w(v,F),C?w(v,C):w(v,F),w(M,F),C?w(M,C):w(M,F);u=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){u.set(0,0,0);w.set(0,0,0);A=new THREE.Vector3(0,0,0);E=0;for(z in B[x])u.addSelf(t[z]),E++;u.divideScalar(E);E=K[x].length;for(z=0;z<E;z++)y=K[x][z],y=n[y[0]].position.clone().addSelf(n[y[1]].position).divideScalar(2),w.addSelf(y);w.divideScalar(E);
-A.addSelf(n[x].position);A.multiplyScalar(E-3);A.addSelf(u);A.addSelf(w.multiplyScalar(2));A.divideScalar(E);f[x].position=A}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(){}};
+c){B[b]===void 0&&(B[b]={});B[b][c]=null};for(x in z)y=z[x],M=x.split("_"),v=M[0],M=M[1],u(v,[v,M]),u(M,[v,M]),F=y[0],C=y[1],w(v,F),C?w(v,C):w(v,F),w(M,F),C?w(M,C):w(M,F);u=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){u.set(0,0,0);w.set(0,0,0);z=new THREE.Vector3(0,0,0);E=0;for(A in B[x])u.addSelf(t[A]),E++;u.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(u);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(){}};
 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,m,h,n){var o=document.createElement("canvas");b[e]=new THREE.Texture(o);b[e].sourceFile=k;if(m){b[e].repeat.set(m[0],m[1]);if(m[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
@@ -558,28 +558,28 @@ THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XML
 m.setRequestHeader("Content-Type","text/plain");m.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=w(b,c),k=w(b,c+1),h=w(b,c+2),m=w(b,c+3),n=(m<<1&255|h>>7)-127;f|=(h&127)<<16|k<<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,c){var e=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function t(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function o(c){var e,
 f,k;e=h(b,c);f=h(b,c+M);k=h(b,c+K);c=u(b,c+B);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+M);k=h(b,c+K);m=u(b,c+B);o=h(b,c+L);p=h(b,c+Y);c=h(b,c+H);m=E.materials[m];var t=G[p*3],v=G[p*3+1];p=G[p*3+2];var w=G[c*3],x=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,x,c)],null,m))}function v(c){var e,f,k,m;e=h(b,c);f=h(b,c+T);k=h(b,c+Q);m=h(b,
-c+Z);c=u(b,c+$);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function z(c){var e,f,k,m,o,t,v,w;e=h(b,c);f=h(b,c+T);k=h(b,c+Q);m=h(b,c+Z);o=u(b,c+$);t=h(b,c+P);v=h(b,c+p);w=h(b,c+V);c=h(b,c+fa);o=E.materials[o];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var S=G[w*3],A=G[w*3+1];w=G[w*3+2];var z=G[c*3],B=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(G[t*3],G[t*3+1],G[t*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(S,A,w),new THREE.Vector3(z,B,c)],null,o))}
-function A(c){var e,f,k,m;e=h(b,c);f=h(b,c+ea);k=h(b,c+ha);c=J[e*2];m=J[e*2+1];e=J[f*2];var o=E.faceVertexUvs[0];f=J[f*2+1];var p=J[k*2];k=J[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function y(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ga);k=h(b,c+ka);m=h(b,c+na);c=J[e*2];o=J[e*2+1];e=J[f*2];p=J[f*2+1];f=J[k*2];var t=E.faceVertexUvs[0];k=J[k*2+1];var u=J[m*2];m=J[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
+c+Z);c=u(b,c+$);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function A(c){var e,f,k,m,o,t,v,w;e=h(b,c);f=h(b,c+T);k=h(b,c+Q);m=h(b,c+Z);o=u(b,c+$);t=h(b,c+P);v=h(b,c+p);w=h(b,c+V);c=h(b,c+fa);o=E.materials[o];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var S=G[w*3],z=G[w*3+1];w=G[w*3+2];var A=G[c*3],B=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(G[t*3],G[t*3+1],G[t*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(S,z,w),new THREE.Vector3(A,B,c)],null,o))}
+function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ea);k=h(b,c+ha);c=J[e*2];m=J[e*2+1];e=J[f*2];var o=E.faceVertexUvs[0];f=J[f*2+1];var p=J[k*2];k=J[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function y(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ga);k=h(b,c+ka);m=h(b,c+na);c=J[e*2];o=J[e*2+1];e=J[f*2];p=J[f*2+1];f=J[k*2];var t=E.faceVertexUvs[0];k=J[k*2+1];var u=J[m*2];m=J[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
 k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,F=0,C,G=[],J=[],M,K,B,L,Y,H,T,Q,Z,$,P,p,V,fa,ea,ha,ga,ka,na,aa,W,U,ia,ja,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);C={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+=C.header_bytes;M=C.vertex_index_bytes;K=C.vertex_index_bytes*2;B=C.vertex_index_bytes*3;L=C.vertex_index_bytes*3+C.material_index_bytes;Y=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;T=C.vertex_index_bytes;
 Q=C.vertex_index_bytes*2;Z=C.vertex_index_bytes*3;$=C.vertex_index_bytes*4;P=C.vertex_index_bytes*4+C.material_index_bytes;p=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;V=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;ea=C.uv_index_bytes;ha=C.uv_index_bytes*2;ga=C.uv_index_bytes;ka=C.uv_index_bytes*2;na=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;ta=C.vertex_index_bytes*
 4+C.material_index_bytes;aa=C.ntri_flat*c;W=C.ntri_smooth*(c+C.normal_index_bytes*3);U=C.ntri_flat_uv*(c+C.uv_index_bytes*3);ia=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ja=C.nquad_flat*ta;c=C.nquad_smooth*(ta+C.normal_index_bytes*4);ta=C.nquad_flat_uv*(ta+C.uv_index_bytes*4);F+=function(c){for(var f,k,h,n=C.vertex_coordinate_bytes*3,o=c+C.nvertices*n;c<o;c+=n)f=e(b,c),k=e(b,c+C.vertex_coordinate_bytes),h=e(b,c+C.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
 k,h)));return C.nvertices*n}(F);F+=function(c){for(var e,f,k,h=C.normal_coordinate_bytes*3,m=c+C.nnormals*h;c<m;c+=h)e=t(b,c),f=t(b,c+C.normal_coordinate_bytes),k=t(b,c+C.normal_coordinate_bytes*2),G.push(e/127,f/127,k/127);return C.nnormals*h}(F);F+=function(c){for(var f,k,h=C.uv_coordinate_bytes*2,n=c+C.nuvs*h;c<n;c+=h)f=e(b,c),k=e(b,c+C.uv_coordinate_bytes),J.push(f,k);return C.nuvs*h}(F);aa=F+aa;W=aa+W;U=W+U;ia=U+ia;ja=ia+ja;c=ja+c;ta=c+ta;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,
-f=e+C.uv_index_bytes*3,k=b+C.ntri_flat_uv*f;for(c=b;c<k;c+=f)o(c),A(c+e);return k-b})(W);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,k=b+C.ntri_smooth_uv*f;for(c=b;c<k;c+=f)x(c),A(c+e);return k-b})(U);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,k=b+C.nquad_flat_uv*f;for(c=b;c<k;c+=f)v(c),y(c+e);return k-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
-4,f=e+C.uv_index_bytes*4,k=b+C.nquad_smooth_uv*f;for(c=b;c<k;c+=f)z(c),y(c+e);return k-b})(ta);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)o(c);return f-b})(F);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(aa);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(ia);(function(b){var c,
-e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(ja);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
+f=e+C.uv_index_bytes*3,k=b+C.ntri_flat_uv*f;for(c=b;c<k;c+=f)o(c),z(c+e);return k-b})(W);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,k=b+C.ntri_smooth_uv*f;for(c=b;c<k;c+=f)x(c),z(c+e);return k-b})(U);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,k=b+C.nquad_flat_uv*f;for(c=b;c<k;c+=f)v(c),y(c+e);return k-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
+4,f=e+C.uv_index_bytes*4,k=b+C.nquad_smooth_uv*f;for(c=b;c<k;c+=f)A(c),y(c+e);return k-b})(ta);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)o(c);return f-b})(F);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(aa);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(ia);(function(b){var c,
+e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)A(c);return f-b})(ja);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,f,h){W=b;f=f||ja;h!==void 0&&(b=h.split("/"),b.pop(),Ga=b.length<1?"":b.join("/")+"/");la=c("//dae:library_images/dae:image",m,"image");sa=c("//dae:library_materials/dae:material",B,"material");ya=c("//dae:library_effects/dae:effect",Q,"effect");ra=c("//dae:library_geometries/dae:geometry",y,"geometry");pa=c("//dae:library_controllers/dae:controller",n,"controller");ca=c("//dae:library_animations/dae:animation",$,"animation");Ca=c(".//dae:library_visual_scenes/dae:visual_scene",
 w,"visual_scene");Fa=[];Da=[];(b=W.evaluate(".//dae:scene/dae:instance_visual_scene",W,fa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(b=b.getAttribute("url").replace(/^#/,""),ia=Ca[b]):ia=null;U=new THREE.Object3D;for(b=0;b<ia.nodes.length;b++)U.add(k(ia.nodes[b]));e();for(var o in ca);o={scene:U,morphs:Fa,skins:Da,dae:{images:la,materials:sa,effects:ya,geometries:ra,controllers:pa,animations:ca,visualScenes:Ca,scene:ia}};f&&f(o);return o}function c(b,c,e){for(var b=W.evaluate(b,
 W,fa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},k=b.iterateNext(),h=0;k;){k=(new c).parse(k);if(k.id.length==0)k.id=e+h++;f[k.id]=k;k=b.iterateNext()}return f}function e(){var b=1E6,c=-b,e=0,f;for(f in ca)for(var k=ca[f],h=0;h<k.sampler.length;h++){var m=k.sampler[h];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function f(b,c,e,k){b.world=b.world||new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var h=
 b.channels[0].sampler.output[e];h instanceof THREE.Matrix4&&b.world.copy(h)}k&&b.world.multiply(k,b.world);c.push(b);for(k=0;k<b.nodes.length;k++)f(b.nodes[k],c,e,b.world)}function h(b,c,k){var h=pa[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var m=e(),c=ia.getChildById(c.skeleton[0],!0)||ia.getChildBySid(c.skeleton[0],!0),n,o,p,t,u=new THREE.Vector3,
-v;for(n=0;n<b.vertices.length;n++)h.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(k=0;k<m.frames;k++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(c,w,k);n=w;o=h.skin;for(t=0;t<n.length;t++)if(p=n[t],v=-1,p.type=="JOINT"){for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];for(y=0;y<o.weights.length;y++)for(var A=
-0;A<o.weights[y].length;A++){var z=o.weights[y][A];z.joint==v&&p.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<w.length;n++)if(w[n].type=="JOINT")for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+k,vertices:x})}}}function k(b){var c=
-new THREE.Object3D,e,f,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=pa[b.controllers[m].url];switch(n.type){case "skin":if(ra[n.skin.source]){var o=new A;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(pa[n.skin.source]&&(f=n=pa[n.skin.source],n.morph&&ra[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(ra[n.morph.source])o=new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),f=b.controllers[m];console.log("ColladaLoader: Morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=ra[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var w=ya[sa[u.target].instance_effect.url].shader;w.material.opacity=
+v;for(n=0;n<b.vertices.length;n++)h.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(k=0;k<m.frames;k++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(c,w,k);n=w;o=h.skin;for(t=0;t<n.length;t++)if(p=n[t],v=-1,p.type=="JOINT"){for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.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&&p.weights.push(A)}}else throw"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<w.length;n++)if(w[n].type=="JOINT")for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+k,vertices:x})}}}function k(b){var c=
+new THREE.Object3D,e,f,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=pa[b.controllers[m].url];switch(n.type){case "skin":if(ra[n.skin.source]){var o=new z;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(pa[n.skin.source]&&(f=n=pa[n.skin.source],n.morph&&ra[n.morph.source]))o=new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);
+break;case "morph":if(ra[n.morph.source])o=new z,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),f=b.controllers[m];console.log("ColladaLoader: Morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=ra[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var w=ya[sa[u.target].instance_effect.url].shader;w.material.opacity=
 !w.material.opacity?1:w.material.opacity;u=p[u.symbol]=w.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)h(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=pa[e.url],o.skinInstanceController=e,o.name="skin_"+Da.length,Da.push(o);else if(f!==void 0){p=n;t=f instanceof v?
 pa[f.url]:f;if(!t||!t.morph)console.log("could not find morph controller!");else{t=t.morph;for(w=0;w<t.targets.length;w++){var x=ra[t.targets[w]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:x.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Fa.length;Fa.push(o)}else o=new THREE.Mesh(n,o);c.add(o)}}for(m=
 0;m<b.nodes.length;m++)c.add(k(b.nodes[m],b));return c}function m(){this.init_from=this.id=""}function n(){this.type=this.name=this.id="";this.morph=this.skin=null}function u(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function w(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=
-[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function A(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function E(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function C(){this.material="";this.count=0;this.inputs=
+[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function A(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function E(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function C(){this.material="";this.count=0;this.inputs=
 [];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";this.stride=this.count=0;this.params=[]}function J(){this.input={}}function M(){this.semantic="";this.offset=0;this.source="";this.set=0}function K(b){this.id=b;this.type=null}function B(){this.name=this.id="";this.instance_effect=null}function L(){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 Y(b,c){this.type=
 b;this.effect=c;this.material=null}function H(b){this.effect=b;this.format=this.init_from=null}function T(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Z(){this.url=""}function $(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function P(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
 this.sid=null}function p(b){this.id="";this.animation=b;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function V(b){var c=b.getAttribute("id");if(ta[c]!=void 0)return ta[c];ta[c]=(new K(c)).parse(b);return ta[c]}function fa(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ea(b){for(var b=ga(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function ha(b){for(var b=ga(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],
@@ -593,18 +593,18 @@ k[u],w=e[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;case "WEIGH
 b.getAttribute("id");this.name=b.getAttribute("name");this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new o).parse(e))}}return this};o.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var k=f.shift(),h=k.indexOf(".")>=0,m=k.indexOf("(")>=0,n;if(h)f=k.split("."),k=f.shift(),f.shift();else if(m){n=k.split("(");k=n.shift();
 for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,""))}if(k==b)return e.info={sid:k,dotSyntax:h,arrSyntax:m,arrIndices:n},e}return null};o.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};o.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};o.prototype.getTransformBySid=
 function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==b)return this.transforms[c];return null};o.prototype.parse=function(b){var c;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 e=0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==
-1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(c));break;case "instance_geometry":this.geometries.push((new A).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=W.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",W,fa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(c));break;
+1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(c));break;case "instance_geometry":this.geometries.push((new z).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=W.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",W,fa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(c));break;
 case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(c));break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in ca)for(var k=ca[f],h=0;h<k.channel.length;h++){var m=k.channel[h],n=k.sampler[h];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=
 1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var k={},p=h=void 0,h=0;h<this.channels.length;h++)p=this.channels[h],k[p.sid]=p;m=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(n=this.transforms[h],p=k[n.sid],p!==void 0){for(var t=p.sampler,u,p=0;p<t.input.length-1;p++)if(t.input[p+1]>c){u=t.output[p];break}m=u!==void 0?u instanceof THREE.Matrix4?
 m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};x.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ea(b.textContent);this.updateMatrix();return this};
 x.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};v.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=W.evaluate(".//dae:instance_material",e,fa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null))for(var f=e.iterateNext();f;)this.instance_material.push((new z).parse(f)),f=e.iterateNext()}}return this};z.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 c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=W.evaluate(".//dae:instance_material",
-e,fa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new z).parse(c)),c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new E(this)).parse(e)}}return this};E.prototype.parse=function(b){function c(b,e){var f=aa(b.position);k[f]===void 0&&(k[f]={v:b,index:e});return k[f]}this.primitives=[];var e;for(e=
+null))for(var f=e.iterateNext();f;)this.instance_material.push((new A).parse(f)),f=e.iterateNext()}}return this};A.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=W.evaluate(".//dae:instance_material",
+e,fa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new A).parse(c)),c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new E(this)).parse(e)}}return this};E.prototype.parse=function(b){function c(b,e){var f=aa(b.position);k[f]===void 0&&(k[f]={v:b,index:e});return k[f]}this.primitives=[];var e;for(e=
 0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":V(f);break;case "vertices":this.vertices=(new J).parse(f);break;case "triangles":this.primitives.push((new C).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var k={};this.geometry3js=new THREE.Geometry;f=ta[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var h=new THREE.Vertex(new THREE.Vector3(f[e],f[e+
 1],f[e+2]));c(h,b);this.geometry3js.vertices.push(h)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,k);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};E.prototype.handlePrimitive=function(b,c,e){var f=0,k,h,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(k=0;k<n.length;k++)switch(o=n[k],
-o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],A={},z=[];b.vcount&&(v=b.vcount[u++]);for(k=0;k<v;k++)for(h=0;h<n.length;h++)switch(o=n[h],source=ta[o.source],p=m[f+k*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=aa(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":A[o.set]===void 0&&(A[o.set]=[]);A[o.set].push(new THREE.UV(source.data[t],
-source.data[t+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;v==3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],z.length?z: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]],z.length?z:new THREE.Color));B.daeMaterial=b.material;c.faces.push(B);for(h=0;h<w.length;h++)k=A[w[h]],c.faceVertexUvs[h].push([k[0],k[1],k[2]]);f+=n.length*v}};F.prototype=new C;F.prototype.constructor=F;C.prototype.setVertices=
+o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(k=0;k<v;k++)for(h=0;h<n.length;h++)switch(o=n[h],source=ta[o.source],p=m[f+k*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=aa(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],
+source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+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;c.faces.push(B);for(h=0;h<w.length;h++)k=z[w[h]],c.faceVertexUvs[h].push([k[0],k[1],k[2]]);f+=n.length*v}};F.prototype=new C;F.prototype.constructor=F;C.prototype.setVertices=
 function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};C.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ka(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new M).parse(b.childNodes[c]));break;case "vcount":this.vcount=ha(e.textContent);break;case "p":this.p=ha(e.textContent)}}return this};G.prototype.parse=
 function(b){this.params=[];this.source=b.getAttribute("source");this.count=ka(b,"count",0);this.stride=ka(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};J.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new M).parse(b.childNodes[c]),this.input[input.semantic]=
 input);return this};M.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ka(b,"set",-1);this.offset=ka(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};K.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=ga(e.textContent),k=[],h=0;h<f.length;h++)k.push(f[h]=="true"||f[h]=="1"?
@@ -624,19 +624,19 @@ p.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.i
 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(c,e){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4&&(f.status==0||f.status==
 200))ja=e,b(f.responseXML,void 0,c)};f.open("GET",c,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:b,setPreferredShading:function(b){za=b},applySkin:h,geometries:ra}};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,c,e){var f=this,h;if(b instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),h=b,b=h.model,c=h.callback,e=h.texture_path;h=new Worker(b);e=e?e:this.extractUrlbase(b);h.onmessage=function(b){f.createModel(b.data,c,e);f.onLoadComplete()};this.onLoadStart();h.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,u,t,w,o,x,v,z,A,y,E,F,C,G=b.faces;o=b.vertices;var J=b.normals,M=b.colors,K=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;e<K;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(w=o.length;t<w;)x=new THREE.Vertex,x.position.x=o[t++]*c,x.position.y=
-o[t++]*c,x.position.z=o[t++]*c,f.vertices.push(x);t=0;for(w=G.length;t<w;){c=G[t++];o=c&1;u=c&2;e=c&4;h=c&8;v=c&16;x=c&32;A=c&64;c&=128;o?(y=new THREE.Face4,y.a=G[t++],y.b=G[t++],y.c=G[t++],y.d=G[t++],o=4):(y=new THREE.Face3,y.a=G[t++],y.b=G[t++],y.c=G[t++],o=3);if(u)u=G[t++],y.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<K;e++)E=b.uvs[e],z=G[t++],C=E[z*2],z=E[z*2+1],f.faceUvs[e][u]=new THREE.UV(C,z);if(h)for(e=0;e<K;e++){E=b.uvs[e];F=[];for(h=0;h<o;h++)z=G[t++],C=E[z*2],z=E[z*2+1],F[h]=
-new THREE.UV(C,z);f.faceVertexUvs[e][u]=F}if(v)v=G[t++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],y.normal=h;if(x)for(e=0;e<o;e++)v=G[t++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],y.vertexNormals.push(h);if(A)x=G[t++],x=new THREE.Color(M[x]),y.color=x;if(c)for(e=0;e<o;e++)x=G[t++],x=new THREE.Color(M[x]),y.vertexColors.push(x);f.faces.push(y)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
-u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,t,w,o,x,v,z;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;z=b.morphTargets[e].vertices;u=0;for(t=z.length;u<t;u+=3)w=z[u]*c,o=z[u+1]*
-c,x=z[u+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(w,o,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];t=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(u=w.length;c<u;c+=3)o=new THREE.Color(16755200),o.setRGB(w[c],w[c+1],w[c+2]),t.push(o)}}})(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(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,u,t,w,o,x,v,A,z,y,E,F,C,G=b.faces;o=b.vertices;var J=b.normals,M=b.colors,K=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;e<K;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(w=o.length;t<w;)x=new THREE.Vertex,x.position.x=o[t++]*c,x.position.y=
+o[t++]*c,x.position.z=o[t++]*c,f.vertices.push(x);t=0;for(w=G.length;t<w;){c=G[t++];o=c&1;u=c&2;e=c&4;h=c&8;v=c&16;x=c&32;z=c&64;c&=128;o?(y=new THREE.Face4,y.a=G[t++],y.b=G[t++],y.c=G[t++],y.d=G[t++],o=4):(y=new THREE.Face3,y.a=G[t++],y.b=G[t++],y.c=G[t++],o=3);if(u)u=G[t++],y.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<K;e++)E=b.uvs[e],A=G[t++],C=E[A*2],A=E[A*2+1],f.faceUvs[e][u]=new THREE.UV(C,A);if(h)for(e=0;e<K;e++){E=b.uvs[e];F=[];for(h=0;h<o;h++)A=G[t++],C=E[A*2],A=E[A*2+1],F[h]=
+new THREE.UV(C,A);f.faceVertexUvs[e][u]=F}if(v)v=G[t++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],y.normal=h;if(x)for(e=0;e<o;e++)v=G[t++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],y.vertexNormals.push(h);if(z)x=G[t++],x=new THREE.Color(M[x]),y.color=x;if(c)for(e=0;e<o;e++)x=G[t++],x=new THREE.Color(M[x]),y.vertexColors.push(x);f.faces.push(y)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,t,w,o,x,v,A;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;A=b.morphTargets[e].vertices;u=0;for(t=A.length;u<t;u+=3)w=A[u]*c,o=A[u+1]*
+c,x=A[u+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(w,o,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];t=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(u=w.length;c<u;c+=3)o=new THREE.Color(16755200),o.setRGB(w[c],w[c+1],w[c+2]),t.push(o)}}})(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,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(v in T.objects)if(!V.objects[v])if(F=T.objects[v],F.geometry!==void 0){if(M=V.geometries[F.geometry]){var b=!1;Y=[];for(ea=0;ea<F.materials.length;ea++)Y[ea]=V.materials[F.materials[ea]],b=Y[ea]instanceof THREE.ShaderMaterial;b&&M.computeTangents();C=F.position;r=F.rotation;
 q=F.quaternion;s=F.scale;q=0;Y.length==0&&(Y[0]=new THREE.MeshFaceMaterial);Y.length>1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,Y);object.name=v;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=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 C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
 s[1],s[2]),object.visible=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 u(b){return function(c){V.geometries[b]=c;n();Z-=1;e.onLoadComplete();w()}}function t(b){return function(c){V.geometries[b]=c}}function w(){e.callbackProgress({totalModels:P,totalTextures:p,loadedModels:P-Z,loadedTextures:p-$},V);e.onLoadProgress();Z==0&&$==0&&c(V)}var o,x,
-v,z,A,y,E,F,C,G,J,M,K,B,L,Y,H,T,Q,Z,$,P,p,V;T=b.data;L=new THREE.BinaryLoader;Q=new THREE.JSONLoader;$=Z=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in T.objects)if(F=T.objects[v],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;G=T.transform.rotation;var fa=T.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0],
-G[1],G[2]);fa&&V.scene.scale.set(fa[0],fa[1],fa[2]);(b||G||fa)&&V.scene.updateMatrix()}b=function(){$-=1;w();e.onLoadComplete()};for(A in T.cameras)G=T.cameras[A],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)),C=G.position,G=G.target,K.position.set(C[0],C[1],C[2]),K.target=new THREE.Vector3(G[0],G[1],G[2]),V.cameras[A]=K;for(z in T.lights)A=T.lights[z],K=A.color!==void 0?
-A.color:16777215,G=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(C=A.direction,H=new THREE.DirectionalLight(K,G),H.position.set(C[0],C[1],C[2]),H.position.normalize()):A.type=="point"?(C=A.position,d=A.distance,H=new THREE.PointLight(K,G,d),H.position.set(C[0],C[1],C[2])):A.type=="ambient"&&(H=new THREE.AmbientLight(K)),V.scene.add(H),V.lights[z]=H;for(y in T.fogs)z=T.fogs[y],z.type=="linear"?B=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(B=new THREE.FogExp2(0,z.density)),G=z.color,
+v,A,z,y,E,F,C,G,J,M,K,B,L,Y,H,T,Q,Z,$,P,p,V;T=b.data;L=new THREE.BinaryLoader;Q=new THREE.JSONLoader;$=Z=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in T.objects)if(F=T.objects[v],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;G=T.transform.rotation;var fa=T.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0],
+G[1],G[2]);fa&&V.scene.scale.set(fa[0],fa[1],fa[2]);(b||G||fa)&&V.scene.updateMatrix()}b=function(){$-=1;w();e.onLoadComplete()};for(z in T.cameras)G=T.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)),C=G.position,G=G.target,K.position.set(C[0],C[1],C[2]),K.target=new THREE.Vector3(G[0],G[1],G[2]),V.cameras[z]=K;for(A in T.lights)z=T.lights[A],K=z.color!==void 0?
+z.color:16777215,G=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(C=z.direction,H=new THREE.DirectionalLight(K,G),H.position.set(C[0],C[1],C[2]),H.position.normalize()):z.type=="point"?(C=z.position,d=z.distance,H=new THREE.PointLight(K,G,d),H.position.set(C[0],C[1],C[2])):z.type=="ambient"&&(H=new THREE.AmbientLight(K)),V.scene.add(H),V.lights[A]=H;for(y in T.fogs)A=T.fogs[y],A.type=="linear"?B=new THREE.Fog(0,A.near,A.far):A.type=="exp2"&&(B=new THREE.FogExp2(0,A.density)),G=A.color,
 B.color.setRGB(G[0],G[1],G[2]),V.fogs[y]=B;if(V.cameras&&T.defaults.camera)V.currentCamera=V.cameras[T.defaults.camera];if(V.fogs&&T.defaults.fog)V.scene.fog=V.fogs[T.defaults.fog];G=T.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(G[0],G[1],G[2]);V.bgColorAlpha=T.defaults.bgalpha;for(o in T.geometries)if(y=T.geometries[o],y.type=="bin_mesh"||y.type=="ascii_mesh")Z+=1,e.onLoadStart();P=Z;for(o in T.geometries)y=T.geometries[o],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[o]=M):y.type=="plane"?(M=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),V.geometries[o]=M):y.type=="sphere"?(M=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),V.geometries[o]=M):y.type=="cylinder"?(M=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),V.geometries[o]=M):y.type=="torus"?(M=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,
 y.segmentsT),V.geometries[o]=M):y.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(y.subdivisions),V.geometries[o]=M):y.type=="bin_mesh"?L.load({model:f(y.url,T.urlBaseType),callback:u(o)}):y.type=="ascii_mesh"?Q.load({model:f(y.url,T.urlBaseType),callback:u(o)}):y.type=="embedded_mesh"&&(y=T.embeds[y.id])&&Q.createModel(y,t(o),"");for(E in T.textures)if(o=T.textures[E],o.url instanceof Array){$+=o.url.length;for(L=0;L<o.url.length;L++)e.onLoadStart()}else $+=1,e.onLoadStart();p=$;for(E in T.textures){o=
@@ -656,14 +656,14 @@ e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;
 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,u,t,w,o){m=(m-w)/(o-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=u;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,u,t,w,o){m=(m-w)/(o-w);w=this.normal_cache;c[k]=n;c[k+1]=u+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,u,t,w,o){m=(m-w)/(o-w);w=this.normal_cache;c[k]=n;c[k+1]=u;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 u=k+1,t=k+this.yd,w=k+this.zd,o=u+this.yd,x=u+this.zd,v=k+this.yd+this.zd,z=u+this.yd+this.zd,A=0,y=this.field[k],E=this.field[u],F=this.field[t],C=this.field[o],G=this.field[w],J=this.field[x],M=this.field[v],K=this.field[z];y<m&&(A|=1);E<m&&(A|=2);F<m&&(A|=8);C<m&&(A|=4);G<m&&(A|=16);J<m&&(A|=32);M<m&&(A|=128);K<m&&(A|=64);var B=THREE.edgeTable[A];if(B==0)return 0;var L=this.delta,
+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 u=k+1,t=k+this.yd,w=k+this.zd,o=u+this.yd,x=u+this.zd,v=k+this.yd+this.zd,A=u+this.yd+this.zd,z=0,y=this.field[k],E=this.field[u],F=this.field[t],C=this.field[o],G=this.field[w],J=this.field[x],M=this.field[v],K=this.field[A];y<m&&(z|=1);E<m&&(z|=2);F<m&&(z|=8);C<m&&(z|=4);G<m&&(z|=16);J<m&&(z|=32);M<m&&(z|=128);K<m&&(z|=64);var B=THREE.edgeTable[z];if(B==0)return 0;var L=this.delta,
 Y=b+L,H=c+L,L=h+L;B&1&&(this.compNorm(k),this.compNorm(u),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,y,E));B&2&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,3,m,Y,c,h,E,C));B&4&&(this.compNorm(t),this.compNorm(o),this.VIntX(t*3,this.vlist,this.nlist,6,m,b,H,h,F,C));B&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,y,F));B&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,L,G,J));B&32&&(this.compNorm(x),
-this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,m,Y,c,L,J,K));B&64&&(this.compNorm(v),this.compNorm(z),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,H,L,M,K));B&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,L,G,M));B&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,y,G));B&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,m,Y,c,h,E,J));B&1024&&(this.compNorm(o),this.compNorm(z),this.VIntZ(o*
-3,this.vlist,this.nlist,30,m,Y,H,h,C,K));B&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,H,h,F,M));A<<=4;for(m=k=0;THREE.triTable[A+m]!=-1;)b=A+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 u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[k];this.positionArray[u+
+this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,m,Y,c,L,J,K));B&64&&(this.compNorm(v),this.compNorm(A),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,H,L,M,K));B&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,L,G,M));B&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,y,G));B&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,m,Y,c,h,E,J));B&1024&&(this.compNorm(o),this.compNorm(A),this.VIntZ(o*
+3,this.vlist,this.nlist,30,m,Y,H,h,C,K));B&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,m,b,H,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 u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[k];this.positionArray[u+
 4]=b[k+1];this.positionArray[u+5]=b[k+2];this.positionArray[u+6]=b[m];this.positionArray[u+7]=b[m+1];this.positionArray[u+8]=b[m+2];this.normalArray[u]=c[h];this.normalArray[u+1]=c[h+1];this.normalArray[u+2]=c[h+2];this.normalArray[u+3]=c[k];this.normalArray[u+4]=c[k+1];this.normalArray[u+5]=c[k+2];this.normalArray[u+6]=c[m];this.normalArray[u+7]=c[m+1];this.normalArray[u+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),u=h*this.size,t=c*this.size,w=b*this.size,o=Math.floor(u-n);o<1&&(o=1);u=Math.floor(u+n);u>this.size-1&&(u=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 z,A,y,E,F,C;o<u;o++){w=this.size2*o;A=o/this.size-h;F=A*A;for(A=x;A<t;A++){y=w+this.size*A;z=A/this.size-c;C=z*z;for(z=v;z<n;z++)E=z/this.size-b,E=k/(1.0E-6+E*E+C+F)-m,E>0&&(this.field[y+z]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,u,t=this.size,w=this.yd,o=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++){u=h+k*w;for(m=0;m<t;m++)x[o*m+u]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,u,t,w=this.size,o=this.yd,x=
-this.zd,v=this.field,z=w*Math.sqrt(b/c);z>w&&(z=w);for(k=0;k<z;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){u=k*o;for(h=0;h<w;h++){t=u+h;for(m=0;m<w;m++)v[x*m+t]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,u,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){u=zd*m;for(k=0;k<size;k++){t=u+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 A,z,y,E,F,C;o<u;o++){w=this.size2*o;z=o/this.size-h;F=z*z;for(z=x;z<t;z++){y=w+this.size*z;A=z/this.size-c;C=A*A;for(A=v;A<n;A++)E=A/this.size-b,E=k/(1.0E-6+E*E+C+F)-m,E>0&&(this.field[y+A]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,u,t=this.size,w=this.yd,o=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++){u=h+k*w;for(m=0;m<t;m++)x[o*m+u]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,u,t,w=this.size,o=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){u=k*o;for(h=0;h<w;h++){t=u+h;for(m=0;m<w;m++)v[x*m+t]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,u,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){u=zd*m;for(k=0;k<size;k++){t=u+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,u,t,w,o,x=this.size-2;for(m=1;m<x;m++){o=this.size2*m;t=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=o+this.size*k;u=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,u,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,u,t,w,o,x,v;for(m=0;m<k.count;m++)x=m*3,w=x+1,v=x+2,n=k.positionArray[x],
 u=k.positionArray[w],t=k.positionArray[v],o=new THREE.Vector3(n,u,t),n=k.normalArray[x],u=k.normalArray[w],t=k.normalArray[v],x=new THREE.Vector3(n,u,t),x.normalize(),w=new THREE.Vertex(o),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,o=h[x],n=h[w],u=h[v],x=new THREE.Face3(x,w,v,[o,n,u]),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,
@@ -707,7 +707,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,u,t,w;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=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:o},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 z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);o.width=b;o.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||t!==e.near||w!==e.fov){u=e.aspect;t=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,C=F*t/125,G=t*Math.tan(w*Math.PI/360),J;m.n14=F;n.n14=-F;F=-G*u+C;J=G*u+C;E.n11=2*t/(J-F);E.n13=(J+F)/(J-F);h.projectionMatrix=E.clone();F=-G*u-C;J=G*u-C;E.n11=2*t/(J-F);E.n13=
-(J+F)/(J-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,o,!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,z,v)}};
+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);o.width=b;o.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||t!==e.near||w!==e.fov){u=e.aspect;t=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,C=F*t/125,G=t*Math.tan(w*Math.PI/360),J;m.n14=F;n.n14=-F;F=-G*u+C;J=G*u+C;E.n11=2*t/(J-F);E.n13=(J+F)/(J-F);h.projectionMatrix=E.clone();F=-G*u-C;J=G*u-C;E.n11=2*t/(J-F);E.n13=
+(J+F)/(J-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,o,!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)}};
 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)}};

+ 27 - 27
build/custom/ThreeWebGL.js

@@ -231,38 +231,38 @@ case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:
 case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var H=this,f,Ia=[],Za=null,aa=null,na=-1,D=null,R=0,U=null,W=null,ia=null,P=null,za=null,Ma=null,Sa=null,Ta=null,Aa=0,Ea=0,va=0,Ka=0,X=[new THREE.Vector4,new THREE.Vector4,
 new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Fa=new THREE.Matrix4,Wa=new Float32Array(16),Xa=new Float32Array(16),Ja=new THREE.Vector4,ab={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Q=b.stencil!==void 0?b.stencil:!0,fb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,gb=b.antialias!==void 0?b.antialias:!1,wa=b.clearColor!==
 void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ba=b.clearAlpha!==void 0?b.clearAlpha:0,$a=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=Ga;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=
-this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var sa,Va=[],b=THREE.ShaderLib.depthRGBA,db=THREE.UniformsUtils.clone(b.uniforms),Ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:db}),bb=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:db,morphTargets:!0});Ya._shadowPass=!0;bb._shadowPass=!0;
-try{if(!(f=Ga.getContext("experimental-webgl",{antialias:gb,stencil:Q,preserveDrawingBuffer:fb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(hb){console.error(hb)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);
-f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(wa.r,wa.g,wa.b,Ba);this.context=f;var eb=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);Q=0;r.vertices[Q++]=-1;r.vertices[Q++]=-1;r.vertices[Q++]=0;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=-1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=0;r.vertices[Q++]=
--1;r.vertices[Q++]=1;r.vertices[Q++]=0;Q=r.vertices[Q++]=0;r.faces[Q++]=0;r.faces[Q++]=1;r.faces[Q++]=2;r.faces[Q++]=0;r.faces[Q++]=2;r.faces[Q++]=3;r.vertexBuffer=f.createBuffer();r.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,r.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,r.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,r.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,r.faces,f.STATIC_DRAW);r.program=f.createProgram();f.attachShader(r.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));
-f.attachShader(r.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=f.getAttribLocation(r.program,"position");r.attributes.uv=f.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=f.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=f.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=f.getUniformLocation(r.program,"rotation");r.uniforms.scale=f.getUniformLocation(r.program,"scale");r.uniforms.alignment=
-f.getUniformLocation(r.program,"alignment");r.uniforms.color=f.getUniformLocation(r.program,"color");r.uniforms.map=f.getUniformLocation(r.program,"map");r.uniforms.opacity=f.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=f.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=f.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=f.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix=f.getUniformLocation(r.program,
-"modelViewMatrix");r.uniforms.projectionMatrix=f.getUniformLocation(r.program,"projectionMatrix");var cb=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Aa=b;Ea=c;va=d;Ka=e;f.viewport(Aa,Ea,va,Ka)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(b,c){wa.setHex(b);Ba=c;f.clearColor(wa.r,wa.g,wa.b,
-Ba)};this.setClearColor=function(b,c){wa.copy(b);Ba=c;f.clearColor(wa.r,wa.g,wa.b,Ba)};this.getClearColor=function(){return wa};this.getClearAlpha=function(){return Ba};this.clear=function(b,c,d){var e=0;if(b==void 0||b)e|=f.COLOR_BUFFER_BIT;if(c==void 0||c)e|=f.DEPTH_BUFFER_BIT;if(d==void 0||d)e|=f.STENCIL_BUFFER_BIT;f.clear(e)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,
-delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);
-f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d]);H.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),H.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),H.info.memory.geometries--;
-else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture),H.info.memory.textures--};this.initMaterial=function(b,c,d,e){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 n=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var m,p,q;m=q=n=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&&n++;n+q<=$a?m=q:(m=Math.ceil($a*q/
-(n+q)),n=$a-m);j={directional:m,point:n};n=q=0;for(m=c.length;n<m;n++)p=c[n],p instanceof THREE.SpotLight&&p.castShadow&&q++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var s;a:{m=b.fragmentShader;p=b.vertexShader;var n=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&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},r,e=[];k?e.push(k):(e.push(m),e.push(p));for(r in d)e.push(r),e.push(d[r]);k=e.join();r=0;for(e=Ia.length;r<e;r++)if(Ia[r].code==k){s=Ia[r].program;break a}r=f.createProgram();e=[eb?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":
-"",H.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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");
+this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var sa,Va=[],b=THREE.ShaderLib.depthRGBA,db=THREE.UniformsUtils.clone(b.uniforms),Ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:db}),bb=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:db,morphTargets:!0});Ya._shadowPass=
+!0;bb._shadowPass=!0;try{if(!(f=Ga.getContext("experimental-webgl",{antialias:gb,stencil:Q,preserveDrawingBuffer:fb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(hb){console.error(hb)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);
+f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(wa.r,wa.g,wa.b,Ba);this.context=f;var eb=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);Q=0;r.vertices[Q++]=-1;r.vertices[Q++]=-1;r.vertices[Q++]=0;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=-1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=
+0;r.vertices[Q++]=-1;r.vertices[Q++]=1;r.vertices[Q++]=0;Q=r.vertices[Q++]=0;r.faces[Q++]=0;r.faces[Q++]=1;r.faces[Q++]=2;r.faces[Q++]=0;r.faces[Q++]=2;r.faces[Q++]=3;r.vertexBuffer=f.createBuffer();r.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,r.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,r.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,r.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,r.faces,f.STATIC_DRAW);r.program=f.createProgram();f.attachShader(r.program,Z("fragment",
+THREE.ShaderLib.sprite.fragmentShader));f.attachShader(r.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=f.getAttribLocation(r.program,"position");r.attributes.uv=f.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=f.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=f.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=f.getUniformLocation(r.program,"rotation");r.uniforms.scale=f.getUniformLocation(r.program,
+"scale");r.uniforms.alignment=f.getUniformLocation(r.program,"alignment");r.uniforms.color=f.getUniformLocation(r.program,"color");r.uniforms.map=f.getUniformLocation(r.program,"map");r.uniforms.opacity=f.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=f.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=f.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=f.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix=
+f.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=f.getUniformLocation(r.program,"projectionMatrix");var cb=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Aa=b;Ea=c;va=d;Ka=e;f.viewport(Aa,Ea,va,Ka)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(b,c){wa.setHex(b);
+Ba=c;f.clearColor(wa.r,wa.g,wa.b,Ba)};this.setClearColor=function(b,c){wa.copy(b);Ba=c;f.clearColor(wa.r,wa.g,wa.b,Ba)};this.getClearColor=function(){return wa};this.getClearAlpha=function(){return Ba};this.clear=function(b,c,d){var e=0;if(b==void 0||b)e|=f.COLOR_BUFFER_BIT;if(c==void 0||c)e|=f.DEPTH_BUFFER_BIT;if(d==void 0||d)e|=f.STENCIL_BUFFER_BIT;f.clear(e)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,
+delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);
+f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d]);H.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),H.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),
+H.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),H.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture),H.info.memory.textures--};this.initMaterial=function(b,c,d,e){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 n=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var m,p,q;m=q=n=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&&
+n++;n+q<=$a?m=q:(m=Math.ceil($a*q/(n+q)),n=$a-m);j={directional:m,point:n};n=q=0;for(m=c.length;n<m;n++)p=c[n],p instanceof THREE.SpotLight&&p.castShadow&&q++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var s;a:{m=b.fragmentShader;p=b.vertexShader;var n=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&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},r,e=[];k?e.push(k):(e.push(m),e.push(p));for(r in d)e.push(r),e.push(d[r]);k=e.join();r=0;for(e=Ia.length;r<e;r++)if(Ia[r].code==k){s=Ia[r].program;break a}r=f.createProgram();e=[eb?"#define VERTEX_TEXTURES":"",H.gammaInput?"#define GAMMA_INPUT":
+"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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:"",H.gammaInput?"#define GAMMA_INPUT":"",H.gammaOutput?"#define GAMMA_OUTPUT":"",H.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",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");f.attachShader(r,Z("fragment",j+m));f.attachShader(r,Z("vertex",e+p));f.linkProgram(r);f.getProgramParameter(r,f.LINK_STATUS)||
 console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(r,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");r.uniforms={};r.attributes={};var v,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in n)e.push(v);v=e;e=0;for(n=v.length;e<n;e++)m=v[e],r.uniforms[m]=f.getUniformLocation(r,m);e=["position","normal","uv","uv2","tangent","color","skinVertexA",
 "skinVertexB","skinIndex","skinWeight"];for(v=0;v<d.maxMorphTargets;v++)e.push("morphTarget"+v);for(s in c)e.push(s);s=e;v=0;for(c=s.length;v<c;v++)d=s[v],r.attributes[d]=f.getAttribLocation(r,d);r.id=Ia.length;Ia.push({program:r,code:k});H.info.memory.programs=Ia.length;s=r}b.program=s;s=b.program.attributes;s.position>=0&&f.enableVertexAttribArray(s.position);s.color>=0&&f.enableVertexAttribArray(s.color);s.normal>=0&&f.enableVertexAttribArray(s.normal);s.tangent>=0&&f.enableVertexAttribArray(s.tangent);
 b.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0&&(f.enableVertexAttribArray(s.skinVertexA),f.enableVertexAttribArray(s.skinVertexB),f.enableVertexAttribArray(s.skinIndex),f.enableVertexAttribArray(s.skinWeight));if(b.attributes)for(i in b.attributes)s[i]!==void 0&&s[i]>=0&&f.enableVertexAttribArray(s[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)v="morphTarget"+i,s[v]>=0&&(f.enableVertexAttribArray(s[v]),b.numSupportedMorphTargets++);
-b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){V(b);this.clear(c,d,f)};this.render=function(b,c,t,r){var I,v,Da,S,x,Ua,z,Qa,Ra=b.lights,M=b.fog;na=-1;this.shadowMapEnabled&&y(b,c);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;if(c.matrixAutoUpdate){for(x=c;x.parent;)x=x.parent;x.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Xa);c.projectionMatrix.flattenToArray(Wa);Fa.multiply(c.projectionMatrix,
-c.matrixWorldInverse);p(Fa);this.initWebGLObjects(b);V(t);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);x=b.__webglObjects.length;for(r=0;r<x;r++)if(I=b.__webglObjects[r],z=I.object,z.visible)if(!(z instanceof THREE.Mesh)||!z.frustumCulled||q(z)){if(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,c,!0),m(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(Ja.copy(z.position),Fa.multiplyVector3(Ja),I.z=Ja.z)}else I.render=
-!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(B);Ua=b.__webglObjectsImmediate.length;for(r=0;r<Ua;r++)I=b.__webglObjectsImmediate[r],z=I.object,z.visible&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,c,!0),s(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(r=0;r<x;r++)if(I=b.__webglObjects[r],I.render)z=I.object,Qa=I.buffer,i(z),d(c,Ra,M,b.overrideMaterial,Qa,z);for(r=0;r<Ua;r++)I=b.__webglObjectsImmediate[r],
-z=I.object,z.visible&&(D=-1,i(z),v=e(c,Ra,M,b.overrideMaterial,z),z.immediateRenderCallback?z.immediateRenderCallback(v,f,X):z.render(function(c){h(c,v,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(r=x-1;r>=0;r--)if(I=b.__webglObjects[r],I.render){z=I.object;Qa=I.buffer;Da=I.opaque;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),d(c,Ra,M,S,Qa,z)}for(r=0;r<Ua;r++)if(I=b.__webglObjectsImmediate[r],
-z=I.object,z.visible){D=-1;Da=I.opaque;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),v=e(c,Ra,M,S,z),z.immediateRenderCallback?z.immediateRenderCallback(v,f,X):z.render(function(b){h(b,v,S.shading)})}for(r=0;r<x;r++)if(I=b.__webglObjects[r],I.render){z=I.object;Qa=I.buffer;Da=I.transparent;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],G(S.blending),j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,
-S.polygonOffsetUnits),d(c,Ra,M,S,Qa,z)}for(r=0;r<Ua;r++)if(I=b.__webglObjectsImmediate[r],z=I.object,z.visible){D=-1;Da=I.transparent;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],G(S.blending),j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),v=e(c,Ra,M,S,z),z.immediateRenderCallback?z.immediateRenderCallback(v,f,X):z.render(function(b){h(b,v,S.shading)})}}b.__webglSprites.length&&J(b,c);t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&
-la(t)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,h=void 0,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=f.createBuffer();k.__webglNormalBuffer=f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();k.__webglSkinWeightsBuffer=
-f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}H.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,s=void 0,t=s=void 0,r=void 0,v=void 0,B=v=n=0,y=s=q=void 0,s=m=y=q=p=void 0,t=k.geometry,r=t.faces,y=j.faces,p=0,q=y.length;p<q;p++)s=y[p],s=r[s],s instanceof THREE.Face3?(n+=3,v+=1,B+=3):s instanceof
-THREE.Face4&&(n+=4,v+=2,B+=4);for(var p=j,q=k,F=y=r=void 0,E=void 0,F=void 0,s=[],r=0,y=q.materials.length;r<y;r++)if(F=q.materials[r],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<l;F++)(E=p.materials[F])&&s.push(E)}else(E=F)&&s.push(E);p=s;j.__materials=p;a:{r=q=void 0;y=p.length;for(q=0;q<y;q++)if(r=p[q],r.map||r.lightMap||r instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=r=void 0;s=p.length;for(r=0;r<s;r++)if(y=p[r],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||
-y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{s=r=void 0;F=p.length;for(r=0;r<F;r++)if(s=p[r],s.vertexColors){s=s.vertexColors;break a}s=!1}j.__vertexArray=new Float32Array(n*3);if(y)j.__normalArray=new Float32Array(n*3);if(t.hasTangents)j.__tangentArray=new Float32Array(n*4);if(s)j.__colorArray=new Float32Array(n*3);if(q){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*
+b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){V(b);this.clear(c,d,f)};this.updateShadowMap=function(b,c){y(b,c)};this.render=function(b,c,t,r){var I,v,Da,S,x,Ua,z,Qa,Ra=b.lights,M=b.fog;na=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&y(b,c);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;if(c.matrixAutoUpdate){for(x=c;x.parent;)x=x.parent;x.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Xa);
+c.projectionMatrix.flattenToArray(Wa);Fa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Fa);this.initWebGLObjects(b);V(t);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);x=b.__webglObjects.length;for(r=0;r<x;r++)if(I=b.__webglObjects[r],z=I.object,z.visible)if(!(z instanceof THREE.Mesh)||!z.frustumCulled||q(z)){if(z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,c,!0),m(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:
+(Ja.copy(z.position),Fa.multiplyVector3(Ja),I.z=Ja.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(B);Ua=b.__webglObjectsImmediate.length;for(r=0;r<Ua;r++)I=b.__webglObjectsImmediate[r],z=I.object,z.visible&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),F(z,c,!0),s(I));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(r=0;r<x;r++)if(I=b.__webglObjects[r],I.render)z=I.object,Qa=I.buffer,i(z),d(c,Ra,M,b.overrideMaterial,
+Qa,z);for(r=0;r<Ua;r++)I=b.__webglObjectsImmediate[r],z=I.object,z.visible&&(D=-1,i(z),v=e(c,Ra,M,b.overrideMaterial,z),z.immediateRenderCallback?z.immediateRenderCallback(v,f,X):z.render(function(c){h(c,v,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(r=x-1;r>=0;r--)if(I=b.__webglObjects[r],I.render){z=I.object;Qa=I.buffer;Da=I.opaque;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),d(c,Ra,M,S,Qa,
+z)}for(r=0;r<Ua;r++)if(I=b.__webglObjectsImmediate[r],z=I.object,z.visible){D=-1;Da=I.opaque;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),v=e(c,Ra,M,S,z),z.immediateRenderCallback?z.immediateRenderCallback(v,f,X):z.render(function(b){h(b,v,S.shading)})}for(r=0;r<x;r++)if(I=b.__webglObjects[r],I.render){z=I.object;Qa=I.buffer;Da=I.transparent;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],G(S.blending),j(S.depthTest),
+k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),d(c,Ra,M,S,Qa,z)}for(r=0;r<Ua;r++)if(I=b.__webglObjectsImmediate[r],z=I.object,z.visible){D=-1;Da=I.transparent;i(z);for(I=0;I<Da.count;I++)S=Da.list[I],G(S.blending),j(S.depthTest),k(S.depthWrite),n(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),v=e(c,Ra,M,S,z),z.immediateRenderCallback?z.immediateRenderCallback(v,f,X):z.render(function(b){h(b,v,S.shading)})}}b.__webglSprites.length&&J(b,c);t&&t.minFilter!==
+THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&la(t)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,h=void 0,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=f.createBuffer();k.__webglNormalBuffer=f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();
+k.__webglSkinWeightsBuffer=f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var n=void 0,m=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(m=k.numMorphTargets;n<m;n++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}H.info.memory.geometries++;for(var k=d,p=void 0,q=void 0,s=void 0,t=s=void 0,r=void 0,v=void 0,B=v=n=0,y=s=q=void 0,s=m=y=q=p=void 0,t=k.geometry,r=t.faces,y=j.faces,p=0,q=y.length;p<q;p++)s=y[p],s=r[s],s instanceof THREE.Face3?
+(n+=3,v+=1,B+=3):s instanceof THREE.Face4&&(n+=4,v+=2,B+=4);for(var p=j,q=k,F=y=r=void 0,E=void 0,F=void 0,s=[],r=0,y=q.materials.length;r<y;r++)if(F=q.materials[r],F instanceof THREE.MeshFaceMaterial){F=0;for(l=p.materials.length;F<l;F++)(E=p.materials[F])&&s.push(E)}else(E=F)&&s.push(E);p=s;j.__materials=p;a:{r=q=void 0;y=p.length;for(q=0;q<y;q++)if(r=p[q],r.map||r.lightMap||r instanceof THREE.ShaderMaterial){q=!0;break a}q=!1}a:{y=r=void 0;s=p.length;for(r=0;r<s;r++)if(y=p[r],!(y instanceof THREE.MeshBasicMaterial&&
+!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{s=r=void 0;F=p.length;for(r=0;r<F;r++)if(s=p[r],s.vertexColors){s=s.vertexColors;break a}s=!1}j.__vertexArray=new Float32Array(n*3);if(y)j.__normalArray=new Float32Array(n*3);if(t.hasTangents)j.__tangentArray=new Float32Array(n*4);if(s)j.__colorArray=new Float32Array(n*3);if(q){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*
 2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(B*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(r=
 j.numMorphTargets;t<r;t++)j.__morphTargetsArrays.push(new Float32Array(n*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=s;j.__normalType=y;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=B*2;t=0;for(r=p.length;t<r;t++)if(q=p[t],q.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in q.attributes){s=q.attributes[a];y={};for(m in s)y[m]=s[m];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=
 !0,v=1,y.type==="v2"?v=2:y.type==="v3"?v=3:y.type==="v4"?v=4:y.type==="c"&&(v=3),y.size=v,y.array=new Float32Array(n*v),y.buffer=f.createBuffer(),y.buffer.belongsToAttribute=a,s.needsUpdate=!0,y.__original=s;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=

+ 3 - 0
examples/webgl_shading_physical.html

@@ -447,6 +447,7 @@
 
 				//
 
+				renderer.shadowMapAutoUpdate = false;
 				renderer.shadowMapEnabled = true;
 				renderer.shadowMapDarkness = 0.5 * sunIntensity;
 				renderer.shadowMapBias = 0.00390125;
@@ -614,6 +615,8 @@
 
 				mesh.visible = false;
 
+				renderer.updateShadowMap( scene, camera );
+
 				renderer.autoClear = true;
 				cubeCamera.updatePosition( mesh.position );
 				cubeCamera.updateCubeMap( renderer, scene );

+ 9 - 1
src/renderers/WebGLRenderer.js

@@ -123,7 +123,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 	this.shadowCameraFov = 50;
 
 	this.shadowMap = [];
+
 	this.shadowMapEnabled = false;
+	this.shadowMapAutoUpdate = true;
 	this.shadowMapSoft = true;
 
 	var _cameraLight, _shadowMatrix = [];
@@ -3756,6 +3758,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	this.updateShadowMap = function ( scene, camera ) {
+
+		renderShadowMap( scene, camera );
+
+	};
+
 	this.render = function( scene, camera, renderTarget, forceClear ) {
 
 		var i, program, opaque, transparent, material,
@@ -3765,7 +3773,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		_currentMaterialId = -1;
 
-		if ( this.shadowMapEnabled ) renderShadowMap( scene, camera );
+		if ( this.shadowMapEnabled && this.shadowMapAutoUpdate ) renderShadowMap( scene, camera );
 
 		_this.info.render.calls = 0;
 		_this.info.render.vertices = 0;