Browse Source

Number of bones in skinning shader is now taken from SkinnedMesh.

If no object is passed to initMaterials (for example, if material is pre-built while loading, or shader program is intended for sharing), max limit of 50 bones is used (should be enough to leave space for other uniforms not to hit ANGLE limits).
alteredq 14 years ago
parent
commit
c421b2d791
4 changed files with 347 additions and 308 deletions
  1. 129 129
      build/Three.js
  2. 125 116
      build/custom/ThreeWebGL.js
  3. 90 63
      src/renderers/WebGLRenderer.js
  4. 3 0
      utils/build.py

+ 129 - 129
build/Three.js

@@ -12,7 +12,7 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
 THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(E,v,F,w){w=w.clone().subSelf(v);F=F.clone().subSelf(v);var O=E.clone().subSelf(v);E=w.dot(w);v=w.dot(F);w=w.dot(O);var K=F.dot(F);F=F.dot(O);O=1/(E*K-v*v);K=(K*w-v*F)*O;E=(E*F-v*w)*O;return K>0&&E>0&&K+E<1}var b,d,e,g,h,j,k,n,q,x,
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(E,v,F,w){w=w.clone().subSelf(v);F=F.clone().subSelf(v);var N=E.clone().subSelf(v);E=w.dot(w);v=w.dot(F);w=w.dot(N);var L=F.dot(F);F=F.dot(N);N=1/(E*L-v*v);L=(L*w-v*F)*N;E=(E*F-v*w)*N;return L>0&&E>0&&L+E<1}var b,d,e,g,h,j,k,n,q,x,
 u,t=a.geometry,y=t.vertices,A=[];b=0;for(d=t.faces.length;b<d;b++){e=t.faces[b];x=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(y[e.a].position.clone());h=k.multiplyVector3(y[e.b].position.clone());j=k.multiplyVector3(y[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(y[e.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(e.normal.clone());q=u.dot(n);if(q<0){n=n.dot((new THREE.Vector3).sub(g,x))/q;x=x.addSelf(u.multiplyScalar(n));
 u,t=a.geometry,y=t.vertices,A=[];b=0;for(d=t.faces.length;b<d;b++){e=t.faces[b];x=this.origin.clone();u=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(y[e.a].position.clone());h=k.multiplyVector3(y[e.b].position.clone());j=k.multiplyVector3(y[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(y[e.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(e.normal.clone());q=u.dot(n);if(q<0){n=n.dot((new THREE.Vector3).sub(g,x))/q;x=x.addSelf(u.multiplyScalar(n));
 if(e instanceof THREE.Face3){if(c(x,g,h,j)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,k)||c(x,h,j,k))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}}return A}};
 if(e instanceof THREE.Face3){if(c(x,g,h,j)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,k)||c(x,h,j,k))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};A.push(e)}}}return A}};
 THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,n,q,x){j=!1;c=k;b=n;d=q;e=x;a()};this.addPoint=function(k,n){if(j){j=!1;c=k;b=n;d=k;e=n}else{c=c<k?c:k;b=b<n?b:n;d=d>k?d:k;e=e>n?e:n}a()};
 THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,n,q,x){j=!1;c=k;b=n;d=q;e=x;a()};this.addPoint=function(k,n){if(j){j=!1;c=k;b=n;d=k;e=n}else{c=c<k?c:k;b=b<n?b:n;d=d>k?d:k;e=e>n?e:n}a()};
@@ -23,8 +23,8 @@ THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,n,q,x,u,t,y,A){this.set(a||1,c||0,b||0,
 THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,n,q,x,u,t,y,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=n;this.n33=q;this.n34=x;this.n41=u;this.n42=t;this.n43=y;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
 THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,n,q,x,u,t,y,A){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=n;this.n33=q;this.n34=x;this.n41=u;this.n42=t;this.n43=y;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();d.cross(b,g).normalize();e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},
 e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();d.cross(b,g).normalize();e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},
 multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+
 multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+
-this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,E=a.n43,v=a.n44,F=c.n11,w=c.n12,O=c.n13,K=c.n14,Z=c.n21,M=c.n22,f=c.n23,V=c.n24,T=c.n31,ca=c.n32,ea=c.n33,H=c.n34;this.n11=b*F+d*Z+e*T;this.n12=
-b*w+d*M+e*ca;this.n13=b*O+d*f+e*ea;this.n14=b*K+d*V+e*H+g;this.n21=h*F+j*Z+k*T;this.n22=h*w+j*M+k*ca;this.n23=h*O+j*f+k*ea;this.n24=h*K+j*V+k*H+n;this.n31=q*F+x*Z+u*T;this.n32=q*w+x*M+u*ca;this.n33=q*O+x*f+u*ea;this.n34=q*K+x*V+u*H+t;this.n41=y*F+A*Z+E*T;this.n42=y*w+A*M+E*ca;this.n43=y*O+A*f+E*ea;this.n44=y*K+A*V+E*H+v;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=
+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,n=a.n24,q=a.n31,x=a.n32,u=a.n33,t=a.n34,y=a.n41,A=a.n42,E=a.n43,v=a.n44,F=c.n11,w=c.n12,N=c.n13,L=c.n14,Z=c.n21,M=c.n22,f=c.n23,V=c.n24,T=c.n31,ca=c.n32,ea=c.n33,I=c.n34;this.n11=b*F+d*Z+e*T;this.n12=
+b*w+d*M+e*ca;this.n13=b*N+d*f+e*ea;this.n14=b*L+d*V+e*I+g;this.n21=h*F+j*Z+k*T;this.n22=h*w+j*M+k*ca;this.n23=h*N+j*f+k*ea;this.n24=h*L+j*V+k*I+n;this.n31=q*F+x*Z+u*T;this.n32=q*w+x*M+u*ca;this.n33=q*N+x*f+u*ea;this.n34=q*L+x*V+u*I+t;this.n41=y*F+A*Z+E*T;this.n42=y*w+A*M+E*ca;this.n43=y*N+A*f+E*ea;this.n44=y*L+A*V+E*I+v;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=
 this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=
 this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=
 this.n22,h=this.n23,j=this.n24,k=this.n31,n=this.n32,q=this.n33,x=this.n34,u=this.n41,t=this.n42,y=this.n43,A=this.n44;return d*h*n*u-b*j*n*u-d*g*q*u+c*j*q*u+b*g*x*u-c*h*x*u-d*h*k*t+b*j*k*t+d*e*q*t-a*j*q*t-b*e*x*t+a*h*x*t+d*g*k*y-c*j*k*y-d*e*n*y+a*j*n*y+c*e*x*y-a*g*x*y-b*g*k*A+c*h*k*A+b*e*n*A-a*h*n*A-c*e*q*A+a*g*q*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=
 this.n22,h=this.n23,j=this.n24,k=this.n31,n=this.n32,q=this.n33,x=this.n34,u=this.n41,t=this.n42,y=this.n43,A=this.n44;return d*h*n*u-b*j*n*u-d*g*q*u+c*j*q*u+b*g*x*u-c*h*x*u-d*h*k*t+b*j*k*t+d*e*q*t-a*j*q*t-b*e*x*t+a*h*x*t+d*g*k*y-c*j*k*y-d*e*n*y+a*j*n*y+c*e*x*y-a*g*x*y-b*g*k*A+c*h*k*A+b*e*n*A-a*h*n*A-c*e*q*A+a*g*q*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=
 a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=
 a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=
@@ -56,8 +56,8 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.f
 b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.normal.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
 b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.normal.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
 b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
 b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<
-c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(H,ba,wa,da,ua,ha,fa){g=H.vertices[ba].position;h=H.vertices[wa].position;j=H.vertices[da].position;k=e[ua];n=e[ha];q=e[fa];x=h.x-g.x;u=j.x-g.x;t=h.y-g.y;
-y=j.y-g.y;A=h.z-g.z;E=j.z-g.z;v=n.u-k.u;F=q.u-k.u;w=n.v-k.v;O=q.v-k.v;K=1/(v*O-F*w);f.set((O*x-w*u)*K,(O*t-w*y)*K,(O*A-w*E)*K);V.set((v*u-F*x)*K,(v*y-F*t)*K,(v*E-F*A)*K);Z[ba].addSelf(f);Z[wa].addSelf(f);Z[da].addSelf(f);M[ba].addSelf(V);M[wa].addSelf(V);M[da].addSelf(V)}var c,b,d,e,g,h,j,k,n,q,x,u,t,y,A,E,v,F,w,O,K,Z=[],M=[],f=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,ca=new THREE.Vector3,ea=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Z[c]=new THREE.Vector3;M[c]=new THREE.Vector3}c=
+c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(I,ba,wa,da,ua,ha,fa){g=I.vertices[ba].position;h=I.vertices[wa].position;j=I.vertices[da].position;k=e[ua];n=e[ha];q=e[fa];x=h.x-g.x;u=j.x-g.x;t=h.y-g.y;
+y=j.y-g.y;A=h.z-g.z;E=j.z-g.z;v=n.u-k.u;F=q.u-k.u;w=n.v-k.v;N=q.v-k.v;L=1/(v*N-F*w);f.set((N*x-w*u)*L,(N*t-w*y)*L,(N*A-w*E)*L);V.set((v*u-F*x)*L,(v*y-F*t)*L,(v*E-F*A)*L);Z[ba].addSelf(f);Z[wa].addSelf(f);Z[da].addSelf(f);M[ba].addSelf(V);M[wa].addSelf(V);M[da].addSelf(V)}var c,b,d,e,g,h,j,k,n,q,x,u,t,y,A,E,v,F,w,N,L,Z=[],M=[],f=new THREE.Vector3,V=new THREE.Vector3,T=new THREE.Vector3,ca=new THREE.Vector3,ea=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Z[c]=new THREE.Vector3;M[c]=new THREE.Vector3}c=
 0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.uvs[c];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.uvs[c];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){ea.copy(this.vertices[c].normal);d=Z[c];T.copy(d);T.subSelf(ea.multiplyScalar(ea.dot(d))).normalize();ca.cross(this.vertices[c].normal,d);d=ca.dot(M[c]);d=d<0?-1:1;this.vertices[c].tangent.set(T.x,T.y,T.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=0;for(b=this.vertices.length;c<b;c++){ea.copy(this.vertices[c].normal);d=Z[c];T.copy(d);T.subSelf(ea.multiplyScalar(ea.dot(d))).normalize();ca.cross(this.vertices[c].normal,d);d=ca.dot(M[c]);d=d<0?-1:1;this.vertices[c].tangent.set(T.x,T.y,T.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
@@ -140,10 +140,10 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
-THREE.Projector=function(){function a(M,f){return f.z-M.z}function c(M,f){var V=0,T=1,ca=M.z+M.w,ea=f.z+f.w,H=-M.z+M.w,ba=-f.z+f.w;if(ca>=0&&ea>=0&&H>=0&&ba>=0)return!0;else if(ca<0&&ea<0||H<0&&ba<0)return!1;else{if(ca<0)V=Math.max(V,ca/(ca-ea));else ea<0&&(T=Math.min(T,ca/(ca-ea)));if(H<0)V=Math.max(V,H/(H-ba));else ba<0&&(T=Math.min(T,H/(H-ba)));if(T<V)return!1;else{M.lerpSelf(f,V);f.lerpSelf(M,1-T);return!0}}}var b,d,e=[],g,h,j,k=[],n,q,x=[],u,t,y=[],A=new THREE.Vector4,E=new THREE.Vector4,v=new THREE.Matrix4,
-F=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Vector4,K=new THREE.Vector4,Z;this.projectObjects=function(M,f,V){f=[];var T,ca,ea;d=0;ca=M.objects;M=0;for(T=ca.length;M<T;M++){ea=ca[M];var H;if(!(H=!ea.visible))if(H=ea instanceof THREE.Mesh){a:{H=void 0;for(var ba=ea.matrixWorld,wa=-ea.geometry.boundingSphere.radius*Math.max(ea.scale.x,Math.max(ea.scale.y,ea.scale.z)),da=0;da<6;da++){H=w[da].x*ba.n14+
-w[da].y*ba.n24+w[da].z*ba.n34+w[da].w;if(H<=wa){H=!1;break a}}H=!0}H=!H}if(!H){b=e[d]=e[d]||new THREE.RenderableObject;A.copy(ea.position);v.multiplyVector3(A);b.object=ea;b.z=A.z;f.push(b);d++}}V&&f.sort(a);return f};this.projectScene=function(M,f,V){var T=[],ca=f.near,ea=f.far,H,ba,wa,da,ua,ha,fa,sa,xa,ga,aa,la,ma,R,ia,pa;j=q=t=0;f.matrixAutoUpdate&&f.update();v.multiply(f.projectionMatrix,f.matrixWorldInverse);w[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);w[1].set(v.n41+v.n11,v.n42+
-v.n12,v.n43+v.n13,v.n44+v.n14);w[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);w[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);w[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);w[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(H=0;H<6;H++){ha=w[H];ha.divideScalar(Math.sqrt(ha.x*ha.x+ha.y*ha.y+ha.z*ha.z))}M.update(undefined,!1,f);ha=this.projectObjects(M,f,!0);M=0;for(H=ha.length;M<H;M++){fa=ha[M].object;if(fa.visible){sa=fa.matrixWorld;aa=fa.matrixRotationWorld;
+THREE.Projector=function(){function a(M,f){return f.z-M.z}function c(M,f){var V=0,T=1,ca=M.z+M.w,ea=f.z+f.w,I=-M.z+M.w,ba=-f.z+f.w;if(ca>=0&&ea>=0&&I>=0&&ba>=0)return!0;else if(ca<0&&ea<0||I<0&&ba<0)return!1;else{if(ca<0)V=Math.max(V,ca/(ca-ea));else ea<0&&(T=Math.min(T,ca/(ca-ea)));if(I<0)V=Math.max(V,I/(I-ba));else ba<0&&(T=Math.min(T,I/(I-ba)));if(T<V)return!1;else{M.lerpSelf(f,V);f.lerpSelf(M,1-T);return!0}}}var b,d,e=[],g,h,j,k=[],n,q,x=[],u,t,y=[],A=new THREE.Vector4,E=new THREE.Vector4,v=new THREE.Matrix4,
+F=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,L=new THREE.Vector4,Z;this.projectObjects=function(M,f,V){f=[];var T,ca,ea;d=0;ca=M.objects;M=0;for(T=ca.length;M<T;M++){ea=ca[M];var I;if(!(I=!ea.visible))if(I=ea instanceof THREE.Mesh){a:{I=void 0;for(var ba=ea.matrixWorld,wa=-ea.geometry.boundingSphere.radius*Math.max(ea.scale.x,Math.max(ea.scale.y,ea.scale.z)),da=0;da<6;da++){I=w[da].x*ba.n14+
+w[da].y*ba.n24+w[da].z*ba.n34+w[da].w;if(I<=wa){I=!1;break a}}I=!0}I=!I}if(!I){b=e[d]=e[d]||new THREE.RenderableObject;A.copy(ea.position);v.multiplyVector3(A);b.object=ea;b.z=A.z;f.push(b);d++}}V&&f.sort(a);return f};this.projectScene=function(M,f,V){var T=[],ca=f.near,ea=f.far,I,ba,wa,da,ua,ha,fa,sa,xa,ga,aa,la,ma,R,ia,pa;j=q=t=0;f.matrixAutoUpdate&&f.update();v.multiply(f.projectionMatrix,f.matrixWorldInverse);w[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);w[1].set(v.n41+v.n11,v.n42+
+v.n12,v.n43+v.n13,v.n44+v.n14);w[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);w[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);w[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);w[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(I=0;I<6;I++){ha=w[I];ha.divideScalar(Math.sqrt(ha.x*ha.x+ha.y*ha.y+ha.z*ha.z))}M.update(undefined,!1,f);ha=this.projectObjects(M,f,!0);M=0;for(I=ha.length;M<I;M++){fa=ha[M].object;if(fa.visible){sa=fa.matrixWorld;aa=fa.matrixRotationWorld;
 xa=fa.materials;ga=fa.overdraw;if(fa instanceof THREE.Mesh){la=fa.geometry;ma=la.vertices;ba=0;for(wa=ma.length;ba<wa;ba++){R=ma[ba];R.positionWorld.copy(R.position);sa.multiplyVector3(R.positionWorld);da=R.positionScreen;da.copy(R.positionWorld);v.multiplyVector4(da);da.x/=da.w;da.y/=da.w;R.__visible=da.z>ca&&da.z<ea}la=la.faces;ba=0;for(wa=la.length;ba<wa;ba++){R=la[ba];if(R instanceof THREE.Face3){da=ma[R.a];ua=ma[R.b];ia=ma[R.c];if(da.__visible&&ua.__visible&&ia.__visible&&(fa.doubleSided||fa.flipSided!=
 xa=fa.materials;ga=fa.overdraw;if(fa instanceof THREE.Mesh){la=fa.geometry;ma=la.vertices;ba=0;for(wa=ma.length;ba<wa;ba++){R=ma[ba];R.positionWorld.copy(R.position);sa.multiplyVector3(R.positionWorld);da=R.positionScreen;da.copy(R.positionWorld);v.multiplyVector4(da);da.x/=da.w;da.y/=da.w;R.__visible=da.z>ca&&da.z<ea}la=la.faces;ba=0;for(wa=la.length;ba<wa;ba++){R=la[ba];if(R instanceof THREE.Face3){da=ma[R.a];ua=ma[R.b];ia=ma[R.c];if(da.__visible&&ua.__visible&&ia.__visible&&(fa.doubleSided||fa.flipSided!=
 (ia.positionScreen.x-da.positionScreen.x)*(ua.positionScreen.y-da.positionScreen.y)-(ia.positionScreen.y-da.positionScreen.y)*(ua.positionScreen.x-da.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(da.positionWorld);g.v2.positionWorld.copy(ua.positionWorld);g.v3.positionWorld.copy(ia.positionWorld);g.v1.positionScreen.copy(da.positionScreen);g.v2.positionScreen.copy(ua.positionScreen);g.v3.positionScreen.copy(ia.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);
 (ia.positionScreen.x-da.positionScreen.x)*(ua.positionScreen.y-da.positionScreen.y)-(ia.positionScreen.y-da.positionScreen.y)*(ua.positionScreen.x-da.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(da.positionWorld);g.v2.positionWorld.copy(ua.positionWorld);g.v3.positionWorld.copy(ia.positionWorld);g.v1.positionScreen.copy(da.positionScreen);g.v2.positionScreen.copy(ua.positionScreen);g.v3.positionScreen.copy(ia.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);
 g.centroidWorld.copy(R.centroid);sa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);ia=R.vertexNormals;Z=g.vertexNormalsWorld;da=0;for(ua=ia.length;da<ua;da++){pa=Z[da]=Z[da]||new THREE.Vector3;pa.copy(ia[da]);aa.multiplyVector3(pa)}g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=R.materials;g.overdraw=ga;if(fa.geometry.uvs[ba]){g.uvs[0]=fa.geometry.uvs[ba][0];g.uvs[1]=fa.geometry.uvs[ba][1];g.uvs[2]=fa.geometry.uvs[ba][2]}T.push(g);
 g.centroidWorld.copy(R.centroid);sa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);ia=R.vertexNormals;Z=g.vertexNormalsWorld;da=0;for(ua=ia.length;da<ua;da++){pa=Z[da]=Z[da]||new THREE.Vector3;pa.copy(ia[da]);aa.multiplyVector3(pa)}g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=R.materials;g.overdraw=ga;if(fa.geometry.uvs[ba]){g.uvs[0]=fa.geometry.uvs[ba][0];g.uvs[1]=fa.geometry.uvs[ba][1];g.uvs[2]=fa.geometry.uvs[ba][2]}T.push(g);
@@ -151,109 +151,109 @@ j++}}else if(R instanceof THREE.Face4){da=ma[R.a];ua=ma[R.b];ia=ma[R.c];pa=ma[R.
 0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(da.positionWorld);g.v2.positionWorld.copy(ua.positionWorld);g.v3.positionWorld.copy(pa.positionWorld);g.v1.positionScreen.copy(da.positionScreen);g.v2.positionScreen.copy(ua.positionScreen);g.v3.positionScreen.copy(pa.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);sa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);
 0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(da.positionWorld);g.v2.positionWorld.copy(ua.positionWorld);g.v3.positionWorld.copy(pa.positionWorld);g.v1.positionScreen.copy(da.positionScreen);g.v2.positionScreen.copy(ua.positionScreen);g.v3.positionScreen.copy(pa.positionScreen);g.normalWorld.copy(R.normal);aa.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);sa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);
 g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=R.materials;g.overdraw=ga;if(fa.geometry.uvs[ba]){g.uvs[0]=fa.geometry.uvs[ba][0];g.uvs[1]=fa.geometry.uvs[ba][1];g.uvs[2]=fa.geometry.uvs[ba][3]}T.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ua.positionWorld);h.v2.positionWorld.copy(ia.positionWorld);h.v3.positionWorld.copy(pa.positionWorld);h.v1.positionScreen.copy(ua.positionScreen);h.v2.positionScreen.copy(ia.positionScreen);h.v3.positionScreen.copy(pa.positionScreen);
 g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=R.materials;g.overdraw=ga;if(fa.geometry.uvs[ba]){g.uvs[0]=fa.geometry.uvs[ba][0];g.uvs[1]=fa.geometry.uvs[ba][1];g.uvs[2]=fa.geometry.uvs[ba][3]}T.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ua.positionWorld);h.v2.positionWorld.copy(ia.positionWorld);h.v3.positionWorld.copy(pa.positionWorld);h.v1.positionScreen.copy(ua.positionScreen);h.v2.positionScreen.copy(ia.positionScreen);h.v3.positionScreen.copy(pa.positionScreen);
 h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=xa;h.faceMaterials=R.materials;h.overdraw=ga;if(fa.geometry.uvs[ba]){h.uvs[0]=fa.geometry.uvs[ba][1];h.uvs[1]=fa.geometry.uvs[ba][2];h.uvs[2]=fa.geometry.uvs[ba][3]}T.push(h);j++}}}}else if(fa instanceof THREE.Line){F.multiply(v,sa);ma=fa.geometry.vertices;R=ma[0];R.positionScreen.copy(R.position);F.multiplyVector4(R.positionScreen);ba=1;for(wa=ma.length;ba<
 h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=xa;h.faceMaterials=R.materials;h.overdraw=ga;if(fa.geometry.uvs[ba]){h.uvs[0]=fa.geometry.uvs[ba][1];h.uvs[1]=fa.geometry.uvs[ba][2];h.uvs[2]=fa.geometry.uvs[ba][3]}T.push(h);j++}}}}else if(fa instanceof THREE.Line){F.multiply(v,sa);ma=fa.geometry.vertices;R=ma[0];R.positionScreen.copy(R.position);F.multiplyVector4(R.positionScreen);ba=1;for(wa=ma.length;ba<
-wa;ba++){da=ma[ba];da.positionScreen.copy(da.position);F.multiplyVector4(da.positionScreen);ua=ma[ba-1];O.copy(da.positionScreen);K.copy(ua.positionScreen);if(c(O,K)){O.multiplyScalar(1/O.w);K.multiplyScalar(1/K.w);n=x[q]=x[q]||new THREE.RenderableLine;n.v1.positionScreen.copy(O);n.v2.positionScreen.copy(K);n.z=Math.max(O.z,K.z);n.materials=fa.materials;T.push(n);q++}}}else if(fa instanceof THREE.Particle){E.set(fa.position.x,fa.position.y,fa.position.z,1);v.multiplyVector4(E);E.z/=E.w;if(E.z>0&&
+wa;ba++){da=ma[ba];da.positionScreen.copy(da.position);F.multiplyVector4(da.positionScreen);ua=ma[ba-1];N.copy(da.positionScreen);L.copy(ua.positionScreen);if(c(N,L)){N.multiplyScalar(1/N.w);L.multiplyScalar(1/L.w);n=x[q]=x[q]||new THREE.RenderableLine;n.v1.positionScreen.copy(N);n.v2.positionScreen.copy(L);n.z=Math.max(N.z,L.z);n.materials=fa.materials;T.push(n);q++}}}else if(fa instanceof THREE.Particle){E.set(fa.position.x,fa.position.y,fa.position.z,1);v.multiplyVector4(E);E.z/=E.w;if(E.z>0&&
 E.z<1){u=y[t]=y[t]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=fa.rotation.z;u.scale.x=fa.scale.x*Math.abs(u.x-(E.x+f.projectionMatrix.n11)/(E.w+f.projectionMatrix.n14));u.scale.y=fa.scale.y*Math.abs(u.y-(E.y+f.projectionMatrix.n22)/(E.w+f.projectionMatrix.n24));u.materials=fa.materials;T.push(u);t++}}}}V&&T.sort(a);return T};this.unprojectVector=function(M,f){var V=f.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));V.multiplyVector3(M);
 E.z<1){u=y[t]=y[t]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=fa.rotation.z;u.scale.x=fa.scale.x*Math.abs(u.x-(E.x+f.projectionMatrix.n11)/(E.w+f.projectionMatrix.n14));u.scale.y=fa.scale.y*Math.abs(u.y-(E.y+f.projectionMatrix.n22)/(E.w+f.projectionMatrix.n24));u.materials=fa.materials;T.push(u);t++}}}}V&&T.sort(a);return T};this.unprojectVector=function(M,f){var V=f.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(f.projectionMatrix));V.multiplyVector3(M);
 return M}};
 return M}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,n,q,x,u,t,y,A;a=c.projectScene(h,j);k=0;for(n=a.length;k<n;k++){u=a[k];if(u instanceof THREE.RenderableParticle){y=u.x*e+e;A=u.y*g+g;q=0;for(x=u.material.length;q<x;q++){t=u.material[q];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=y+"px";t.style.top=A+"px"}}}}}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,n,q,x,u,t,y,A;a=c.projectScene(h,j);k=0;for(n=a.length;k<n;k++){u=a[k];if(u instanceof THREE.RenderableParticle){y=u.x*e+e;A=u.y*g+g;q=0;for(x=u.material.length;q<x;q++){t=u.material[q];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=y+"px";t.style.top=A+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ja){if(u!=ja)n.globalAlpha=u=ja}function c(ja){if(t!=ja){switch(ja){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=ja}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,n=e.getContext("2d"),q=new THREE.Color(0),x=0,u=1,t=0,y=null,A=null,E=1,v,F,w,O,K,Z,M,f,V,T=new THREE.Color,
-ca=new THREE.Color,ea=new THREE.Color,H=new THREE.Color,ba=new THREE.Color,wa,da,ua,ha,fa,sa,xa,ga,aa,la=new THREE.Rectangle,ma=new THREE.Rectangle,R=new THREE.Rectangle,ia=!1,pa=new THREE.Color,m=new THREE.Color,z=new THREE.Color,p=new THREE.Color,l=Math.PI*2,o=new THREE.Vector3,C,B,G,N,L,P,ka=16;C=document.createElement("canvas");C.width=C.height=2;B=C.getContext("2d");B.fillStyle="rgba(0,0,0,1)";B.fillRect(0,0,2,2);G=B.getImageData(0,0,2,2);N=G.data;L=document.createElement("canvas");L.width=L.height=
-ka;P=L.getContext("2d");P.translate(-ka/2,-ka/2);P.scale(ka,ka);ka--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ja,qa){g=ja;h=qa;j=g/2;k=h/2;e.width=g;e.height=h;la.set(-j,-k,j,k);u=1;t=0;A=y=null;E=1};this.setClearColor=function(ja,qa){q=ja;x=qa};this.setClearColorHex=function(ja,qa){q.setHex(ja);x=qa};this.clear=function(){n.setTransform(1,0,0,-1,j,k);if(!ma.isEmpty()){ma.inflate(1);ma.minSelf(la);if(q.hex==0&&x==0)n.clearRect(ma.getX(),ma.getY(),
-ma.getWidth(),ma.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+x+")";n.fillRect(ma.getX(),ma.getY(),ma.getWidth(),ma.getHeight())}ma.empty()}};this.render=function(ja,qa){function ra(I){var Y,U,J,S=I.lights;m.setRGB(0,0,0);z.setRGB(0,0,0);p.setRGB(0,0,0);I=0;for(Y=S.length;I<Y;I++){U=S[I];J=U.color;if(U instanceof THREE.AmbientLight){m.r+=J.r;m.g+=J.g;m.b+=J.b}else if(U instanceof THREE.DirectionalLight){z.r+=
-J.r;z.g+=J.g;z.b+=J.b}else if(U instanceof THREE.PointLight){p.r+=J.r;p.g+=J.g;p.b+=J.b}}}function na(I,Y,U,J){var S,ta,va,Ha,ya=I.lights;I=0;for(S=ya.length;I<S;I++){ta=ya[I];va=ta.color;Ha=ta.intensity;if(ta instanceof THREE.DirectionalLight){ta=U.dot(ta.position)*Ha;if(ta>0){J.r+=va.r*ta;J.g+=va.g*ta;J.b+=va.b*ta}}else if(ta instanceof THREE.PointLight){o.sub(ta.position,Y);o.normalize();ta=U.dot(o)*Ha;if(ta>0){J.r+=va.r*ta;J.g+=va.g*ta;J.b+=va.b*ta}}}}function oa(I,Y,U){if(U.opacity!=0){a(U.opacity);
-c(U.blending);var J,S,ta,va,Ha,ya;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){va=U.map.image;Ha=va.width>>1;ya=va.height>>1;S=Y.scale.x*j;ta=Y.scale.y*k;U=S*Ha;J=ta*ya;R.set(I.x-U,I.y-J,I.x+U,I.y+J);if(la.instersects(R)){n.save();n.translate(I.x,I.y);n.rotate(-Y.rotation);n.scale(S,-ta);n.translate(-Ha,-ya);n.drawImage(va,0,0);n.restore()}}}else if(U instanceof THREE.ParticleCircleMaterial){if(ia){pa.r=m.r+z.r+p.r;pa.g=m.g+z.g+p.g;pa.b=m.b+z.b+p.b;T.r=U.color.r*pa.r;T.g=U.color.g*pa.g;
-T.b=U.color.b*pa.b;T.updateStyleString()}else T.__styleString=U.color.__styleString;U=Y.scale.x*j;J=Y.scale.y*k;R.set(I.x-U,I.y-J,I.x+U,I.y+J);if(la.instersects(R)){S=T.__styleString;if(A!=S)n.fillStyle=A=S;n.save();n.translate(I.x,I.y);n.rotate(-Y.rotation);n.scale(U,J);n.beginPath();n.arc(0,0,1,0,l,!0);n.closePath();n.fill();n.restore()}}}}function Ia(I,Y,U,J){if(J.opacity!=0){a(J.opacity);c(J.blending);n.beginPath();n.moveTo(I.positionScreen.x,I.positionScreen.y);n.lineTo(Y.positionScreen.x,Y.positionScreen.y);
-n.closePath();if(J instanceof THREE.LineBasicMaterial){T.__styleString=J.color.__styleString;I=J.linewidth;if(E!=I)n.lineWidth=E=I;I=T.__styleString;if(y!=I)n.strokeStyle=y=I;n.stroke();R.inflate(J.linewidth*2)}}}function Q(I,Y,U,J,S,ta){if(S.opacity!=0){a(S.opacity);c(S.blending);O=I.positionScreen.x;K=I.positionScreen.y;Z=Y.positionScreen.x;M=Y.positionScreen.y;f=U.positionScreen.x;V=U.positionScreen.y;n.beginPath();n.moveTo(O,K);n.lineTo(Z,M);n.lineTo(f,V);n.lineTo(O,K);n.closePath();if(S instanceof
-THREE.MeshBasicMaterial)if(S.map)S.map.mapping instanceof THREE.UVMapping&&Ea(O,K,Z,M,f,V,S.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){I=qa.matrixWorldInverse;o.copy(J.vertexNormalsWorld[0]);ha=(o.x*I.n11+o.y*I.n12+o.z*I.n13)*0.5+0.5;fa=-(o.x*I.n21+o.y*I.n22+o.z*I.n23)*0.5+0.5;o.copy(J.vertexNormalsWorld[1]);sa=(o.x*I.n11+o.y*I.n12+o.z*I.n13)*0.5+0.5;xa=-(o.x*I.n21+o.y*I.n22+o.z*I.n23)*
-0.5+0.5;o.copy(J.vertexNormalsWorld[2]);ga=(o.x*I.n11+o.y*I.n12+o.z*I.n13)*0.5+0.5;aa=-(o.x*I.n21+o.y*I.n22+o.z*I.n23)*0.5+0.5;Ea(O,K,Z,M,f,V,S.envMap.image,ha,fa,sa,xa,ga,aa)}}else S.wireframe?Fa(S.color.__styleString,S.wireframeLinewidth):Da(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof THREE.UVMapping&&Ea(O,K,Z,M,f,V,S.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);c(THREE.SubtractiveBlending)}if(ia)if(!S.wireframe&&
-S.shading==THREE.SmoothShading&&J.vertexNormalsWorld.length==3){ca.r=ea.r=H.r=m.r;ca.g=ea.g=H.g=m.g;ca.b=ea.b=H.b=m.b;na(ta,J.v1.positionWorld,J.vertexNormalsWorld[0],ca);na(ta,J.v2.positionWorld,J.vertexNormalsWorld[1],ea);na(ta,J.v3.positionWorld,J.vertexNormalsWorld[2],H);ba.r=(ea.r+H.r)*0.5;ba.g=(ea.g+H.g)*0.5;ba.b=(ea.b+H.b)*0.5;ua=W(ca,ea,H,ba);Ea(O,K,Z,M,f,V,ua,0,0,1,0,0,1)}else{pa.r=m.r;pa.g=m.g;pa.b=m.b;na(ta,J.centroidWorld,J.normalWorld,pa);T.r=S.color.r*pa.r;T.g=S.color.g*pa.g;T.b=S.color.b*
-pa.b;T.updateStyleString();S.wireframe?Fa(T.__styleString,S.wireframeLinewidth):Da(T.__styleString)}else S.wireframe?Fa(S.color.__styleString,S.wireframeLinewidth):Da(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){wa=qa.near;da=qa.far;ca.r=ca.g=ca.b=1-X(I.positionScreen.z,wa,da);ea.r=ea.g=ea.b=1-X(Y.positionScreen.z,wa,da);H.r=H.g=H.b=1-X(U.positionScreen.z,wa,da);ba.r=(ea.r+H.r)*0.5;ba.g=(ea.g+H.g)*0.5;ba.b=(ea.b+H.b)*0.5;ua=W(ca,ea,H,ba);Ea(O,K,Z,M,f,V,ua,0,0,1,0,0,1)}else if(S instanceof
-THREE.MeshNormalMaterial){T.r=$(J.normalWorld.x);T.g=$(J.normalWorld.y);T.b=$(J.normalWorld.z);T.updateStyleString();S.wireframe?Fa(T.__styleString,S.wireframeLinewidth):Da(T.__styleString)}}}function Fa(I,Y){if(y!=I)n.strokeStyle=y=I;if(E!=Y)n.lineWidth=E=Y;n.stroke();R.inflate(Y*2)}function Da(I){if(A!=I)n.fillStyle=A=I;n.fill()}function Ea(I,Y,U,J,S,ta,va,Ha,ya,Oa,Ja,Ka,Sa){var Ma,Pa;Ma=va.width-1;Pa=va.height-1;Ha*=Ma;ya*=Pa;Oa*=Ma;Ja*=Pa;Ka*=Ma;Sa*=Pa;U-=I;J-=Y;S-=I;ta-=Y;Oa-=Ha;Ja-=ya;Ka-=Ha;
-Sa-=ya;Ma=Oa*Sa-Ka*Ja;if(Ma!=0){Pa=1/Ma;Ma=(Sa*U-Ja*S)*Pa;Ja=(Sa*J-Ja*ta)*Pa;U=(Oa*S-Ka*U)*Pa;J=(Oa*ta-Ka*J)*Pa;I=I-Ma*Ha-U*ya;Y=Y-Ja*Ha-J*ya;n.save();n.transform(Ma,Ja,U,J,I,Y);n.clip();n.drawImage(va,0,0);n.restore()}}function W(I,Y,U,J){var S=~~(I.r*255),ta=~~(I.g*255);I=~~(I.b*255);var va=~~(Y.r*255),Ha=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(U.r*255),Oa=~~(U.g*255);U=~~(U.b*255);var Ja=~~(J.r*255),Ka=~~(J.g*255);J=~~(J.b*255);N[0]=S<0?0:S>255?255:S;N[1]=ta<0?0:ta>255?255:ta;N[2]=I<0?0:I>255?255:
-I;N[4]=va<0?0:va>255?255:va;N[5]=Ha<0?0:Ha>255?255:Ha;N[6]=Y<0?0:Y>255?255:Y;N[8]=ya<0?0:ya>255?255:ya;N[9]=Oa<0?0:Oa>255?255:Oa;N[10]=U<0?0:U>255?255:U;N[12]=Ja<0?0:Ja>255?255:Ja;N[13]=Ka<0?0:Ka>255?255:Ka;N[14]=J<0?0:J>255?255:J;B.putImageData(G,0,0);P.drawImage(C,0,0);return L}function X(I,Y,U){I=(I-Y)/(U-Y);return I*I*(3-2*I)}function $(I){I=(I+1)*0.5;return I<0?0:I>1?1:I}function za(I,Y){var U=Y.x-I.x,J=Y.y-I.y,S=1/Math.sqrt(U*U+J*J);U*=S;J*=S;Y.x+=U;Y.y+=J;I.x-=U;I.y-=J}var Ga,Ca,D,Ba,Qa,Ta,
+THREE.CanvasRenderer=function(){function a(ja){if(u!=ja)n.globalAlpha=u=ja}function c(ja){if(t!=ja){switch(ja){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}t=ja}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,n=e.getContext("2d"),q=new THREE.Color(0),x=0,u=1,t=0,y=null,A=null,E=1,v,F,w,N,L,Z,M,f,V,T=new THREE.Color,
+ca=new THREE.Color,ea=new THREE.Color,I=new THREE.Color,ba=new THREE.Color,wa,da,ua,ha,fa,sa,xa,ga,aa,la=new THREE.Rectangle,ma=new THREE.Rectangle,R=new THREE.Rectangle,ia=!1,pa=new THREE.Color,l=new THREE.Color,z=new THREE.Color,p=new THREE.Color,m=Math.PI*2,o=new THREE.Vector3,B,C,G,Q,H,O,ka=16;B=document.createElement("canvas");B.width=B.height=2;C=B.getContext("2d");C.fillStyle="rgba(0,0,0,1)";C.fillRect(0,0,2,2);G=C.getImageData(0,0,2,2);Q=G.data;H=document.createElement("canvas");H.width=H.height=
+ka;O=H.getContext("2d");O.translate(-ka/2,-ka/2);O.scale(ka,ka);ka--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ja,qa){g=ja;h=qa;j=g/2;k=h/2;e.width=g;e.height=h;la.set(-j,-k,j,k);u=1;t=0;A=y=null;E=1};this.setClearColor=function(ja,qa){q=ja;x=qa};this.setClearColorHex=function(ja,qa){q.setHex(ja);x=qa};this.clear=function(){n.setTransform(1,0,0,-1,j,k);if(!ma.isEmpty()){ma.inflate(1);ma.minSelf(la);if(q.hex==0&&x==0)n.clearRect(ma.getX(),ma.getY(),
+ma.getWidth(),ma.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+x+")";n.fillRect(ma.getX(),ma.getY(),ma.getWidth(),ma.getHeight())}ma.empty()}};this.render=function(ja,qa){function ra(J){var Y,U,K,S=J.lights;l.setRGB(0,0,0);z.setRGB(0,0,0);p.setRGB(0,0,0);J=0;for(Y=S.length;J<Y;J++){U=S[J];K=U.color;if(U instanceof THREE.AmbientLight){l.r+=K.r;l.g+=K.g;l.b+=K.b}else if(U instanceof THREE.DirectionalLight){z.r+=
+K.r;z.g+=K.g;z.b+=K.b}else if(U instanceof THREE.PointLight){p.r+=K.r;p.g+=K.g;p.b+=K.b}}}function na(J,Y,U,K){var S,ta,va,Ha,ya=J.lights;J=0;for(S=ya.length;J<S;J++){ta=ya[J];va=ta.color;Ha=ta.intensity;if(ta instanceof THREE.DirectionalLight){ta=U.dot(ta.position)*Ha;if(ta>0){K.r+=va.r*ta;K.g+=va.g*ta;K.b+=va.b*ta}}else if(ta instanceof THREE.PointLight){o.sub(ta.position,Y);o.normalize();ta=U.dot(o)*Ha;if(ta>0){K.r+=va.r*ta;K.g+=va.g*ta;K.b+=va.b*ta}}}}function oa(J,Y,U){if(U.opacity!=0){a(U.opacity);
+c(U.blending);var K,S,ta,va,Ha,ya;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){va=U.map.image;Ha=va.width>>1;ya=va.height>>1;S=Y.scale.x*j;ta=Y.scale.y*k;U=S*Ha;K=ta*ya;R.set(J.x-U,J.y-K,J.x+U,J.y+K);if(la.instersects(R)){n.save();n.translate(J.x,J.y);n.rotate(-Y.rotation);n.scale(S,-ta);n.translate(-Ha,-ya);n.drawImage(va,0,0);n.restore()}}}else if(U instanceof THREE.ParticleCircleMaterial){if(ia){pa.r=l.r+z.r+p.r;pa.g=l.g+z.g+p.g;pa.b=l.b+z.b+p.b;T.r=U.color.r*pa.r;T.g=U.color.g*pa.g;
+T.b=U.color.b*pa.b;T.updateStyleString()}else T.__styleString=U.color.__styleString;U=Y.scale.x*j;K=Y.scale.y*k;R.set(J.x-U,J.y-K,J.x+U,J.y+K);if(la.instersects(R)){S=T.__styleString;if(A!=S)n.fillStyle=A=S;n.save();n.translate(J.x,J.y);n.rotate(-Y.rotation);n.scale(U,K);n.beginPath();n.arc(0,0,1,0,m,!0);n.closePath();n.fill();n.restore()}}}}function Ia(J,Y,U,K){if(K.opacity!=0){a(K.opacity);c(K.blending);n.beginPath();n.moveTo(J.positionScreen.x,J.positionScreen.y);n.lineTo(Y.positionScreen.x,Y.positionScreen.y);
+n.closePath();if(K instanceof THREE.LineBasicMaterial){T.__styleString=K.color.__styleString;J=K.linewidth;if(E!=J)n.lineWidth=E=J;J=T.__styleString;if(y!=J)n.strokeStyle=y=J;n.stroke();R.inflate(K.linewidth*2)}}}function P(J,Y,U,K,S,ta){if(S.opacity!=0){a(S.opacity);c(S.blending);N=J.positionScreen.x;L=J.positionScreen.y;Z=Y.positionScreen.x;M=Y.positionScreen.y;f=U.positionScreen.x;V=U.positionScreen.y;n.beginPath();n.moveTo(N,L);n.lineTo(Z,M);n.lineTo(f,V);n.lineTo(N,L);n.closePath();if(S instanceof
+THREE.MeshBasicMaterial)if(S.map)S.map.mapping instanceof THREE.UVMapping&&Ea(N,L,Z,M,f,V,S.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(S.envMap){if(S.envMap.mapping instanceof THREE.SphericalReflectionMapping){J=qa.matrixWorldInverse;o.copy(K.vertexNormalsWorld[0]);ha=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;fa=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*0.5+0.5;o.copy(K.vertexNormalsWorld[1]);sa=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;xa=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*
+0.5+0.5;o.copy(K.vertexNormalsWorld[2]);ga=(o.x*J.n11+o.y*J.n12+o.z*J.n13)*0.5+0.5;aa=-(o.x*J.n21+o.y*J.n22+o.z*J.n23)*0.5+0.5;Ea(N,L,Z,M,f,V,S.envMap.image,ha,fa,sa,xa,ga,aa)}}else S.wireframe?Fa(S.color.__styleString,S.wireframeLinewidth):Da(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof THREE.UVMapping&&Ea(N,L,Z,M,f,V,S.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);c(THREE.SubtractiveBlending)}if(ia)if(!S.wireframe&&
+S.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){ca.r=ea.r=I.r=l.r;ca.g=ea.g=I.g=l.g;ca.b=ea.b=I.b=l.b;na(ta,K.v1.positionWorld,K.vertexNormalsWorld[0],ca);na(ta,K.v2.positionWorld,K.vertexNormalsWorld[1],ea);na(ta,K.v3.positionWorld,K.vertexNormalsWorld[2],I);ba.r=(ea.r+I.r)*0.5;ba.g=(ea.g+I.g)*0.5;ba.b=(ea.b+I.b)*0.5;ua=W(ca,ea,I,ba);Ea(N,L,Z,M,f,V,ua,0,0,1,0,0,1)}else{pa.r=l.r;pa.g=l.g;pa.b=l.b;na(ta,K.centroidWorld,K.normalWorld,pa);T.r=S.color.r*pa.r;T.g=S.color.g*pa.g;T.b=S.color.b*
+pa.b;T.updateStyleString();S.wireframe?Fa(T.__styleString,S.wireframeLinewidth):Da(T.__styleString)}else S.wireframe?Fa(S.color.__styleString,S.wireframeLinewidth):Da(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){wa=qa.near;da=qa.far;ca.r=ca.g=ca.b=1-X(J.positionScreen.z,wa,da);ea.r=ea.g=ea.b=1-X(Y.positionScreen.z,wa,da);I.r=I.g=I.b=1-X(U.positionScreen.z,wa,da);ba.r=(ea.r+I.r)*0.5;ba.g=(ea.g+I.g)*0.5;ba.b=(ea.b+I.b)*0.5;ua=W(ca,ea,I,ba);Ea(N,L,Z,M,f,V,ua,0,0,1,0,0,1)}else if(S instanceof
+THREE.MeshNormalMaterial){T.r=$(K.normalWorld.x);T.g=$(K.normalWorld.y);T.b=$(K.normalWorld.z);T.updateStyleString();S.wireframe?Fa(T.__styleString,S.wireframeLinewidth):Da(T.__styleString)}}}function Fa(J,Y){if(y!=J)n.strokeStyle=y=J;if(E!=Y)n.lineWidth=E=Y;n.stroke();R.inflate(Y*2)}function Da(J){if(A!=J)n.fillStyle=A=J;n.fill()}function Ea(J,Y,U,K,S,ta,va,Ha,ya,Oa,Ja,Ka,Sa){var Ma,Pa;Ma=va.width-1;Pa=va.height-1;Ha*=Ma;ya*=Pa;Oa*=Ma;Ja*=Pa;Ka*=Ma;Sa*=Pa;U-=J;K-=Y;S-=J;ta-=Y;Oa-=Ha;Ja-=ya;Ka-=Ha;
+Sa-=ya;Ma=Oa*Sa-Ka*Ja;if(Ma!=0){Pa=1/Ma;Ma=(Sa*U-Ja*S)*Pa;Ja=(Sa*K-Ja*ta)*Pa;U=(Oa*S-Ka*U)*Pa;K=(Oa*ta-Ka*K)*Pa;J=J-Ma*Ha-U*ya;Y=Y-Ja*Ha-K*ya;n.save();n.transform(Ma,Ja,U,K,J,Y);n.clip();n.drawImage(va,0,0);n.restore()}}function W(J,Y,U,K){var S=~~(J.r*255),ta=~~(J.g*255);J=~~(J.b*255);var va=~~(Y.r*255),Ha=~~(Y.g*255);Y=~~(Y.b*255);var ya=~~(U.r*255),Oa=~~(U.g*255);U=~~(U.b*255);var Ja=~~(K.r*255),Ka=~~(K.g*255);K=~~(K.b*255);Q[0]=S<0?0:S>255?255:S;Q[1]=ta<0?0:ta>255?255:ta;Q[2]=J<0?0:J>255?255:
+J;Q[4]=va<0?0:va>255?255:va;Q[5]=Ha<0?0:Ha>255?255:Ha;Q[6]=Y<0?0:Y>255?255:Y;Q[8]=ya<0?0:ya>255?255:ya;Q[9]=Oa<0?0:Oa>255?255:Oa;Q[10]=U<0?0:U>255?255:U;Q[12]=Ja<0?0:Ja>255?255:Ja;Q[13]=Ka<0?0:Ka>255?255:Ka;Q[14]=K<0?0:K>255?255:K;C.putImageData(G,0,0);O.drawImage(B,0,0);return H}function X(J,Y,U){J=(J-Y)/(U-Y);return J*J*(3-2*J)}function $(J){J=(J+1)*0.5;return J<0?0:J>1?1:J}function za(J,Y){var U=Y.x-J.x,K=Y.y-J.y,S=1/Math.sqrt(U*U+K*K);U*=S;K*=S;Y.x+=U;Y.y+=K;J.x-=U;J.y-=K}var Ga,Ca,D,Ba,Qa,Ta,
 La,Aa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,j,k);b=d.projectScene(ja,qa,this.sortElements);(ia=ja.lights.length>0)&&ra(ja);Ga=0;for(Ca=b.length;Ga<Ca;Ga++){D=b[Ga];R.empty();if(D instanceof THREE.RenderableParticle){v=D;v.x*=j;v.y*=k;Ba=0;for(Qa=D.materials.length;Ba<Qa;Ba++)oa(v,D,D.materials[Ba],ja)}else if(D instanceof THREE.RenderableLine){v=D.v1;F=D.v2;v.positionScreen.x*=j;v.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;R.addPoint(v.positionScreen.x,v.positionScreen.y);
 La,Aa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,j,k);b=d.projectScene(ja,qa,this.sortElements);(ia=ja.lights.length>0)&&ra(ja);Ga=0;for(Ca=b.length;Ga<Ca;Ga++){D=b[Ga];R.empty();if(D instanceof THREE.RenderableParticle){v=D;v.x*=j;v.y*=k;Ba=0;for(Qa=D.materials.length;Ba<Qa;Ba++)oa(v,D,D.materials[Ba],ja)}else if(D instanceof THREE.RenderableLine){v=D.v1;F=D.v2;v.positionScreen.x*=j;v.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;R.addPoint(v.positionScreen.x,v.positionScreen.y);
 R.addPoint(F.positionScreen.x,F.positionScreen.y);if(la.instersects(R)){Ba=0;for(Qa=D.materials.length;Ba<Qa;)Ia(v,F,D,D.materials[Ba++],ja)}}else if(D instanceof THREE.RenderableFace3){v=D.v1;F=D.v2;w=D.v3;v.positionScreen.x*=j;v.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;w.positionScreen.x*=j;w.positionScreen.y*=k;if(D.overdraw){za(v.positionScreen,F.positionScreen);za(F.positionScreen,w.positionScreen);za(w.positionScreen,v.positionScreen)}R.add3Points(v.positionScreen.x,v.positionScreen.y,
 R.addPoint(F.positionScreen.x,F.positionScreen.y);if(la.instersects(R)){Ba=0;for(Qa=D.materials.length;Ba<Qa;)Ia(v,F,D,D.materials[Ba++],ja)}}else if(D instanceof THREE.RenderableFace3){v=D.v1;F=D.v2;w=D.v3;v.positionScreen.x*=j;v.positionScreen.y*=k;F.positionScreen.x*=j;F.positionScreen.y*=k;w.positionScreen.x*=j;w.positionScreen.y*=k;if(D.overdraw){za(v.positionScreen,F.positionScreen);za(F.positionScreen,w.positionScreen);za(w.positionScreen,v.positionScreen)}R.add3Points(v.positionScreen.x,v.positionScreen.y,
-F.positionScreen.x,F.positionScreen.y,w.positionScreen.x,w.positionScreen.y);if(la.instersects(R)){Ba=0;for(Qa=D.meshMaterials.length;Ba<Qa;){Aa=D.meshMaterials[Ba++];if(Aa instanceof THREE.MeshFaceMaterial){Ta=0;for(La=D.faceMaterials.length;Ta<La;)(Aa=D.faceMaterials[Ta++])&&Q(v,F,w,D,Aa,ja)}else Q(v,F,w,D,Aa,ja)}}}ma.addRectangle(R)}n.setTransform(1,0,0,1,0,0)}};
+F.positionScreen.x,F.positionScreen.y,w.positionScreen.x,w.positionScreen.y);if(la.instersects(R)){Ba=0;for(Qa=D.meshMaterials.length;Ba<Qa;){Aa=D.meshMaterials[Ba++];if(Aa instanceof THREE.MeshFaceMaterial){Ta=0;for(La=D.faceMaterials.length;Ta<La;)(Aa=D.faceMaterials[Ta++])&&P(v,F,w,D,Aa,ja)}else P(v,F,w,D,Aa,ja)}}}ma.addRectangle(R)}n.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function a(ha,fa,sa){var xa,ga,aa,la;xa=0;for(ga=ha.lights.length;xa<ga;xa++){aa=ha.lights[xa];if(aa instanceof THREE.DirectionalLight){la=fa.normalWorld.dot(aa.position)*aa.intensity;if(la>0){sa.r+=aa.color.r*la;sa.g+=aa.color.g*la;sa.b+=aa.color.b*la}}else if(aa instanceof THREE.PointLight){V.sub(aa.position,fa.centroidWorld);V.normalize();la=fa.normalWorld.dot(V)*aa.intensity;if(la>0){sa.r+=aa.color.r*la;sa.g+=aa.color.g*la;sa.b+=aa.color.b*la}}}}function c(ha,fa,sa,
 THREE.SVGRenderer=function(){function a(ha,fa,sa){var xa,ga,aa,la;xa=0;for(ga=ha.lights.length;xa<ga;xa++){aa=ha.lights[xa];if(aa instanceof THREE.DirectionalLight){la=fa.normalWorld.dot(aa.position)*aa.intensity;if(la>0){sa.r+=aa.color.r*la;sa.g+=aa.color.g*la;sa.b+=aa.color.b*la}}else if(aa instanceof THREE.PointLight){V.sub(aa.position,fa.centroidWorld);V.normalize();la=fa.normalWorld.dot(V)*aa.intensity;if(la>0){sa.r+=aa.color.r*la;sa.g+=aa.color.g*la;sa.b+=aa.color.b*la}}}}function c(ha,fa,sa,
-xa,ga,aa){H=d(ba++);H.setAttribute("d","M "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");if(ga instanceof THREE.MeshBasicMaterial)w.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshLambertMaterial)if(F){O.r=K.r;O.g=K.g;O.b=K.b;a(aa,xa,O);w.r=ga.color.r*O.r;w.g=ga.color.g*O.g;w.b=ga.color.b*O.b;w.updateStyleString()}else w.__styleString=ga.color.__styleString;else if(ga instanceof
-THREE.MeshDepthMaterial){f=1-ga.__2near/(ga.__farPlusNear-xa.z*ga.__farMinusNear);w.setRGB(f,f,f)}else ga instanceof THREE.MeshNormalMaterial&&w.setRGB(e(xa.normalWorld.x),e(xa.normalWorld.y),e(xa.normalWorld.z));ga.wireframe?H.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ga.wireframeLinewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.wireframeLinecap+"; stroke-linejoin: "+ga.wireframeLinejoin):H.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+
-ga.opacity);j.appendChild(H)}function b(ha,fa,sa,xa,ga,aa,la){H=d(ba++);H.setAttribute("d","M "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(F){O.r=K.r;O.g=K.g;O.b=K.b;a(la,ga,O);w.r=aa.color.r*O.r;w.g=aa.color.g*O.g;
-w.b=aa.color.b*O.b;w.updateStyleString()}else w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ga.z*aa.__farMinusNear);w.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&w.setRGB(e(ga.normalWorld.x),e(ga.normalWorld.y),e(ga.normalWorld.z));aa.wireframe?H.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
-"; stroke-linejoin: "+aa.wireframeLinejoin):H.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(H)}function d(ha){if(T[ha]==null){T[ha]=document.createElementNS("http://www.w3.org/2000/svg","path");ua==0&&T[ha].setAttribute("shape-rendering","crispEdges")}return T[ha]}function e(ha){return ha<0?Math.min((1+ha)*0.5,0.5):0.5+Math.min(ha*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,q,x,u,t,y,A,E=
-new THREE.Rectangle,v=new THREE.Rectangle,F=!1,w=new THREE.Color(16777215),O=new THREE.Color(16777215),K=new THREE.Color(0),Z=new THREE.Color(0),M=new THREE.Color(0),f,V=new THREE.Vector3,T=[],ca=[],ea=[],H,ba,wa,da,ua=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ha){switch(ha){case "high":ua=1;break;case "low":ua=0}};this.setSize=function(ha,fa){k=ha;n=fa;q=k/2;x=n/2;j.setAttribute("viewBox",-q+" "+-x+" "+k+" "+n);j.setAttribute("width",
-k);j.setAttribute("height",n);E.set(-q,-x,q,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ha,fa){var sa,xa,ga,aa,la,ma,R,ia;this.autoClear&&this.clear();g=h.projectScene(ha,fa,this.sortElements);da=wa=ba=0;if(F=ha.lights.length>0){R=ha.lights;K.setRGB(0,0,0);Z.setRGB(0,0,0);M.setRGB(0,0,0);sa=0;for(xa=R.length;sa<xa;sa++){ga=R[sa];aa=ga.color;if(ga instanceof THREE.AmbientLight){K.r+=aa.r;K.g+=aa.g;K.b+=aa.b}else if(ga instanceof THREE.DirectionalLight){Z.r+=
-aa.r;Z.g+=aa.g;Z.b+=aa.b}else if(ga instanceof THREE.PointLight){M.r+=aa.r;M.g+=aa.g;M.b+=aa.b}}}sa=0;for(xa=g.length;sa<xa;sa++){R=g[sa];v.empty();if(R instanceof THREE.RenderableParticle){u=R;u.x*=q;u.y*=-x;ga=0;for(aa=R.materials.length;ga<aa;ga++)if(ia=R.materials[ga]){la=u;ma=R;var pa=wa++;if(ca[pa]==null){ca[pa]=document.createElementNS("http://www.w3.org/2000/svg","circle");ua==0&&ca[pa].setAttribute("shape-rendering","crispEdges")}H=ca[pa];H.setAttribute("cx",la.x);H.setAttribute("cy",la.y);
-H.setAttribute("r",ma.scale.x*q);if(ia instanceof THREE.ParticleCircleMaterial){if(F){O.r=K.r+Z.r+M.r;O.g=K.g+Z.g+M.g;O.b=K.b+Z.b+M.b;w.r=ia.color.r*O.r;w.g=ia.color.g*O.g;w.b=ia.color.b*O.b;w.updateStyleString()}else w=ia.color;H.setAttribute("style","fill: "+w.__styleString)}j.appendChild(H)}}else if(R instanceof THREE.RenderableLine){u=R.v1;t=R.v2;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,
-t.positionScreen.y);if(E.instersects(v)){ga=0;for(aa=R.materials.length;ga<aa;)if(ia=R.materials[ga++]){la=u;ma=t;pa=da++;if(ea[pa]==null){ea[pa]=document.createElementNS("http://www.w3.org/2000/svg","line");ua==0&&ea[pa].setAttribute("shape-rendering","crispEdges")}H=ea[pa];H.setAttribute("x1",la.positionScreen.x);H.setAttribute("y1",la.positionScreen.y);H.setAttribute("x2",ma.positionScreen.x);H.setAttribute("y2",ma.positionScreen.y);if(ia instanceof THREE.LineBasicMaterial){w.__styleString=ia.color.__styleString;
-H.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ia.linewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.linecap+"; stroke-linejoin: "+ia.linejoin);j.appendChild(H)}}}}else if(R instanceof THREE.RenderableFace3){u=R.v1;t=R.v2;y=R.v3;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;y.positionScreen.x*=q;y.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);
+xa,ga,aa){I=d(ba++);I.setAttribute("d","M "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");if(ga instanceof THREE.MeshBasicMaterial)w.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshLambertMaterial)if(F){N.r=L.r;N.g=L.g;N.b=L.b;a(aa,xa,N);w.r=ga.color.r*N.r;w.g=ga.color.g*N.g;w.b=ga.color.b*N.b;w.updateStyleString()}else w.__styleString=ga.color.__styleString;else if(ga instanceof
+THREE.MeshDepthMaterial){f=1-ga.__2near/(ga.__farPlusNear-xa.z*ga.__farMinusNear);w.setRGB(f,f,f)}else ga instanceof THREE.MeshNormalMaterial&&w.setRGB(e(xa.normalWorld.x),e(xa.normalWorld.y),e(xa.normalWorld.z));ga.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ga.wireframeLinewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.wireframeLinecap+"; stroke-linejoin: "+ga.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+
+ga.opacity);j.appendChild(I)}function b(ha,fa,sa,xa,ga,aa,la){I=d(ba++);I.setAttribute("d","M "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+sa.positionScreen.x+","+sa.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(F){N.r=L.r;N.g=L.g;N.b=L.b;a(la,ga,N);w.r=aa.color.r*N.r;w.g=aa.color.g*N.g;
+w.b=aa.color.b*N.b;w.updateStyleString()}else w.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ga.z*aa.__farMinusNear);w.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&w.setRGB(e(ga.normalWorld.x),e(ga.normalWorld.y),e(ga.normalWorld.z));aa.wireframe?I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
+"; stroke-linejoin: "+aa.wireframeLinejoin):I.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+aa.opacity);j.appendChild(I)}function d(ha){if(T[ha]==null){T[ha]=document.createElementNS("http://www.w3.org/2000/svg","path");ua==0&&T[ha].setAttribute("shape-rendering","crispEdges")}return T[ha]}function e(ha){return ha<0?Math.min((1+ha)*0.5,0.5):0.5+Math.min(ha*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,q,x,u,t,y,A,E=
+new THREE.Rectangle,v=new THREE.Rectangle,F=!1,w=new THREE.Color(16777215),N=new THREE.Color(16777215),L=new THREE.Color(0),Z=new THREE.Color(0),M=new THREE.Color(0),f,V=new THREE.Vector3,T=[],ca=[],ea=[],I,ba,wa,da,ua=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ha){switch(ha){case "high":ua=1;break;case "low":ua=0}};this.setSize=function(ha,fa){k=ha;n=fa;q=k/2;x=n/2;j.setAttribute("viewBox",-q+" "+-x+" "+k+" "+n);j.setAttribute("width",
+k);j.setAttribute("height",n);E.set(-q,-x,q,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(ha,fa){var sa,xa,ga,aa,la,ma,R,ia;this.autoClear&&this.clear();g=h.projectScene(ha,fa,this.sortElements);da=wa=ba=0;if(F=ha.lights.length>0){R=ha.lights;L.setRGB(0,0,0);Z.setRGB(0,0,0);M.setRGB(0,0,0);sa=0;for(xa=R.length;sa<xa;sa++){ga=R[sa];aa=ga.color;if(ga instanceof THREE.AmbientLight){L.r+=aa.r;L.g+=aa.g;L.b+=aa.b}else if(ga instanceof THREE.DirectionalLight){Z.r+=
+aa.r;Z.g+=aa.g;Z.b+=aa.b}else if(ga instanceof THREE.PointLight){M.r+=aa.r;M.g+=aa.g;M.b+=aa.b}}}sa=0;for(xa=g.length;sa<xa;sa++){R=g[sa];v.empty();if(R instanceof THREE.RenderableParticle){u=R;u.x*=q;u.y*=-x;ga=0;for(aa=R.materials.length;ga<aa;ga++)if(ia=R.materials[ga]){la=u;ma=R;var pa=wa++;if(ca[pa]==null){ca[pa]=document.createElementNS("http://www.w3.org/2000/svg","circle");ua==0&&ca[pa].setAttribute("shape-rendering","crispEdges")}I=ca[pa];I.setAttribute("cx",la.x);I.setAttribute("cy",la.y);
+I.setAttribute("r",ma.scale.x*q);if(ia instanceof THREE.ParticleCircleMaterial){if(F){N.r=L.r+Z.r+M.r;N.g=L.g+Z.g+M.g;N.b=L.b+Z.b+M.b;w.r=ia.color.r*N.r;w.g=ia.color.g*N.g;w.b=ia.color.b*N.b;w.updateStyleString()}else w=ia.color;I.setAttribute("style","fill: "+w.__styleString)}j.appendChild(I)}}else if(R instanceof THREE.RenderableLine){u=R.v1;t=R.v2;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,
+t.positionScreen.y);if(E.instersects(v)){ga=0;for(aa=R.materials.length;ga<aa;)if(ia=R.materials[ga++]){la=u;ma=t;pa=da++;if(ea[pa]==null){ea[pa]=document.createElementNS("http://www.w3.org/2000/svg","line");ua==0&&ea[pa].setAttribute("shape-rendering","crispEdges")}I=ea[pa];I.setAttribute("x1",la.positionScreen.x);I.setAttribute("y1",la.positionScreen.y);I.setAttribute("x2",ma.positionScreen.x);I.setAttribute("y2",ma.positionScreen.y);if(ia instanceof THREE.LineBasicMaterial){w.__styleString=ia.color.__styleString;
+I.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+ia.linewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.linecap+"; stroke-linejoin: "+ia.linejoin);j.appendChild(I)}}}}else if(R instanceof THREE.RenderableFace3){u=R.v1;t=R.v2;y=R.v3;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;y.positionScreen.x*=q;y.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);
 v.addPoint(y.positionScreen.x,y.positionScreen.y);if(E.instersects(v)){ga=0;for(aa=R.meshMaterials.length;ga<aa;){ia=R.meshMaterials[ga++];if(ia instanceof THREE.MeshFaceMaterial){la=0;for(ma=R.faceMaterials.length;la<ma;)(ia=R.faceMaterials[la++])&&c(u,t,y,R,ia,ha)}else ia&&c(u,t,y,R,ia,ha)}}}else if(R instanceof THREE.RenderableFace4){u=R.v1;t=R.v2;y=R.v3;A=R.v4;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;y.positionScreen.x*=q;y.positionScreen.y*=-x;
 v.addPoint(y.positionScreen.x,y.positionScreen.y);if(E.instersects(v)){ga=0;for(aa=R.meshMaterials.length;ga<aa;){ia=R.meshMaterials[ga++];if(ia instanceof THREE.MeshFaceMaterial){la=0;for(ma=R.faceMaterials.length;la<ma;)(ia=R.faceMaterials[la++])&&c(u,t,y,R,ia,ha)}else ia&&c(u,t,y,R,ia,ha)}}}else if(R instanceof THREE.RenderableFace4){u=R.v1;t=R.v2;y=R.v3;A=R.v4;u.positionScreen.x*=q;u.positionScreen.y*=-x;t.positionScreen.x*=q;t.positionScreen.y*=-x;y.positionScreen.x*=q;y.positionScreen.y*=-x;
 A.positionScreen.x*=q;A.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(y.positionScreen.x,y.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(v)){ga=0;for(aa=R.meshMaterials.length;ga<aa;){ia=R.meshMaterials[ga++];if(ia instanceof THREE.MeshFaceMaterial){la=0;for(ma=R.faceMaterials.length;la<ma;)(ia=R.faceMaterials[la++])&&b(u,t,y,A,R,ia,ha)}else ia&&b(u,t,y,A,R,ia,ha)}}}}}};
 A.positionScreen.x*=q;A.positionScreen.y*=-x;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(y.positionScreen.x,y.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(v)){ga=0;for(aa=R.meshMaterials.length;ga<aa;){ia=R.meshMaterials[ga++];if(ia instanceof THREE.MeshFaceMaterial){la=0;for(ma=R.faceMaterials.length;la<ma;)(ia=R.faceMaterials[la++])&&b(u,t,y,A,R,ia,ha)}else ia&&b(u,t,y,A,R,ia,ha)}}}}}};
-THREE.WebGLRenderer=function(a){function c(m,z,p){var l,o,C,B=m.vertices,G=B.length,N=m.colors,L=N.length,P=m.__vertexArray,ka=m.__colorArray,ja=m.__sortArray,qa=m.__dirtyVertices,ra=m.__dirtyColors;if(p.sortParticles){xa.multiplySelf(p.matrixWorld);for(l=0;l<G;l++){o=B[l].position;la.copy(o);xa.multiplyVector3(la);ja[l]=[la.z,l]}ja.sort(function(na,oa){return oa[0]-na[0]});for(l=0;l<G;l++){o=B[ja[l][1]].position;C=l*3;P[C]=o.x;P[C+1]=o.y;P[C+2]=o.z}for(l=0;l<L;l++){C=l*3;color=N[ja[l][1]];ka[C]=
-color.r;ka[C+1]=color.g;ka[C+2]=color.b}}else{if(qa)for(l=0;l<G;l++){o=B[l].position;C=l*3;P[C]=o.x;P[C+1]=o.y;P[C+2]=o.z}if(ra)for(l=0;l<L;l++){color=N[l];C=l*3;ka[C]=color.r;ka[C+1]=color.g;ka[C+2]=color.b}}if(qa||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,P,z)}if(ra||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,ka,z)}}function b(m,z){m.fragmentShader=z.fragmentShader;m.vertexShader=z.vertexShader;
-m.uniforms=Uniforms.clone(z.uniforms)}function d(m,z,p,l,o){l.program||ca.initMaterial(l,z,p);var C=l.program,B=C.uniforms,G=l.uniforms;if(C!=V){f.useProgram(C);V=C;f.uniformMatrix4fv(B.projectionMatrix,!1,ga)}if(p&&(l instanceof THREE.MeshBasicMaterial||l instanceof THREE.MeshLambertMaterial||l instanceof THREE.MeshPhongMaterial||l instanceof THREE.LineBasicMaterial||l instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){G.fogNear.value=p.near;
-G.fogFar.value=p.far}else if(p instanceof THREE.FogExp2)G.fogDensity.value=p.density}if(l instanceof THREE.MeshPhongMaterial||l instanceof THREE.MeshLambertMaterial){var N,L,P=0,ka=0,ja=0,qa,ra,na,oa=ma,Ia=oa.directional.colors,Q=oa.directional.positions,Fa=oa.point.colors,Da=oa.point.positions,Ea=0,W=0;p=L=L=0;for(N=z.length;p<N;p++){L=z[p];qa=L.color;ra=L.position;na=L.intensity;if(L instanceof THREE.AmbientLight){P+=qa.r;ka+=qa.g;ja+=qa.b}else if(L instanceof THREE.DirectionalLight){L=Ea*3;Ia[L]=
-qa.r*na;Ia[L+1]=qa.g*na;Ia[L+2]=qa.b*na;Q[L]=ra.x;Q[L+1]=ra.y;Q[L+2]=ra.z;Ea+=1}else if(L instanceof THREE.PointLight){L=W*3;Fa[L]=qa.r*na;Fa[L+1]=qa.g*na;Fa[L+2]=qa.b*na;Da[L]=ra.x;Da[L+1]=ra.y;Da[L+2]=ra.z;W+=1}}for(p=Ea*3;p<Ia.length;p++)Ia[p]=0;for(p=W*3;p<Fa.length;p++)Fa[p]=0;oa.point.length=W;oa.directional.length=Ea;oa.ambient[0]=P;oa.ambient[1]=ka;oa.ambient[2]=ja;z=ma;G.enableLighting.value=z.directional.length+z.point.length;G.ambientLightColor.value=z.ambient;G.directionalLightColor.value=
-z.directional.colors;G.directionalLightDirection.value=z.directional.positions;G.pointLightColor.value=z.point.colors;G.pointLightPosition.value=z.point.positions}if(l instanceof THREE.MeshBasicMaterial||l instanceof THREE.MeshLambertMaterial||l instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(l.color.r*l.opacity,l.color.g*l.opacity,l.color.b*l.opacity);G.opacity.value=l.opacity;G.map.texture=l.map;G.lightMap.texture=l.lightMap;G.envMap.texture=l.envMap;G.reflectivity.value=l.reflectivity;
-G.refractionRatio.value=l.refractionRatio;G.combine.value=l.combine;G.useRefract.value=l.envMap&&l.envMap.mapping instanceof THREE.CubeRefractionMapping}if(l instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(l.color.r*l.opacity,l.color.g*l.opacity,l.color.b*l.opacity);G.opacity.value=l.opacity}else if(l instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(l.color.r*l.opacity,l.color.g*l.opacity,l.color.b*l.opacity);G.opacity.value=l.opacity;G.size.value=l.size;G.map.texture=l.map}else if(l instanceof
-THREE.MeshPhongMaterial){G.ambient.value.setRGB(l.ambient.r,l.ambient.g,l.ambient.b);G.specular.value.setRGB(l.specular.r,l.specular.g,l.specular.b);G.shininess.value=l.shininess}else if(l instanceof THREE.MeshDepthMaterial){G.mNear.value=m.near;G.mFar.value=m.far;G.opacity.value=l.opacity}else if(l instanceof THREE.MeshNormalMaterial)G.opacity.value=l.opacity;for(var X in G)if(P=C.uniforms[X]){p=G[X];N=p.type;z=p.value;if(N=="i")f.uniform1i(P,z);else if(N=="f")f.uniform1f(P,z);else if(N=="fv1")f.uniform1fv(P,
-z);else if(N=="fv")f.uniform3fv(P,z);else if(N=="v2")f.uniform2f(P,z.x,z.y);else if(N=="v3")f.uniform3f(P,z.x,z.y,z.z);else if(N=="c")f.uniform3f(P,z.r,z.g,z.b);else if(N=="t"){f.uniform1i(P,z);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(N=0;N<6;++N)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[N])}else{p.image.__webGLTextureCube=
-f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(N=0;N<6;++N)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[N]);p.__wasSetOnce=!0}F(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,
-0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}F(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(B.modelViewMatrix,!1,o._modelViewMatrixArray);f.uniformMatrix3fv(B.normalMatrix,!1,o._normalMatrixArray);(l instanceof THREE.MeshShaderMaterial||
-l instanceof THREE.MeshPhongMaterial||l.envMap)&&f.uniform3f(B.cameraPosition,m.position.x,m.position.y,m.position.z);(l instanceof THREE.MeshShaderMaterial||l.envMap||l.skinning)&&f.uniformMatrix4fv(B.objectMatrix,!1,o._objectMatrixArray);(l instanceof THREE.MeshPhongMaterial||l instanceof THREE.MeshLambertMaterial||l instanceof THREE.MeshShaderMaterial||l.skinning)&&f.uniformMatrix4fv(B.viewMatrix,!1,aa);if(l.skinning){f.uniformMatrix4fv(B.cameraInverseMatrix,!1,aa);f.uniformMatrix4fv(B.boneGlobalMatrices,
-!1,o.boneMatrices)}return C}function e(m,z,p,l,o,C){m=d(m,z,p,l,C).attributes;f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.vertexAttribPointer(m.position,3,f.FLOAT,!1,0,0);if(m.color>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.vertexAttribPointer(m.color,3,f.FLOAT,!1,0,0)}if(m.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLNormalBuffer);f.vertexAttribPointer(m.normal,3,f.FLOAT,!1,0,0)}if(m.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLTangentBuffer);f.vertexAttribPointer(m.tangent,
-4,f.FLOAT,!1,0,0)}if(m.uv>=0)if(o.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUVBuffer);f.vertexAttribPointer(m.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv)}else f.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(o.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUV2Buffer);f.vertexAttribPointer(m.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv2)}else f.disableVertexAttribArray(m.uv2);if(l.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,
-o.__webGLSkinVertexABuffer);f.vertexAttribPointer(m.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);f.vertexAttribPointer(m.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);f.vertexAttribPointer(m.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);f.vertexAttribPointer(m.skinWeight,4,f.FLOAT,!1,0,0)}if(C instanceof THREE.Mesh)if(l.wireframe){f.lineWidth(l.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
-o.__webGLLineBuffer);f.drawElements(f.LINES,o.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,o.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(l.linewidth);f.drawArrays(C,0,o.__webGLLineCount)}else if(C instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,o.__webGLParticleCount);else C instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,
-0,o.__webGLVertexCount)}function g(m,z){if(!m.__webGLVertexBuffer)m.__webGLVertexBuffer=f.createBuffer();if(!m.__webGLNormalBuffer)m.__webGLNormalBuffer=f.createBuffer();if(m.hasPos){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,m.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(m.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,m.normalArray,
-f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,m.count);m.count=0}function h(m){if(ea!=m.doubleSided){m.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);ea=m.doubleSided}if(H!=m.flipSided){m.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);H=m.flipSided}}function j(m){if(wa!=m){m?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);wa=m}}function k(m){sa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,
-m.n44-m.n14);sa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);sa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);sa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);sa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);sa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var z;for(m=0;m<6;m++){z=sa[m];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function n(m){for(var z=m.matrixWorld,p=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,
-m.scale.z)),l=0;l<6;l++){m=sa[l].x*z.n14+sa[l].y*z.n24+sa[l].z*z.n34+sa[l].w;if(m<=p)return!1}return!0}function q(m,z){m.list[m.count]=z;m.count+=1}function x(m){var z,p,l=m.object,o=m.opaque,C=m.transparent;C.count=0;m=o.count=0;for(z=l.materials.length;m<z;m++){p=l.materials[m];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?q(C,p):q(o,p)}}function u(m){var z,p,l,o,C=m.object,B=m.buffer,G=m.opaque,N=m.transparent;N.count=0;m=G.count=0;for(l=C.materials.length;m<l;m++){z=C.materials[m];
-if(z instanceof THREE.MeshFaceMaterial){z=0;for(p=B.materials.length;z<p;z++)(o=B.materials[z])&&(o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?q(N,o):q(G,o))}else{o=z;o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?q(N,o):q(G,o)}}}function t(m,z){return z.z-m.z}function y(m,z){m._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function A(m){function z(ka){var ja=
-[];p=0;for(l=ka.length;p<l;p++)ka[p]==undefined?ja.push("undefined"):ja.push(ka[p].id);return ja.join("_")}var p,l,o,C,B,G,N,L,P={};m.geometryGroups={};o=0;for(C=m.faces.length;o<C;o++){B=m.faces[o];G=B.materials;N=z(G);P[N]==undefined&&(P[N]={hash:N,counter:0});L=P[N].hash+"_"+P[N].counter;m.geometryGroups[L]==undefined&&(m.geometryGroups[L]={faces:[],materials:G,vertices:0});B=B instanceof THREE.Face3?3:4;if(m.geometryGroups[L].vertices+B>65535){P[N].counter+=1;L=P[N].hash+"_"+P[N].counter;m.geometryGroups[L]==
-undefined&&(m.geometryGroups[L]={faces:[],materials:G,vertices:0})}m.geometryGroups[L].faces.push(o);m.geometryGroups[L].vertices+=B}}function E(m,z,p){m.push({buffer:z,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(m){if(m!=ba){switch(m){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,
-f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ba=m}}function F(m,z,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(m,f.TEXTURE_WRAP_S,Z(z.wrapS));f.texParameteri(m,f.TEXTURE_WRAP_T,Z(z.wrapT));f.texParameteri(m,f.TEXTURE_MAG_FILTER,Z(z.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,Z(z.minFilter));f.generateMipmap(m)}else{f.texParameteri(m,
-f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_MAG_FILTER,K(z.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,K(z.minFilter))}}function w(m){if(m&&!m.__webGLFramebuffer){m.__webGLFramebuffer=f.createFramebuffer();m.__webGLRenderbuffer=f.createRenderbuffer();m.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,m.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,m.width,m.height);f.bindTexture(f.TEXTURE_2D,
-m.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Z(m.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Z(m.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Z(m.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Z(m.minFilter));f.texImage2D(f.TEXTURE_2D,0,Z(m.format),m.width,m.height,0,Z(m.format),Z(m.type),null);f.bindFramebuffer(f.FRAMEBUFFER,m.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,m.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,
-f.DEPTH_ATTACHMENT,f.RENDERBUFFER,m.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,p;if(m){z=m.__webGLFramebuffer;p=m.width;m=m.height}else{z=null;p=ha;m=fa}if(z!=T){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(da,ua,p,m);T=z}}function O(m,z){var p;if(m=="fragment")p=f.createShader(f.FRAGMENT_SHADER);else m=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,z);f.compileShader(p);if(!f.getShaderParameter(p,
-f.COMPILE_STATUS)){alert(f.getShaderInfoLog(p));return null}return p}function K(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function Z(m){switch(m){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;
+THREE.WebGLRenderer=function(a){function c(l,z,p){var m,o,B,C=l.vertices,G=C.length,Q=l.colors,H=Q.length,O=l.__vertexArray,ka=l.__colorArray,ja=l.__sortArray,qa=l.__dirtyVertices,ra=l.__dirtyColors;if(p.sortParticles){xa.multiplySelf(p.matrixWorld);for(m=0;m<G;m++){o=C[m].position;la.copy(o);xa.multiplyVector3(la);ja[m]=[la.z,m]}ja.sort(function(na,oa){return oa[0]-na[0]});for(m=0;m<G;m++){o=C[ja[m][1]].position;B=m*3;O[B]=o.x;O[B+1]=o.y;O[B+2]=o.z}for(m=0;m<H;m++){B=m*3;color=Q[ja[m][1]];ka[B]=
+color.r;ka[B+1]=color.g;ka[B+2]=color.b}}else{if(qa)for(m=0;m<G;m++){o=C[m].position;B=m*3;O[B]=o.x;O[B+1]=o.y;O[B+2]=o.z}if(ra)for(m=0;m<H;m++){color=Q[m];B=m*3;ka[B]=color.r;ka[B+1]=color.g;ka[B+2]=color.b}}if(qa||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,O,z)}if(ra||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,ka,z)}}function b(l,z){l.fragmentShader=z.fragmentShader;l.vertexShader=z.vertexShader;
+l.uniforms=Uniforms.clone(z.uniforms)}function d(l,z,p,m,o){m.program||ca.initMaterial(m,z,p,o);var B=m.program,C=B.uniforms,G=m.uniforms;if(B!=V){f.useProgram(B);V=B;f.uniformMatrix4fv(C.projectionMatrix,!1,ga)}if(p&&(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial||m instanceof THREE.LineBasicMaterial||m instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){G.fogNear.value=p.near;
+G.fogFar.value=p.far}else if(p instanceof THREE.FogExp2)G.fogDensity.value=p.density}if(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial){var Q,H,O=0,ka=0,ja=0,qa,ra,na,oa=ma,Ia=oa.directional.colors,P=oa.directional.positions,Fa=oa.point.colors,Da=oa.point.positions,Ea=0,W=0;p=H=H=0;for(Q=z.length;p<Q;p++){H=z[p];qa=H.color;ra=H.position;na=H.intensity;if(H instanceof THREE.AmbientLight){O+=qa.r;ka+=qa.g;ja+=qa.b}else if(H instanceof THREE.DirectionalLight){H=Ea*3;Ia[H]=
+qa.r*na;Ia[H+1]=qa.g*na;Ia[H+2]=qa.b*na;P[H]=ra.x;P[H+1]=ra.y;P[H+2]=ra.z;Ea+=1}else if(H instanceof THREE.PointLight){H=W*3;Fa[H]=qa.r*na;Fa[H+1]=qa.g*na;Fa[H+2]=qa.b*na;Da[H]=ra.x;Da[H+1]=ra.y;Da[H+2]=ra.z;W+=1}}for(p=Ea*3;p<Ia.length;p++)Ia[p]=0;for(p=W*3;p<Fa.length;p++)Fa[p]=0;oa.point.length=W;oa.directional.length=Ea;oa.ambient[0]=O;oa.ambient[1]=ka;oa.ambient[2]=ja;z=ma;G.enableLighting.value=z.directional.length+z.point.length;G.ambientLightColor.value=z.ambient;G.directionalLightColor.value=
+z.directional.colors;G.directionalLightDirection.value=z.directional.positions;G.pointLightColor.value=z.point.colors;G.pointLightPosition.value=z.point.positions}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity;G.map.texture=m.map;G.lightMap.texture=m.lightMap;G.envMap.texture=m.envMap;G.reflectivity.value=m.reflectivity;
+G.refractionRatio.value=m.refractionRatio;G.combine.value=m.combine;G.useRefract.value=m.envMap&&m.envMap.mapping instanceof THREE.CubeRefractionMapping}if(m instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity}else if(m instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(m.color.r*m.opacity,m.color.g*m.opacity,m.color.b*m.opacity);G.opacity.value=m.opacity;G.size.value=m.size;G.map.texture=m.map}else if(m instanceof
+THREE.MeshPhongMaterial){G.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);G.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);G.shininess.value=m.shininess}else if(m instanceof THREE.MeshDepthMaterial){G.mNear.value=l.near;G.mFar.value=l.far;G.opacity.value=m.opacity}else if(m instanceof THREE.MeshNormalMaterial)G.opacity.value=m.opacity;for(var X in G)if(O=B.uniforms[X]){p=G[X];Q=p.type;z=p.value;if(Q=="i")f.uniform1i(O,z);else if(Q=="f")f.uniform1f(O,z);else if(Q=="fv1")f.uniform1fv(O,
+z);else if(Q=="fv")f.uniform3fv(O,z);else if(Q=="v2")f.uniform2f(O,z.x,z.y);else if(Q=="v3")f.uniform3f(O,z.x,z.y,z.z);else if(Q=="c")f.uniform3f(O,z.r,z.g,z.b);else if(Q=="t"){f.uniform1i(O,z);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[Q])}else{p.image.__webGLTextureCube=
+f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(Q=0;Q<6;++Q)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[Q]);p.__wasSetOnce=!0}F(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,
+0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}F(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+z);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,o._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,!1,o._normalMatrixArray);(m instanceof THREE.MeshShaderMaterial||
+m instanceof THREE.MeshPhongMaterial||m.envMap)&&f.uniform3f(C.cameraPosition,l.position.x,l.position.y,l.position.z);(m instanceof THREE.MeshShaderMaterial||m.envMap||m.skinning)&&f.uniformMatrix4fv(C.objectMatrix,!1,o._objectMatrixArray);(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshShaderMaterial||m.skinning)&&f.uniformMatrix4fv(C.viewMatrix,!1,aa);if(m.skinning){f.uniformMatrix4fv(C.cameraInverseMatrix,!1,aa);f.uniformMatrix4fv(C.boneGlobalMatrices,
+!1,o.boneMatrices)}return B}function e(l,z,p,m,o,B){l=d(l,z,p,m,B).attributes;f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.vertexAttribPointer(l.position,3,f.FLOAT,!1,0,0);if(l.color>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.vertexAttribPointer(l.color,3,f.FLOAT,!1,0,0)}if(l.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLNormalBuffer);f.vertexAttribPointer(l.normal,3,f.FLOAT,!1,0,0)}if(l.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLTangentBuffer);f.vertexAttribPointer(l.tangent,
+4,f.FLOAT,!1,0,0)}if(l.uv>=0)if(o.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUVBuffer);f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv)}else f.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(o.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,o.__webGLUV2Buffer);f.vertexAttribPointer(l.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(l.uv2)}else f.disableVertexAttribArray(l.uv2);if(m.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,
+o.__webGLSkinVertexABuffer);f.vertexAttribPointer(l.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);f.vertexAttribPointer(l.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);f.vertexAttribPointer(l.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);f.vertexAttribPointer(l.skinWeight,4,f.FLOAT,!1,0,0)}if(B instanceof THREE.Mesh)if(m.wireframe){f.lineWidth(m.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
+o.__webGLLineBuffer);f.drawElements(f.LINES,o.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,o.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(m.linewidth);f.drawArrays(B,0,o.__webGLLineCount)}else if(B instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,o.__webGLParticleCount);else B instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,
+0,o.__webGLVertexCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=f.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=f.createBuffer();if(l.hasPos){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,l.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.position);f.vertexAttribPointer(z.attributes.position,3,f.FLOAT,!1,0,0)}if(l.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,l.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,l.normalArray,
+f.DYNAMIC_DRAW);f.enableVertexAttribArray(z.attributes.normal);f.vertexAttribPointer(z.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,l.count);l.count=0}function h(l){if(ea!=l.doubleSided){l.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);ea=l.doubleSided}if(I!=l.flipSided){l.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);I=l.flipSided}}function j(l){if(wa!=l){l?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);wa=l}}function k(l){sa[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,
+l.n44-l.n14);sa[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);sa[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);sa[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);sa[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);sa[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=sa[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}function n(l){for(var z=l.matrixWorld,p=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,
+l.scale.z)),m=0;m<6;m++){l=sa[m].x*z.n14+sa[m].y*z.n24+sa[m].z*z.n34+sa[m].w;if(l<=p)return!1}return!0}function q(l,z){l.list[l.count]=z;l.count+=1}function x(l){var z,p,m=l.object,o=l.opaque,B=l.transparent;B.count=0;l=o.count=0;for(z=m.materials.length;l<z;l++){p=m.materials[l];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?q(B,p):q(o,p)}}function u(l){var z,p,m,o,B=l.object,C=l.buffer,G=l.opaque,Q=l.transparent;Q.count=0;l=G.count=0;for(m=B.materials.length;l<m;l++){z=B.materials[l];
+if(z instanceof THREE.MeshFaceMaterial){z=0;for(p=C.materials.length;z<p;z++)(o=C.materials[z])&&(o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?q(Q,o):q(G,o))}else{o=z;o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?q(Q,o):q(G,o)}}}function t(l,z){return z.z-l.z}function y(l,z){l._modelViewMatrix.multiplyToArray(z.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function A(l){function z(ka){var ja=
+[];p=0;for(m=ka.length;p<m;p++)ka[p]==undefined?ja.push("undefined"):ja.push(ka[p].id);return ja.join("_")}var p,m,o,B,C,G,Q,H,O={};l.geometryGroups={};o=0;for(B=l.faces.length;o<B;o++){C=l.faces[o];G=C.materials;Q=z(G);O[Q]==undefined&&(O[Q]={hash:Q,counter:0});H=O[Q].hash+"_"+O[Q].counter;l.geometryGroups[H]==undefined&&(l.geometryGroups[H]={faces:[],materials:G,vertices:0});C=C instanceof THREE.Face3?3:4;if(l.geometryGroups[H].vertices+C>65535){O[Q].counter+=1;H=O[Q].hash+"_"+O[Q].counter;l.geometryGroups[H]==
+undefined&&(l.geometryGroups[H]={faces:[],materials:G,vertices:0})}l.geometryGroups[H].faces.push(o);l.geometryGroups[H].vertices+=C}}function E(l,z,p){l.push({buffer:z,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=ba){switch(l){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,
+f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}ba=l}}function F(l,z,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(l,f.TEXTURE_WRAP_S,Z(z.wrapS));f.texParameteri(l,f.TEXTURE_WRAP_T,Z(z.wrapT));f.texParameteri(l,f.TEXTURE_MAG_FILTER,Z(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,Z(z.minFilter));f.generateMipmap(l)}else{f.texParameteri(l,
+f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(l,f.TEXTURE_MAG_FILTER,L(z.magFilter));f.texParameteri(l,f.TEXTURE_MIN_FILTER,L(z.minFilter))}}function w(l){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=f.createFramebuffer();l.__webGLRenderbuffer=f.createRenderbuffer();l.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,l.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,l.width,l.height);f.bindTexture(f.TEXTURE_2D,
+l.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Z(l.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Z(l.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Z(l.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Z(l.minFilter));f.texImage2D(f.TEXTURE_2D,0,Z(l.format),l.width,l.height,0,Z(l.format),Z(l.type),null);f.bindFramebuffer(f.FRAMEBUFFER,l.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,l.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,
+f.DEPTH_ATTACHMENT,f.RENDERBUFFER,l.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var z,p;if(l){z=l.__webGLFramebuffer;p=l.width;l=l.height}else{z=null;p=ha;l=fa}if(z!=T){f.bindFramebuffer(f.FRAMEBUFFER,z);f.viewport(da,ua,p,l);T=z}}function N(l,z){var p;if(l=="fragment")p=f.createShader(f.FRAGMENT_SHADER);else l=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,z);f.compileShader(p);if(!f.getShaderParameter(p,
+f.COMPILE_STATUS)){alert(f.getShaderInfoLog(p));return null}return p}function L(l){switch(l){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}function Z(l){switch(l){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;
 case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;
 case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;
-case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),f,V=null,T=null,ca=this,ea=null,H=null,ba=null,wa=null,da=0,ua=0,ha=0,fa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],xa=new THREE.Matrix4,ga=new Float32Array(16),aa=new Float32Array(16),la=new THREE.Vector4,ma={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},R=!0,ia=new THREE.Color(0),pa=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&ia.setHex(a.clearColor);if(a.clearAlpha!==undefined)pa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!0;(function(m,z,p){try{if(!(f=
-M.getContext("experimental-webgl",{antialias:m})))throw"Error creating WebGL context.";}catch(l){console.error(l)}f.clearColor(0,0,0,1);f.clearDepth(1);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.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,p);_cullEnabled=!0})(R,ia,pa);this.context=f;this.setSize=function(m,z){M.width=m;M.height=z;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(m,
-z,p,l){da=m;ua=z;ha=p;fa=l;f.viewport(da,ua,ha,fa)};this.setScissor=function(m,z,p,l){f.scissor(m,z,p,l)};this.enableScissorTest=function(m){m?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){f.depthMask(m)};this.setClearColorHex=function(m,z){var p=new THREE.Color(m);f.clearColor(p.r,p.g,p.b,z)};this.setClearColor=function(m,z){f.clearColor(m.r,m.g,m.b,z)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(m,
-z,p){var l,o;if(m instanceof THREE.MeshDepthMaterial)b(m,THREE.ShaderLib.depth);else if(m instanceof THREE.MeshNormalMaterial)b(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)b(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)b(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)b(m,THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)b(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&b(m,THREE.ShaderLib.particle_basic);
-var C,B,G,N;o=G=N=0;for(C=z.length;o<C;o++){B=z[o];B instanceof THREE.DirectionalLight&&G++;B instanceof THREE.PointLight&&N++}if(N+G<=4)z=G;else{z=Math.ceil(4*G/(N+G));N=4-z}o={directional:z,point:N};N=m.fragmentShader;z=m.vertexShader;C={fog:p,map:m.map,envMap:m.envMap,lightMap:m.lightMap,vertexColors:m.vertexColors,skinning:m.skinning,maxDirLights:o.directional,maxPointLights:o.point};p=f.createProgram();o=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+C.maxDirLights,
-"#define MAX_POINT_LIGHTS "+C.maxPointLights,C.fog?"#define USE_FOG":"",C.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");C=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,C.map?
-"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"",C.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-f.attachShader(p,O("fragment",o+N));f.attachShader(p,O("vertex",C+z));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};m.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(l in m.uniforms)p.push(l);l=m.program;N=0;for(z=p.length;N<
-z;N++){o=p[N];l.uniforms[o]=f.getUniformLocation(l,o)}l=m.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];N=0;for(z=p.length;N<z;N++){o=p[N];l.attributes[o]=f.getAttribLocation(l,o)}l=m.program.attributes;f.enableVertexAttribArray(l.position);l.color>=0&&f.enableVertexAttribArray(l.color);l.normal>=0&&f.enableVertexAttribArray(l.normal);l.tangent>=0&&f.enableVertexAttribArray(l.tangent);if(m.skinning&&l.skinVertexA>=0&&l.skinVertexB>=
-0&&l.skinIndex>=0&&l.skinWeight>=0){f.enableVertexAttribArray(l.skinVertexA);f.enableVertexAttribArray(l.skinVertexB);f.enableVertexAttribArray(l.skinIndex);f.enableVertexAttribArray(l.skinWeight)}};this.render=function(m,z,p,l){var o,C,B,G,N,L,P,ka,ja=m.lights,qa=m.fog;z.matrixAutoUpdate&&z.update();z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ga);xa.multiply(z.projectionMatrix,z.matrixWorldInverse);k(xa);m.update(undefined,!1,z);this.initWebGLObjects(m);w(p);(this.autoClear||
-l)&&this.clear();N=m.__webglObjects.length;for(l=0;l<N;l++){o=m.__webglObjects[l];P=o.object;if(P.visible)if(!(P instanceof THREE.Mesh)||n(P)){P.matrixWorld.flattenToArray(P._objectMatrixArray);y(P,z);u(o);o.render=!0;if(this.sortObjects){la.copy(P.position);xa.multiplyVector3(la);o.z=la.z}}else o.render=!1;else o.render=!1}this.sortObjects&&m.__webglObjects.sort(t);L=m.__webglObjectsImmediate.length;for(l=0;l<L;l++){o=m.__webglObjectsImmediate[l];P=o.object;if(P.visible){P.matrixAutoUpdate&&P.matrixWorld.flattenToArray(P._objectMatrixArray);
-y(P,z);x(o)}}v(THREE.NormalBlending);for(l=0;l<N;l++){o=m.__webglObjects[l];if(o.render){P=o.object;ka=o.buffer;B=o.opaque;h(P);for(o=0;o<B.count;o++){G=B.list[o];j(G.depthTest);e(z,ja,qa,G,ka,P)}}}for(l=0;l<L;l++){o=m.__webglObjectsImmediate[l];P=o.object;if(P.visible){B=o.opaque;h(P);for(o=0;o<B.count;o++){G=B.list[o];j(G.depthTest);C=d(z,ja,qa,G,P);P.render(function(ra){g(ra,C)})}}}for(l=0;l<N;l++){o=m.__webglObjects[l];if(o.render){P=o.object;ka=o.buffer;B=o.transparent;h(P);for(o=0;o<B.count;o++){G=
-B.list[o];v(G.blending);j(G.depthTest);e(z,ja,qa,G,ka,P)}}}for(l=0;l<L;l++){o=m.__webglObjectsImmediate[l];P=o.object;if(P.visible){B=o.transparent;h(P);for(o=0;o<B.count;o++){G=B.list[o];v(G.blending);j(G.depthTest);C=d(z,ja,qa,G,P);P.render(function(ra){g(ra,C)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=
-[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var z=m.__objectsAdded[0],p=m,l=void 0,o=void 0,C=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){o=z.geometry;o.geometryGroups==undefined&&A(o);for(l in o.geometryGroups){C=o.geometryGroups[l];if(!C.__webGLVertexBuffer){var B=
-C;B.__webGLVertexBuffer=f.createBuffer();B.__webGLNormalBuffer=f.createBuffer();B.__webGLTangentBuffer=f.createBuffer();B.__webGLColorBuffer=f.createBuffer();B.__webGLUVBuffer=f.createBuffer();B.__webGLUV2Buffer=f.createBuffer();B.__webGLSkinVertexABuffer=f.createBuffer();B.__webGLSkinVertexBBuffer=f.createBuffer();B.__webGLSkinIndicesBuffer=f.createBuffer();B.__webGLSkinWeightsBuffer=f.createBuffer();B.__webGLFaceBuffer=f.createBuffer();B.__webGLLineBuffer=f.createBuffer();B=C;var G=z,N=void 0,L=
-void 0,P=0,ka=0,ja=0,qa=G.geometry.faces,ra=B.faces;N=0;for(L=ra.length;N<L;N++){fi=ra[N];face=qa[fi];if(face instanceof THREE.Face3){P+=3;ka+=1;ja+=3}else if(face instanceof THREE.Face4){P+=4;ka+=2;ja+=4}}B.__vertexArray=new Float32Array(P*3);B.__normalArray=new Float32Array(P*3);B.__tangentArray=new Float32Array(P*4);B.__colorArray=new Float32Array(P*3);B.__uvArray=new Float32Array(P*2);B.__uv2Array=new Float32Array(P*2);B.__skinVertexAArray=new Float32Array(P*4);B.__skinVertexBArray=new Float32Array(P*
-4);B.__skinIndexArray=new Float32Array(P*4);B.__skinWeightArray=new Float32Array(P*4);B.__faceArray=new Uint16Array(ka*3);B.__lineArray=new Uint16Array(ja*2);L=N=B;P=void 0;qa=void 0;var na=void 0,oa=void 0;na=void 0;ra=!1;P=0;for(qa=G.materials.length;P<qa;P++){na=G.materials[P];if(na instanceof THREE.MeshFaceMaterial){na=0;for(oa=L.materials.length;na<oa;na++)if(L.materials[na]&&L.materials[na].shading!=undefined&&L.materials[na].shading==THREE.SmoothShading){ra=!0;break}}else if(na&&na.shading!=
-undefined&&na.shading==THREE.SmoothShading){ra=!0;break}if(ra)break}N.__needsSmoothNormals=ra;B.__webGLFaceCount=ka*3;B.__webGLLineCount=ja*2;o.__dirtyVertices=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=!0}E(p.__webglObjects,C,z)}}else if(z instanceof THREE.Ribbon){o=z.geometry;if(!o.__webGLVertexBuffer){l=o;l.__webGLVertexBuffer=f.createBuffer();l.__webGLColorBuffer=f.createBuffer();l=o;C=l.vertices.length;l.__vertexArray=new Float32Array(C*3);
-l.__colorArray=new Float32Array(C*3);l.__webGLVertexCount=C;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else if(z instanceof THREE.Line){o=z.geometry;if(!o.__webGLVertexBuffer){l=o;l.__webGLVertexBuffer=f.createBuffer();l.__webGLColorBuffer=f.createBuffer();l=o;C=l.vertices.length;l.__vertexArray=new Float32Array(C*3);l.__colorArray=new Float32Array(C*3);l.__webGLLineCount=C;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else if(z instanceof THREE.ParticleSystem){o=
-z.geometry;if(!o.__webGLVertexBuffer){l=o;l.__webGLVertexBuffer=f.createBuffer();l.__webGLColorBuffer=f.createBuffer();l=o;C=l.vertices.length;l.__vertexArray=new Float32Array(C*3);l.__colorArray=new Float32Array(C*3);l.__sortArray=[];l.__webGLParticleCount=C;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,
-1)}for(;m.__objectsRemoved.length;){z=m.__objectsRemoved[0];p=m;o=void 0;l=void 0;for(o=p.__webglObjects.length-1;o>=0;o--){l=p.__webglObjects[o].object;z==l&&p.__webglObjects.splice(o,1)}m.__objectsRemoved.splice(0,1)}z=0;for(p=m.__webglObjects.length;z<p;z++){l=m.__webglObjects[z].object;C=void 0;o=void 0;B=void 0;if(l instanceof THREE.Mesh){o=l.geometry;for(C in o.geometryGroups){B=o.geometryGroups[C];if(o.__dirtyVertices||o.__dirtyElements||o.__dirtyUvs||o.__dirtyNormals||o.__dirtyColors||o.__dirtyTangents){ka=
-f.DYNAMIC_DRAW;ja=void 0;N=void 0;var Ia=void 0,Q=void 0,Fa=void 0,Da=void 0,Ea=void 0;Ia=void 0;var W=void 0,X=void 0,$=void 0,za=void 0;W=void 0;X=void 0;$=void 0;Q=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;Q=void 0;Da=void 0;Fa=void 0;Ea=void 0;var Ga=oa=na=ra=qa=P=G=L=0,Ca=0,D=0,Ba=B.__vertexArray,Qa=B.__uvArray,Ta=B.__uv2Array,La=B.__normalArray,
-Aa=B.__tangentArray,I=B.__colorArray,Y=B.__skinVertexAArray,U=B.__skinVertexBArray,J=B.__skinIndexArray,S=B.__skinWeightArray,ta=B.__faceArray,va=B.__lineArray,Ha=B.__needsSmoothNormals,ya=l.geometry,Oa=ya.__dirtyVertices,Ja=ya.__dirtyElements,Ka=ya.__dirtyUvs,Sa=ya.__dirtyNormals,Ma=ya.__dirtyTangents,Pa=ya.__dirtyColors,Na=ya.vertices,Ya=B.faces,Za=ya.faces,$a=ya.uvs,ab=ya.uvs2,Ra=ya.colors,Va=ya.skinVerticesA,Wa=ya.skinVerticesB,Xa=ya.skinIndices,Ua=ya.skinWeights;ja=0;for(N=Ya.length;ja<N;ja++){Ia=
-Ya[ja];Q=Za[Ia];Ea=$a[Ia];Ia=ab[Ia];Fa=Q.vertexNormals;Da=Q.normal;if(Q instanceof THREE.Face3){if(Oa){W=Na[Q.a].position;X=Na[Q.b].position;$=Na[Q.c].position;Ba[G]=W.x;Ba[G+1]=W.y;Ba[G+2]=W.z;Ba[G+3]=X.x;Ba[G+4]=X.y;Ba[G+5]=X.z;Ba[G+6]=$.x;Ba[G+7]=$.y;Ba[G+8]=$.z;G+=9}if(Ua.length){W=Ua[Q.a];X=Ua[Q.b];$=Ua[Q.c];S[D]=W.x;S[D+1]=W.y;S[D+2]=W.z;S[D+3]=W.w;S[D+4]=X.x;S[D+5]=X.y;S[D+6]=X.z;S[D+7]=X.w;S[D+8]=$.x;S[D+9]=$.y;S[D+10]=$.z;S[D+11]=$.w;W=Xa[Q.a];X=Xa[Q.b];$=Xa[Q.c];J[D]=W.x;J[D+1]=W.y;J[D+
-2]=W.z;J[D+3]=W.w;J[D+4]=X.x;J[D+5]=X.y;J[D+6]=X.z;J[D+7]=X.w;J[D+8]=$.x;J[D+9]=$.y;J[D+10]=$.z;J[D+11]=$.w;W=Va[Q.a];X=Va[Q.b];$=Va[Q.c];Y[D]=W.x;Y[D+1]=W.y;Y[D+2]=W.z;Y[D+3]=1;Y[D+4]=X.x;Y[D+5]=X.y;Y[D+6]=X.z;Y[D+7]=1;Y[D+8]=$.x;Y[D+9]=$.y;Y[D+10]=$.z;Y[D+11]=1;W=Wa[Q.a];X=Wa[Q.b];$=Wa[Q.c];U[D]=W.x;U[D+1]=W.y;U[D+2]=W.z;U[D+3]=1;U[D+4]=X.x;U[D+5]=X.y;U[D+6]=X.z;U[D+7]=1;U[D+8]=$.x;U[D+9]=$.y;U[D+10]=$.z;U[D+11]=1;D+=12}if(Pa&&Ra.length){W=Ra[Q.a];X=Ra[Q.b];$=Ra[Q.c];I[Ca]=W.r;I[Ca+1]=W.g;I[Ca+
-2]=W.b;I[Ca+3]=X.r;I[Ca+4]=X.g;I[Ca+5]=X.b;I[Ca+6]=$.r;I[Ca+7]=$.g;I[Ca+8]=$.b;Ca+=9}if(Ma&&ya.hasTangents){W=Na[Q.a].tangent;X=Na[Q.b].tangent;$=Na[Q.c].tangent;Aa[oa]=W.x;Aa[oa+1]=W.y;Aa[oa+2]=W.z;Aa[oa+3]=W.w;Aa[oa+4]=X.x;Aa[oa+5]=X.y;Aa[oa+6]=X.z;Aa[oa+7]=X.w;Aa[oa+8]=$.x;Aa[oa+9]=$.y;Aa[oa+10]=$.z;Aa[oa+11]=$.w;oa+=12}if(Sa)if(Fa.length==3&&Ha)for(Q=0;Q<3;Q++){Da=Fa[Q];La[na]=Da.x;La[na+1]=Da.y;La[na+2]=Da.z;na+=3}else for(Q=0;Q<3;Q++){La[na]=Da.x;La[na+1]=Da.y;La[na+2]=Da.z;na+=3}if(Ka&&Ea)for(Q=
-0;Q<3;Q++){Fa=Ea[Q];Qa[P]=Fa.u;Qa[P+1]=Fa.v;P+=2}if(Ka&&Ia)for(Q=0;Q<3;Q++){Ea=Ia[Q];Ta[qa]=Ea.u;Ta[qa+1]=Ea.v;qa+=2}if(Ja){ta[ra]=L;ta[ra+1]=L+1;ta[ra+2]=L+2;ra+=3;va[Ga]=L;va[Ga+1]=L+1;va[Ga+2]=L;va[Ga+3]=L+2;va[Ga+4]=L+1;va[Ga+5]=L+2;Ga+=6;L+=3}}else if(Q instanceof THREE.Face4){if(Oa){W=Na[Q.a].position;X=Na[Q.b].position;$=Na[Q.c].position;za=Na[Q.d].position;Ba[G]=W.x;Ba[G+1]=W.y;Ba[G+2]=W.z;Ba[G+3]=X.x;Ba[G+4]=X.y;Ba[G+5]=X.z;Ba[G+6]=$.x;Ba[G+7]=$.y;Ba[G+8]=$.z;Ba[G+9]=za.x;Ba[G+10]=za.y;Ba[G+
-11]=za.z;G+=12}if(Ua.length){W=Ua[Q.a];X=Ua[Q.b];$=Ua[Q.c];za=Ua[Q.d];S[D]=W.x;S[D+1]=W.y;S[D+2]=W.z;S[D+3]=W.w;S[D+4]=X.x;S[D+5]=X.y;S[D+6]=X.z;S[D+7]=X.w;S[D+8]=$.x;S[D+9]=$.y;S[D+10]=$.z;S[D+11]=$.w;S[D+12]=za.x;S[D+13]=za.y;S[D+14]=za.z;S[D+15]=za.w;W=Xa[Q.a];X=Xa[Q.b];$=Xa[Q.c];za=Xa[Q.d];J[D]=W.x;J[D+1]=W.y;J[D+2]=W.z;J[D+3]=W.w;J[D+4]=X.x;J[D+5]=X.y;J[D+6]=X.z;J[D+7]=X.w;J[D+8]=$.x;J[D+9]=$.y;J[D+10]=$.z;J[D+11]=$.w;J[D+12]=za.x;J[D+13]=za.y;J[D+14]=za.z;J[D+15]=za.w;W=Va[Q.a];X=Va[Q.b];$=
-Va[Q.c];za=Va[Q.d];Y[D]=W.x;Y[D+1]=W.y;Y[D+2]=W.z;Y[D+3]=1;Y[D+4]=X.x;Y[D+5]=X.y;Y[D+6]=X.z;Y[D+7]=1;Y[D+8]=$.x;Y[D+9]=$.y;Y[D+10]=$.z;Y[D+11]=1;Y[D+12]=za.x;Y[D+13]=za.y;Y[D+14]=za.z;Y[D+15]=1;W=Wa[Q.a];X=Wa[Q.b];$=Wa[Q.c];za=Wa[Q.d];U[D]=W.x;U[D+1]=W.y;U[D+2]=W.z;U[D+3]=1;U[D+4]=X.x;U[D+5]=X.y;U[D+6]=X.z;U[D+7]=1;U[D+8]=$.x;U[D+9]=$.y;U[D+10]=$.z;U[D+11]=1;U[D+12]=za.x;U[D+13]=za.y;U[D+14]=za.z;U[D+15]=1;D+=16}if(Pa&&Ra.length){W=Ra[Q.a];X=Ra[Q.b];$=Ra[Q.c];za=Ra[Q.d];I[Ca]=W.r;I[Ca+1]=W.g;I[Ca+
-2]=W.b;I[Ca+3]=X.r;I[Ca+4]=X.g;I[Ca+5]=X.b;I[Ca+6]=$.r;I[Ca+7]=$.g;I[Ca+8]=$.b;I[Ca+9]=za.r;I[Ca+10]=za.g;I[Ca+11]=za.b;Ca+=12}if(Ma&&ya.hasTangents){W=Na[Q.a].tangent;X=Na[Q.b].tangent;$=Na[Q.c].tangent;Q=Na[Q.d].tangent;Aa[oa]=W.x;Aa[oa+1]=W.y;Aa[oa+2]=W.z;Aa[oa+3]=W.w;Aa[oa+4]=X.x;Aa[oa+5]=X.y;Aa[oa+6]=X.z;Aa[oa+7]=X.w;Aa[oa+8]=$.x;Aa[oa+9]=$.y;Aa[oa+10]=$.z;Aa[oa+11]=$.w;Aa[oa+12]=Q.x;Aa[oa+13]=Q.y;Aa[oa+14]=Q.z;Aa[oa+15]=Q.w;oa+=16}if(Sa)if(Fa.length==4&&Ha)for(Q=0;Q<4;Q++){Da=Fa[Q];La[na]=Da.x;
-La[na+1]=Da.y;La[na+2]=Da.z;na+=3}else for(Q=0;Q<4;Q++){La[na]=Da.x;La[na+1]=Da.y;La[na+2]=Da.z;na+=3}if(Ka&&Ea)for(Q=0;Q<4;Q++){Fa=Ea[Q];Qa[P]=Fa.u;Qa[P+1]=Fa.v;P+=2}if(Ka&&Ia)for(Q=0;Q<4;Q++){Ea=Ia[Q];Ta[qa]=Ea.u;Ta[qa+1]=Ea.v;qa+=2}if(Ja){ta[ra]=L;ta[ra+1]=L+1;ta[ra+2]=L+2;ta[ra+3]=L;ta[ra+4]=L+2;ta[ra+5]=L+3;ra+=6;va[Ga]=L;va[Ga+1]=L+1;va[Ga+2]=L;va[Ga+3]=L+3;va[Ga+4]=L+1;va[Ga+5]=L+2;va[Ga+6]=L+2;va[Ga+7]=L+3;Ga+=8;L+=4}}}if(Oa){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
-Ba,ka)}if(Pa&&Ra.length){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,I,ka)}if(Sa){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,La,ka)}if(Ma&&ya.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Aa,ka)}if(Ka&&P>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Qa,ka)}if(Ka&&qa>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Ta,ka)}if(Ja){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
-B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ta,ka);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,va,ka)}if(D>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Y,ka);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,ka);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,J,ka);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
-S,ka)}}}o.__dirtyVertices=!1;o.__dirtyElements=!1;o.__dirtyUvs=!1;o.__dirtyNormals=!1;o.__dirtyTangents=!1;o.__dirtyColors=!1}else if(l instanceof THREE.Ribbon){o=l.geometry;if(o.__dirtyVertices||o.__dirtyColors){l=o;C=f.DYNAMIC_DRAW;L=void 0;L=void 0;G=void 0;B=void 0;P=l.vertices;ka=l.colors;qa=P.length;ja=ka.length;ra=l.__vertexArray;N=l.__colorArray;na=l.__dirtyColors;if(l.__dirtyVertices){for(L=0;L<qa;L++){G=P[L].position;B=L*3;ra[B]=G.x;ra[B+1]=G.y;ra[B+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);
-f.bufferData(f.ARRAY_BUFFER,ra,C)}if(na){for(L=0;L<ja;L++){color=ka[L];B=L*3;N[B]=color.r;N[B+1]=color.g;N[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,l.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,N,C)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(l instanceof THREE.Line){o=l.geometry;if(o.__dirtyVertices||o.__dirtyColors){l=o;C=f.DYNAMIC_DRAW;L=void 0;L=void 0;G=void 0;B=void 0;P=l.vertices;ka=l.colors;qa=P.length;ja=ka.length;ra=l.__vertexArray;N=l.__colorArray;na=l.__dirtyColors;if(l.__dirtyVertices){for(L=
-0;L<qa;L++){G=P[L].position;B=L*3;ra[B]=G.x;ra[B+1]=G.y;ra[B+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,l.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ra,C)}if(na){for(L=0;L<ja;L++){color=ka[L];B=L*3;N[B]=color.r;N[B+1]=color.g;N[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,l.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,N,C)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(l instanceof THREE.ParticleSystem){o=l.geometry;(o.__dirtyVertices||o.__dirtyColors||l.sortParticles)&&c(o,f.DYNAMIC_DRAW,l);o.__dirtyVertices=
-!1;o.__dirtyColors=!1}}};this.setFaceCulling=function(m,z){if(m){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+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 M=document.createElement("canvas"),f,V=null,T=null,ca=this,ea=null,I=null,ba=null,wa=null,da=0,ua=0,ha=0,fa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],xa=new THREE.Matrix4,ga=new Float32Array(16),aa=new Float32Array(16),la=new THREE.Vector4,ma={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},R=!0,ia=new THREE.Color(0),pa=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&ia.setHex(a.clearColor);if(a.clearAlpha!==undefined)pa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!0;(function(l,z,p){try{if(!(f=
+M.getContext("experimental-webgl",{antialias:l})))throw"Error creating WebGL context.";}catch(m){console.error(m)}f.clearColor(0,0,0,1);f.clearDepth(1);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.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);f.clearColor(z.r,z.g,z.b,p);_cullEnabled=!0})(R,ia,pa);this.context=f;this.setSize=function(l,z){M.width=l;M.height=z;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(l,
+z,p,m){da=l;ua=z;ha=p;fa=m;f.viewport(da,ua,ha,fa)};this.setScissor=function(l,z,p,m){f.scissor(l,z,p,m)};this.enableScissorTest=function(l){l?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(l){f.depthMask(l)};this.setClearColorHex=function(l,z){var p=new THREE.Color(l);f.clearColor(p.r,p.g,p.b,z)};this.setClearColor=function(l,z){f.clearColor(l.r,l.g,l.b,z)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,
+z,p,m){var o;if(l instanceof THREE.MeshDepthMaterial)b(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)b(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)b(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)b(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)b(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)b(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&b(l,THREE.ShaderLib.particle_basic);
+var B,C,G,Q,H;B=Q=H=0;for(C=z.length;B<C;B++){G=z[B];G instanceof THREE.DirectionalLight&&Q++;G instanceof THREE.PointLight&&H++}if(H+Q<=4)z=Q;else{z=Math.ceil(4*Q/(H+Q));H=4-z}z={directional:z,point:H};B=50;if(m!==undefined&&m instanceof THREE.SkinnedMesh)B=m.bones.length;m=l.fragmentShader;H=l.vertexShader;B={fog:p,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,maxDirLights:z.directional,maxPointLights:z.point,maxBones:B};p=f.createProgram();z=["#ifdef GL_ES\nprecision highp float;\n#endif",
+"#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.fog?"#define USE_FOG":"",B.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");B=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+
+B.maxPointLights,"#define MAX_BONES "+B.maxBones,B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+f.attachShader(p,N("fragment",z+m));f.attachShader(p,N("vertex",B+H));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};l.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(o in l.uniforms)p.push(o);o=l.program;m=0;for(H=p.length;m<
+H;m++){z=p[m];o.uniforms[z]=f.getUniformLocation(o,z)}o=l.program;p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];m=0;for(H=p.length;m<H;m++){z=p[m];o.attributes[z]=f.getAttribLocation(o,z)}o=l.program.attributes;f.enableVertexAttribArray(o.position);o.color>=0&&f.enableVertexAttribArray(o.color);o.normal>=0&&f.enableVertexAttribArray(o.normal);o.tangent>=0&&f.enableVertexAttribArray(o.tangent);if(l.skinning&&o.skinVertexA>=0&&o.skinVertexB>=
+0&&o.skinIndex>=0&&o.skinWeight>=0){f.enableVertexAttribArray(o.skinVertexA);f.enableVertexAttribArray(o.skinVertexB);f.enableVertexAttribArray(o.skinIndex);f.enableVertexAttribArray(o.skinWeight)}};this.render=function(l,z,p,m){var o,B,C,G,Q,H,O,ka,ja=l.lights,qa=l.fog;z.matrixAutoUpdate&&z.update();z.matrixWorldInverse.flattenToArray(aa);z.projectionMatrix.flattenToArray(ga);xa.multiply(z.projectionMatrix,z.matrixWorldInverse);k(xa);l.update(undefined,!1,z);this.initWebGLObjects(l);w(p);(this.autoClear||
+m)&&this.clear();Q=l.__webglObjects.length;for(m=0;m<Q;m++){o=l.__webglObjects[m];O=o.object;if(O.visible)if(!(O instanceof THREE.Mesh)||n(O)){O.matrixWorld.flattenToArray(O._objectMatrixArray);y(O,z);u(o);o.render=!0;if(this.sortObjects){la.copy(O.position);xa.multiplyVector3(la);o.z=la.z}}else o.render=!1;else o.render=!1}this.sortObjects&&l.__webglObjects.sort(t);H=l.__webglObjectsImmediate.length;for(m=0;m<H;m++){o=l.__webglObjectsImmediate[m];O=o.object;if(O.visible){O.matrixAutoUpdate&&O.matrixWorld.flattenToArray(O._objectMatrixArray);
+y(O,z);x(o)}}v(THREE.NormalBlending);for(m=0;m<Q;m++){o=l.__webglObjects[m];if(o.render){O=o.object;ka=o.buffer;C=o.opaque;h(O);for(o=0;o<C.count;o++){G=C.list[o];j(G.depthTest);e(z,ja,qa,G,ka,O)}}}for(m=0;m<H;m++){o=l.__webglObjectsImmediate[m];O=o.object;if(O.visible){C=o.opaque;h(O);for(o=0;o<C.count;o++){G=C.list[o];j(G.depthTest);B=d(z,ja,qa,G,O);O.render(function(ra){g(ra,B)})}}}for(m=0;m<Q;m++){o=l.__webglObjects[m];if(o.render){O=o.object;ka=o.buffer;C=o.transparent;h(O);for(o=0;o<C.count;o++){G=
+C.list[o];v(G.blending);j(G.depthTest);e(z,ja,qa,G,ka,O)}}}for(m=0;m<H;m++){o=l.__webglObjectsImmediate[m];O=o.object;if(O.visible){C=o.transparent;h(O);for(o=0;o<C.count;o++){G=C.list[o];v(G.blending);j(G.depthTest);B=d(z,ja,qa,G,O);O.render(function(ra){g(ra,B)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=
+[];l.__webglObjectsImmediate=[]}for(;l.__objectsAdded.length;){var z=l.__objectsAdded[0],p=l,m=void 0,o=void 0,B=void 0;if(z._modelViewMatrix==undefined){z._modelViewMatrix=new THREE.Matrix4;z._normalMatrixArray=new Float32Array(9);z._modelViewMatrixArray=new Float32Array(16);z._objectMatrixArray=new Float32Array(16);z.matrixWorld.flattenToArray(z._objectMatrixArray)}if(z instanceof THREE.Mesh){o=z.geometry;o.geometryGroups==undefined&&A(o);for(m in o.geometryGroups){B=o.geometryGroups[m];if(!B.__webGLVertexBuffer){var C=
+B;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();C=B;var G=z,Q=void 0,H=
+void 0,O=0,ka=0,ja=0,qa=G.geometry.faces,ra=C.faces;Q=0;for(H=ra.length;Q<H;Q++){fi=ra[Q];face=qa[fi];if(face instanceof THREE.Face3){O+=3;ka+=1;ja+=3}else if(face instanceof THREE.Face4){O+=4;ka+=2;ja+=4}}C.__vertexArray=new Float32Array(O*3);C.__normalArray=new Float32Array(O*3);C.__tangentArray=new Float32Array(O*4);C.__colorArray=new Float32Array(O*3);C.__uvArray=new Float32Array(O*2);C.__uv2Array=new Float32Array(O*2);C.__skinVertexAArray=new Float32Array(O*4);C.__skinVertexBArray=new Float32Array(O*
+4);C.__skinIndexArray=new Float32Array(O*4);C.__skinWeightArray=new Float32Array(O*4);C.__faceArray=new Uint16Array(ka*3);C.__lineArray=new Uint16Array(ja*2);H=Q=C;O=void 0;qa=void 0;var na=void 0,oa=void 0;na=void 0;ra=!1;O=0;for(qa=G.materials.length;O<qa;O++){na=G.materials[O];if(na instanceof THREE.MeshFaceMaterial){na=0;for(oa=H.materials.length;na<oa;na++)if(H.materials[na]&&H.materials[na].shading!=undefined&&H.materials[na].shading==THREE.SmoothShading){ra=!0;break}}else if(na&&na.shading!=
+undefined&&na.shading==THREE.SmoothShading){ra=!0;break}if(ra)break}Q.__needsSmoothNormals=ra;C.__webGLFaceCount=ka*3;C.__webGLLineCount=ja*2;o.__dirtyVertices=!0;o.__dirtyElements=!0;o.__dirtyUvs=!0;o.__dirtyNormals=!0;o.__dirtyTangents=!0;o.__dirtyColors=!0}E(p.__webglObjects,B,z)}}else if(z instanceof THREE.Ribbon){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);
+m.__colorArray=new Float32Array(B*3);m.__webGLVertexCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else if(z instanceof THREE.Line){o=z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__webGLLineCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else if(z instanceof THREE.ParticleSystem){o=
+z.geometry;if(!o.__webGLVertexBuffer){m=o;m.__webGLVertexBuffer=f.createBuffer();m.__webGLColorBuffer=f.createBuffer();m=o;B=m.vertices.length;m.__vertexArray=new Float32Array(B*3);m.__colorArray=new Float32Array(B*3);m.__sortArray=[];m.__webGLParticleCount=B;o.__dirtyVertices=!0;o.__dirtyColors=!0}E(p.__webglObjects,o,z)}else THREE.MarchingCubes!==undefined&&z instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,
+1)}for(;l.__objectsRemoved.length;){z=l.__objectsRemoved[0];p=l;o=void 0;m=void 0;for(o=p.__webglObjects.length-1;o>=0;o--){m=p.__webglObjects[o].object;z==m&&p.__webglObjects.splice(o,1)}l.__objectsRemoved.splice(0,1)}z=0;for(p=l.__webglObjects.length;z<p;z++){m=l.__webglObjects[z].object;B=void 0;o=void 0;C=void 0;if(m instanceof THREE.Mesh){o=m.geometry;for(B in o.geometryGroups){C=o.geometryGroups[B];if(o.__dirtyVertices||o.__dirtyElements||o.__dirtyUvs||o.__dirtyNormals||o.__dirtyColors||o.__dirtyTangents){ka=
+f.DYNAMIC_DRAW;ja=void 0;Q=void 0;var Ia=void 0,P=void 0,Fa=void 0,Da=void 0,Ea=void 0;Ia=void 0;var W=void 0,X=void 0,$=void 0,za=void 0;W=void 0;X=void 0;$=void 0;P=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;W=void 0;X=void 0;$=void 0;za=void 0;P=void 0;Da=void 0;Fa=void 0;Ea=void 0;var Ga=oa=na=ra=qa=O=G=H=0,Ca=0,D=0,Ba=C.__vertexArray,Qa=C.__uvArray,Ta=C.__uv2Array,La=C.__normalArray,
+Aa=C.__tangentArray,J=C.__colorArray,Y=C.__skinVertexAArray,U=C.__skinVertexBArray,K=C.__skinIndexArray,S=C.__skinWeightArray,ta=C.__faceArray,va=C.__lineArray,Ha=C.__needsSmoothNormals,ya=m.geometry,Oa=ya.__dirtyVertices,Ja=ya.__dirtyElements,Ka=ya.__dirtyUvs,Sa=ya.__dirtyNormals,Ma=ya.__dirtyTangents,Pa=ya.__dirtyColors,Na=ya.vertices,Ya=C.faces,Za=ya.faces,$a=ya.uvs,ab=ya.uvs2,Ra=ya.colors,Va=ya.skinVerticesA,Wa=ya.skinVerticesB,Xa=ya.skinIndices,Ua=ya.skinWeights;ja=0;for(Q=Ya.length;ja<Q;ja++){Ia=
+Ya[ja];P=Za[Ia];Ea=$a[Ia];Ia=ab[Ia];Fa=P.vertexNormals;Da=P.normal;if(P instanceof THREE.Face3){if(Oa){W=Na[P.a].position;X=Na[P.b].position;$=Na[P.c].position;Ba[G]=W.x;Ba[G+1]=W.y;Ba[G+2]=W.z;Ba[G+3]=X.x;Ba[G+4]=X.y;Ba[G+5]=X.z;Ba[G+6]=$.x;Ba[G+7]=$.y;Ba[G+8]=$.z;G+=9}if(Ua.length){W=Ua[P.a];X=Ua[P.b];$=Ua[P.c];S[D]=W.x;S[D+1]=W.y;S[D+2]=W.z;S[D+3]=W.w;S[D+4]=X.x;S[D+5]=X.y;S[D+6]=X.z;S[D+7]=X.w;S[D+8]=$.x;S[D+9]=$.y;S[D+10]=$.z;S[D+11]=$.w;W=Xa[P.a];X=Xa[P.b];$=Xa[P.c];K[D]=W.x;K[D+1]=W.y;K[D+
+2]=W.z;K[D+3]=W.w;K[D+4]=X.x;K[D+5]=X.y;K[D+6]=X.z;K[D+7]=X.w;K[D+8]=$.x;K[D+9]=$.y;K[D+10]=$.z;K[D+11]=$.w;W=Va[P.a];X=Va[P.b];$=Va[P.c];Y[D]=W.x;Y[D+1]=W.y;Y[D+2]=W.z;Y[D+3]=1;Y[D+4]=X.x;Y[D+5]=X.y;Y[D+6]=X.z;Y[D+7]=1;Y[D+8]=$.x;Y[D+9]=$.y;Y[D+10]=$.z;Y[D+11]=1;W=Wa[P.a];X=Wa[P.b];$=Wa[P.c];U[D]=W.x;U[D+1]=W.y;U[D+2]=W.z;U[D+3]=1;U[D+4]=X.x;U[D+5]=X.y;U[D+6]=X.z;U[D+7]=1;U[D+8]=$.x;U[D+9]=$.y;U[D+10]=$.z;U[D+11]=1;D+=12}if(Pa&&Ra.length){W=Ra[P.a];X=Ra[P.b];$=Ra[P.c];J[Ca]=W.r;J[Ca+1]=W.g;J[Ca+
+2]=W.b;J[Ca+3]=X.r;J[Ca+4]=X.g;J[Ca+5]=X.b;J[Ca+6]=$.r;J[Ca+7]=$.g;J[Ca+8]=$.b;Ca+=9}if(Ma&&ya.hasTangents){W=Na[P.a].tangent;X=Na[P.b].tangent;$=Na[P.c].tangent;Aa[oa]=W.x;Aa[oa+1]=W.y;Aa[oa+2]=W.z;Aa[oa+3]=W.w;Aa[oa+4]=X.x;Aa[oa+5]=X.y;Aa[oa+6]=X.z;Aa[oa+7]=X.w;Aa[oa+8]=$.x;Aa[oa+9]=$.y;Aa[oa+10]=$.z;Aa[oa+11]=$.w;oa+=12}if(Sa)if(Fa.length==3&&Ha)for(P=0;P<3;P++){Da=Fa[P];La[na]=Da.x;La[na+1]=Da.y;La[na+2]=Da.z;na+=3}else for(P=0;P<3;P++){La[na]=Da.x;La[na+1]=Da.y;La[na+2]=Da.z;na+=3}if(Ka&&Ea)for(P=
+0;P<3;P++){Fa=Ea[P];Qa[O]=Fa.u;Qa[O+1]=Fa.v;O+=2}if(Ka&&Ia)for(P=0;P<3;P++){Ea=Ia[P];Ta[qa]=Ea.u;Ta[qa+1]=Ea.v;qa+=2}if(Ja){ta[ra]=H;ta[ra+1]=H+1;ta[ra+2]=H+2;ra+=3;va[Ga]=H;va[Ga+1]=H+1;va[Ga+2]=H;va[Ga+3]=H+2;va[Ga+4]=H+1;va[Ga+5]=H+2;Ga+=6;H+=3}}else if(P instanceof THREE.Face4){if(Oa){W=Na[P.a].position;X=Na[P.b].position;$=Na[P.c].position;za=Na[P.d].position;Ba[G]=W.x;Ba[G+1]=W.y;Ba[G+2]=W.z;Ba[G+3]=X.x;Ba[G+4]=X.y;Ba[G+5]=X.z;Ba[G+6]=$.x;Ba[G+7]=$.y;Ba[G+8]=$.z;Ba[G+9]=za.x;Ba[G+10]=za.y;Ba[G+
+11]=za.z;G+=12}if(Ua.length){W=Ua[P.a];X=Ua[P.b];$=Ua[P.c];za=Ua[P.d];S[D]=W.x;S[D+1]=W.y;S[D+2]=W.z;S[D+3]=W.w;S[D+4]=X.x;S[D+5]=X.y;S[D+6]=X.z;S[D+7]=X.w;S[D+8]=$.x;S[D+9]=$.y;S[D+10]=$.z;S[D+11]=$.w;S[D+12]=za.x;S[D+13]=za.y;S[D+14]=za.z;S[D+15]=za.w;W=Xa[P.a];X=Xa[P.b];$=Xa[P.c];za=Xa[P.d];K[D]=W.x;K[D+1]=W.y;K[D+2]=W.z;K[D+3]=W.w;K[D+4]=X.x;K[D+5]=X.y;K[D+6]=X.z;K[D+7]=X.w;K[D+8]=$.x;K[D+9]=$.y;K[D+10]=$.z;K[D+11]=$.w;K[D+12]=za.x;K[D+13]=za.y;K[D+14]=za.z;K[D+15]=za.w;W=Va[P.a];X=Va[P.b];$=
+Va[P.c];za=Va[P.d];Y[D]=W.x;Y[D+1]=W.y;Y[D+2]=W.z;Y[D+3]=1;Y[D+4]=X.x;Y[D+5]=X.y;Y[D+6]=X.z;Y[D+7]=1;Y[D+8]=$.x;Y[D+9]=$.y;Y[D+10]=$.z;Y[D+11]=1;Y[D+12]=za.x;Y[D+13]=za.y;Y[D+14]=za.z;Y[D+15]=1;W=Wa[P.a];X=Wa[P.b];$=Wa[P.c];za=Wa[P.d];U[D]=W.x;U[D+1]=W.y;U[D+2]=W.z;U[D+3]=1;U[D+4]=X.x;U[D+5]=X.y;U[D+6]=X.z;U[D+7]=1;U[D+8]=$.x;U[D+9]=$.y;U[D+10]=$.z;U[D+11]=1;U[D+12]=za.x;U[D+13]=za.y;U[D+14]=za.z;U[D+15]=1;D+=16}if(Pa&&Ra.length){W=Ra[P.a];X=Ra[P.b];$=Ra[P.c];za=Ra[P.d];J[Ca]=W.r;J[Ca+1]=W.g;J[Ca+
+2]=W.b;J[Ca+3]=X.r;J[Ca+4]=X.g;J[Ca+5]=X.b;J[Ca+6]=$.r;J[Ca+7]=$.g;J[Ca+8]=$.b;J[Ca+9]=za.r;J[Ca+10]=za.g;J[Ca+11]=za.b;Ca+=12}if(Ma&&ya.hasTangents){W=Na[P.a].tangent;X=Na[P.b].tangent;$=Na[P.c].tangent;P=Na[P.d].tangent;Aa[oa]=W.x;Aa[oa+1]=W.y;Aa[oa+2]=W.z;Aa[oa+3]=W.w;Aa[oa+4]=X.x;Aa[oa+5]=X.y;Aa[oa+6]=X.z;Aa[oa+7]=X.w;Aa[oa+8]=$.x;Aa[oa+9]=$.y;Aa[oa+10]=$.z;Aa[oa+11]=$.w;Aa[oa+12]=P.x;Aa[oa+13]=P.y;Aa[oa+14]=P.z;Aa[oa+15]=P.w;oa+=16}if(Sa)if(Fa.length==4&&Ha)for(P=0;P<4;P++){Da=Fa[P];La[na]=Da.x;
+La[na+1]=Da.y;La[na+2]=Da.z;na+=3}else for(P=0;P<4;P++){La[na]=Da.x;La[na+1]=Da.y;La[na+2]=Da.z;na+=3}if(Ka&&Ea)for(P=0;P<4;P++){Fa=Ea[P];Qa[O]=Fa.u;Qa[O+1]=Fa.v;O+=2}if(Ka&&Ia)for(P=0;P<4;P++){Ea=Ia[P];Ta[qa]=Ea.u;Ta[qa+1]=Ea.v;qa+=2}if(Ja){ta[ra]=H;ta[ra+1]=H+1;ta[ra+2]=H+2;ta[ra+3]=H;ta[ra+4]=H+2;ta[ra+5]=H+3;ra+=6;va[Ga]=H;va[Ga+1]=H+1;va[Ga+2]=H;va[Ga+3]=H+3;va[Ga+4]=H+1;va[Ga+5]=H+2;va[Ga+6]=H+2;va[Ga+7]=H+3;Ga+=8;H+=4}}}if(Oa){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
+Ba,ka)}if(Pa&&Ra.length){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,J,ka)}if(Sa){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,La,ka)}if(Ma&&ya.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Aa,ka)}if(Ka&&O>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Qa,ka)}if(Ka&&qa>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Ta,ka)}if(Ja){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
+C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ta,ka);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,va,ka)}if(D>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Y,ka);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,U,ka);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,K,ka);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
+S,ka)}}}o.__dirtyVertices=!1;o.__dirtyElements=!1;o.__dirtyUvs=!1;o.__dirtyNormals=!1;o.__dirtyTangents=!1;o.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){o=m.geometry;if(o.__dirtyVertices||o.__dirtyColors){m=o;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=m.vertices;ka=m.colors;qa=O.length;ja=ka.length;ra=m.__vertexArray;Q=m.__colorArray;na=m.__dirtyColors;if(m.__dirtyVertices){for(H=0;H<qa;H++){G=O[H].position;C=H*3;ra[C]=G.x;ra[C+1]=G.y;ra[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);
+f.bufferData(f.ARRAY_BUFFER,ra,B)}if(na){for(H=0;H<ja;H++){color=ka[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(m instanceof THREE.Line){o=m.geometry;if(o.__dirtyVertices||o.__dirtyColors){m=o;B=f.DYNAMIC_DRAW;H=void 0;H=void 0;G=void 0;C=void 0;O=m.vertices;ka=m.colors;qa=O.length;ja=ka.length;ra=m.__vertexArray;Q=m.__colorArray;na=m.__dirtyColors;if(m.__dirtyVertices){for(H=
+0;H<qa;H++){G=O[H].position;C=H*3;ra[C]=G.x;ra[C+1]=G.y;ra[C+2]=G.z}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ra,B)}if(na){for(H=0;H<ja;H++){color=ka[H];C=H*3;Q[C]=color.r;Q[C+1]=color.g;Q[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Q,B)}}o.__dirtyVertices=!1;o.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){o=m.geometry;(o.__dirtyVertices||o.__dirtyColors||m.sortParticles)&&c(o,f.DYNAMIC_DRAW,m);o.__dirtyVertices=
+!1;o.__dirtyColors=!1}}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(l=="back")f.cullFace(f.BACK);else l=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 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",
@@ -261,7 +261,7 @@ map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D(
 lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
 lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
-color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
+color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
 value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
 value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
 THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
 THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
@@ -280,15 +280,15 @@ THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3
 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.Vertex;this.v2=new THREE.Vertex;this.materials=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.Vertex;this.v2=new THREE.Vertex;this.materials=null};
 var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,n=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var q=0,x=h.length;q<x;q++){var u=new THREE.Vertex(h[q].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}q=0;for(x=k.length;q<x;q++){h=k[q];var t,y=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
 var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,n=a.uvs;e=e.uvs;b&&c.matrixAutoUpdate&&c.updateMatrix();for(var q=0,x=h.length;q<x;q++){var u=new THREE.Vertex(h[q].position.clone());b&&c.matrix.multiplyVector3(u.position);g.push(u)}q=0;for(x=k.length;q<x;q++){h=k[q];var t,y=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
 d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);b=0;for(g=y.length;b<g;b++){u=y[b];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();j.push(t)}q=0;for(x=e.length;q<x;q++){d=e[q];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));n.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
 d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);b=0;for(g=y.length;b<g;b++){u=y[b];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();j.push(t)}q=0;for(x=e.length;q<x;q++){d=e[q];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));n.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,
-c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(q in M.objects)if(!H.objects[q]){A=M.objects[q];if(w=H.geometries[A.geometry]){Z=[];for(i=0;i<A.materials.length;i++)Z[i]=H.materials[A.materials[i]];E=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(w,Z);object.position.set(E[0],
-E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;H.scene.addObject(object);H.objects[q]=object}}}function h(ba){return function(wa){H.geometries[ba]=wa;g();V-=1;j()}}function j(){d({total_models:ca,total_textures:ea,loaded_models:ca-V,loaded_textures:ea-T},H);V==0&&T==0&&b(H)}var k,n,q,x,u,t,y,A,E,v,F,w,O,K,Z,M,f,V,T,ca,ea,H;M=e.data;f=new THREE.Loader;T=V=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
-lights:{},fogs:{}};e=function(){T-=1;j()};for(u in M.cameras){v=M.cameras[u];if(v.type=="perspective")O=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){O=new THREE.Camera;O.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}E=v.position;v=v.target;O.position.set(E[0],E[1],E[2]);O.target.position.set(v[0],v[1],v[2]);H.cameras[u]=O}for(x in M.lights){u=M.lights[x];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
-E[1],E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);H.scene.addLight(light);H.lights[x]=light}for(t in M.fogs){x=M.fogs[t];if(x.type=="linear")K=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(K=new THREE.FogExp2(0,x.density));v=x.color;K.color.setRGB(v[0],v[1],v[2]);H.fogs[t]=K}if(H.cameras&&M.defaults.camera)H.currentCamera=H.cameras[M.defaults.camera];
-if(H.fogs&&M.defaults.fog)H.scene.fog=H.fogs[M.defaults.fog];v=M.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(v[0],v[1],v[2]);H.bgColorAlpha=M.defaults.bgalpha;for(k in M.geometries){t=M.geometries[k];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}ca=V;for(k in M.geometries){t=M.geometries[k];if(t.type=="cube"){w=new Cube(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides);H.geometries[k]=w}else if(t.type=="plane"){w=new Plane(t.width,
-t.height,t.segmentsWidth,t.segmentsHeight);H.geometries[k]=w}else if(t.type=="sphere"){w=new Sphere(t.radius,t.segmentsWidth,t.segmentsHeight);H.geometries[k]=w}else if(t.type=="cylinder"){w=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);H.geometries[k]=w}else if(t.type=="torus"){w=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);H.geometries[k]=w}else if(t.type=="icosahedron"){w=new Icosahedron(t.subdivisions);H.geometries[k]=w}else if(t.type=="bin_mesh")f.loadBinary({model:t.url,
+c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(q in M.objects)if(!I.objects[q]){A=M.objects[q];if(w=I.geometries[A.geometry]){Z=[];for(i=0;i<A.materials.length;i++)Z[i]=I.materials[A.materials[i]];E=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(w,Z);object.position.set(E[0],
+E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;I.scene.addObject(object);I.objects[q]=object}}}function h(ba){return function(wa){I.geometries[ba]=wa;g();V-=1;j()}}function j(){d({total_models:ca,total_textures:ea,loaded_models:ca-V,loaded_textures:ea-T},I);V==0&&T==0&&b(I)}var k,n,q,x,u,t,y,A,E,v,F,w,N,L,Z,M,f,V,T,ca,ea,I;M=e.data;f=new THREE.Loader;T=V=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
+lights:{},fogs:{}};e=function(){T-=1;j()};for(u in M.cameras){v=M.cameras[u];if(v.type=="perspective")N=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){N=new THREE.Camera;N.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}E=v.position;v=v.target;N.position.set(E[0],E[1],E[2]);N.target.position.set(v[0],v[1],v[2]);I.cameras[u]=N}for(x in M.lights){u=M.lights[x];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
+E[1],E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);I.scene.addLight(light);I.lights[x]=light}for(t in M.fogs){x=M.fogs[t];if(x.type=="linear")L=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(L=new THREE.FogExp2(0,x.density));v=x.color;L.color.setRGB(v[0],v[1],v[2]);I.fogs[t]=L}if(I.cameras&&M.defaults.camera)I.currentCamera=I.cameras[M.defaults.camera];
+if(I.fogs&&M.defaults.fog)I.scene.fog=I.fogs[M.defaults.fog];v=M.defaults.bgcolor;I.bgColor=new THREE.Color;I.bgColor.setRGB(v[0],v[1],v[2]);I.bgColorAlpha=M.defaults.bgalpha;for(k in M.geometries){t=M.geometries[k];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}ca=V;for(k in M.geometries){t=M.geometries[k];if(t.type=="cube"){w=new Cube(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides);I.geometries[k]=w}else if(t.type=="plane"){w=new Plane(t.width,
+t.height,t.segmentsWidth,t.segmentsHeight);I.geometries[k]=w}else if(t.type=="sphere"){w=new Sphere(t.radius,t.segmentsWidth,t.segmentsHeight);I.geometries[k]=w}else if(t.type=="cylinder"){w=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);I.geometries[k]=w}else if(t.type=="torus"){w=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);I.geometries[k]=w}else if(t.type=="icosahedron"){w=new Icosahedron(t.subdivisions);I.geometries[k]=w}else if(t.type=="bin_mesh")f.loadBinary({model:t.url,
 callback:h(k)});else t.type=="ascii_mesh"&&f.loadAscii({model:t.url,callback:h(k)})}for(y in M.textures){k=M.textures[y];T+=k.url instanceof Array?k.url.length:1}ea=T;for(y in M.textures){k=M.textures[y];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)t=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{t=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)t.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)t.magFilter=
 callback:h(k)});else t.type=="ascii_mesh"&&f.loadAscii({model:t.url,callback:h(k)})}for(y in M.textures){k=M.textures[y];T+=k.url instanceof Array?k.url.length:1}ea=T;for(y in M.textures){k=M.textures[y];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)t=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{t=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=undefined)t.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)t.magFilter=
-THREE[k.magFilter]}H.textures[y]=t}for(n in M.materials){y=M.materials[n];for(F in y.parameters)if(F=="envMap"||F=="map"||F=="lightMap")y.parameters[F]=H.textures[y.parameters[F]];else if(F=="shading")y.parameters[F]=y.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")y.parameters[F]=THREE[y.parameters[F]]?THREE[y.parameters[F]]:THREE.NormalBlending;else F=="combine"&&(y.parameters[F]=y.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);y=new THREE[y.type](y.parameters);
-H.materials[n]=y}g();c(H)}},addMesh:function(a,c,b,d,e,g,h,j,k,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
+THREE[k.magFilter]}I.textures[y]=t}for(n in M.materials){y=M.materials[n];for(F in y.parameters)if(F=="envMap"||F=="map"||F=="lightMap")y.parameters[F]=I.textures[y.parameters[F]];else if(F=="shading")y.parameters[F]=y.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")y.parameters[F]=THREE[y.parameters[F]]?THREE[y.parameters[F]]:THREE.NormalBlending;else F=="combine"&&(y.parameters[F]=y.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);y=new THREE[y.type](y.parameters);
+I.materials[n]=y}g();c(I)}},addMesh:function(a,c,b,d,e,g,h,j,k,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
 return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);
 return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);
 a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
 a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
 SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))}},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}",
 SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))}},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}",
@@ -300,11 +300,11 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}},Cube=function(a,c,b,d,e,g,h,j,k){function n(E,v,F,w,O,K,Z,M){var f,V,T=d||1,ca=e||1,ea=O/2,H=K/2,ba=q.vertices.length;if(E=="x"&&v=="y"||E=="y"&&v=="x")f="z";else if(E=="x"&&v=="z"||E=="z"&&v=="x"){f="y";ca=g||1}else if(E=="z"&&
-v=="y"||E=="y"&&v=="z"){f="x";T=g||1}var wa=T+1,da=ca+1;O/=T;var ua=K/ca;for(V=0;V<da;V++)for(K=0;K<wa;K++){var ha=new THREE.Vector3;ha[E]=(K*O-ea)*F;ha[v]=(V*ua-H)*w;ha[f]=Z;q.vertices.push(new THREE.Vertex(ha))}for(V=0;V<ca;V++)for(K=0;K<T;K++){q.faces.push(new THREE.Face4(K+wa*V+ba,K+wa*(V+1)+ba,K+1+wa*(V+1)+ba,K+1+wa*V+ba,null,M));q.uvs.push([new THREE.UV(K/T,V/ca),new THREE.UV(K/T,(V+1)/ca),new THREE.UV((K+1)/T,(V+1)/ca),new THREE.UV((K+1)/T,V/ca)])}}THREE.Geometry.call(this);var q=this,x=a/
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}},Cube=function(a,c,b,d,e,g,h,j,k){function n(E,v,F,w,N,L,Z,M){var f,V,T=d||1,ca=e||1,ea=N/2,I=L/2,ba=q.vertices.length;if(E=="x"&&v=="y"||E=="y"&&v=="x")f="z";else if(E=="x"&&v=="z"||E=="z"&&v=="x"){f="y";ca=g||1}else if(E=="z"&&
+v=="y"||E=="y"&&v=="z"){f="x";T=g||1}var wa=T+1,da=ca+1;N/=T;var ua=L/ca;for(V=0;V<da;V++)for(L=0;L<wa;L++){var ha=new THREE.Vector3;ha[E]=(L*N-ea)*F;ha[v]=(V*ua-I)*w;ha[f]=Z;q.vertices.push(new THREE.Vertex(ha))}for(V=0;V<ca;V++)for(L=0;L<T;L++){q.faces.push(new THREE.Face4(L+wa*V+ba,L+wa*(V+1)+ba,L+1+wa*(V+1)+ba,L+1+wa*V+ba,null,M));q.uvs.push([new THREE.UV(L/T,V/ca),new THREE.UV(L/T,(V+1)/ca),new THREE.UV((L+1)/T,(V+1)/ca),new THREE.UV((L+1)/T,V/ca)])}}THREE.Geometry.call(this);var q=this,x=a/
 2,u=c/2,t=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=k[A]);this.sides.px&&n("z","y",1*j,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*j,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&n("x","z",1*j,-1,
 2,u=c/2,t=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=k[A]);this.sides.px&&n("z","y",1*j,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*j,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*j,1,a,b,u,this.materials[2]);this.sides.ny&&n("x","z",1*j,-1,
-a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*j,-1,a,c,t,this.materials[4]);this.sides.nz&&n("x","y",-1*j,-1,a,c,-t,this.materials[5]);(function(){for(var E=[],v=[],F=0,w=q.vertices.length;F<w;F++){for(var O=q.vertices[F],K=!1,Z=0,M=E.length;Z<M;Z++){var f=E[Z];if(O.position.x==f.position.x&&O.position.y==f.position.y&&O.position.z==f.position.z){v[F]=Z;K=!0;break}}if(!K){v[F]=E.length;E.push(new THREE.Vertex(O.position.clone()))}}F=0;for(w=q.faces.length;F<w;F++){O=q.faces[F];O.a=v[O.a];O.b=
-v[O.b];O.c=v[O.c];O.d=v[O.d]}q.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+a,b,-u,this.materials[3]);this.sides.pz&&n("x","y",1*j,-1,a,c,t,this.materials[4]);this.sides.nz&&n("x","y",-1*j,-1,a,c,-t,this.materials[5]);(function(){for(var E=[],v=[],F=0,w=q.vertices.length;F<w;F++){for(var N=q.vertices[F],L=!1,Z=0,M=E.length;Z<M;Z++){var f=E[Z];if(N.position.x==f.position.x&&N.position.y==f.position.y&&N.position.z==f.position.z){v[F]=Z;L=!0;break}}if(!L){v[F]=E.length;E.push(new THREE.Vertex(N.position.clone()))}}F=0;for(w=q.faces.length;F<w;F++){N=q.faces[F];N.a=v[N.a];N.b=
+v[N.b];N.c=v[N.c];N.d=v[N.d]}q.vertices=E})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 var Cylinder=function(a,c,b,d,e){function g(n,q,x){h.vertices.push(new THREE.Vertex(new THREE.Vector3(n,q,x)))}THREE.Geometry.call(this);var h=this,j=Math.PI,k;for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*b,Math.cos(2*j*k/a)*b,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b!=0){g(0,0,-e);for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(c!=0){g(0,0,d+e);for(k=a+a/2;k<
 var Cylinder=function(a,c,b,d,e){function g(n,q,x){h.vertices.push(new THREE.Vertex(new THREE.Vector3(n,q,x)))}THREE.Geometry.call(this);var h=this,j=Math.PI,k;for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*b,Math.cos(2*j*k/a)*b,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b!=0){g(0,0,-e);for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(c!=0){g(0,0,d+e);for(k=a+a/2;k<
 2*a;k++)h.faces.push(new THREE.Face4((2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 2*a;k++)h.faces.push(new THREE.Face4((2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var n=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*n-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
 var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var n=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*n-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.uvs.push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
@@ -323,9 +323,9 @@ if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,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=
 THREE.MarchingCubes=function(a,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.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=n;e[g]=this.lerp(q[b],q[b+3],h);e[g+1]=this.lerp(q[b+1],q[b+4],h);e[g+2]=this.lerp(q[b+2],q[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=n;e[g]=this.lerp(q[b],q[b+3],h);e[g+1]=this.lerp(q[b+1],q[b+4],h);e[g+2]=this.lerp(q[b+2],q[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
 2]=n;d=b+this.yd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=n+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
 2]=n;d=b+this.yd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=n+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(q[b],q[d],h);e[g+1]=this.lerp(q[b+1],q[d+1],h);e[g+2]=this.lerp(q[b+2],q[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,n=g+this.yd,q=g+this.zd,x=k+this.yd,u=k+this.zd,t=g+this.yd+this.zd,y=k+this.yd+this.zd,A=0,E=this.field[g],v=this.field[k],F=this.field[n],w=this.field[x],O=this.field[q],K=this.field[u],Z=this.field[t],M=this.field[y];E<h&&(A|=1);v<h&&(A|=2);F<h&&(A|=8);w<h&&(A|=4);O<h&&(A|=16);K<h&&(A|=32);Z<h&&(A|=128);M<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,n=g+this.yd,q=g+this.zd,x=k+this.yd,u=k+this.zd,t=g+this.yd+this.zd,y=k+this.yd+this.zd,A=0,E=this.field[g],v=this.field[k],F=this.field[n],w=this.field[x],N=this.field[q],L=this.field[u],Z=this.field[t],M=this.field[y];E<h&&(A|=1);v<h&&(A|=2);F<h&&(A|=8);w<h&&(A|=4);N<h&&(A|=16);L<h&&(A|=32);Z<h&&(A|=128);M<h&&(A|=64);var f=THREE.edgeTable[A];if(f==0)return 0;
 var V=this.delta,T=b+V,ca=d+V;V=e+V;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,E,v)}if(f&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,T,d,e,v,w)}if(f&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,ca,e,F,w)}if(f&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,E,F)}if(f&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
 var V=this.delta,T=b+V,ca=d+V;V=e+V;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,E,v)}if(f&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,T,d,e,v,w)}if(f&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,ca,e,F,w)}if(f&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,E,F)}if(f&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
-V,O,K)}if(f&32){this.compNorm(u);this.compNorm(y);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,V,K,M)}if(f&64){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,18,h,b,ca,V,Z,M)}if(f&128){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,V,O,Z)}if(f&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,E,O)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,T,d,e,v,K)}if(f&1024){this.compNorm(x);
+V,N,L)}if(f&32){this.compNorm(u);this.compNorm(y);this.VIntY(u*3,this.vlist,this.nlist,15,h,T,d,V,L,M)}if(f&64){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,18,h,b,ca,V,Z,M)}if(f&128){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,V,N,Z)}if(f&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,E,N)}if(f&512){this.compNorm(k);this.compNorm(u);this.VIntZ(k*3,this.vlist,this.nlist,27,h,T,d,e,v,L)}if(f&1024){this.compNorm(x);
 this.compNorm(y);this.VIntZ(x*3,this.vlist,this.nlist,30,h,T,ca,e,w,M)}if(f&2048){this.compNorm(n);this.compNorm(t);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,ca,e,F,Z)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
 this.compNorm(y);this.VIntZ(x*3,this.vlist,this.nlist,30,h,T,ca,e,w,M)}if(f&2048){this.compNorm(n);this.compNorm(t);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,ca,e,F,Z)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){b=A+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+2]=b[e+2];this.positionArray[k+
 3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
 3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
 function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,n=d*this.size,q=b*this.size,x=Math.floor(k-j);x<1&&(x=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(n-j);u<1&&(u=1);n=Math.floor(n+j);n>this.size-1&&(n=this.size-1);var t=Math.floor(q-j);t<1&&(t=1);j=Math.floor(q+j);
 function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,n=d*this.size,q=b*this.size,x=Math.floor(k-j);x<1&&(x=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var u=Math.floor(n-j);u<1&&(u=1);n=Math.floor(n+j);n>this.size-1&&(n=this.size-1);var t=Math.floor(q-j);t<1&&(t=1);j=Math.floor(q+j);
@@ -362,20 +362,20 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
 c},loadAsciiOld:function(a,c){var b=document.createElement("script");b.type="text/javascript";b.onload=c;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.Loader.prototype.createModel(e.data,b,d)};c.postMessage(a)},loadBinary:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:
 c},loadAsciiOld:function(a,c){var b=document.createElement("script");b.type="text/javascript";b.onload=c;b.src=a;document.getElementsByTagName("head")[0].appendChild(b)},loadAscii:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.Loader.prototype.createModel(e.data,b,d)};c.postMessage(a)},loadBinary:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:
 THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;
 THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,c,b,d){var e=function(g){function h(p,l){var o=q(p,l),C=q(p,l+1),B=q(p,l+2),G=q(p,l+3),N=(G<<1&255|B>>7)-127;o|=(B&127)<<16|C<<8;if(o==0&&N==-127)return 0;return(1-2*(G>>7))*(1+o*Math.pow(2,-23))*Math.pow(2,N)}function j(p,l){var o=q(p,l),C=q(p,l+1),B=q(p,l+2);return(q(p,l+3)<<24)+(B<<16)+(C<<8)+o}function k(p,l){var o=q(p,l);return(q(p,l+1)<<8)+o}function n(p,l){var o=q(p,l);return o>127?o-256:o}function q(p,l){return p.charCodeAt(l)&255}function x(p){var l,o,C;l=j(a,p);
-o=j(a,p+Z);C=j(a,p+M);p=k(a,p+f);THREE.Loader.prototype.f3(v,l,o,C,p)}function u(p){var l,o,C,B,G,N;l=j(a,p);o=j(a,p+Z);C=j(a,p+M);B=k(a,p+f);G=j(a,p+V);N=j(a,p+T);p=j(a,p+ca);THREE.Loader.prototype.f3n(v,O,l,o,C,B,G,N,p)}function t(p){var l,o,C,B;l=j(a,p);o=j(a,p+ea);C=j(a,p+H);B=j(a,p+ba);p=k(a,p+wa);THREE.Loader.prototype.f4(v,l,o,C,B,p)}function y(p){var l,o,C,B,G,N,L,P;l=j(a,p);o=j(a,p+ea);C=j(a,p+H);B=j(a,p+ba);G=k(a,p+wa);N=j(a,p+da);L=j(a,p+ua);P=j(a,p+ha);p=j(a,p+fa);THREE.Loader.prototype.f4n(v,
-O,l,o,C,B,G,N,L,P,p)}function A(p){var l,o;l=j(a,p);o=j(a,p+sa);p=j(a,p+xa);THREE.Loader.prototype.uv3(v.uvs,K[l*2],K[l*2+1],K[o*2],K[o*2+1],K[p*2],K[p*2+1])}function E(p){var l,o,C;l=j(a,p);o=j(a,p+ga);C=j(a,p+aa);p=j(a,p+la);THREE.Loader.prototype.uv4(v.uvs,K[l*2],K[l*2+1],K[o*2],K[o*2+1],K[C*2],K[C*2+1],K[p*2],K[p*2+1])}var v=this,F=0,w,O=[],K=[],Z,M,f,V,T,ca,ea,H,ba,wa,da,ua,ha,fa,sa,xa,ga,aa,la,ma,R,ia,pa,m,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(F,
+createBinModel:function(a,c,b,d){var e=function(g){function h(p,m){var o=q(p,m),B=q(p,m+1),C=q(p,m+2),G=q(p,m+3),Q=(G<<1&255|C>>7)-127;o|=(C&127)<<16|B<<8;if(o==0&&Q==-127)return 0;return(1-2*(G>>7))*(1+o*Math.pow(2,-23))*Math.pow(2,Q)}function j(p,m){var o=q(p,m),B=q(p,m+1),C=q(p,m+2);return(q(p,m+3)<<24)+(C<<16)+(B<<8)+o}function k(p,m){var o=q(p,m);return(q(p,m+1)<<8)+o}function n(p,m){var o=q(p,m);return o>127?o-256:o}function q(p,m){return p.charCodeAt(m)&255}function x(p){var m,o,B;m=j(a,p);
+o=j(a,p+Z);B=j(a,p+M);p=k(a,p+f);THREE.Loader.prototype.f3(v,m,o,B,p)}function u(p){var m,o,B,C,G,Q;m=j(a,p);o=j(a,p+Z);B=j(a,p+M);C=k(a,p+f);G=j(a,p+V);Q=j(a,p+T);p=j(a,p+ca);THREE.Loader.prototype.f3n(v,N,m,o,B,C,G,Q,p)}function t(p){var m,o,B,C;m=j(a,p);o=j(a,p+ea);B=j(a,p+I);C=j(a,p+ba);p=k(a,p+wa);THREE.Loader.prototype.f4(v,m,o,B,C,p)}function y(p){var m,o,B,C,G,Q,H,O;m=j(a,p);o=j(a,p+ea);B=j(a,p+I);C=j(a,p+ba);G=k(a,p+wa);Q=j(a,p+da);H=j(a,p+ua);O=j(a,p+ha);p=j(a,p+fa);THREE.Loader.prototype.f4n(v,
+N,m,o,B,C,G,Q,H,O,p)}function A(p){var m,o;m=j(a,p);o=j(a,p+sa);p=j(a,p+xa);THREE.Loader.prototype.uv3(v.uvs,L[m*2],L[m*2+1],L[o*2],L[o*2+1],L[p*2],L[p*2+1])}function E(p){var m,o,B;m=j(a,p);o=j(a,p+ga);B=j(a,p+aa);p=j(a,p+la);THREE.Loader.prototype.uv4(v.uvs,L[m*2],L[m*2+1],L[o*2],L[o*2+1],L[B*2],L[B*2+1],L[p*2],L[p*2+1])}var v=this,F=0,w,N=[],L=[],Z,M,f,V,T,ca,ea,I,ba,wa,da,ua,ha,fa,sa,xa,ga,aa,la,ma,R,ia,pa,l,z;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(F,
 8),header_bytes:q(a,F+8),vertex_coordinate_bytes:q(a,F+9),normal_coordinate_bytes:q(a,F+10),uv_coordinate_bytes:q(a,F+11),vertex_index_bytes:q(a,F+12),normal_index_bytes:q(a,F+13),uv_index_bytes:q(a,F+14),material_index_bytes:q(a,F+15),nvertices:j(a,F+16),nnormals:j(a,F+16+4),nuvs:j(a,F+16+8),ntri_flat:j(a,F+16+12),ntri_smooth:j(a,F+16+16),ntri_flat_uv:j(a,F+16+20),ntri_smooth_uv:j(a,F+16+24),nquad_flat:j(a,F+16+28),nquad_smooth:j(a,F+16+32),nquad_flat_uv:j(a,F+16+36),nquad_smooth_uv:j(a,F+16+40)};
 8),header_bytes:q(a,F+8),vertex_coordinate_bytes:q(a,F+9),normal_coordinate_bytes:q(a,F+10),uv_coordinate_bytes:q(a,F+11),vertex_index_bytes:q(a,F+12),normal_index_bytes:q(a,F+13),uv_index_bytes:q(a,F+14),material_index_bytes:q(a,F+15),nvertices:j(a,F+16),nnormals:j(a,F+16+4),nuvs:j(a,F+16+8),ntri_flat:j(a,F+16+12),ntri_smooth:j(a,F+16+16),ntri_flat_uv:j(a,F+16+20),ntri_smooth_uv:j(a,F+16+24),nquad_flat:j(a,F+16+28),nquad_smooth:j(a,F+16+32),nquad_flat_uv:j(a,F+16+36),nquad_smooth_uv:j(a,F+16+40)};
-F+=w.header_bytes;Z=w.vertex_index_bytes;M=w.vertex_index_bytes*2;f=w.vertex_index_bytes*3;V=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;ca=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;ea=w.vertex_index_bytes;H=w.vertex_index_bytes*2;ba=w.vertex_index_bytes*3;wa=w.vertex_index_bytes*4;da=w.vertex_index_bytes*4+w.material_index_bytes;ua=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ha=
+F+=w.header_bytes;Z=w.vertex_index_bytes;M=w.vertex_index_bytes*2;f=w.vertex_index_bytes*3;V=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;ca=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;ea=w.vertex_index_bytes;I=w.vertex_index_bytes*2;ba=w.vertex_index_bytes*3;wa=w.vertex_index_bytes*4;da=w.vertex_index_bytes*4+w.material_index_bytes;ua=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ha=
 w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;fa=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;sa=w.uv_index_bytes;xa=w.uv_index_bytes*2;ga=w.uv_index_bytes;aa=w.uv_index_bytes*2;la=w.uv_index_bytes*3;g=w.vertex_index_bytes*3+w.material_index_bytes;z=w.vertex_index_bytes*4+w.material_index_bytes;ma=w.ntri_flat*g;R=w.ntri_smooth*(g+w.normal_index_bytes*3);ia=w.ntri_flat_uv*(g+w.uv_index_bytes*3);pa=w.ntri_smooth_uv*(g+w.normal_index_bytes*3+w.uv_index_bytes*
 w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;fa=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;sa=w.uv_index_bytes;xa=w.uv_index_bytes*2;ga=w.uv_index_bytes;aa=w.uv_index_bytes*2;la=w.uv_index_bytes*3;g=w.vertex_index_bytes*3+w.material_index_bytes;z=w.vertex_index_bytes*4+w.material_index_bytes;ma=w.ntri_flat*g;R=w.ntri_smooth*(g+w.normal_index_bytes*3);ia=w.ntri_flat_uv*(g+w.uv_index_bytes*3);pa=w.ntri_smooth_uv*(g+w.normal_index_bytes*3+w.uv_index_bytes*
-3);m=w.nquad_flat*z;g=w.nquad_smooth*(z+w.normal_index_bytes*4);z=w.nquad_flat_uv*(z+w.uv_index_bytes*4);F+=function(p){for(var l,o,C,B=w.vertex_coordinate_bytes*3,G=p+w.nvertices*B;p<G;p+=B){l=h(a,p);o=h(a,p+w.vertex_coordinate_bytes);C=h(a,p+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,l,o,C)}return w.nvertices*B}(F);F+=function(p){for(var l,o,C,B=w.normal_coordinate_bytes*3,G=p+w.nnormals*B;p<G;p+=B){l=n(a,p);o=n(a,p+w.normal_coordinate_bytes);C=n(a,p+w.normal_coordinate_bytes*2);O.push(l/
-127,o/127,C/127)}return w.nnormals*B}(F);F+=function(p){for(var l,o,C=w.uv_coordinate_bytes*2,B=p+w.nuvs*C;p<B;p+=C){l=h(a,p);o=h(a,p+w.uv_coordinate_bytes);K.push(l,o)}return w.nuvs*C}(F);ma=F+ma;R=ma+R;ia=R+ia;pa=ia+pa;m=pa+m;g=m+g;z=g+z;(function(p){var l,o=w.vertex_index_bytes*3+w.material_index_bytes,C=o+w.uv_index_bytes*3,B=p+w.ntri_flat_uv*C;for(l=p;l<B;l+=C){x(l);A(l+o)}return B-p})(R);(function(p){var l,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,C=o+w.uv_index_bytes*
-3,B=p+w.ntri_smooth_uv*C;for(l=p;l<B;l+=C){u(l);A(l+o)}return B-p})(ia);(function(p){var l,o=w.vertex_index_bytes*4+w.material_index_bytes,C=o+w.uv_index_bytes*4,B=p+w.nquad_flat_uv*C;for(l=p;l<B;l+=C){t(l);E(l+o)}return B-p})(g);(function(p){var l,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,C=o+w.uv_index_bytes*4,B=p+w.nquad_smooth_uv*C;for(l=p;l<B;l+=C){y(l);E(l+o)}return B-p})(z);(function(p){var l,o=w.vertex_index_bytes*3+w.material_index_bytes,C=p+w.ntri_flat*o;for(l=
-p;l<C;l+=o)x(l);return C-p})(F);(function(p){var l,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,C=p+w.ntri_smooth*o;for(l=p;l<C;l+=o)u(l);return C-p})(ma);(function(p){var l,o=w.vertex_index_bytes*4+w.material_index_bytes,C=p+w.nquad_flat*o;for(l=p;l<C;l+=o)t(l);return C-p})(pa);(function(p){var l,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,C=p+w.nquad_smooth*o;for(l=p;l<C;l+=o)y(l);return C-p})(m);this.computeCentroids();this.computeFaceNormals()};
+3);l=w.nquad_flat*z;g=w.nquad_smooth*(z+w.normal_index_bytes*4);z=w.nquad_flat_uv*(z+w.uv_index_bytes*4);F+=function(p){for(var m,o,B,C=w.vertex_coordinate_bytes*3,G=p+w.nvertices*C;p<G;p+=C){m=h(a,p);o=h(a,p+w.vertex_coordinate_bytes);B=h(a,p+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,m,o,B)}return w.nvertices*C}(F);F+=function(p){for(var m,o,B,C=w.normal_coordinate_bytes*3,G=p+w.nnormals*C;p<G;p+=C){m=n(a,p);o=n(a,p+w.normal_coordinate_bytes);B=n(a,p+w.normal_coordinate_bytes*2);N.push(m/
+127,o/127,B/127)}return w.nnormals*C}(F);F+=function(p){for(var m,o,B=w.uv_coordinate_bytes*2,C=p+w.nuvs*B;p<C;p+=B){m=h(a,p);o=h(a,p+w.uv_coordinate_bytes);L.push(m,o)}return w.nuvs*B}(F);ma=F+ma;R=ma+R;ia=R+ia;pa=ia+pa;l=pa+l;g=l+g;z=g+z;(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=o+w.uv_index_bytes*3,C=p+w.ntri_flat_uv*B;for(m=p;m<C;m+=B){x(m);A(m+o)}return C-p})(R);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=o+w.uv_index_bytes*
+3,C=p+w.ntri_smooth_uv*B;for(m=p;m<C;m+=B){u(m);A(m+o)}return C-p})(ia);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=o+w.uv_index_bytes*4,C=p+w.nquad_flat_uv*B;for(m=p;m<C;m+=B){t(m);E(m+o)}return C-p})(g);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=o+w.uv_index_bytes*4,C=p+w.nquad_smooth_uv*B;for(m=p;m<C;m+=B){y(m);E(m+o)}return C-p})(z);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes,B=p+w.ntri_flat*o;for(m=
+p;m<B;m+=o)x(m);return B-p})(F);(function(p){var m,o=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,B=p+w.ntri_smooth*o;for(m=p;m<B;m+=o)u(m);return B-p})(ma);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes,B=p+w.nquad_flat*o;for(m=p;m<B;m+=o)t(m);return B-p})(pa);(function(p){var m,o=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,B=p+w.nquad_smooth*o;for(m=p;m<B;m+=o)y(m);return B-p})(l);this.computeCentroids();this.computeFaceNormals()};
 e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,n,q;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];n=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(g,k,n,q)}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];n=a.colors[h+1];q=a.colors[h+2];THREE.Loader.prototype.vc(g,k,n,q)}}})();(function(){function h(y,
 e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){var h,j,k,n,q;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];n=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(g,k,n,q)}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];n=a.colors[h+1];q=a.colors[h+2];THREE.Loader.prototype.vc(g,k,n,q)}}})();(function(){function h(y,
-A){THREE.Loader.prototype.f3(g,y[A],y[A+1],y[A+2],y[A+3])}function j(y,A){THREE.Loader.prototype.f3n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6])}function k(y,A){THREE.Loader.prototype.f4(g,y[A],y[A+1],y[A+2],y[A+3],y[A+4])}function n(y,A){THREE.Loader.prototype.f4n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6],y[A+7],y[A+8])}function q(y,A){var E,v,F,w,O,K,Z,M,f;E=y[A];v=y[A+1];F=y[A+2];w=a.uvs[E*2];Z=a.uvs[E*2+1];O=a.uvs[v*2];M=a.uvs[v*2+1];K=a.uvs[F*2];f=a.uvs[F*2+1];
-THREE.Loader.prototype.uv3(g.uvs,w,Z,O,M,K,f);if(a.uvs2&&a.uvs2.length){w=a.uvs2[E*2];Z=a.uvs2[E*2+1];O=a.uvs2[v*2];M=a.uvs2[v*2+1];K=a.uvs2[F*2];f=a.uvs2[F*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-Z,O,1-M,K,1-f)}}function x(y,A){var E,v,F,w,O,K,Z,M,f,V,T,ca;E=y[A];v=y[A+1];F=y[A+2];w=y[A+3];O=a.uvs[E*2];f=a.uvs[E*2+1];K=a.uvs[v*2];V=a.uvs[v*2+1];Z=a.uvs[F*2];T=a.uvs[F*2+1];M=a.uvs[w*2];ca=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,O,f,K,V,Z,T,M,ca);if(a.uvs2){O=a.uvs2[E*2];f=a.uvs2[E*2+1];K=
-a.uvs2[v*2];V=a.uvs2[v*2+1];Z=a.uvs2[F*2];T=a.uvs2[F*2+1];M=a.uvs2[w*2];ca=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,O,1-f,K,1-V,Z,1-T,M,1-ca)}}var u,t;u=0;for(t=a.trianglesUvs.length;u<t;u+=7){h(a.trianglesUvs,u);q(a.trianglesUvs,u+4)}u=0;for(t=a.trianglesNormalsUvs.length;u<t;u+=10){j(a.trianglesNormalsUvs,u);q(a.trianglesNormalsUvs,u+7)}u=0;for(t=a.quadsUvs.length;u<t;u+=9){k(a.quadsUvs,u);x(a.quadsUvs,u+5)}u=0;for(t=a.quadsNormalsUvs.length;u<t;u+=13){n(a.quadsNormalsUvs,u);x(a.quadsNormalsUvs,
+A){THREE.Loader.prototype.f3(g,y[A],y[A+1],y[A+2],y[A+3])}function j(y,A){THREE.Loader.prototype.f3n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6])}function k(y,A){THREE.Loader.prototype.f4(g,y[A],y[A+1],y[A+2],y[A+3],y[A+4])}function n(y,A){THREE.Loader.prototype.f4n(g,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6],y[A+7],y[A+8])}function q(y,A){var E,v,F,w,N,L,Z,M,f;E=y[A];v=y[A+1];F=y[A+2];w=a.uvs[E*2];Z=a.uvs[E*2+1];N=a.uvs[v*2];M=a.uvs[v*2+1];L=a.uvs[F*2];f=a.uvs[F*2+1];
+THREE.Loader.prototype.uv3(g.uvs,w,Z,N,M,L,f);if(a.uvs2&&a.uvs2.length){w=a.uvs2[E*2];Z=a.uvs2[E*2+1];N=a.uvs2[v*2];M=a.uvs2[v*2+1];L=a.uvs2[F*2];f=a.uvs2[F*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-Z,N,1-M,L,1-f)}}function x(y,A){var E,v,F,w,N,L,Z,M,f,V,T,ca;E=y[A];v=y[A+1];F=y[A+2];w=y[A+3];N=a.uvs[E*2];f=a.uvs[E*2+1];L=a.uvs[v*2];V=a.uvs[v*2+1];Z=a.uvs[F*2];T=a.uvs[F*2+1];M=a.uvs[w*2];ca=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,N,f,L,V,Z,T,M,ca);if(a.uvs2){N=a.uvs2[E*2];f=a.uvs2[E*2+1];L=
+a.uvs2[v*2];V=a.uvs2[v*2+1];Z=a.uvs2[F*2];T=a.uvs2[F*2+1];M=a.uvs2[w*2];ca=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,N,1-f,L,1-V,Z,1-T,M,1-ca)}}var u,t;u=0;for(t=a.trianglesUvs.length;u<t;u+=7){h(a.trianglesUvs,u);q(a.trianglesUvs,u+4)}u=0;for(t=a.trianglesNormalsUvs.length;u<t;u+=10){j(a.trianglesNormalsUvs,u);q(a.trianglesNormalsUvs,u+7)}u=0;for(t=a.quadsUvs.length;u<t;u+=9){k(a.quadsUvs,u);x(a.quadsUvs,u+5)}u=0;for(t=a.quadsNormalsUvs.length;u<t;u+=13){n(a.quadsNormalsUvs,u);x(a.quadsNormalsUvs,
 u+9)}u=0;for(t=a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.trianglesNormals.length;u<t;u+=7)j(a.trianglesNormals,u);u=0;for(t=a.quads.length;u<t;u+=5)k(a.quads,u);u=0;for(t=a.quadsNormals.length;u<t;u+=9)n(a.quadsNormals,u)})();(function(){var h,j,k,n;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];n=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,n,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];n=a.skinIndices[h+1];
 u+9)}u=0;for(t=a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.trianglesNormals.length;u<t;u+=7)j(a.trianglesNormals,u);u=0;for(t=a.quads.length;u<t;u+=5)k(a.quads,u);u=0;for(t=a.quadsNormals.length;u<t;u+=9)n(a.quadsNormals,u)})();(function(){var h,j,k,n;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];n=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,n,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];n=a.skinIndices[h+1];
 THREE.Loader.prototype.si(g,k,n,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,d,e){a.skinIndices.push(new THREE.Vector4(c,b,d,e))},sw:function(a,c,b,d,e){a.skinWeights.push(new THREE.Vector4(c,b,d,e))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
 THREE.Loader.prototype.si(g,k,n,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))},bones:function(a,c){a.bones=c},animation:function(a,c){a.animation=c},si:function(a,c,b,d,e){a.skinIndices.push(new THREE.Vector4(c,b,d,e))},sw:function(a,c,b,d,e){a.skinWeights.push(new THREE.Vector4(c,b,d,e))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
 b,d)))},vc:function(a,c,b,d){var e=new THREE.Color(16777215);e.setRGB(c,b,d);a.colors.push(e)},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var n=c[j*3],q=c[j*3+1];j=c[j*3+2];var x=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,q,j),new THREE.Vector3(x,
 b,d)))},vc:function(a,c,b,d){var e=new THREE.Color(16777215);e.setRGB(c,b,d);a.colors.push(e)},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,a.materials[g]))},f3n:function(a,c,b,d,e,g,h,j,k){g=a.materials[g];var n=c[j*3],q=c[j*3+1];j=c[j*3+2];var x=c[k*3],u=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,q,j),new THREE.Vector3(x,

+ 125 - 116
build/custom/ThreeWebGL.js

@@ -1,68 +1,68 @@
 // ThreeWebGL.js r35 - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r35 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var f,h,n,l,q,m;if(d==0)f=h=n=0;else{l=Math.floor(a*6);q=a*6-l;a=d*(1-b);m=d*(1-b*q);b=d*(1-b*(1-q));switch(l){case 1:f=m;h=d;n=a;break;case 2:f=a;h=d;n=b;break;case 3:f=a;h=m;n=d;break;case 4:f=b;h=a;n=d;break;case 5:f=d;h=a;n=m;break;case 6:case 0:f=d;h=b;n=a}}this.r=f;this.g=h;this.b=n;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,g,m,k,o,n;if(d==0)e=g=m=0;else{k=Math.floor(a*6);o=a*6-k;a=d*(1-b);n=d*(1-b*o);b=d*(1-b*(1-o));switch(k){case 1:e=n;g=d;m=a;break;case 2:e=a;g=d;m=b;break;case 3:e=a;g=n;m=d;break;case 4:e=b;g=a;m=d;break;case 5:e=d;g=a;m=n;break;case 6:case 0:e=d;g=b;m=a}}this.r=e;this.g=g;this.b=m;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,d){this.set(a||0,b||0,d||0)};
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,d){this.set(a||0,b||0,d||0)};
 THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,d=this.y,f=this.z;this.set(d*a.z-f*a.y,f*a.x-b*a.z,b*a.y-d*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.set(d*a.z-e*a.y,e*a.x-b*a.z,b*a.y-d*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,f){this.set(a||0,b||0,d||0,f||1)};
-THREE.Vector4.prototype={set:function(a,b,d,f){this.x=a;this.y=b;this.z=d;this.w=f;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
+THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,d,f=a.objects,h=[];a=0;for(b=f.length;a<b;a++){d=f[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(n,l){return n.distance-l.distance});return h},intersectObject:function(a){function b(L,M,V,X){X=X.clone().subSelf(M);V=V.clone().subSelf(M);var ca=L.clone().subSelf(M);L=X.dot(X);M=X.dot(V);X=X.dot(ca);var aa=V.dot(V);V=V.dot(ca);ca=1/(L*aa-M*M);aa=(aa*X-M*V)*ca;L=(L*V-M*X)*ca;return aa>0&&L>0&&aa+L<1}var d,f,h,n,
-l,q,m,w,A,y,D,E=a.geometry,F=E.vertices,H=[];d=0;for(f=E.faces.length;d<f;d++){h=E.faces[d];y=this.origin.clone();D=this.direction.clone();m=a.matrixWorld;n=m.multiplyVector3(F[h.a].position.clone());l=m.multiplyVector3(F[h.b].position.clone());q=m.multiplyVector3(F[h.c].position.clone());m=h instanceof THREE.Face4?m.multiplyVector3(F[h.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(h.normal.clone());A=D.dot(w);if(A<0){w=w.dot((new THREE.Vector3).sub(n,y))/A;y=y.addSelf(D.multiplyScalar(w));
-if(h instanceof THREE.Face3){if(b(y,n,l,q)){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}else if(h instanceof THREE.Face4&&(b(y,n,l,m)||b(y,l,q,m))){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}}return H}};
-THREE.Rectangle=function(){function a(){n=f-b;l=h-d}var b,d,f,h,n,l,q=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return n};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(m,w,A,y){q=!1;b=m;d=w;f=A;h=y;a()};this.addPoint=function(m,w){if(q){q=!1;b=m;d=w;f=m;h=w}else{b=b<m?b:m;d=d<w?d:w;f=f>m?f:m;h=h>w?h:w}a()};
-this.add3Points=function(m,w,A,y,D,E){if(q){q=!1;b=m<A?m<D?m:D:A<D?A:D;d=w<y?w<E?w:E:y<E?y:E;f=m>A?m>D?m:D:A>D?A:D;h=w>y?w>E?w:E:y>E?y:E}else{b=m<A?m<D?m<b?m:b:D<b?D:b:A<D?A<b?A:b:D<b?D:b;d=w<y?w<E?w<d?w:d:E<d?E:d:y<E?y<d?y:d:E<d?E:d;f=m>A?m>D?m>f?m:f:D>f?D:f:A>D?A>f?A:f:D>f?D:f;h=w>y?w>E?w>h?w:h:E>h?E:h:y>E?y>h?y:h:E>h?E:h}a()};this.addRectangle=function(m){if(q){q=!1;b=m.getLeft();d=m.getTop();f=m.getRight();h=m.getBottom()}else{b=b<m.getLeft()?b:m.getLeft();d=d<m.getTop()?d:m.getTop();f=f>m.getRight()?
-f:m.getRight();h=h>m.getBottom()?h:m.getBottom()}a()};this.inflate=function(m){b-=m;d-=m;f+=m;h+=m;a()};this.minSelf=function(m){b=b>m.getLeft()?b:m.getLeft();d=d>m.getTop()?d:m.getTop();f=f<m.getRight()?f:m.getRight();h=h<m.getBottom()?h:m.getBottom();a()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(b,m.getLeft())>=0&&Math.min(h,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){q=!0;h=f=d=b=0;a()};this.isEmpty=function(){return q}};
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(m,k){return m.distance-k.distance});return g},intersectObject:function(a){function b(L,M,V,X){X=X.clone().subSelf(M);V=V.clone().subSelf(M);var ca=L.clone().subSelf(M);L=X.dot(X);M=X.dot(V);X=X.dot(ca);var aa=V.dot(V);V=V.dot(ca);ca=1/(L*aa-M*M);aa=(aa*X-M*V)*ca;L=(L*V-M*X)*ca;return aa>0&&L>0&&aa+L<1}var d,e,g,m,
+k,o,n,w,z,x,D,E=a.geometry,F=E.vertices,H=[];d=0;for(e=E.faces.length;d<e;d++){g=E.faces[d];x=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;m=n.multiplyVector3(F[g.a].position.clone());k=n.multiplyVector3(F[g.b].position.clone());o=n.multiplyVector3(F[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(F[g.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(g.normal.clone());z=D.dot(w);if(z<0){w=w.dot((new THREE.Vector3).sub(m,x))/z;x=x.addSelf(D.multiplyScalar(w));
+if(g instanceof THREE.Face3){if(b(x,m,k,o)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};H.push(g)}}else if(g instanceof THREE.Face4&&(b(x,m,k,n)||b(x,k,o,n))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:a};H.push(g)}}}return H}};
+THREE.Rectangle=function(){function a(){m=e-b;k=g-d}var b,d,e,g,m,k,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(n,w,z,x){o=!1;b=n;d=w;e=z;g=x;a()};this.addPoint=function(n,w){if(o){o=!1;b=n;d=w;e=n;g=w}else{b=b<n?b:n;d=d<w?d:w;e=e>n?e:n;g=g>w?g:w}a()};
+this.add3Points=function(n,w,z,x,D,E){if(o){o=!1;b=n<z?n<D?n:D:z<D?z:D;d=w<x?w<E?w:E:x<E?x:E;e=n>z?n>D?n:D:z>D?z:D;g=w>x?w>E?w:E:x>E?x:E}else{b=n<z?n<D?n<b?n:b:D<b?D:b:z<D?z<b?z:b:D<b?D:b;d=w<x?w<E?w<d?w:d:E<d?E:d:x<E?x<d?x:d:E<d?E:d;e=n>z?n>D?n>e?n:e:D>e?D:e:z>D?z>e?z:e:D>e?D:e;g=w>x?w>E?w>g?w:g:E>g?E:g:x>E?x>g?x:g:E>g?E:g}a()};this.addRectangle=function(n){if(o){o=!1;b=n.getLeft();d=n.getTop();e=n.getRight();g=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();d=d<n.getTop()?d:n.getTop();e=e>n.getRight()?
+e:n.getRight();g=g>n.getBottom()?g:n.getBottom()}a()};this.inflate=function(n){b-=n;d-=n;e+=n;g+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();d=d>n.getTop()?d:n.getTop();e=e<n.getRight()?e:n.getRight();g=g<n.getBottom()?g:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(g,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){o=!0;g=e=d=b=0;a()};this.isEmpty=function(){return o}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,d,f,h,n,l,q,m,w,A,y,D,E,F,H){this.set(a||1,b||0,d||0,f||0,h||0,n||1,l||0,q||0,m||0,w||0,A||1,y||0,D||0,E||0,F||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,d,f,h,n,l,q,m,w,A,y,D,E,F,H){this.n11=a;this.n12=b;this.n13=d;this.n14=f;this.n21=h;this.n22=n;this.n23=l;this.n24=q;this.n31=m;this.n32=w;this.n33=A;this.n34=y;this.n41=D;this.n42=E;this.n43=F;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var f=THREE.Matrix4.__v1,
-h=THREE.Matrix4.__v2,n=THREE.Matrix4.__v3;n.sub(a,b).normalize();f.cross(d,n).normalize();h.cross(n,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=n.x;this.n21=f.y;this.n22=h.y;this.n23=n.y;this.n31=f.z;this.n32=h.z;this.n33=n.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,f=a.z,h=1/(this.n41*b+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*f+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*b+this.n32*d+this.n33*f+this.n34)*h;return a},
-multiplyVector4:function(a){var b=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*b+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*b+this.n22*d+this.n23*f+this.n24*h;a.z=this.n31*b+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*b+this.n42*d+this.n43*f+this.n44*h;return a},rotateAxis:function(a){var b=a.x,d=a.y,f=a.z;a.x=b*this.n11+d*this.n12+f*this.n13;a.y=b*this.n21+d*this.n22+f*this.n23;a.z=b*this.n31+d*this.n32+f*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+
-this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,f=a.n12,h=a.n13,n=a.n14,l=a.n21,q=a.n22,m=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,V=b.n11,X=b.n12,ca=b.n13,aa=b.n14,Y=b.n21,fa=b.n22,c=b.n23,na=b.n24,la=b.n31,ta=b.n32,oa=b.n33,pa=b.n34;this.n11=d*V+f*Y+h*
-la;this.n12=d*X+f*fa+h*ta;this.n13=d*ca+f*c+h*oa;this.n14=d*aa+f*na+h*pa+n;this.n21=l*V+q*Y+m*la;this.n22=l*X+q*fa+m*ta;this.n23=l*ca+q*c+m*oa;this.n24=l*aa+q*na+m*pa+w;this.n31=A*V+y*Y+D*la;this.n32=A*X+y*fa+D*ta;this.n33=A*ca+y*c+D*oa;this.n34=A*aa+y*na+D*pa+E;this.n41=F*V+H*Y+L*la;this.n42=F*X+H*fa+L*ta;this.n43=F*ca+H*c+L*oa;this.n44=F*aa+H*na+L*pa+M;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;
+THREE.Matrix4=function(a,b,d,e,g,m,k,o,n,w,z,x,D,E,F,H){this.set(a||1,b||0,d||0,e||0,g||0,m||1,k||0,o||0,n||0,w||0,z||1,x||0,D||0,E||0,F||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,d,e,g,m,k,o,n,w,z,x,D,E,F,H){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=m;this.n23=k;this.n24=o;this.n31=n;this.n32=w;this.n33=z;this.n34=x;this.n41=D;this.n42=E;this.n43=F;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__v1,
+g=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(a,b).normalize();e.cross(d,m).normalize();g.cross(m,e).normalize();this.n11=e.x;this.n12=g.x;this.n13=m.x;this.n21=e.y;this.n22=g.y;this.n23=m.y;this.n31=e.z;this.n32=g.z;this.n33=m.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},
+multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*g;return a},rotateAxis:function(a){var b=a.x,d=a.y,e=a.z;a.x=b*this.n11+d*this.n12+e*this.n13;a.y=b*this.n21+d*this.n22+e*this.n23;a.z=b*this.n31+d*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+
+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,g=a.n13,m=a.n14,k=a.n21,o=a.n22,n=a.n23,w=a.n24,z=a.n31,x=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,V=b.n11,X=b.n12,ca=b.n13,aa=b.n14,Y=b.n21,fa=b.n22,c=b.n23,na=b.n24,la=b.n31,ta=b.n32,oa=b.n33,pa=b.n34;this.n11=d*V+e*Y+g*
+la;this.n12=d*X+e*fa+g*ta;this.n13=d*ca+e*c+g*oa;this.n14=d*aa+e*na+g*pa+m;this.n21=k*V+o*Y+n*la;this.n22=k*X+o*fa+n*ta;this.n23=k*ca+o*c+n*oa;this.n24=k*aa+o*na+n*pa+w;this.n31=z*V+x*Y+D*la;this.n32=z*X+x*fa+D*ta;this.n33=z*ca+x*c+D*oa;this.n34=z*aa+x*na+D*pa+E;this.n41=F*V+H*Y+L*la;this.n42=F*X+H*fa+L*ta;this.n43=F*ca+H*c+L*oa;this.n44=F*aa+H*na+L*pa+M;return this},multiplyToArray:function(a,b,d){this.multiply(a,b);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;
 d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=
 d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=
-this.n13,f=this.n14,h=this.n21,n=this.n22,l=this.n23,q=this.n24,m=this.n31,w=this.n32,A=this.n33,y=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return f*l*w*D-d*q*w*D-f*n*A*D+b*q*A*D+d*n*y*D-b*l*y*D-f*l*m*E+d*q*m*E+f*h*A*E-a*q*A*E-d*h*y*E+a*l*y*E+f*n*m*F-b*q*m*F-f*h*w*F+a*q*w*F+b*h*y*F-a*n*y*F-d*n*m*H+b*l*m*H+d*h*w*H-a*l*w*H-b*h*A*H+a*n*A*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=
+this.n13,e=this.n14,g=this.n21,m=this.n22,k=this.n23,o=this.n24,n=this.n31,w=this.n32,z=this.n33,x=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return e*k*w*D-d*o*w*D-e*m*z*D+b*o*z*D+d*m*x*D-b*k*x*D-e*k*n*E+d*o*n*E+e*g*z*E-a*o*z*E-d*g*x*E+a*k*x*E+e*m*n*F-b*o*n*F-e*g*w*F+a*o*w*F+b*g*x*F-a*m*x*F-d*m*n*H+b*k*n*H+d*g*w*H-a*k*w*H-b*g*z*H+a*m*z*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=
 this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;
 this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;
 this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;
 this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;
 a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,
 a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,
-0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),f=Math.sin(b),h=1-d,n=a.x,l=a.y,q=a.z,m=h*n,w=h*l;this.set(m*n+d,m*l-f*q,m*
-q+f*l,0,m*l+f*q,w*l+d,w*q-f*n,0,m*q-f*l,w*q+f*n,h*q*q+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,f=a.z;a=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var n=Math.cos(f);f=Math.sin(f);var l=a*d,q=b*d;this.n11=h*n;this.n12=-h*f;this.n13=d;this.n21=q*n+a*f;this.n22=-q*f+a*n;this.n23=-b*h;this.n31=-l*n+b*f;this.n32=l*f+b*n;this.n33=a*h;return this},setRotationFromQuaternion:function(a){var b=
-a.x,d=a.y,f=a.z,h=a.w,n=b+b,l=d+d,q=f+f;a=b*n;var m=b*l;b*=q;var w=d*l;d*=q;f*=q;n*=h;l*=h;h*=q;this.n11=1-(w+f);this.n12=m-h;this.n13=b+l;this.n21=m+h;this.n22=1-(a+f);this.n23=d-n;this.n31=b-l;this.n32=d+n;this.n33=1-(a+w);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
-a.n34},extractRotation:function(a,b){var d=1/b.x,f=1/b.y,h=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*f;this.n22=a.n22*f;this.n32=a.n32*f;this.n13=a.n13*h;this.n23=a.n23*h;this.n33=a.n33*h}};
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,f=a.n12,h=a.n13,n=a.n14,l=a.n21,q=a.n22,m=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=m*E*H-w*D*H+w*y*L-q*E*L-m*y*M+q*D*M;b.n12=n*D*H-h*E*H-n*y*L+f*E*L+h*y*M-f*D*M;b.n13=h*w*H-n*m*H+n*q*L-f*w*L-h*q*M+f*m*M;b.n14=n*m*y-h*w*y-n*q*D+f*w*D+h*q*E-f*m*E;b.n21=w*D*F-m*E*F-w*A*L+l*E*L+m*A*M-l*D*M;b.n22=h*E*F-n*D*F+n*A*L-d*E*L-h*A*M+d*D*M;b.n23=n*m*F-h*w*F-n*l*L+d*w*L+h*l*M-d*m*M;
-b.n24=h*w*A-n*m*A+n*l*D-d*w*D-h*l*E+d*m*E;b.n31=q*E*F-w*y*F+w*A*H-l*E*H-q*A*M+l*y*M;b.n32=n*y*F-f*E*F-n*A*H+d*E*H+f*A*M-d*y*M;b.n33=h*w*F-n*q*F+n*l*H-d*w*H-f*l*M+d*q*M;b.n34=n*q*A-f*w*A-n*l*y+d*w*y+f*l*E-d*q*E;b.n41=m*y*F-q*D*F-m*A*H+l*D*H+q*A*L-l*y*L;b.n42=f*D*F-h*y*F+h*A*H-d*D*H-f*A*L+d*y*L;b.n43=h*q*F-f*m*F-h*l*H+d*m*H+f*l*L-d*q*L;b.n44=f*m*A-h*q*A+h*l*y-d*m*y-f*l*D+d*q*D;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,f=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,n=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,q=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,A=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*l+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*h;d[2]=a*n;d[3]=a*l;d[4]=a*q;d[5]=a*m;d[6]=a*w;d[7]=a*A;d[8]=a*y;return b};
-THREE.Matrix4.makeFrustum=function(a,b,d,f,h,n){var l;l=new THREE.Matrix4;l.n11=2*h/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*h/(f-d);l.n23=(f+d)/(f-d);l.n24=0;l.n31=0;l.n32=0;l.n33=-(n+h)/(n-h);l.n34=-2*n*h/(n-h);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,d,f)};
-THREE.Matrix4.makeOrtho=function(a,b,d,f,h,n){var l,q,m,w;l=new THREE.Matrix4;q=b-a;m=d-f;w=n-h;l.n11=2/q;l.n12=0;l.n13=0;l.n14=-((b+a)/q);l.n21=0;l.n22=2/m;l.n23=0;l.n24=-((d+f)/m);l.n31=0;l.n32=0;l.n33=-2/w;l.n34=-((n+h)/w);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),g=1-d,m=a.x,k=a.y,o=a.z,n=g*m,w=g*k;this.set(n*m+d,n*k-e*o,n*
+o+e*k,0,n*k+e*o,w*k+d,w*o-e*m,0,n*o-e*k,w*o+e*m,g*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var m=Math.cos(e);e=Math.sin(e);var k=a*d,o=b*d;this.n11=g*m;this.n12=-g*e;this.n13=d;this.n21=o*m+a*e;this.n22=-o*e+a*m;this.n23=-b*g;this.n31=-k*m+b*e;this.n32=k*e+b*m;this.n33=a*g;return this},setRotationFromQuaternion:function(a){var b=
+a.x,d=a.y,e=a.z,g=a.w,m=b+b,k=d+d,o=e+e;a=b*m;var n=b*k;b*=o;var w=d*k;d*=o;e*=o;m*=g;k*=g;g*=o;this.n11=1-(w+e);this.n12=n-g;this.n13=b+k;this.n21=n+g;this.n22=1-(a+e);this.n23=d-m;this.n31=b-k;this.n32=d+m;this.n33=1-(a+w);return this},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+a.n34},extractRotation:function(a,b){var d=1/b.x,e=1/b.y,g=1/b.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*g;this.n23=a.n23*g;this.n33=a.n33*g}};
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,g=a.n13,m=a.n14,k=a.n21,o=a.n22,n=a.n23,w=a.n24,z=a.n31,x=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*E*H-w*D*H+w*x*L-o*E*L-n*x*M+o*D*M;b.n12=m*D*H-g*E*H-m*x*L+e*E*L+g*x*M-e*D*M;b.n13=g*w*H-m*n*H+m*o*L-e*w*L-g*o*M+e*n*M;b.n14=m*n*x-g*w*x-m*o*D+e*w*D+g*o*E-e*n*E;b.n21=w*D*F-n*E*F-w*z*L+k*E*L+n*z*M-k*D*M;b.n22=g*E*F-m*D*F+m*z*L-d*E*L-g*z*M+d*D*M;b.n23=m*n*F-g*w*F-m*k*L+d*w*L+g*k*M-d*n*M;
+b.n24=g*w*z-m*n*z+m*k*D-d*w*D-g*k*E+d*n*E;b.n31=o*E*F-w*x*F+w*z*H-k*E*H-o*z*M+k*x*M;b.n32=m*x*F-e*E*F-m*z*H+d*E*H+e*z*M-d*x*M;b.n33=g*w*F-m*o*F+m*k*H-d*w*H-e*k*M+d*o*M;b.n34=m*o*z-e*w*z-m*k*x+d*w*x+e*k*E-d*o*E;b.n41=n*x*F-o*D*F-n*z*H+k*D*H+o*z*L-k*x*L;b.n42=e*D*F-g*x*F+g*z*H-d*D*H-e*z*L+d*x*L;b.n43=g*o*F-e*n*F-g*k*H+d*n*H+e*k*L-d*o*L;b.n44=e*n*z-g*o*z+g*k*x-d*n*x-e*k*D+d*o*D;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,m=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,z=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*k+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*g;d[2]=a*m;d[3]=a*k;d[4]=a*o;d[5]=a*n;d[6]=a*w;d[7]=a*z;d[8]=a*x;return b};
+THREE.Matrix4.makeFrustum=function(a,b,d,e,g,m){var k;k=new THREE.Matrix4;k.n11=2*g/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*g/(e-d);k.n23=(e+d)/(e-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(m+g)/(m-g);k.n34=-2*m*g/(m-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,b,d,e,g,m){var k,o,n,w;k=new THREE.Matrix4;o=b-a;n=d-e;w=m-g;k.n11=2/o;k.n12=0;k.n13=0;k.n14=-((b+a)/o);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((d+e)/n);k.n31=0;k.n32=0;k.n33=-2/w;k.n34=-((m+g)/w);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);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))}return!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var f=this.children.length;a<f;a++)this.children[a].update(this.matrixWorld,
-b,d)}}};THREE.Quaternion=function(a,b,d,f){this.set(a||0,b||0,d||0,f!==undefined?f:1)};
-THREE.Quaternion.prototype={set:function(a,b,d,f){this.x=a;this.y=b;this.z=d;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,f=a.y*b,h=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-h);h=Math.sin(-h);var n=Math.cos(d);d=Math.sin(d);var l=a*b,q=f*h;this.w=l*n-q*d;this.x=l*d+q*n;this.y=f*b*n+a*h*d;this.z=a*h*n-f*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,f=this.z,h=this.w,n=a.x,l=a.y,q=a.z;a=a.w;this.x=b*a+h*n+d*q-f*l;this.y=d*a+h*l+f*n-b*q;this.z=f*a+h*q+b*l-d*n;this.w=h*a-b*n-d*l-f*q;return this},
-multiplyVector3:function(a,b){b||(b=a);var d=a.x,f=a.y,h=a.z,n=this.x,l=this.y,q=this.z,m=this.w,w=m*d+l*h-q*f,A=m*f+q*d-n*h,y=m*h+n*f-l*d;d=-n*d-l*f-q*h;b.x=w*m+d*-n+A*-q-y*-l;b.y=A*m+d*-l+y*-n-w*-q;b.z=y*m+d*-q+w*-l-A*-n;return b}};
-THREE.Quaternion.slerp=function(a,b,d,f){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var n=Math.acos(h),l=Math.sqrt(1-h*h);if(Math.abs(l)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-f)*n)/l;f=Math.sin(f*n)/l;d.w=a.w*h+b.w*f;d.x=a.x*h+b.x*f;d.y=a.y*h+b.y*f;d.z=a.z*h+b.z*f;return d};
+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))}return!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
+b,d)}}};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
+THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var m=Math.cos(d);d=Math.sin(d);var k=a*b,o=e*g;this.w=k*m-o*d;this.x=k*d+o*m;this.y=e*b*m+a*g*d;this.z=a*g*m-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,g=this.w,m=a.x,k=a.y,o=a.z;a=a.w;this.x=b*a+g*m+d*o-e*k;this.y=d*a+g*k+e*m-b*o;this.z=e*a+g*o+b*k-d*m;this.w=g*a-b*m-d*k-e*o;return this},
+multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,g=a.z,m=this.x,k=this.y,o=this.z,n=this.w,w=n*d+k*g-o*e,z=n*e+o*d-m*g,x=n*g+m*e-k*d;d=-m*d-k*e-o*g;b.x=w*n+d*-m+z*-o-x*-k;b.y=z*n+d*-k+x*-m-w*-o;b.z=x*n+d*-o+w*-k-z*-m;return b}};
+THREE.Quaternion.slerp=function(a,b,d,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var m=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}g=Math.sin((1-e)*m)/k;e=Math.sin(e*m)/k;d.w=a.w*g+b.w*e;d.x=a.x*g+b.x*e;d.y=a.y*g+b.y*e;d.z=a.z*g+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
-THREE.Face3=function(a,b,d,f,h){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,b,d,f,h,n){this.a=a;this.b=b;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=n instanceof Array?n:[n]};
+THREE.Face3=function(a,b,d,e,g){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face4=function(a,b,d,e,g,m){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=m instanceof Array?m:[m]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,f,h,n,l,q=new THREE.Vector3,m=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){n=this.vertices[f];n.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){n=this.faces[f];if(a&&n.vertexNormals.length){q.set(0,0,0);b=0;for(d=n.normal.length;b<d;b++)q.addSelf(n.vertexNormals[b]);q.divideScalar(3)}else{b=this.vertices[n.a];d=this.vertices[n.b];l=this.vertices[n.c];q.sub(l.position,
-d.position);m.sub(b.position,d.position);q.crossSelf(m)}q.isZero()||q.normalize();n.normal.copy(q)}},computeVertexNormals:function(){var a,b,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)f[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(pa,za,Aa,va,Da,Ea,Fa){n=pa.vertices[za].position;l=pa.vertices[Aa].position;q=pa.vertices[va].position;m=h[Da];w=h[Ea];A=h[Fa];y=l.x-n.x;D=q.x-n.x;E=l.y-
-n.y;F=q.y-n.y;H=l.z-n.z;L=q.z-n.z;M=w.u-m.u;V=A.u-m.u;X=w.v-m.v;ca=A.v-m.v;aa=1/(M*ca-V*X);c.set((ca*y-X*D)*aa,(ca*E-X*F)*aa,(ca*H-X*L)*aa);na.set((M*D-V*y)*aa,(M*F-V*E)*aa,(M*L-V*H)*aa);Y[za].addSelf(c);Y[Aa].addSelf(c);Y[va].addSelf(c);fa[za].addSelf(na);fa[Aa].addSelf(na);fa[va].addSelf(na)}var b,d,f,h,n,l,q,m,w,A,y,D,E,F,H,L,M,V,X,ca,aa,Y=[],fa=[],c=new THREE.Vector3,na=new THREE.Vector3,la=new THREE.Vector3,ta=new THREE.Vector3,oa=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){Y[b]=
-new THREE.Vector3;fa[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){f=this.faces[b];h=this.uvs[b];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);
-this.vertices[f.c].normal.copy(f.vertexNormals[2]);this.vertices[f.d].normal.copy(f.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){oa.copy(this.vertices[b].normal);f=Y[b];la.copy(f);la.subSelf(oa.multiplyScalar(oa.dot(f))).normalize();ta.cross(this.vertices[b].normal,f);f=ta.dot(fa[b]);f=f<0?-1:1;this.vertices[b].tangent.set(la.x,la.y,la.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,m,k,o=new THREE.Vector3,n=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){m=this.vertices[e];m.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){m=this.faces[e];if(a&&m.vertexNormals.length){o.set(0,0,0);b=0;for(d=m.normal.length;b<d;b++)o.addSelf(m.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[m.a];d=this.vertices[m.b];k=this.vertices[m.c];o.sub(k.position,
+d.position);n.sub(b.position,d.position);o.crossSelf(n)}o.isZero()||o.normalize();m.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(pa,za,Aa,va,Da,Ea,Fa){m=pa.vertices[za].position;k=pa.vertices[Aa].position;o=pa.vertices[va].position;n=g[Da];w=g[Ea];z=g[Fa];x=k.x-m.x;D=o.x-m.x;E=k.y-
+m.y;F=o.y-m.y;H=k.z-m.z;L=o.z-m.z;M=w.u-n.u;V=z.u-n.u;X=w.v-n.v;ca=z.v-n.v;aa=1/(M*ca-V*X);c.set((ca*x-X*D)*aa,(ca*E-X*F)*aa,(ca*H-X*L)*aa);na.set((M*D-V*x)*aa,(M*F-V*E)*aa,(M*L-V*H)*aa);Y[za].addSelf(c);Y[Aa].addSelf(c);Y[va].addSelf(c);fa[za].addSelf(na);fa[Aa].addSelf(na);fa[va].addSelf(na)}var b,d,e,g,m,k,o,n,w,z,x,D,E,F,H,L,M,V,X,ca,aa,Y=[],fa=[],c=new THREE.Vector3,na=new THREE.Vector3,la=new THREE.Vector3,ta=new THREE.Vector3,oa=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){Y[b]=
+new THREE.Vector3;fa[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);
+this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){oa.copy(this.vertices[b].normal);e=Y[b];la.copy(e);la.subSelf(oa.multiplyScalar(oa.dot(e))).normalize();ta.cross(this.vertices[b].normal,e);e=ta.dot(fa[b]);e=e<0?-1:1;this.vertices[b].tangent.set(la.x,la.y,la.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
 y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
 y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
 this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,b,d,f,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=f||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,b,d,e,g){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
@@ -89,92 +89,101 @@ a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!=
 undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
 undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
 undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
 undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
-THREE.Texture=function(a,b,d,f,h,n){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==undefined?h:THREE.LinearFilter;this.minFilter=n!==undefined?n:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.Texture=function(a,b,d,e,g,m){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=m!==undefined?m:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
 THREE.RenderTarget=function(a,b,d){this.width=a;this.height=b;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var b,d,f,h={};for(b in a){h[b]={};for(d in a[b]){f=a[b][d];h[b][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var b,d,f,h={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(d in f)h[d]=f[d]}return h}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}return g}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
-b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
-THREE.Sound=function(a,b,d,f){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=a instanceof Array?a:[a];var h;d=this.sources.length;for(a=0;a<d;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)h=
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)h="audio/ogg";else b.indexOf(".wav")!==-1&&(h="audio/wav");if(this.domElement.canPlayType(h)){h=document.createElement("source");h.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(h);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Bone.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<g;e++)this.children[e].update(this.skinMatrix,
+b,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,g,m,k,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){g=this.geometry.bones[d];m=g.pos;k=g.rotq;o=g.scl;e=this.addBone();e.name=g.name;e.position.set(m[0],m[1],m[2]);e.quaternion.set(k[0],k[1],k[2],k[3]);o!==undefined?e.scale.set(o[0],o[1],o[2]):e.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){g=this.geometry.bones[d];e=this.bones[d];
+g.parent===-1?this.addChild(e):this.bones[g.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,g=this.children.length;for(e=0;e<g;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,b,d)}}};
+THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],d=0;d<this.bones.length;d++){a=this.bones[d];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,m=this.geometry.skinIndices[a].y;
+e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(b[m].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
+THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+THREE.Sound=function(a,b,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var g;d=this.sources.length;for(a=0;a<d;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)g=
+"audio/mpeg";else if(b.indexOf(".ogg")!==-1)g="audio/ogg";else b.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(g);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.matrixWorld,b,d)};
-THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
-THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
+THREE.Sound.prototype.update=function(a,b,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
+THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var d=0;d<this.LODs.length;d++)if(b<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
+THREE.LOD.prototype.update=function(a,b,d){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible=
+!1;this.LODs[e].object3D.visible=!0}else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var f,h=d.length;for(f=0;f<h;f++){a=d[f];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
-THREE.WebGLRenderer=function(a){function b(e,j,k){var g,i,u,o=e.vertices,r=o.length,x=e.colors,s=x.length,v=e.__vertexArray,J=e.__colorArray,P=e.__sortArray,N=e.__dirtyVertices,I=e.__dirtyColors;if(k.sortParticles){Ga.multiplySelf(k.matrixWorld);for(g=0;g<r;g++){i=o[g].position;Ba.copy(i);Ga.multiplyVector3(Ba);P[g]=[Ba.z,g]}P.sort(function(K,G){return G[0]-K[0]});for(g=0;g<r;g++){i=o[P[g][1]].position;u=g*3;v[u]=i.x;v[u+1]=i.y;v[u+2]=i.z}for(g=0;g<s;g++){u=g*3;color=x[P[g][1]];J[u]=color.r;J[u+1]=
-color.g;J[u+2]=color.b}}else{if(N)for(g=0;g<r;g++){i=o[g].position;u=g*3;v[u]=i.x;v[u+1]=i.y;v[u+2]=i.z}if(I)for(g=0;g<s;g++){color=x[g];u=g*3;J[u]=color.r;J[u+1]=color.g;J[u+2]=color.b}}if(N||k.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,j)}if(I||k.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,J,j)}}function d(e,j){e.fragmentShader=j.fragmentShader;e.vertexShader=j.vertexShader;e.uniforms=Uniforms.clone(j.uniforms)}
-function f(e,j,k,g,i){g.program||ta.initMaterial(g,j,k);var u=g.program,o=u.uniforms,r=g.uniforms;if(u!=na){c.useProgram(u);na=u;c.uniformMatrix4fv(o.projectionMatrix,!1,Pa)}if(k&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){r.fogNear.value=k.near;r.fogFar.value=k.far}else if(k instanceof
-THREE.FogExp2)r.fogDensity.value=k.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var x,s,v=0,J=0,P=0,N,I,K,G=Qa,ha=G.directional.colors,t=G.directional.positions,da=G.point.colors,ba=G.point.positions,ga=0,z=0;k=s=s=0;for(x=j.length;k<x;k++){s=j[k];N=s.color;I=s.position;K=s.intensity;if(s instanceof THREE.AmbientLight){v+=N.r;J+=N.g;P+=N.b}else if(s instanceof THREE.DirectionalLight){s=ga*3;ha[s]=N.r*K;ha[s+1]=N.g*K;ha[s+2]=N.b*K;t[s]=I.x;t[s+1]=I.y;t[s+
-2]=I.z;ga+=1}else if(s instanceof THREE.PointLight){s=z*3;da[s]=N.r*K;da[s+1]=N.g*K;da[s+2]=N.b*K;ba[s]=I.x;ba[s+1]=I.y;ba[s+2]=I.z;z+=1}}for(k=ga*3;k<ha.length;k++)ha[k]=0;for(k=z*3;k<da.length;k++)da[k]=0;G.point.length=z;G.directional.length=ga;G.ambient[0]=v;G.ambient[1]=J;G.ambient[2]=P;j=Qa;r.enableLighting.value=j.directional.length+j.point.length;r.ambientLightColor.value=j.ambient;r.directionalLightColor.value=j.directional.colors;r.directionalLightDirection.value=j.directional.positions;
-r.pointLightColor.value=j.point.colors;r.pointLightPosition.value=j.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.map.texture=g.map;r.lightMap.texture=g.lightMap;r.envMap.texture=g.envMap;r.reflectivity.value=g.reflectivity;r.refractionRatio.value=g.refractionRatio;r.combine.value=g.combine;r.useRefract.value=
-g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.size.value=g.size;r.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(g.ambient.r,g.ambient.g,
-g.ambient.b);r.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);r.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)r.opacity.value=g.opacity;for(var B in r)if(v=u.uniforms[B]){k=r[B];x=k.type;j=k.value;if(x=="i")c.uniform1i(v,j);else if(x=="f")c.uniform1f(v,j);else if(x=="fv1")c.uniform1fv(v,j);else if(x=="fv")c.uniform3fv(v,j);else if(x=="v2")c.uniform2f(v,
-j.x,j.y);else if(x=="v3")c.uniform3f(v,j.x,j.y,j.z);else if(x=="c")c.uniform3f(v,j.r,j.g,j.b);else if(x=="t"){c.uniform1i(v,j);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(x=0;x<6;++x)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[x])}else{k.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);
-for(x=0;x<6;++x)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[x]);k.__wasSetOnce=!0}V(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,k.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,
-k.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}V(c.TEXTURE_2D,k,k.image);c.bindTexture(c.TEXTURE_2D,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_2D,k.__webGLTexture)}}}c.uniformMatrix4fv(o.modelViewMatrix,!1,i._modelViewMatrixArray);c.uniformMatrix3fv(o.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&c.uniform3f(o.cameraPosition,e.position.x,
-e.position.y,e.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&c.uniformMatrix4fv(o.objectMatrix,!1,i._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&c.uniformMatrix4fv(o.viewMatrix,!1,Ja);if(g.skinning){c.uniformMatrix4fv(o.cameraInverseMatrix,!1,Ja);c.uniformMatrix4fv(o.boneGlobalMatrices,!1,i.boneMatrices)}return u}function h(e,j,k,g,i,u){e=f(e,j,k,g,u).attributes;c.bindBuffer(c.ARRAY_BUFFER,
-i.__webGLVertexBuffer);c.vertexAttribPointer(e.position,3,c.FLOAT,!1,0,0);if(e.color>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.vertexAttribPointer(e.color,3,c.FLOAT,!1,0,0)}if(e.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLNormalBuffer);c.vertexAttribPointer(e.normal,3,c.FLOAT,!1,0,0)}if(e.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLTangentBuffer);c.vertexAttribPointer(e.tangent,4,c.FLOAT,!1,0,0)}if(e.uv>=0)if(i.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUVBuffer);
-c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(e.uv)}else c.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(i.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUV2Buffer);c.vertexAttribPointer(e.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(e.uv2)}else c.disableVertexAttribArray(e.uv2);if(g.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);c.vertexAttribPointer(e.skinVertexA,4,c.FLOAT,
-!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);c.vertexAttribPointer(e.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);c.vertexAttribPointer(e.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);c.vertexAttribPointer(e.skinWeight,4,c.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(g.wireframe){c.lineWidth(g.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);c.drawElements(c.LINES,i.__webGLLineCount,
-c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,i.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(g.linewidth);c.drawArrays(u,0,i.__webGLLineCount)}else if(u instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,i.__webGLParticleCount);else u instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function n(e,j){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=
-c.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=c.createBuffer();if(e.hasPos){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,e.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.position);c.vertexAttribPointer(j.attributes.position,3,c.FLOAT,!1,0,0)}if(e.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,e.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,e.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.normal);c.vertexAttribPointer(j.attributes.normal,
-3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,e.count);e.count=0}function l(e){if(oa!=e.doubleSided){e.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);oa=e.doubleSided}if(pa!=e.flipSided){e.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=e.flipSided}}function q(e){if(Aa!=e){e?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Aa=e}}function m(e){qa[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);qa[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);qa[2].set(e.n41+e.n21,e.n42+e.n22,
-e.n43+e.n23,e.n44+e.n24);qa[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);qa[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);qa[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var j;for(e=0;e<6;e++){j=qa[e];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(e){for(var j=e.matrixWorld,k=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),g=0;g<6;g++){e=qa[g].x*j.n14+qa[g].y*j.n24+qa[g].z*j.n34+qa[g].w;if(e<=k)return!1}return!0}function A(e,
-j){e.list[e.count]=j;e.count+=1}function y(e){var j,k,g=e.object,i=e.opaque,u=e.transparent;u.count=0;e=i.count=0;for(j=g.materials.length;e<j;e++){k=g.materials[e];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(u,k):A(i,k)}}function D(e){var j,k,g,i,u=e.object,o=e.buffer,r=e.opaque,x=e.transparent;x.count=0;e=r.count=0;for(g=u.materials.length;e<g;e++){j=u.materials[e];if(j instanceof THREE.MeshFaceMaterial){j=0;for(k=o.materials.length;j<k;j++)(i=o.materials[j])&&(i.opacity&&i.opacity<
-1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i)}}}function E(e,j){return j.z-e.z}function F(e,j){e._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function H(e){function j(J){var P=[];k=0;for(g=J.length;k<g;k++)J[k]==undefined?P.push("undefined"):P.push(J[k].id);return P.join("_")}var k,
-g,i,u,o,r,x,s,v={};e.geometryGroups={};i=0;for(u=e.faces.length;i<u;i++){o=e.faces[i];r=o.materials;x=j(r);v[x]==undefined&&(v[x]={hash:x,counter:0});s=v[x].hash+"_"+v[x].counter;e.geometryGroups[s]==undefined&&(e.geometryGroups[s]={faces:[],materials:r,vertices:0});o=o instanceof THREE.Face3?3:4;if(e.geometryGroups[s].vertices+o>65535){v[x].counter+=1;s=v[x].hash+"_"+v[x].counter;e.geometryGroups[s]==undefined&&(e.geometryGroups[s]={faces:[],materials:r,vertices:0})}e.geometryGroups[s].faces.push(i);
-e.geometryGroups[s].vertices+=o}}function L(e,j,k){e.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(e){if(e!=za){switch(e){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);
-c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}za=e}}function V(e,j,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){c.texParameteri(e,c.TEXTURE_WRAP_S,Y(j.wrapS));c.texParameteri(e,c.TEXTURE_WRAP_T,Y(j.wrapT));c.texParameteri(e,c.TEXTURE_MAG_FILTER,Y(j.magFilter));c.texParameteri(e,c.TEXTURE_MIN_FILTER,Y(j.minFilter));c.generateMipmap(e)}else{c.texParameteri(e,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(e,c.TEXTURE_WRAP_T,
-c.CLAMP_TO_EDGE);c.texParameteri(e,c.TEXTURE_MAG_FILTER,aa(j.magFilter));c.texParameteri(e,c.TEXTURE_MIN_FILTER,aa(j.minFilter))}}function X(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=c.createFramebuffer();e.__webGLRenderbuffer=c.createRenderbuffer();e.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,e.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,e.width,e.height);c.bindTexture(c.TEXTURE_2D,e.__webGLTexture);c.texParameteri(c.TEXTURE_2D,
-c.TEXTURE_WRAP_S,Y(e.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,Y(e.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,Y(e.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,Y(e.minFilter));c.texImage2D(c.TEXTURE_2D,0,Y(e.format),e.width,e.height,0,Y(e.format),Y(e.type),null);c.bindFramebuffer(c.FRAMEBUFFER,e.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,e.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,
-c.RENDERBUFFER,e.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var j,k;if(e){j=e.__webGLFramebuffer;k=e.width;e=e.height}else{j=null;k=Ea;e=Fa}if(j!=la){c.bindFramebuffer(c.FRAMEBUFFER,j);c.viewport(va,Da,k,e);la=j}}function ca(e,j){var k;if(e=="fragment")k=c.createShader(c.FRAGMENT_SHADER);else e=="vertex"&&(k=c.createShader(c.VERTEX_SHADER));c.shaderSource(k,j);c.compileShader(k);if(!c.getShaderParameter(k,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(k));
-return null}return k}function aa(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function Y(e){switch(e){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,g=d.length;for(e=0;e<g;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.WebGLRenderer=function(a){function b(f,j,l){var h,i,t,p=f.vertices,s=p.length,A=f.colors,r=A.length,v=f.__vertexArray,J=f.__colorArray,P=f.__sortArray,N=f.__dirtyVertices,I=f.__dirtyColors;if(l.sortParticles){Ga.multiplySelf(l.matrixWorld);for(h=0;h<s;h++){i=p[h].position;Ba.copy(i);Ga.multiplyVector3(Ba);P[h]=[Ba.z,h]}P.sort(function(K,G){return G[0]-K[0]});for(h=0;h<s;h++){i=p[P[h][1]].position;t=h*3;v[t]=i.x;v[t+1]=i.y;v[t+2]=i.z}for(h=0;h<r;h++){t=h*3;color=A[P[h][1]];J[t]=color.r;J[t+1]=
+color.g;J[t+2]=color.b}}else{if(N)for(h=0;h<s;h++){i=p[h].position;t=h*3;v[t]=i.x;v[t+1]=i.y;v[t+2]=i.z}if(I)for(h=0;h<r;h++){color=A[h];t=h*3;J[t]=color.r;J[t+1]=color.g;J[t+2]=color.b}}if(N||l.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,j)}if(I||l.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,J,j)}}function d(f,j){f.fragmentShader=j.fragmentShader;f.vertexShader=j.vertexShader;f.uniforms=Uniforms.clone(j.uniforms)}
+function e(f,j,l,h,i){h.program||ta.initMaterial(h,j,l,i);var t=h.program,p=t.uniforms,s=h.uniforms;if(t!=na){c.useProgram(t);na=t;c.uniformMatrix4fv(p.projectionMatrix,!1,Pa)}if(l&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){s.fogColor.value.setHex(l.color.hex);if(l instanceof THREE.Fog){s.fogNear.value=l.near;s.fogFar.value=l.far}else if(l instanceof
+THREE.FogExp2)s.fogDensity.value=l.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){var A,r,v=0,J=0,P=0,N,I,K,G=Qa,ha=G.directional.colors,u=G.directional.positions,da=G.point.colors,ba=G.point.positions,ga=0,y=0;l=r=r=0;for(A=j.length;l<A;l++){r=j[l];N=r.color;I=r.position;K=r.intensity;if(r instanceof THREE.AmbientLight){v+=N.r;J+=N.g;P+=N.b}else if(r instanceof THREE.DirectionalLight){r=ga*3;ha[r]=N.r*K;ha[r+1]=N.g*K;ha[r+2]=N.b*K;u[r]=I.x;u[r+1]=I.y;u[r+
+2]=I.z;ga+=1}else if(r instanceof THREE.PointLight){r=y*3;da[r]=N.r*K;da[r+1]=N.g*K;da[r+2]=N.b*K;ba[r]=I.x;ba[r+1]=I.y;ba[r+2]=I.z;y+=1}}for(l=ga*3;l<ha.length;l++)ha[l]=0;for(l=y*3;l<da.length;l++)da[l]=0;G.point.length=y;G.directional.length=ga;G.ambient[0]=v;G.ambient[1]=J;G.ambient[2]=P;j=Qa;s.enableLighting.value=j.directional.length+j.point.length;s.ambientLightColor.value=j.ambient;s.directionalLightColor.value=j.directional.colors;s.directionalLightDirection.value=j.directional.positions;
+s.pointLightColor.value=j.point.colors;s.pointLightPosition.value=j.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){s.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);s.opacity.value=h.opacity;s.map.texture=h.map;s.lightMap.texture=h.lightMap;s.envMap.texture=h.envMap;s.reflectivity.value=h.reflectivity;s.refractionRatio.value=h.refractionRatio;s.combine.value=h.combine;s.useRefract.value=
+h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){s.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);s.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){s.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);s.opacity.value=h.opacity;s.size.value=h.size;s.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){s.ambient.value.setRGB(h.ambient.r,h.ambient.g,
+h.ambient.b);s.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);s.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){s.mNear.value=f.near;s.mFar.value=f.far;s.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)s.opacity.value=h.opacity;for(var B in s)if(v=t.uniforms[B]){l=s[B];A=l.type;j=l.value;if(A=="i")c.uniform1i(v,j);else if(A=="f")c.uniform1f(v,j);else if(A=="fv1")c.uniform1fv(v,j);else if(A=="fv")c.uniform3fv(v,j);else if(A=="v2")c.uniform2f(v,
+j.x,j.y);else if(A=="v3")c.uniform3f(v,j.x,j.y,j.z);else if(A=="c")c.uniform3f(v,j.r,j.g,j.b);else if(A=="t"){c.uniform1i(v,j);if(l=l.texture)if(l.image instanceof Array&&l.image.length==6){if(l.image.length==6){if(l.needsUpdate){if(l.__wasSetOnce){c.bindTexture(c.TEXTURE_CUBE_MAP,l.image.__webGLTextureCube);for(A=0;A<6;++A)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,c.RGBA,c.UNSIGNED_BYTE,l.image[A])}else{l.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,l.image.__webGLTextureCube);
+for(A=0;A<6;++A)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,l.image[A]);l.__wasSetOnce=!0}V(c.TEXTURE_CUBE_MAP,l,l.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);l.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_CUBE_MAP,l.image.__webGLTextureCube)}}else{if(l.needsUpdate){if(l.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,l.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,l.image)}else{l.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,
+l.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,l.image);l.__wasSetOnce=!0}V(c.TEXTURE_2D,l,l.image);c.bindTexture(c.TEXTURE_2D,null);l.needsUpdate=!1}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_2D,l.__webGLTexture)}}}c.uniformMatrix4fv(p.modelViewMatrix,!1,i._modelViewMatrixArray);c.uniformMatrix3fv(p.normalMatrix,!1,i._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||h.envMap)&&c.uniform3f(p.cameraPosition,f.position.x,
+f.position.y,f.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&c.uniformMatrix4fv(p.objectMatrix,!1,i._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&c.uniformMatrix4fv(p.viewMatrix,!1,Ja);if(h.skinning){c.uniformMatrix4fv(p.cameraInverseMatrix,!1,Ja);c.uniformMatrix4fv(p.boneGlobalMatrices,!1,i.boneMatrices)}return t}function g(f,j,l,h,i,t){f=e(f,j,l,h,t).attributes;c.bindBuffer(c.ARRAY_BUFFER,
+i.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUVBuffer);
+c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);if(h.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,
+!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,4,c.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(h.wireframe){c.lineWidth(h.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);c.drawElements(c.LINES,i.__webGLLineCount,
+c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,i.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(h.linewidth);c.drawArrays(t,0,i.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)c.drawArrays(c.POINTS,0,i.__webGLParticleCount);else t instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function m(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=
+c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.position);c.vertexAttribPointer(j.attributes.position,3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(j.attributes.normal);c.vertexAttribPointer(j.attributes.normal,
+3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if(oa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);oa=f.doubleSided}if(pa!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);pa=f.flipSided}}function o(f){if(Aa!=f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);Aa=f}}function n(f){qa[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);qa[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);qa[2].set(f.n41+f.n21,f.n42+f.n22,
+f.n43+f.n23,f.n44+f.n24);qa[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);qa[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);qa[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var j;for(f=0;f<6;f++){j=qa[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(f){for(var j=f.matrixWorld,l=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),h=0;h<6;h++){f=qa[h].x*j.n14+qa[h].y*j.n24+qa[h].z*j.n34+qa[h].w;if(f<=l)return!1}return!0}function z(f,
+j){f.list[f.count]=j;f.count+=1}function x(f){var j,l,h=f.object,i=f.opaque,t=f.transparent;t.count=0;f=i.count=0;for(j=h.materials.length;f<j;f++){l=h.materials[f];l.opacity&&l.opacity<1||l.blending!=THREE.NormalBlending?z(t,l):z(i,l)}}function D(f){var j,l,h,i,t=f.object,p=f.buffer,s=f.opaque,A=f.transparent;A.count=0;f=s.count=0;for(h=t.materials.length;f<h;f++){j=t.materials[f];if(j instanceof THREE.MeshFaceMaterial){j=0;for(l=p.materials.length;j<l;j++)(i=p.materials[j])&&(i.opacity&&i.opacity<
+1||i.blending!=THREE.NormalBlending?z(A,i):z(s,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?z(A,i):z(s,i)}}}function E(f,j){return j.z-f.z}function F(f,j){f._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){function j(J){var P=[];l=0;for(h=J.length;l<h;l++)J[l]==undefined?P.push("undefined"):P.push(J[l].id);return P.join("_")}var l,
+h,i,t,p,s,A,r,v={};f.geometryGroups={};i=0;for(t=f.faces.length;i<t;i++){p=f.faces[i];s=p.materials;A=j(s);v[A]==undefined&&(v[A]={hash:A,counter:0});r=v[A].hash+"_"+v[A].counter;f.geometryGroups[r]==undefined&&(f.geometryGroups[r]={faces:[],materials:s,vertices:0});p=p instanceof THREE.Face3?3:4;if(f.geometryGroups[r].vertices+p>65535){v[A].counter+=1;r=v[A].hash+"_"+v[A].counter;f.geometryGroups[r]==undefined&&(f.geometryGroups[r]={faces:[],materials:s,vertices:0})}f.geometryGroups[r].faces.push(i);
+f.geometryGroups[r].vertices+=p}}function L(f,j,l){f.push({buffer:j,object:l,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=za){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);
+c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}za=f}}function V(f,j,l){if((l.width&l.width-1)==0&&(l.height&l.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,Y(j.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,Y(j.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,Y(j.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Y(j.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,
+c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,aa(j.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,aa(j.minFilter))}}function X(f){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,
+c.TEXTURE_WRAP_S,Y(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,Y(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,Y(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,Y(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,Y(f.format),f.width,f.height,0,Y(f.format),Y(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,
+c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var j,l;if(f){j=f.__webGLFramebuffer;l=f.width;f=f.height}else{j=null;l=Ea;f=Fa}if(j!=la){c.bindFramebuffer(c.FRAMEBUFFER,j);c.viewport(va,Da,l,f);la=j}}function ca(f,j){var l;if(f=="fragment")l=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(l=c.createShader(c.VERTEX_SHADER));c.shaderSource(l,j);c.compileShader(l);if(!c.getShaderParameter(l,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(l));
+return null}return l}function aa(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return c.LINEAR}}function Y(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;
 case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;
 case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;
 case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var fa=document.createElement("canvas"),c,na=null,la=null,ta=this,oa=null,pa=null,za=null,Aa=null,va=0,Da=0,Ea=0,Fa=0,qa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Pa=new Float32Array(16),Ja=new Float32Array(16),
 case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var fa=document.createElement("canvas"),c,na=null,la=null,ta=this,oa=null,pa=null,za=null,Aa=null,va=0,Da=0,Ea=0,Fa=0,qa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ga=new THREE.Matrix4,Pa=new Float32Array(16),Ja=new Float32Array(16),
-Ba=new THREE.Vector4,Qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ra=!0,Sa=new THREE.Color(0),Ta=0;if(a){if(a.antialias!==undefined)Ra=a.antialias;a.clearColor!==undefined&&Sa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ta=a.clearAlpha}this.domElement=fa;this.autoClear=!0;this.sortObjects=!0;(function(e,j,k){try{if(!(c=fa.getContext("experimental-webgl",{antialias:e})))throw"Error creating WebGL context.";}catch(g){console.error(g)}c.clearColor(0,
-0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Ra,Sa,Ta);this.context=c;this.setSize=function(e,j){fa.width=e;fa.height=j;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(e,j,k,g){va=e;Da=j;Ea=k;Fa=g;c.viewport(va,Da,Ea,Fa)};this.setScissor=function(e,j,k,g){c.scissor(e,j,k,g)};this.enableScissorTest=
-function(e){e?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(e){c.depthMask(e)};this.setClearColorHex=function(e,j){var k=new THREE.Color(e);c.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(e,j){c.clearColor(e.r,e.g,e.b,j)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(e,j,k){var g,i;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.MeshNormalMaterial)d(e,
-THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);var u,o,r,x;i=r=x=0;for(u=j.length;i<u;i++){o=j[i];o instanceof THREE.DirectionalLight&&r++;o instanceof
-THREE.PointLight&&x++}if(x+r<=4)j=r;else{j=Math.ceil(4*r/(x+r));x=4-j}i={directional:j,point:x};x=e.fragmentShader;j=e.vertexShader;u={fog:k,map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,skinning:e.skinning,maxDirLights:i.directional,maxPointLights:i.point};k=c.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
-"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":
-"",u.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");c.attachShader(k,
-ca("fragment",i+x));c.attachShader(k,ca("vertex",u+j));c.linkProgram(k);c.getProgramParameter(k,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(k,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");k.uniforms={};k.attributes={};e.program=k;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in e.uniforms)k.push(g);g=e.program;x=0;for(j=k.length;x<j;x++){i=
-k[x];g.uniforms[i]=c.getUniformLocation(g,i)}g=e.program;k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];x=0;for(j=k.length;x<j;x++){i=k[x];g.attributes[i]=c.getAttribLocation(g,i)}g=e.program.attributes;c.enableVertexAttribArray(g.position);g.color>=0&&c.enableVertexAttribArray(g.color);g.normal>=0&&c.enableVertexAttribArray(g.normal);g.tangent>=0&&c.enableVertexAttribArray(g.tangent);if(e.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=
-0&&g.skinWeight>=0){c.enableVertexAttribArray(g.skinVertexA);c.enableVertexAttribArray(g.skinVertexB);c.enableVertexAttribArray(g.skinIndex);c.enableVertexAttribArray(g.skinWeight)}};this.render=function(e,j,k,g){var i,u,o,r,x,s,v,J,P=e.lights,N=e.fog;j.matrixAutoUpdate&&j.update();j.matrixWorldInverse.flattenToArray(Ja);j.projectionMatrix.flattenToArray(Pa);Ga.multiply(j.projectionMatrix,j.matrixWorldInverse);m(Ga);e.update(undefined,!1,j);this.initWebGLObjects(e);X(k);(this.autoClear||g)&&this.clear();
-x=e.__webglObjects.length;for(g=0;g<x;g++){i=e.__webglObjects[g];v=i.object;if(v.visible)if(!(v instanceof THREE.Mesh)||w(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);F(v,j);D(i);i.render=!0;if(this.sortObjects){Ba.copy(v.position);Ga.multiplyVector3(Ba);i.z=Ba.z}}else i.render=!1;else i.render=!1}this.sortObjects&&e.__webglObjects.sort(E);s=e.__webglObjectsImmediate.length;for(g=0;g<s;g++){i=e.__webglObjectsImmediate[g];v=i.object;if(v.visible){v.matrixAutoUpdate&&v.matrixWorld.flattenToArray(v._objectMatrixArray);
-F(v,j);y(i)}}M(THREE.NormalBlending);for(g=0;g<x;g++){i=e.__webglObjects[g];if(i.render){v=i.object;J=i.buffer;o=i.opaque;l(v);for(i=0;i<o.count;i++){r=o.list[i];q(r.depthTest);h(j,P,N,r,J,v)}}}for(g=0;g<s;g++){i=e.__webglObjectsImmediate[g];v=i.object;if(v.visible){o=i.opaque;l(v);for(i=0;i<o.count;i++){r=o.list[i];q(r.depthTest);u=f(j,P,N,r,v);v.render(function(I){n(I,u)})}}}for(g=0;g<x;g++){i=e.__webglObjects[g];if(i.render){v=i.object;J=i.buffer;o=i.transparent;l(v);for(i=0;i<o.count;i++){r=o.list[i];
-M(r.blending);q(r.depthTest);h(j,P,N,r,J,v)}}}for(g=0;g<s;g++){i=e.__webglObjectsImmediate[g];v=i.object;if(v.visible){o=i.transparent;l(v);for(i=0;i<o.count;i++){r=o.list[i];M(r.blending);q(r.depthTest);u=f(j,P,N,r,v);v.render(function(I){n(I,u)})}}}if(k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,k.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(e){if(!e.__webglObjects){e.__webglObjects=
-[];e.__webglObjectsImmediate=[]}for(;e.__objectsAdded.length;){var j=e.__objectsAdded[0],k=e,g=void 0,i=void 0,u=void 0;if(j._modelViewMatrix==undefined){j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.matrixWorld.flattenToArray(j._objectMatrixArray)}if(j instanceof THREE.Mesh){i=j.geometry;i.geometryGroups==undefined&&H(i);for(g in i.geometryGroups){u=i.geometryGroups[g];if(!u.__webGLVertexBuffer){var o=
-u;o.__webGLVertexBuffer=c.createBuffer();o.__webGLNormalBuffer=c.createBuffer();o.__webGLTangentBuffer=c.createBuffer();o.__webGLColorBuffer=c.createBuffer();o.__webGLUVBuffer=c.createBuffer();o.__webGLUV2Buffer=c.createBuffer();o.__webGLSkinVertexABuffer=c.createBuffer();o.__webGLSkinVertexBBuffer=c.createBuffer();o.__webGLSkinIndicesBuffer=c.createBuffer();o.__webGLSkinWeightsBuffer=c.createBuffer();o.__webGLFaceBuffer=c.createBuffer();o.__webGLLineBuffer=c.createBuffer();o=u;var r=j,x=void 0,s=
-void 0,v=0,J=0,P=0,N=r.geometry.faces,I=o.faces;x=0;for(s=I.length;x<s;x++){fi=I[x];face=N[fi];if(face instanceof THREE.Face3){v+=3;J+=1;P+=3}else if(face instanceof THREE.Face4){v+=4;J+=2;P+=4}}o.__vertexArray=new Float32Array(v*3);o.__normalArray=new Float32Array(v*3);o.__tangentArray=new Float32Array(v*4);o.__colorArray=new Float32Array(v*3);o.__uvArray=new Float32Array(v*2);o.__uv2Array=new Float32Array(v*2);o.__skinVertexAArray=new Float32Array(v*4);o.__skinVertexBArray=new Float32Array(v*4);
-o.__skinIndexArray=new Float32Array(v*4);o.__skinWeightArray=new Float32Array(v*4);o.__faceArray=new Uint16Array(J*3);o.__lineArray=new Uint16Array(P*2);s=x=o;v=void 0;N=void 0;var K=void 0,G=void 0;K=void 0;I=!1;v=0;for(N=r.materials.length;v<N;v++){K=r.materials[v];if(K instanceof THREE.MeshFaceMaterial){K=0;for(G=s.materials.length;K<G;K++)if(s.materials[K]&&s.materials[K].shading!=undefined&&s.materials[K].shading==THREE.SmoothShading){I=!0;break}}else if(K&&K.shading!=undefined&&K.shading==THREE.SmoothShading){I=
-!0;break}if(I)break}x.__needsSmoothNormals=I;o.__webGLFaceCount=J*3;o.__webGLLineCount=P*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}L(k.__webglObjects,u,j)}}else if(j instanceof THREE.Ribbon){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__webGLVertexCount=
-u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.Line){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__webGLLineCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.ParticleSystem){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=
-c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__sortArray=[];g.__webGLParticleCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes&&k.__webglObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){j=e.__objectsRemoved[0];
-k=e;i=void 0;g=void 0;for(i=k.__webglObjects.length-1;i>=0;i--){g=k.__webglObjects[i].object;j==g&&k.__webglObjects.splice(i,1)}e.__objectsRemoved.splice(0,1)}j=0;for(k=e.__webglObjects.length;j<k;j++){g=e.__webglObjects[j].object;u=void 0;i=void 0;o=void 0;if(g instanceof THREE.Mesh){i=g.geometry;for(u in i.geometryGroups){o=i.geometryGroups[u];if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){J=c.DYNAMIC_DRAW;P=void 0;x=void 0;var ha=void 0,
-t=void 0,da=void 0,ba=void 0,ga=void 0;ha=void 0;var z=void 0,B=void 0,C=void 0,O=void 0;z=void 0;B=void 0;C=void 0;t=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;t=void 0;ba=void 0;da=void 0;ga=void 0;var ia=G=K=I=N=v=r=s=0,W=0,p=0,Z=o.__vertexArray,Ha=o.__uvArray,Ia=o.__uv2Array,ma=o.__normalArray,Q=o.__tangentArray,$=o.__colorArray,R=o.__skinVertexAArray,
-S=o.__skinVertexBArray,T=o.__skinIndexArray,U=o.__skinWeightArray,ra=o.__faceArray,ja=o.__lineArray,Ua=o.__needsSmoothNormals,ea=g.geometry,Ka=ea.__dirtyVertices,La=ea.__dirtyElements,Ca=ea.__dirtyUvs,Ma=ea.__dirtyNormals,Na=ea.__dirtyTangents,Oa=ea.__dirtyColors,ka=ea.vertices,Va=o.faces,Wa=ea.faces,Xa=ea.uvs,Ya=ea.uvs2,sa=ea.colors,wa=ea.skinVerticesA,xa=ea.skinVerticesB,ya=ea.skinIndices,ua=ea.skinWeights;P=0;for(x=Va.length;P<x;P++){ha=Va[P];t=Wa[ha];ga=Xa[ha];ha=Ya[ha];da=t.vertexNormals;ba=
-t.normal;if(t instanceof THREE.Face3){if(Ka){z=ka[t.a].position;B=ka[t.b].position;C=ka[t.c].position;Z[r]=z.x;Z[r+1]=z.y;Z[r+2]=z.z;Z[r+3]=B.x;Z[r+4]=B.y;Z[r+5]=B.z;Z[r+6]=C.x;Z[r+7]=C.y;Z[r+8]=C.z;r+=9}if(ua.length){z=ua[t.a];B=ua[t.b];C=ua[t.c];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;z=ya[t.a];B=ya[t.b];C=ya[t.c];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=z.w;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=B.w;T[p+8]=
-C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=C.w;z=wa[t.a];B=wa[t.b];C=wa[t.c];R[p]=z.x;R[p+1]=z.y;R[p+2]=z.z;R[p+3]=1;R[p+4]=B.x;R[p+5]=B.y;R[p+6]=B.z;R[p+7]=1;R[p+8]=C.x;R[p+9]=C.y;R[p+10]=C.z;R[p+11]=1;z=xa[t.a];B=xa[t.b];C=xa[t.c];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;p+=12}if(Oa&&sa.length){z=sa[t.a];B=sa[t.b];C=sa[t.c];$[W]=z.r;$[W+1]=z.g;$[W+2]=z.b;$[W+3]=B.r;$[W+4]=B.g;$[W+5]=B.b;$[W+6]=C.r;$[W+7]=C.g;$[W+8]=C.b;
-W+=9}if(Na&&ea.hasTangents){z=ka[t.a].tangent;B=ka[t.b].tangent;C=ka[t.c].tangent;Q[G]=z.x;Q[G+1]=z.y;Q[G+2]=z.z;Q[G+3]=z.w;Q[G+4]=B.x;Q[G+5]=B.y;Q[G+6]=B.z;Q[G+7]=B.w;Q[G+8]=C.x;Q[G+9]=C.y;Q[G+10]=C.z;Q[G+11]=C.w;G+=12}if(Ma)if(da.length==3&&Ua)for(t=0;t<3;t++){ba=da[t];ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}else for(t=0;t<3;t++){ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}if(Ca&&ga)for(t=0;t<3;t++){da=ga[t];Ha[v]=da.u;Ha[v+1]=da.v;v+=2}if(Ca&&ha)for(t=0;t<3;t++){ga=ha[t];Ia[N]=ga.u;Ia[N+1]=ga.v;
-N+=2}if(La){ra[I]=s;ra[I+1]=s+1;ra[I+2]=s+2;I+=3;ja[ia]=s;ja[ia+1]=s+1;ja[ia+2]=s;ja[ia+3]=s+2;ja[ia+4]=s+1;ja[ia+5]=s+2;ia+=6;s+=3}}else if(t instanceof THREE.Face4){if(Ka){z=ka[t.a].position;B=ka[t.b].position;C=ka[t.c].position;O=ka[t.d].position;Z[r]=z.x;Z[r+1]=z.y;Z[r+2]=z.z;Z[r+3]=B.x;Z[r+4]=B.y;Z[r+5]=B.z;Z[r+6]=C.x;Z[r+7]=C.y;Z[r+8]=C.z;Z[r+9]=O.x;Z[r+10]=O.y;Z[r+11]=O.z;r+=12}if(ua.length){z=ua[t.a];B=ua[t.b];C=ua[t.c];O=ua[t.d];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=
-B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;U[p+12]=O.x;U[p+13]=O.y;U[p+14]=O.z;U[p+15]=O.w;z=ya[t.a];B=ya[t.b];C=ya[t.c];O=ya[t.d];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=z.w;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=B.w;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=C.w;T[p+12]=O.x;T[p+13]=O.y;T[p+14]=O.z;T[p+15]=O.w;z=wa[t.a];B=wa[t.b];C=wa[t.c];O=wa[t.d];R[p]=z.x;R[p+1]=z.y;R[p+2]=z.z;R[p+3]=1;R[p+4]=B.x;R[p+5]=B.y;R[p+6]=B.z;R[p+7]=1;R[p+8]=C.x;R[p+9]=C.y;R[p+10]=C.z;R[p+11]=
-1;R[p+12]=O.x;R[p+13]=O.y;R[p+14]=O.z;R[p+15]=1;z=xa[t.a];B=xa[t.b];C=xa[t.c];O=xa[t.d];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;S[p+12]=O.x;S[p+13]=O.y;S[p+14]=O.z;S[p+15]=1;p+=16}if(Oa&&sa.length){z=sa[t.a];B=sa[t.b];C=sa[t.c];O=sa[t.d];$[W]=z.r;$[W+1]=z.g;$[W+2]=z.b;$[W+3]=B.r;$[W+4]=B.g;$[W+5]=B.b;$[W+6]=C.r;$[W+7]=C.g;$[W+8]=C.b;$[W+9]=O.r;$[W+10]=O.g;$[W+11]=O.b;W+=12}if(Na&&ea.hasTangents){z=ka[t.a].tangent;
-B=ka[t.b].tangent;C=ka[t.c].tangent;t=ka[t.d].tangent;Q[G]=z.x;Q[G+1]=z.y;Q[G+2]=z.z;Q[G+3]=z.w;Q[G+4]=B.x;Q[G+5]=B.y;Q[G+6]=B.z;Q[G+7]=B.w;Q[G+8]=C.x;Q[G+9]=C.y;Q[G+10]=C.z;Q[G+11]=C.w;Q[G+12]=t.x;Q[G+13]=t.y;Q[G+14]=t.z;Q[G+15]=t.w;G+=16}if(Ma)if(da.length==4&&Ua)for(t=0;t<4;t++){ba=da[t];ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}else for(t=0;t<4;t++){ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}if(Ca&&ga)for(t=0;t<4;t++){da=ga[t];Ha[v]=da.u;Ha[v+1]=da.v;v+=2}if(Ca&&ha)for(t=0;t<4;t++){ga=ha[t];Ia[N]=
-ga.u;Ia[N+1]=ga.v;N+=2}if(La){ra[I]=s;ra[I+1]=s+1;ra[I+2]=s+2;ra[I+3]=s;ra[I+4]=s+2;ra[I+5]=s+3;I+=6;ja[ia]=s;ja[ia+1]=s+1;ja[ia+2]=s;ja[ia+3]=s+3;ja[ia+4]=s+1;ja[ia+5]=s+2;ja[ia+6]=s+2;ja[ia+7]=s+3;ia+=8;s+=4}}}if(Ka){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Z,J)}if(Oa&&sa.length){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,$,J)}if(Ma){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ma,J)}if(Na&&
-ea.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,Q,J)}if(Ca&&v>0){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ha,J)}if(Ca&&N>0){c.bindBuffer(c.ARRAY_BUFFER,o.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ia,J)}if(La){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ra,J);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ja,J)}if(p>0){c.bindBuffer(c.ARRAY_BUFFER,
-o.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,R,J);c.bindBuffer(c.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,S,J);c.bindBuffer(c.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,T,J);c.bindBuffer(c.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,U,J)}}}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(g instanceof THREE.Ribbon){i=g.geometry;if(i.__dirtyVertices||
-i.__dirtyColors){g=i;u=c.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;o=void 0;v=g.vertices;J=g.colors;N=v.length;P=J.length;I=g.__vertexArray;x=g.__colorArray;K=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<N;s++){r=v[s].position;o=s*3;I[o]=r.x;I[o+1]=r.y;I[o+2]=r.z}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,u)}if(K){for(s=0;s<P;s++){color=J[s];o=s*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,
-x,u)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.Line){i=g.geometry;if(i.__dirtyVertices||i.__dirtyColors){g=i;u=c.DYNAMIC_DRAW;s=void 0;s=void 0;r=void 0;o=void 0;v=g.vertices;J=g.colors;N=v.length;P=J.length;I=g.__vertexArray;x=g.__colorArray;K=g.__dirtyColors;if(g.__dirtyVertices){for(s=0;s<N;s++){r=v[s].position;o=s*3;I[o]=r.x;I[o+1]=r.y;I[o+2]=r.z}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,u)}if(K){for(s=0;s<P;s++){color=J[s];o=s*
-3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,u)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem){i=g.geometry;(i.__dirtyVertices||i.__dirtyColors||g.sortParticles)&&b(i,c.DYNAMIC_DRAW,g);i.__dirtyVertices=!1;i.__dirtyColors=!1}}};this.setFaceCulling=function(e,j){if(e){!j||j=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(e=="back")c.cullFace(c.BACK);else e=="front"?c.cullFace(c.FRONT):
+Ba=new THREE.Vector4,Qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ra=!0,Sa=new THREE.Color(0),Ta=0;if(a){if(a.antialias!==undefined)Ra=a.antialias;a.clearColor!==undefined&&Sa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ta=a.clearAlpha}this.domElement=fa;this.autoClear=!0;this.sortObjects=!0;(function(f,j,l){try{if(!(c=fa.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(h){console.error(h)}c.clearColor(0,
+0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(j.r,j.g,j.b,l);_cullEnabled=!0})(Ra,Sa,Ta);this.context=c;this.setSize=function(f,j){fa.width=f;fa.height=j;this.setViewport(0,0,fa.width,fa.height)};this.setViewport=function(f,j,l,h){va=f;Da=j;Ea=l;Fa=h;c.viewport(va,Da,Ea,Fa)};this.setScissor=function(f,j,l,h){c.scissor(f,j,l,h)};this.enableScissorTest=
+function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){c.depthMask(f)};this.setClearColorHex=function(f,j){var l=new THREE.Color(f);c.clearColor(l.r,l.g,l.b,j)};this.setClearColor=function(f,j){c.clearColor(f.r,f.g,f.b,j)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,j,l,h){var i;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,
+THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var t,p,s,A,r;t=A=r=0;for(p=j.length;t<p;t++){s=j[t];s instanceof THREE.DirectionalLight&&A++;s instanceof
+THREE.PointLight&&r++}if(r+A<=4)j=A;else{j=Math.ceil(4*A/(r+A));r=4-j}j={directional:j,point:r};t=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)t=h.bones.length;h=f.fragmentShader;r=f.vertexShader;t={fog:l,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:j.directional,maxPointLights:j.point,maxBones:t};l=c.createProgram();j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+t.maxDirLights,"#define MAX_POINT_LIGHTS "+
+t.maxPointLights,t.fog?"#define USE_FOG":"",t.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.lightMap?"#define USE_LIGHTMAP":"",t.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+t.maxDirLights,"#define MAX_POINT_LIGHTS "+t.maxPointLights,"#define MAX_BONES "+t.maxBones,
+t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.lightMap?"#define USE_LIGHTMAP":"",t.vertexColors?"#define USE_COLOR":"",t.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+c.attachShader(l,ca("fragment",j+h));c.attachShader(l,ca("vertex",t+r));c.linkProgram(l);c.getProgramParameter(l,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(l,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");l.uniforms={};l.attributes={};f.program=l;l=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(i in f.uniforms)l.push(i);i=f.program;h=0;for(r=l.length;h<
+r;h++){j=l[h];i.uniforms[j]=c.getUniformLocation(i,j)}i=f.program;l=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];h=0;for(r=l.length;h<r;h++){j=l[h];i.attributes[j]=c.getAttribLocation(i,j)}i=f.program.attributes;c.enableVertexAttribArray(i.position);i.color>=0&&c.enableVertexAttribArray(i.color);i.normal>=0&&c.enableVertexAttribArray(i.normal);i.tangent>=0&&c.enableVertexAttribArray(i.tangent);if(f.skinning&&i.skinVertexA>=0&&i.skinVertexB>=
+0&&i.skinIndex>=0&&i.skinWeight>=0){c.enableVertexAttribArray(i.skinVertexA);c.enableVertexAttribArray(i.skinVertexB);c.enableVertexAttribArray(i.skinIndex);c.enableVertexAttribArray(i.skinWeight)}};this.render=function(f,j,l,h){var i,t,p,s,A,r,v,J,P=f.lights,N=f.fog;j.matrixAutoUpdate&&j.update();j.matrixWorldInverse.flattenToArray(Ja);j.projectionMatrix.flattenToArray(Pa);Ga.multiply(j.projectionMatrix,j.matrixWorldInverse);n(Ga);f.update(undefined,!1,j);this.initWebGLObjects(f);X(l);(this.autoClear||
+h)&&this.clear();A=f.__webglObjects.length;for(h=0;h<A;h++){i=f.__webglObjects[h];v=i.object;if(v.visible)if(!(v instanceof THREE.Mesh)||w(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);F(v,j);D(i);i.render=!0;if(this.sortObjects){Ba.copy(v.position);Ga.multiplyVector3(Ba);i.z=Ba.z}}else i.render=!1;else i.render=!1}this.sortObjects&&f.__webglObjects.sort(E);r=f.__webglObjectsImmediate.length;for(h=0;h<r;h++){i=f.__webglObjectsImmediate[h];v=i.object;if(v.visible){v.matrixAutoUpdate&&v.matrixWorld.flattenToArray(v._objectMatrixArray);
+F(v,j);x(i)}}M(THREE.NormalBlending);for(h=0;h<A;h++){i=f.__webglObjects[h];if(i.render){v=i.object;J=i.buffer;p=i.opaque;k(v);for(i=0;i<p.count;i++){s=p.list[i];o(s.depthTest);g(j,P,N,s,J,v)}}}for(h=0;h<r;h++){i=f.__webglObjectsImmediate[h];v=i.object;if(v.visible){p=i.opaque;k(v);for(i=0;i<p.count;i++){s=p.list[i];o(s.depthTest);t=e(j,P,N,s,v);v.render(function(I){m(I,t)})}}}for(h=0;h<A;h++){i=f.__webglObjects[h];if(i.render){v=i.object;J=i.buffer;p=i.transparent;k(v);for(i=0;i<p.count;i++){s=p.list[i];
+M(s.blending);o(s.depthTest);g(j,P,N,s,J,v)}}}for(h=0;h<r;h++){i=f.__webglObjectsImmediate[h];v=i.object;if(v.visible){p=i.transparent;k(v);for(i=0;i<p.count;i++){s=p.list[i];M(s.blending);o(s.depthTest);t=e(j,P,N,s,v);v.render(function(I){m(I,t)})}}}if(l&&l.minFilter!==THREE.NearestFilter&&l.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,l.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=
+[];f.__webglObjectsImmediate=[]}for(;f.__objectsAdded.length;){var j=f.__objectsAdded[0],l=f,h=void 0,i=void 0,t=void 0;if(j._modelViewMatrix==undefined){j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.matrixWorld.flattenToArray(j._objectMatrixArray)}if(j instanceof THREE.Mesh){i=j.geometry;i.geometryGroups==undefined&&H(i);for(h in i.geometryGroups){t=i.geometryGroups[h];if(!t.__webGLVertexBuffer){var p=
+t;p.__webGLVertexBuffer=c.createBuffer();p.__webGLNormalBuffer=c.createBuffer();p.__webGLTangentBuffer=c.createBuffer();p.__webGLColorBuffer=c.createBuffer();p.__webGLUVBuffer=c.createBuffer();p.__webGLUV2Buffer=c.createBuffer();p.__webGLSkinVertexABuffer=c.createBuffer();p.__webGLSkinVertexBBuffer=c.createBuffer();p.__webGLSkinIndicesBuffer=c.createBuffer();p.__webGLSkinWeightsBuffer=c.createBuffer();p.__webGLFaceBuffer=c.createBuffer();p.__webGLLineBuffer=c.createBuffer();p=t;var s=j,A=void 0,r=
+void 0,v=0,J=0,P=0,N=s.geometry.faces,I=p.faces;A=0;for(r=I.length;A<r;A++){fi=I[A];face=N[fi];if(face instanceof THREE.Face3){v+=3;J+=1;P+=3}else if(face instanceof THREE.Face4){v+=4;J+=2;P+=4}}p.__vertexArray=new Float32Array(v*3);p.__normalArray=new Float32Array(v*3);p.__tangentArray=new Float32Array(v*4);p.__colorArray=new Float32Array(v*3);p.__uvArray=new Float32Array(v*2);p.__uv2Array=new Float32Array(v*2);p.__skinVertexAArray=new Float32Array(v*4);p.__skinVertexBArray=new Float32Array(v*4);
+p.__skinIndexArray=new Float32Array(v*4);p.__skinWeightArray=new Float32Array(v*4);p.__faceArray=new Uint16Array(J*3);p.__lineArray=new Uint16Array(P*2);r=A=p;v=void 0;N=void 0;var K=void 0,G=void 0;K=void 0;I=!1;v=0;for(N=s.materials.length;v<N;v++){K=s.materials[v];if(K instanceof THREE.MeshFaceMaterial){K=0;for(G=r.materials.length;K<G;K++)if(r.materials[K]&&r.materials[K].shading!=undefined&&r.materials[K].shading==THREE.SmoothShading){I=!0;break}}else if(K&&K.shading!=undefined&&K.shading==THREE.SmoothShading){I=
+!0;break}if(I)break}A.__needsSmoothNormals=I;p.__webGLFaceCount=J*3;p.__webGLLineCount=P*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}L(l.__webglObjects,t,j)}}else if(j instanceof THREE.Ribbon){i=j.geometry;if(!i.__webGLVertexBuffer){h=i;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=i;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLVertexCount=
+t;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(l.__webglObjects,i,j)}else if(j instanceof THREE.Line){i=j.geometry;if(!i.__webGLVertexBuffer){h=i;h.__webGLVertexBuffer=c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=i;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLLineCount=t;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(l.__webglObjects,i,j)}else if(j instanceof THREE.ParticleSystem){i=j.geometry;if(!i.__webGLVertexBuffer){h=i;h.__webGLVertexBuffer=
+c.createBuffer();h.__webGLColorBuffer=c.createBuffer();h=i;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__sortArray=[];h.__webGLParticleCount=t;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(l.__webglObjects,i,j)}else THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes&&l.__webglObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}for(;f.__objectsRemoved.length;){j=f.__objectsRemoved[0];
+l=f;i=void 0;h=void 0;for(i=l.__webglObjects.length-1;i>=0;i--){h=l.__webglObjects[i].object;j==h&&l.__webglObjects.splice(i,1)}f.__objectsRemoved.splice(0,1)}j=0;for(l=f.__webglObjects.length;j<l;j++){h=f.__webglObjects[j].object;t=void 0;i=void 0;p=void 0;if(h instanceof THREE.Mesh){i=h.geometry;for(t in i.geometryGroups){p=i.geometryGroups[t];if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){J=c.DYNAMIC_DRAW;P=void 0;A=void 0;var ha=void 0,
+u=void 0,da=void 0,ba=void 0,ga=void 0;ha=void 0;var y=void 0,B=void 0,C=void 0,O=void 0;y=void 0;B=void 0;C=void 0;u=void 0;y=void 0;B=void 0;C=void 0;O=void 0;y=void 0;B=void 0;C=void 0;O=void 0;y=void 0;B=void 0;C=void 0;O=void 0;y=void 0;B=void 0;C=void 0;O=void 0;y=void 0;B=void 0;C=void 0;O=void 0;u=void 0;ba=void 0;da=void 0;ga=void 0;var ia=G=K=I=N=v=s=r=0,W=0,q=0,Z=p.__vertexArray,Ha=p.__uvArray,Ia=p.__uv2Array,ma=p.__normalArray,Q=p.__tangentArray,$=p.__colorArray,R=p.__skinVertexAArray,
+S=p.__skinVertexBArray,T=p.__skinIndexArray,U=p.__skinWeightArray,ra=p.__faceArray,ja=p.__lineArray,Ua=p.__needsSmoothNormals,ea=h.geometry,Ka=ea.__dirtyVertices,La=ea.__dirtyElements,Ca=ea.__dirtyUvs,Ma=ea.__dirtyNormals,Na=ea.__dirtyTangents,Oa=ea.__dirtyColors,ka=ea.vertices,Va=p.faces,Wa=ea.faces,Xa=ea.uvs,Ya=ea.uvs2,sa=ea.colors,wa=ea.skinVerticesA,xa=ea.skinVerticesB,ya=ea.skinIndices,ua=ea.skinWeights;P=0;for(A=Va.length;P<A;P++){ha=Va[P];u=Wa[ha];ga=Xa[ha];ha=Ya[ha];da=u.vertexNormals;ba=
+u.normal;if(u instanceof THREE.Face3){if(Ka){y=ka[u.a].position;B=ka[u.b].position;C=ka[u.c].position;Z[s]=y.x;Z[s+1]=y.y;Z[s+2]=y.z;Z[s+3]=B.x;Z[s+4]=B.y;Z[s+5]=B.z;Z[s+6]=C.x;Z[s+7]=C.y;Z[s+8]=C.z;s+=9}if(ua.length){y=ua[u.a];B=ua[u.b];C=ua[u.c];U[q]=y.x;U[q+1]=y.y;U[q+2]=y.z;U[q+3]=y.w;U[q+4]=B.x;U[q+5]=B.y;U[q+6]=B.z;U[q+7]=B.w;U[q+8]=C.x;U[q+9]=C.y;U[q+10]=C.z;U[q+11]=C.w;y=ya[u.a];B=ya[u.b];C=ya[u.c];T[q]=y.x;T[q+1]=y.y;T[q+2]=y.z;T[q+3]=y.w;T[q+4]=B.x;T[q+5]=B.y;T[q+6]=B.z;T[q+7]=B.w;T[q+8]=
+C.x;T[q+9]=C.y;T[q+10]=C.z;T[q+11]=C.w;y=wa[u.a];B=wa[u.b];C=wa[u.c];R[q]=y.x;R[q+1]=y.y;R[q+2]=y.z;R[q+3]=1;R[q+4]=B.x;R[q+5]=B.y;R[q+6]=B.z;R[q+7]=1;R[q+8]=C.x;R[q+9]=C.y;R[q+10]=C.z;R[q+11]=1;y=xa[u.a];B=xa[u.b];C=xa[u.c];S[q]=y.x;S[q+1]=y.y;S[q+2]=y.z;S[q+3]=1;S[q+4]=B.x;S[q+5]=B.y;S[q+6]=B.z;S[q+7]=1;S[q+8]=C.x;S[q+9]=C.y;S[q+10]=C.z;S[q+11]=1;q+=12}if(Oa&&sa.length){y=sa[u.a];B=sa[u.b];C=sa[u.c];$[W]=y.r;$[W+1]=y.g;$[W+2]=y.b;$[W+3]=B.r;$[W+4]=B.g;$[W+5]=B.b;$[W+6]=C.r;$[W+7]=C.g;$[W+8]=C.b;
+W+=9}if(Na&&ea.hasTangents){y=ka[u.a].tangent;B=ka[u.b].tangent;C=ka[u.c].tangent;Q[G]=y.x;Q[G+1]=y.y;Q[G+2]=y.z;Q[G+3]=y.w;Q[G+4]=B.x;Q[G+5]=B.y;Q[G+6]=B.z;Q[G+7]=B.w;Q[G+8]=C.x;Q[G+9]=C.y;Q[G+10]=C.z;Q[G+11]=C.w;G+=12}if(Ma)if(da.length==3&&Ua)for(u=0;u<3;u++){ba=da[u];ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}else for(u=0;u<3;u++){ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}if(Ca&&ga)for(u=0;u<3;u++){da=ga[u];Ha[v]=da.u;Ha[v+1]=da.v;v+=2}if(Ca&&ha)for(u=0;u<3;u++){ga=ha[u];Ia[N]=ga.u;Ia[N+1]=ga.v;
+N+=2}if(La){ra[I]=r;ra[I+1]=r+1;ra[I+2]=r+2;I+=3;ja[ia]=r;ja[ia+1]=r+1;ja[ia+2]=r;ja[ia+3]=r+2;ja[ia+4]=r+1;ja[ia+5]=r+2;ia+=6;r+=3}}else if(u instanceof THREE.Face4){if(Ka){y=ka[u.a].position;B=ka[u.b].position;C=ka[u.c].position;O=ka[u.d].position;Z[s]=y.x;Z[s+1]=y.y;Z[s+2]=y.z;Z[s+3]=B.x;Z[s+4]=B.y;Z[s+5]=B.z;Z[s+6]=C.x;Z[s+7]=C.y;Z[s+8]=C.z;Z[s+9]=O.x;Z[s+10]=O.y;Z[s+11]=O.z;s+=12}if(ua.length){y=ua[u.a];B=ua[u.b];C=ua[u.c];O=ua[u.d];U[q]=y.x;U[q+1]=y.y;U[q+2]=y.z;U[q+3]=y.w;U[q+4]=B.x;U[q+5]=
+B.y;U[q+6]=B.z;U[q+7]=B.w;U[q+8]=C.x;U[q+9]=C.y;U[q+10]=C.z;U[q+11]=C.w;U[q+12]=O.x;U[q+13]=O.y;U[q+14]=O.z;U[q+15]=O.w;y=ya[u.a];B=ya[u.b];C=ya[u.c];O=ya[u.d];T[q]=y.x;T[q+1]=y.y;T[q+2]=y.z;T[q+3]=y.w;T[q+4]=B.x;T[q+5]=B.y;T[q+6]=B.z;T[q+7]=B.w;T[q+8]=C.x;T[q+9]=C.y;T[q+10]=C.z;T[q+11]=C.w;T[q+12]=O.x;T[q+13]=O.y;T[q+14]=O.z;T[q+15]=O.w;y=wa[u.a];B=wa[u.b];C=wa[u.c];O=wa[u.d];R[q]=y.x;R[q+1]=y.y;R[q+2]=y.z;R[q+3]=1;R[q+4]=B.x;R[q+5]=B.y;R[q+6]=B.z;R[q+7]=1;R[q+8]=C.x;R[q+9]=C.y;R[q+10]=C.z;R[q+11]=
+1;R[q+12]=O.x;R[q+13]=O.y;R[q+14]=O.z;R[q+15]=1;y=xa[u.a];B=xa[u.b];C=xa[u.c];O=xa[u.d];S[q]=y.x;S[q+1]=y.y;S[q+2]=y.z;S[q+3]=1;S[q+4]=B.x;S[q+5]=B.y;S[q+6]=B.z;S[q+7]=1;S[q+8]=C.x;S[q+9]=C.y;S[q+10]=C.z;S[q+11]=1;S[q+12]=O.x;S[q+13]=O.y;S[q+14]=O.z;S[q+15]=1;q+=16}if(Oa&&sa.length){y=sa[u.a];B=sa[u.b];C=sa[u.c];O=sa[u.d];$[W]=y.r;$[W+1]=y.g;$[W+2]=y.b;$[W+3]=B.r;$[W+4]=B.g;$[W+5]=B.b;$[W+6]=C.r;$[W+7]=C.g;$[W+8]=C.b;$[W+9]=O.r;$[W+10]=O.g;$[W+11]=O.b;W+=12}if(Na&&ea.hasTangents){y=ka[u.a].tangent;
+B=ka[u.b].tangent;C=ka[u.c].tangent;u=ka[u.d].tangent;Q[G]=y.x;Q[G+1]=y.y;Q[G+2]=y.z;Q[G+3]=y.w;Q[G+4]=B.x;Q[G+5]=B.y;Q[G+6]=B.z;Q[G+7]=B.w;Q[G+8]=C.x;Q[G+9]=C.y;Q[G+10]=C.z;Q[G+11]=C.w;Q[G+12]=u.x;Q[G+13]=u.y;Q[G+14]=u.z;Q[G+15]=u.w;G+=16}if(Ma)if(da.length==4&&Ua)for(u=0;u<4;u++){ba=da[u];ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}else for(u=0;u<4;u++){ma[K]=ba.x;ma[K+1]=ba.y;ma[K+2]=ba.z;K+=3}if(Ca&&ga)for(u=0;u<4;u++){da=ga[u];Ha[v]=da.u;Ha[v+1]=da.v;v+=2}if(Ca&&ha)for(u=0;u<4;u++){ga=ha[u];Ia[N]=
+ga.u;Ia[N+1]=ga.v;N+=2}if(La){ra[I]=r;ra[I+1]=r+1;ra[I+2]=r+2;ra[I+3]=r;ra[I+4]=r+2;ra[I+5]=r+3;I+=6;ja[ia]=r;ja[ia+1]=r+1;ja[ia+2]=r;ja[ia+3]=r+3;ja[ia+4]=r+1;ja[ia+5]=r+2;ja[ia+6]=r+2;ja[ia+7]=r+3;ia+=8;r+=4}}}if(Ka){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Z,J)}if(Oa&&sa.length){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,$,J)}if(Ma){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ma,J)}if(Na&&
+ea.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,Q,J)}if(Ca&&v>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ha,J)}if(Ca&&N>0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ia,J)}if(La){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ra,J);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ja,J)}if(q>0){c.bindBuffer(c.ARRAY_BUFFER,
+p.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,R,J);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,S,J);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,T,J);c.bindBuffer(c.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,U,J)}}}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){i=h.geometry;if(i.__dirtyVertices||
+i.__dirtyColors){h=i;t=c.DYNAMIC_DRAW;r=void 0;r=void 0;s=void 0;p=void 0;v=h.vertices;J=h.colors;N=v.length;P=J.length;I=h.__vertexArray;A=h.__colorArray;K=h.__dirtyColors;if(h.__dirtyVertices){for(r=0;r<N;r++){s=v[r].position;p=r*3;I[p]=s.x;I[p+1]=s.y;I[p+2]=s.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,t)}if(K){for(r=0;r<P;r++){color=J[r];p=r*3;A[p]=color.r;A[p+1]=color.g;A[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,
+A,t)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(h instanceof THREE.Line){i=h.geometry;if(i.__dirtyVertices||i.__dirtyColors){h=i;t=c.DYNAMIC_DRAW;r=void 0;r=void 0;s=void 0;p=void 0;v=h.vertices;J=h.colors;N=v.length;P=J.length;I=h.__vertexArray;A=h.__colorArray;K=h.__dirtyColors;if(h.__dirtyVertices){for(r=0;r<N;r++){s=v[r].position;p=r*3;I[p]=s.x;I[p+1]=s.y;I[p+2]=s.z}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,t)}if(K){for(r=0;r<P;r++){color=J[r];p=r*
+3;A[p]=color.r;A[p+1]=color.g;A[p+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,h.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,A,t)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){i=h.geometry;(i.__dirtyVertices||i.__dirtyColors||h.sortParticles)&&b(i,c.DYNAMIC_DRAW,h);i.__dirtyVertices=!1;i.__dirtyColors=!1}}};this.setFaceCulling=function(f,j){if(f){!j||j=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):
 c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
@@ -182,7 +191,7 @@ map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_
 lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
 lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
-color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
+color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
 value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
 value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
 THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
 THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",

+ 90 - 63
src/renderers/WebGLRenderer.js

@@ -251,7 +251,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function createMeshBuffers( geometryGroup ) {
+	function createMeshBuffers ( geometryGroup ) {
 
 
 		geometryGroup.__webGLVertexBuffer = _gl.createBuffer();
 		geometryGroup.__webGLVertexBuffer = _gl.createBuffer();
 		geometryGroup.__webGLNormalBuffer = _gl.createBuffer();
 		geometryGroup.__webGLNormalBuffer = _gl.createBuffer();
@@ -270,7 +270,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function initLineBuffers( geometry ) {
+	function initLineBuffers ( geometry ) {
 
 
 		var nvertices = geometry.vertices.length;
 		var nvertices = geometry.vertices.length;
 
 
@@ -281,7 +281,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function initRibbonBuffers( geometry ) {
+	function initRibbonBuffers ( geometry ) {
 
 
 		var nvertices = geometry.vertices.length;
 		var nvertices = geometry.vertices.length;
 
 
@@ -292,7 +292,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function initParticleBuffers( geometry ) {
+	function initParticleBuffers ( geometry ) {
 
 
 		var nvertices = geometry.vertices.length;
 		var nvertices = geometry.vertices.length;
 
 
@@ -305,7 +305,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function initMeshBuffers( geometryGroup, object ) {
+	function initMeshBuffers ( geometryGroup, object ) {
 
 
 		var f, fl, nvertices = 0, ntris = 0, nlines = 0,
 		var f, fl, nvertices = 0, ntris = 0, nlines = 0,
 			obj_faces = object.geometry.faces,
 			obj_faces = object.geometry.faces,
@@ -356,7 +356,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setMeshBuffers( geometryGroup, object, hint ) {
+	function setMeshBuffers ( geometryGroup, object, hint ) {
 
 
 		var f, fl, fi, face, vertexNormals, faceNormal, normal,
 		var f, fl, fi, face, vertexNormals, faceNormal, normal,
 			uv, uv2, v1, v2, v3, v4, t1, t2, t3, t4,
 			uv, uv2, v1, v2, v3, v4, t1, t2, t3, t4,
@@ -938,7 +938,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				}
 				}
 
 
-				if( dirtyElements ) {
+				if ( dirtyElements ) {
 
 
 					faceArray[ offset_face ]     = vertexIndex;
 					faceArray[ offset_face ]     = vertexIndex;
 					faceArray[ offset_face + 1 ] = vertexIndex + 1;
 					faceArray[ offset_face + 1 ] = vertexIndex + 1;
@@ -1042,7 +1042,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setLineBuffers( geometry, hint ) {
+	function setLineBuffers ( geometry, hint ) {
 
 
 		var v, c, vertex, offset,
 		var v, c, vertex, offset,
 			vertices = geometry.vertices,
 			vertices = geometry.vertices,
@@ -1096,7 +1096,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setRibbonBuffers( geometry, hint ) {
+	function setRibbonBuffers ( geometry, hint ) {
 
 
 		var v, c, vertex, offset,
 		var v, c, vertex, offset,
 			vertices = geometry.vertices,
 			vertices = geometry.vertices,
@@ -1150,7 +1150,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setParticleBuffers( geometry, hint, object ) {
+	function setParticleBuffers ( geometry, hint, object ) {
 
 
 		var v, c, vertex, offset,
 		var v, c, vertex, offset,
 			vertices = geometry.vertices,
 			vertices = geometry.vertices,
@@ -1262,7 +1262,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setMaterialShaders( material, shaders ) {
+	function setMaterialShaders ( material, shaders ) {
 
 
 		material.fragmentShader = shaders.fragmentShader;
 		material.fragmentShader = shaders.fragmentShader;
 		material.vertexShader = shaders.vertexShader;
 		material.vertexShader = shaders.vertexShader;
@@ -1270,7 +1270,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function refreshUniformsCommon( uniforms, material ) {
+	function refreshUniformsCommon ( uniforms, material ) {
 
 
 		// premultiply alpha
 		// premultiply alpha
 		uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
 		uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
@@ -1291,14 +1291,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function refreshUniformsLine( uniforms, material ) {
+	function refreshUniformsLine ( uniforms, material ) {
 
 
 		uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
 		uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
 		uniforms.opacity.value = material.opacity;
 		uniforms.opacity.value = material.opacity;
 
 
 	};
 	};
 
 
-	function refreshUniformsParticle( uniforms, material ) {
+	function refreshUniformsParticle ( uniforms, material ) {
 
 
 		uniforms.psColor.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
 		uniforms.psColor.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
 		uniforms.opacity.value = material.opacity;
 		uniforms.opacity.value = material.opacity;
@@ -1307,7 +1307,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function refreshUniformsFog( uniforms, fog ) {
+	function refreshUniformsFog ( uniforms, fog ) {
 
 
 		uniforms.fogColor.value.setHex( fog.color.hex );
 		uniforms.fogColor.value.setHex( fog.color.hex );
 
 
@@ -1324,7 +1324,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function refreshUniformsPhong( uniforms, material ) {
+	function refreshUniformsPhong ( uniforms, material ) {
 
 
 		//uniforms.ambient.value.setHex( material.ambient.hex );
 		//uniforms.ambient.value.setHex( material.ambient.hex );
 		//uniforms.specular.value.setHex( material.specular.hex );
 		//uniforms.specular.value.setHex( material.specular.hex );
@@ -1335,7 +1335,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	};
 	};
 
 
 
 
-	function refreshUniformsLights( uniforms, lights ) {
+	function refreshUniformsLights ( uniforms, lights ) {
 
 
 		uniforms.enableLighting.value = lights.directional.length + lights.point.length;
 		uniforms.enableLighting.value = lights.directional.length + lights.point.length;
 		uniforms.ambientLightColor.value = lights.ambient;
 		uniforms.ambientLightColor.value = lights.ambient;
@@ -1346,9 +1346,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	this.initMaterial = function( material, lights, fog ) {
+	this.initMaterial = function ( material, lights, fog, object ) {
 
 
-		var u, identifiers, parameters, maxLightCount;
+		var u, identifiers, parameters, maxLightCount, maxBones;
 
 
 		if ( material instanceof THREE.MeshDepthMaterial ) {
 		if ( material instanceof THREE.MeshDepthMaterial ) {
 
 
@@ -1385,9 +1385,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		maxLightCount = allocateLights( lights, 4 );
 		maxLightCount = allocateLights( lights, 4 );
 
 
+		maxBones = allocateBones( object );
+		
 		parameters = { fog: fog, map: material.map, envMap: material.envMap, lightMap: material.lightMap, vertexColors: material.vertexColors,
 		parameters = { fog: fog, map: material.map, envMap: material.envMap, lightMap: material.lightMap, vertexColors: material.vertexColors,
 					   skinning: material.skinning,
 					   skinning: material.skinning,
-					   maxDirLights: maxLightCount.directional, maxPointLights: maxLightCount.point };
+					   maxDirLights: maxLightCount.directional, maxPointLights: maxLightCount.point,
+					   maxBones: maxBones };
 
 
 		material.program = buildProgram( material.fragmentShader, material.vertexShader, parameters );
 		material.program = buildProgram( material.fragmentShader, material.vertexShader, parameters );
 
 
@@ -1426,9 +1429,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setProgram( camera, lights, fog, material, object ) {
+	function setProgram ( camera, lights, fog, material, object ) {
 
 
-		if ( !material.program ) _this.initMaterial( material, lights, fog );
+		if ( !material.program ) _this.initMaterial( material, lights, fog, object );
 
 
 		var program = material.program,
 		var program = material.program,
 			p_uniforms = program.uniforms,
 			p_uniforms = program.uniforms,
@@ -1542,7 +1545,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function renderBuffer( camera, lights, fog, material, geometryGroup, object ) {
+	function renderBuffer ( camera, lights, fog, material, geometryGroup, object ) {
 
 
 		var program, attributes, linewidth, primitives;
 		var program, attributes, linewidth, primitives;
 
 
@@ -1682,7 +1685,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function renderBufferImmediate( object, program ) {
+	function renderBufferImmediate ( object, program ) {
 
 
 		if ( ! object.__webGLVertexBuffer ) object.__webGLVertexBuffer = _gl.createBuffer();
 		if ( ! object.__webGLVertexBuffer ) object.__webGLVertexBuffer = _gl.createBuffer();
 		if ( ! object.__webGLNormalBuffer ) object.__webGLNormalBuffer = _gl.createBuffer();
 		if ( ! object.__webGLNormalBuffer ) object.__webGLNormalBuffer = _gl.createBuffer();
@@ -1711,7 +1714,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setObjectFaces( object ) {
+	function setObjectFaces ( object ) {
 
 
 		if ( _oldDoubleSided != object.doubleSided ) {
 		if ( _oldDoubleSided != object.doubleSided ) {
 
 
@@ -1747,7 +1750,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setDepthTest( test ) {
+	function setDepthTest ( test ) {
 
 
 		if ( _oldDepth != test ) {
 		if ( _oldDepth != test ) {
 
 
@@ -1767,7 +1770,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function computeFrustum( m ) {
+	function computeFrustum ( m ) {
 
 
 		_frustum[ 0 ].set( m.n41 - m.n11, m.n42 - m.n12, m.n43 - m.n13, m.n44 - m.n14 );
 		_frustum[ 0 ].set( m.n41 - m.n11, m.n42 - m.n12, m.n43 - m.n13, m.n44 - m.n14 );
 		_frustum[ 1 ].set( m.n41 + m.n11, m.n42 + m.n12, m.n43 + m.n13, m.n44 + m.n14 );
 		_frustum[ 1 ].set( m.n41 + m.n11, m.n42 + m.n12, m.n43 + m.n13, m.n44 + m.n14 );
@@ -1787,7 +1790,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function isInFrustum( object ) {
+	function isInFrustum ( object ) {
 
 
 		var distance, matrix = object.matrixWorld,
 		var distance, matrix = object.matrixWorld,
 		radius = - object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) );
 		radius = - object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) );
@@ -1803,14 +1806,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function addToFixedArray( where, what ) {
+	function addToFixedArray ( where, what ) {
 
 
 		where.list[ where.count ] = what;
 		where.list[ where.count ] = what;
 		where.count += 1;
 		where.count += 1;
 
 
 	};
 	};
 
 
-	function unrollImmediateBufferMaterials( globject ) {
+	function unrollImmediateBufferMaterials ( globject ) {
 
 
 		var i, l, m, ml, material,
 		var i, l, m, ml, material,
 			object = globject.object,
 			object = globject.object,
@@ -1833,7 +1836,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function unrollBufferMaterials( globject ) {
+	function unrollBufferMaterials ( globject ) {
 
 
 		var i, l, m, ml, material, meshMaterial,
 		var i, l, m, ml, material, meshMaterial,
 			object = globject.object,
 			object = globject.object,
@@ -1886,13 +1889,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 	};
 	};
 
 
 
 
-	function painterSort( a, b ) {
+	function painterSort ( a, b ) {
 
 
 		return b.z - a.z;
 		return b.z - a.z;
 
 
 	};
 	};
 
 
-	this.render = function( scene, camera, renderTarget, forceClear ) {
+	this.render = function ( scene, camera, renderTarget, forceClear ) {
 
 
 		var i, program, opaque, transparent, material,
 		var i, program, opaque, transparent, material,
 			o, ol, oil, webglObject, object, buffer,
 			o, ol, oil, webglObject, object, buffer,
@@ -2118,7 +2121,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setupMatrices( object, camera ) {
+	function setupMatrices ( object, camera ) {
 
 
 		object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
 		object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
 		THREE.Matrix4.makeInvert3x3( object._modelViewMatrix ).transposeIntoArray( object._normalMatrixArray );
 		THREE.Matrix4.makeInvert3x3( object._modelViewMatrix ).transposeIntoArray( object._normalMatrixArray );
@@ -2158,7 +2161,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function addObject( object, scene ) {
+	function addObject ( object, scene ) {
 
 
 		var g, geometry, geometryGroup;
 		var g, geometry, geometryGroup;
 
 
@@ -2270,7 +2273,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function updateObject( object, scene ) {
+	function updateObject ( object, scene ) {
 
 
 		var g, geometry, geometryGroup;
 		var g, geometry, geometryGroup;
 
 
@@ -2350,7 +2353,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function removeObject( object, scene ) {
+	function removeObject ( object, scene ) {
 
 
 		var o, ol, zobject;
 		var o, ol, zobject;
 
 
@@ -2368,7 +2371,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function sortFacesByMaterial( geometry ) {
+	function sortFacesByMaterial ( geometry ) {
 
 
 		// TODO
 		// TODO
 		// Should optimize by grouping faces with ColorFill / ColorStroke materials
 		// Should optimize by grouping faces with ColorFill / ColorStroke materials
@@ -2444,7 +2447,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function addBuffer( objlist, buffer, object ) {
+	function addBuffer ( objlist, buffer, object ) {
 
 
 		objlist.push( { buffer: buffer, object: object,
 		objlist.push( { buffer: buffer, object: object,
 				opaque: { list: [], count: 0 },
 				opaque: { list: [], count: 0 },
@@ -2453,7 +2456,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function addBufferImmediate( objlist, object ) {
+	function addBufferImmediate ( objlist, object ) {
 
 
 		objlist.push( { object: object,
 		objlist.push( { object: object,
 				opaque: { list: [], count: 0 },
 				opaque: { list: [], count: 0 },
@@ -2462,7 +2465,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	this.setFaceCulling = function( cullFace, frontFace ) {
+	this.setFaceCulling = function ( cullFace, frontFace ) {
 
 
 		if ( cullFace ) {
 		if ( cullFace ) {
 
 
@@ -2500,19 +2503,19 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	this.supportsVertexTextures = function() {
+	this.supportsVertexTextures = function () {
 
 
 		return maxVertexTextures() > 0;
 		return maxVertexTextures() > 0;
 
 
 	};
 	};
 
 
-	function maxVertexTextures() {
+	function maxVertexTextures () {
 
 
 		return _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
 		return _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
 
 
 	};
 	};
 
 
-	function initGL( antialias, clearColor, clearAlpha ) {
+	function initGL ( antialias, clearColor, clearAlpha ) {
 
 
 		try {
 		try {
 
 
@@ -2546,7 +2549,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function buildProgram( fragmentShader, vertexShader, parameters ) {
+	function buildProgram ( fragmentShader, vertexShader, parameters ) {
 
 
 		var program = _gl.createProgram(),
 		var program = _gl.createProgram(),
 
 
@@ -2577,6 +2580,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 			"#define MAX_DIR_LIGHTS " + parameters.maxDirLights,
 			"#define MAX_DIR_LIGHTS " + parameters.maxDirLights,
 			"#define MAX_POINT_LIGHTS " + parameters.maxPointLights,
 			"#define MAX_POINT_LIGHTS " + parameters.maxPointLights,
 
 
+			"#define MAX_BONES " + parameters.maxBones,
+
 			parameters.map ? "#define USE_MAP" : "",
 			parameters.map ? "#define USE_MAP" : "",
 			parameters.envMap ? "#define USE_ENVMAP" : "",
 			parameters.envMap ? "#define USE_ENVMAP" : "",
 			parameters.lightMap ? "#define USE_LIGHTMAP" : "",
 			parameters.lightMap ? "#define USE_LIGHTMAP" : "",
@@ -2630,21 +2635,21 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function loadUniformsSkinning( uniforms, object ) {
+	function loadUniformsSkinning ( uniforms, object ) {
 
 
 		_gl.uniformMatrix4fv( uniforms.cameraInverseMatrix, false, _viewMatrixArray );
 		_gl.uniformMatrix4fv( uniforms.cameraInverseMatrix, false, _viewMatrixArray );
 		_gl.uniformMatrix4fv( uniforms.boneGlobalMatrices, false, object.boneMatrices );
 		_gl.uniformMatrix4fv( uniforms.boneGlobalMatrices, false, object.boneMatrices );
 
 
 	};
 	};
 
 
-	function loadUniformsMatrices( uniforms, object ) {
+	function loadUniformsMatrices ( uniforms, object ) {
 
 
 		_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrixArray );
 		_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrixArray );
 		_gl.uniformMatrix3fv( uniforms.normalMatrix, false, object._normalMatrixArray );
 		_gl.uniformMatrix3fv( uniforms.normalMatrix, false, object._normalMatrixArray );
 
 
 	};
 	};
 
 
-	function loadUniformsGeneric( program, uniforms ) {
+	function loadUniformsGeneric ( program, uniforms ) {
 
 
 		var u, uniform, value, type, location, texture;
 		var u, uniform, value, type, location, texture;
 
 
@@ -2710,7 +2715,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setBlending( blending ) {
+	function setBlending ( blending ) {
 
 
 		if ( blending != _oldBlending ) {
 		if ( blending != _oldBlending ) {
 
 
@@ -2758,7 +2763,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setTextureParameters( textureType, texture, image ) {
+	function setTextureParameters ( textureType, texture, image ) {
 
 
 		if ( isPowerOfTwo( image.width ) && isPowerOfTwo( image.height ) ) {
 		if ( isPowerOfTwo( image.width ) && isPowerOfTwo( image.height ) ) {
 
 
@@ -2782,7 +2787,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 	
 	
-	function setTexture( texture, slot ) {
+	function setTexture ( texture, slot ) {
 
 
 		if ( texture.needsUpdate ) {
 		if ( texture.needsUpdate ) {
 
 
@@ -2814,7 +2819,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setCubeTexture( texture, slot ) {
+	function setCubeTexture ( texture, slot ) {
 
 
 		if ( texture.image.length == 6 ) {
 		if ( texture.image.length == 6 ) {
 
 
@@ -2860,7 +2865,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function setRenderTarget( renderTexture ) {
+	function setRenderTarget ( renderTexture ) {
 
 
 		if ( renderTexture && !renderTexture.__webGLFramebuffer ) {
 		if ( renderTexture && !renderTexture.__webGLFramebuffer ) {
 
 
@@ -2923,7 +2928,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function updateRenderTargetMipmap( renderTarget ) {
+	function updateRenderTargetMipmap ( renderTarget ) {
 
 
 		_gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webGLTexture );
 		_gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webGLTexture );
 		_gl.generateMipmap( _gl.TEXTURE_2D );
 		_gl.generateMipmap( _gl.TEXTURE_2D );
@@ -2931,7 +2936,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function cacheUniformLocations( program, identifiers ) {
+	function cacheUniformLocations ( program, identifiers ) {
 
 
 		var i, l, id;
 		var i, l, id;
 
 
@@ -2944,7 +2949,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function cacheAttributeLocations( program, identifiers ) {
+	function cacheAttributeLocations ( program, identifiers ) {
 
 
 		var i, l, id;
 		var i, l, id;
 
 
@@ -2957,7 +2962,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function getShader( type, string ) {
+	function getShader ( type, string ) {
 
 
 		var shader;
 		var shader;
 
 
@@ -3003,7 +3008,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		
 		
 	};
 	};
 	
 	
-	function paramThreeToGL( p ) {
+	function paramThreeToGL ( p ) {
 
 
 		switch ( p ) {
 		switch ( p ) {
 
 
@@ -3039,19 +3044,19 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function isPowerOfTwo( value ) {
+	function isPowerOfTwo ( value ) {
 
 
 		return ( value & ( value - 1 ) ) == 0;
 		return ( value & ( value - 1 ) ) == 0;
 
 
 	};
 	};
 
 
-	function materialNeedsSmoothNormals( material ) {
+	function materialNeedsSmoothNormals ( material ) {
 
 
 		return material && material.shading != undefined && material.shading == THREE.SmoothShading;
 		return material && material.shading != undefined && material.shading == THREE.SmoothShading;
 
 
 	};
 	};
 
 
-	function bufferNeedsSmoothNormals( geometryGroup, object ) {
+	function bufferNeedsSmoothNormals ( geometryGroup, object ) {
 
 
 		var m, ml, i, l, meshMaterial, needsSmoothNormals = false;
 		var m, ml, i, l, meshMaterial, needsSmoothNormals = false;
 
 
@@ -3091,7 +3096,29 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	function allocateLights( lights, maxLights ) {
+	function allocateBones ( object ) {
+		
+		// default for when object is not specified
+		// ( for example when prebuilding shader
+		//   to be used with multiple objects )
+		//
+		// 	- leave some extra space for other uniforms
+		//  - limit here is ANGLE's 254 max uniform vectors
+		//    (up to 54 should be safe)
+		
+		var maxBones = 50;
+		
+		if ( object !== undefined && object instanceof THREE.SkinnedMesh ) {
+			
+			maxBones = object.bones.length;
+
+		}
+
+		return maxBones;
+		
+	};
+	
+	function allocateLights ( lights, maxLights ) {
 
 
 		var l, ll, light, dirLights, pointLights, maxDirLights, maxPointLights;
 		var l, ll, light, dirLights, pointLights, maxDirLights, maxPointLights;
 		dirLights = pointLights = maxDirLights = maxPointLights = 0;
 		dirLights = pointLights = maxDirLights = maxPointLights = 0;
@@ -3582,7 +3609,7 @@ THREE.Snippets = {
 
 
 	"#ifdef USE_SKINNING",
 	"#ifdef USE_SKINNING",
 
 
-		"uniform mat4 boneGlobalMatrices[20];",
+		"uniform mat4 boneGlobalMatrices[ MAX_BONES ];",
 
 
 	"#endif"
 	"#endif"
 
 

+ 3 - 0
utils/build.py

@@ -259,7 +259,10 @@ WEBGL_FILES = [
 'objects/Line.js',
 'objects/Line.js',
 'objects/Mesh.js',
 'objects/Mesh.js',
 'objects/Bone.js',
 'objects/Bone.js',
+'objects/SkinnedMesh.js',
+'objects/Ribbon.js',
 'objects/Sound.js',
 'objects/Sound.js',
+'objects/LOD.js',
 'scenes/Scene.js',
 'scenes/Scene.js',
 'scenes/Fog.js',
 'scenes/Fog.js',
 'scenes/FogExp2.js',
 'scenes/FogExp2.js',