Browse Source

Added overrideMaterial property to Scene. If set, the material will be the only material used in WebGLRenderer.render(...). Set to null to disable.

Sven Andersson 14 years ago
parent
commit
2eb7f7a2a6
3 changed files with 360 additions and 310 deletions
  1. 223 222
      build/Three.js
  2. 70 68
      build/custom/ThreeWebGL.js
  3. 67 20
      src/renderers/WebGLRenderer.js

+ 223 - 222
build/Three.js

@@ -14,33 +14,33 @@ THREE.Vector4.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w
 b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,d){return b.distance-d.distance});return e},intersectObject:function(b){function c(b,d,c){var e;e=c.position.clone().subSelf(b).dot(d);b=b.clone().addSelf(d.clone().multiplyScalar(e));return c.position.distanceTo(b)}function d(b,d,c,e){var e=e.clone().subSelf(d),c=c.clone().subSelf(d),
-f=b.clone().subSelf(d),b=e.dot(e),d=e.dot(c),e=e.dot(f),g=c.dot(c),c=c.dot(f),f=1/(b*g-d*d),g=(g*e-d*c)*f,b=(b*c-d*e)*f;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);if(!e||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var f,g,j,k,m,o,n,p,t,u,v=b.geometry,
-z=v.vertices,A=[],e=0;for(f=v.faces.length;e<f;e++)if(g=v.faces[e],t=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(z[g.a].position.clone()),k=o.multiplyVector3(z[g.b].position.clone()),m=o.multiplyVector3(z[g.c].position.clone()),o=g instanceof THREE.Face4?o.multiplyVector3(z[g.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),p=u.dot(n),b.doubleSided||(b.flipSided?p>0:p<0))if(n=n.dot((new THREE.Vector3).sub(j,t))/p,t=t.addSelf(u.multiplyScalar(n)),
-g instanceof THREE.Face3)d(t,j,k,m)&&(g={distance:this.origin.distanceTo(t),point:t,face:g,object:b},A.push(g));else if(g instanceof THREE.Face4&&(d(t,j,k,o)||d(t,k,m,o)))g={distance:this.origin.distanceTo(t),point:t,face:g,object:b},A.push(g);return A}else return[]}};
-THREE.Rectangle=function(){function b(){g=e-c;j=f-d}var c,d,e,f,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,n,p){k=!1;c=g;d=j;e=n;f=p;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,f=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,f=f>j?f:j);b()};this.add3Points=
-function(g,j,n,p,t,u){k?(k=!1,c=g<n?g<t?g:t:n<t?n:t,d=j<p?j<u?j:u:p<u?p:u,e=g>n?g>t?g:t:n>t?n:t,f=j>p?j>u?j:u:p>u?p:u):(c=g<n?g<t?g<c?g:c:t<c?t:c:n<t?n<c?n:c:t<c?t:c,d=j<p?j<u?j<d?j:d:u<d?u:d:p<u?p<d?p:d:u<d?u:d,e=g>n?g>t?g>e?g:e:t>e?t:e:n>t?n>e?n:e:t>e?t:e,f=j>p?j>u?j>f?j:f:u>f?u:f:p>u?p>f?p:f:u>f?u:f);b()};this.addRectangle=function(g){k?(k=!1,c=g.getLeft(),d=g.getTop(),e=g.getRight(),f=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),d=d<g.getTop()?d:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
+f=b.clone().subSelf(d),b=e.dot(e),d=e.dot(c),e=e.dot(f),g=c.dot(c),c=c.dot(f),f=1/(b*g-d*d),g=(g*e-d*c)*f,b=(b*c-d*e)*f;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);if(!e||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var f,g,j,k,m,n,o,p,t,u,v=b.geometry,
+z=v.vertices,A=[],e=0;for(f=v.faces.length;e<f;e++)if(g=v.faces[e],t=this.origin.clone(),u=this.direction.clone(),n=b.matrixWorld,j=n.multiplyVector3(z[g.a].position.clone()),k=n.multiplyVector3(z[g.b].position.clone()),m=n.multiplyVector3(z[g.c].position.clone()),n=g instanceof THREE.Face4?n.multiplyVector3(z[g.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),p=u.dot(o),b.doubleSided||(b.flipSided?p>0:p<0))if(o=o.dot((new THREE.Vector3).sub(j,t))/p,t=t.addSelf(u.multiplyScalar(o)),
+g instanceof THREE.Face3)d(t,j,k,m)&&(g={distance:this.origin.distanceTo(t),point:t,face:g,object:b},A.push(g));else if(g instanceof THREE.Face4&&(d(t,j,k,n)||d(t,k,m,n)))g={distance:this.origin.distanceTo(t),point:t,face:g,object:b},A.push(g);return A}else return[]}};
+THREE.Rectangle=function(){function b(){g=e-c;j=f-d}var c,d,e,f,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,o,p){k=!1;c=g;d=j;e=o;f=p;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,f=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,f=f>j?f:j);b()};this.add3Points=
+function(g,j,o,p,t,u){k?(k=!1,c=g<o?g<t?g:t:o<t?o:t,d=j<p?j<u?j:u:p<u?p:u,e=g>o?g>t?g:t:o>t?o:t,f=j>p?j>u?j:u:p>u?p:u):(c=g<o?g<t?g<c?g:c:t<c?t:c:o<t?o<c?o:c:t<c?t:c,d=j<p?j<u?j<d?j:d:u<d?u:d:p<u?p<d?p:d:u<d?u:d,e=g>o?g>t?g>e?g:e:t>e?t:e:o>t?o>e?o:e:t>e?t:e,f=j>p?j>u?j>f?j:f:u>f?u:f:p>u?p>f?p:f:u>f?u:f);b()};this.addRectangle=function(g){k?(k=!1,c=g.getLeft(),d=g.getTop(),e=g.getRight(),f=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),d=d<g.getTop()?d:g.getTop(),e=e>g.getRight()?e:g.getRight(),f=f>
 g.getBottom()?f:g.getBottom());b()};this.inflate=function(g){c-=g;d-=g;e+=g;f+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(f,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;f=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,f,g,j,k,m,o,n,p,t,u,v,z){this.set(b||1,c||0,d||0,e||0,f||0,g||1,j||0,k||0,m||0,o||0,n||1,p||0,t||0,u||0,v||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,d,e,f,g,j,k,m,o,n,p,t,u,v,z){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=n;this.n34=p;this.n41=t;this.n42=u;this.n43=v;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1,
+THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,f,g,j,k,m,n,o,p,t,u,v,z){this.set(b||1,c||0,d||0,e||0,f||0,g||1,j||0,k||0,m||0,n||0,o||1,p||0,t||0,u||0,v||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,d,e,f,g,j,k,m,n,o,p,t,u,v,z){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=n;this.n33=o;this.n34=p;this.n41=t;this.n42=u;this.n43=v;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;e.cross(d,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(d,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;b.y=(this.n21*c+this.n22*d+this.n23*
 e+this.n24)*f;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,f=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*f;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+d*this.n32+e*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,x=b.n44,G=c.n11,y=c.n12,D=c.n13,F=c.n14,B=c.n21,P=c.n22,
-K=c.n23,L=c.n24,E=c.n31,M=c.n32,T=c.n33,h=c.n34;this.n11=d*G+e*B+f*E;this.n12=d*y+e*P+f*M;this.n13=d*D+e*K+f*T;this.n14=d*F+e*L+f*h+g;this.n21=j*G+k*B+m*E;this.n22=j*y+k*P+m*M;this.n23=j*D+k*K+m*T;this.n24=j*F+k*L+m*h+o;this.n31=n*G+p*B+t*E;this.n32=n*y+p*P+t*M;this.n33=n*D+p*K+t*T;this.n34=n*F+p*L+t*h+u;this.n41=v*G+z*B+A*E;this.n42=v*y+z*P+A*M;this.n43=v*D+z*K+A*T;this.n44=v*F+z*L+A*h+x;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,o=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,x=b.n44,G=c.n11,y=c.n12,D=c.n13,F=c.n14,B=c.n21,P=c.n22,
+L=c.n23,K=c.n24,E=c.n31,M=c.n32,T=c.n33,h=c.n34;this.n11=d*G+e*B+f*E;this.n12=d*y+e*P+f*M;this.n13=d*D+e*L+f*T;this.n14=d*F+e*K+f*h+g;this.n21=j*G+k*B+m*E;this.n22=j*y+k*P+m*M;this.n23=j*D+k*L+m*T;this.n24=j*F+k*K+m*h+n;this.n31=o*G+p*B+t*E;this.n32=o*y+p*P+t*M;this.n33=o*D+p*L+t*T;this.n34=o*F+p*K+t*h+u;this.n41=v*G+z*B+A*E;this.n42=v*y+z*P+A*M;this.n43=v*D+z*L+A*T;this.n44=v*F+z*K+A*h+x;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=
 this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
-this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,n=this.n33,p=this.n34,t=this.n41,u=this.n42,v=this.n43,z=this.n44;return e*j*o*t-d*k*o*t-e*g*n*t+c*k*n*t+d*g*p*t-c*j*p*t-e*j*m*u+d*k*m*u+e*f*n*u-b*k*n*u-d*f*p*u+b*j*p*u+e*g*m*v-c*k*m*v-e*f*o*v+b*k*o*v+c*f*p*v-b*g*p*v-d*g*m*z+c*j*m*z+d*f*o*z-b*j*o*z-c*f*n*z+b*g*n*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
+this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,n=this.n32,o=this.n33,p=this.n34,t=this.n41,u=this.n42,v=this.n43,z=this.n44;return e*j*n*t-d*k*n*t-e*g*o*t+c*k*o*t+d*g*p*t-c*j*p*t-e*j*m*u+d*k*m*u+e*f*o*u-b*k*o*u-d*f*p*u+b*j*p*u+e*g*m*v-c*k*m*v-e*f*n*v+b*k*n*v+c*f*p*v-b*g*p*v-d*g*m*z+c*j*m*z+d*f*n*z-b*j*n*z-c*f*o*z+b*g*o*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
 this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
 this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
 this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,
-c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,g=b.x,j=b.y,k=b.z,m=f*g,o=f*j;this.set(m*
-g+d,m*j-e*k,m*k+e*j,0,m*j+e*k,o*j+d,o*k-e*g,0,m*k-e*j,o*k+e*g,f*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,g=b.x,j=b.y,k=b.z,m=f*g,n=f*j;this.set(m*
+g+d,m*j-e*k,m*k+e*j,0,m*j+e*k,n*j+d,n*k-e*g,0,m*k-e*j,n*k+e*g,f*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
 this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=f*g;this.n12=-f*e;this.n13=d;this.n21=k*g+b*e;this.n22=-k*e+b*g;this.n23=-c*f;this.n31=-j*g+c*e;this.n32=j*e+c*g;this.n33=b*f;return this},
-setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,g=c+c,j=d+d,k=e+e,b=c*g,m=c*j;c*=k;var o=d*j;d*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(o+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
+setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,g=c+c,j=d+d,k=e+e,b=c*g,m=c*j;c*=k;var n=d*j;d*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(n+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,f=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*f;this.n23=b.n23*f;this.n33=b.n33*f}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,n=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*z-o*t*z+o*p*A-k*u*A-m*p*x+k*t*x;c.n12=g*t*z-f*u*z-g*p*A+e*u*A+f*p*x-e*t*x;c.n13=f*o*z-g*m*z+g*k*A-e*o*A-f*k*x+e*m*x;c.n14=g*m*p-f*o*p-g*k*t+e*o*t+f*k*u-e*m*u;c.n21=o*t*v-m*u*v-o*n*A+j*u*A+m*n*x-j*t*x;c.n22=f*u*v-g*t*v+g*n*A-d*u*A-f*n*x+d*t*x;c.n23=g*m*v-f*o*v-g*j*A+d*o*A+f*j*x-d*m*x;c.n24=
-f*o*n-g*m*n+g*j*t-d*o*t-f*j*u+d*m*u;c.n31=k*u*v-o*p*v+o*n*z-j*u*z-k*n*x+j*p*x;c.n32=g*p*v-e*u*v-g*n*z+d*u*z+e*n*x-d*p*x;c.n33=f*o*v-g*k*v+g*j*z-d*o*z-e*j*x+d*k*x;c.n34=g*k*n-e*o*n-g*j*p+d*o*p+e*j*u-d*k*u;c.n41=m*p*v-k*t*v-m*n*z+j*t*z+k*n*A-j*p*A;c.n42=e*t*v-f*p*v+f*n*z-d*t*z-e*n*A+d*p*A;c.n43=f*k*v-e*m*v-f*j*z+d*m*z+e*j*A-d*k*A;c.n44=e*m*n-f*k*n+f*j*p-d*m*p-e*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*o;d[7]=b*n;d[8]=b*p;return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,m=b.n23,n=b.n24,o=b.n31,p=b.n32,t=b.n33,u=b.n34,v=b.n41,z=b.n42,A=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=m*u*z-n*t*z+n*p*A-k*u*A-m*p*x+k*t*x;c.n12=g*t*z-f*u*z-g*p*A+e*u*A+f*p*x-e*t*x;c.n13=f*n*z-g*m*z+g*k*A-e*n*A-f*k*x+e*m*x;c.n14=g*m*p-f*n*p-g*k*t+e*n*t+f*k*u-e*m*u;c.n21=n*t*v-m*u*v-n*o*A+j*u*A+m*o*x-j*t*x;c.n22=f*u*v-g*t*v+g*o*A-d*u*A-f*o*x+d*t*x;c.n23=g*m*v-f*n*v-g*j*A+d*n*A+f*j*x-d*m*x;c.n24=
+f*n*o-g*m*o+g*j*t-d*n*t-f*j*u+d*m*u;c.n31=k*u*v-n*p*v+n*o*z-j*u*z-k*o*x+j*p*x;c.n32=g*p*v-e*u*v-g*o*z+d*u*z+e*o*x-d*p*x;c.n33=f*n*v-g*k*v+g*j*z-d*n*z-e*j*x+d*k*x;c.n34=g*k*o-e*n*o-g*j*p+d*n*p+e*j*u-d*k*u;c.n41=m*p*v-k*t*v-m*o*z+j*t*z+k*o*A-j*p*A;c.n42=e*t*v-f*p*v+f*o*z-d*t*z-e*o*A+d*p*A;c.n43=f*k*v-e*m*v-f*j*z+d*m*z+e*j*A-d*k*A;c.n44=e*m*o-f*k*o+f*j*p-d*m*p-e*j*t+d*k*t;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*n;d[7]=b*o;d[8]=b*p;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,e,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var f,b=d*Math.tan(b*Math.PI/360);f=-b;return THREE.Matrix4.makeFrustum(f*c,b*c,f,b,d,e)};
-THREE.Matrix4.makeOrtho=function(b,c,d,e,f,g){var j,k,m,o;j=new THREE.Matrix4;k=c-b;m=d-e;o=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((g+f)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(b,c,d,e,f,g){var j,k,m,n;j=new THREE.Matrix4;k=c-b;m=d-e;n=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+e)/m);j.n31=0;j.n32=0;j.n33=-2/n;j.n34=-((g+f)/n);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=
 0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
@@ -49,8 +49,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,e=this.children.length;b<e;b++)this.children[b].update(this.matrixWorld,c,d)}};THREE.Quaternion=function(b,c,d,e){this.set(b||0,c||0,d||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,f=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-f),f=Math.sin(-f),g=Math.cos(d),d=Math.sin(d),j=b*c,k=e*f;this.w=j*g-k*d;this.x=j*d+k*g;this.y=e*c*g+b*f*d;this.z=b*f*g-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);this.x=b.x*e;this.y=b.y*
 e;this.z=b.z*e;this.w=Math.cos(d);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
-multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,f=this.w,g=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+f*g+d*k-e*j;this.y=d*b+f*j+e*g-c*k;this.z=e*b+f*k+c*j-d*g;this.w=f*b-c*g-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,f=b.z,g=this.x,j=this.y,k=this.z,m=this.w,o=m*d+j*f-k*e,n=
-m*e+k*d-g*f,p=m*f+g*e-j*d,d=-g*d-j*e-k*f;c.x=o*m+d*-g+n*-k-p*-j;c.y=n*m+d*-j+p*-g-o*-k;c.z=p*m+d*-k+o*-j-n*-g;return c}};
+multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,f=this.w,g=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+f*g+d*k-e*j;this.y=d*b+f*j+e*g-c*k;this.z=e*b+f*k+c*j-d*g;this.w=f*b-c*g-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,f=b.z,g=this.x,j=this.y,k=this.z,m=this.w,n=m*d+j*f-k*e,o=
+m*e+k*d-g*f,p=m*f+g*e-j*d,d=-g*d-j*e-k*f;c.x=n*m+d*-g+o*-k-p*-j;c.y=o*m+d*-j+p*-g-n*-k;c.z=p*m+d*-k+n*-j-o*-g;return c}};
 THREE.Quaternion.slerp=function(b,c,d,e){var f=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(f)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var g=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;f=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,d,e,f,g){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,e,f,g,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
@@ -59,16 +59,16 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.f
 d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,f,g,j,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(b&&g.vertexNormals.length){k.set(0,0,0);c=0;for(d=g.vertexNormals.length;c<d;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[g.a],d=this.vertices[g.b],j=this.vertices[g.c],k.sub(j.position,d.position),m.sub(c.position,d.position),k.crossSelf(m);k.isZero()||
 k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),
-d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,d,c,e,h,f,g){k=b.vertices[d].position;m=b.vertices[c].position;o=b.vertices[e].position;n=j[h];p=j[f];t=j[g];u=m.x-k.x;v=o.x-k.x;z=m.y-k.y;A=o.y-k.y;x=m.z-k.z;G=o.z-k.z;y=p.u-n.u;D=t.u-n.u;F=p.v-n.v;B=t.v-n.v;P=1/(y*B-D*F);M.set((B*u-F*v)*
-P,(B*z-F*A)*P,(B*x-F*G)*P);T.set((y*v-D*u)*P,(y*A-D*z)*P,(y*G-D*x)*P);L[d].addSelf(M);L[c].addSelf(M);L[e].addSelf(M);E[d].addSelf(T);E[c].addSelf(T);E[e].addSelf(T)}var c,d,e,f,g,j,k,m,o,n,p,t,u,v,z,A,x,G,y,D,F,B,P,K,L=[],E=[],M=new THREE.Vector3,T=new THREE.Vector3,h=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)L[c]=new THREE.Vector3,E[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],g instanceof
-THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var N=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++)R.copy(g.vertexNormals[e]),f=g[N[e]],K=L[f],h.copy(K),h.subSelf(R.multiplyScalar(R.dot(K))).normalize(),Q.cross(g.vertexNormals[e],K),f=Q.dot(E[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(h.x,h.y,h.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,d,c,e,h,f,g){k=b.vertices[d].position;m=b.vertices[c].position;n=b.vertices[e].position;o=j[h];p=j[f];t=j[g];u=m.x-k.x;v=n.x-k.x;z=m.y-k.y;A=n.y-k.y;x=m.z-k.z;G=n.z-k.z;y=p.u-o.u;D=t.u-o.u;F=p.v-o.v;B=t.v-o.v;P=1/(y*B-D*F);M.set((B*u-F*v)*
+P,(B*z-F*A)*P,(B*x-F*G)*P);T.set((y*v-D*u)*P,(y*A-D*z)*P,(y*G-D*x)*P);K[d].addSelf(M);K[c].addSelf(M);K[e].addSelf(M);E[d].addSelf(T);E[c].addSelf(T);E[e].addSelf(T)}var c,d,e,f,g,j,k,m,n,o,p,t,u,v,z,A,x,G,y,D,F,B,P,L,K=[],E=[],M=new THREE.Vector3,T=new THREE.Vector3,h=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)K[c]=new THREE.Vector3,E[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],g instanceof
+THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var N=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++)R.copy(g.vertexNormals[e]),f=g[N[e]],L=K[f],h.copy(L),h.subSelf(R.multiplyScalar(R.dot(L))).normalize(),Q.cross(g.vertexNormals[e],L),f=Q.dot(E[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(h.x,h.y,h.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function c(b,d,c){b[d]===
 void 0?(b[d]={set:{},array:[]},b[d].set[c]=1,b[d].array.push(c)):b[d].set[c]===void 0&&(b[d].set[c]=1,b[d].array.push(c))}var d,e,f,g,j,k={};d=0;for(e=this.faces.length;d<e;d++)j=this.faces[d],j instanceof THREE.Face3?(f=b(j.a,j.b),c(k,f,d),f=b(j.b,j.c),c(k,f,d),f=b(j.a,j.c),c(k,f,d)):j instanceof THREE.Face4&&(f=b(j.b,j.d),c(k,f,d),f=b(j.a,j.b),c(k,f,d),f=b(j.a,j.d),c(k,f,d),f=b(j.b,j.c),c(k,f,d),f=b(j.c,j.d),c(k,f,d));d=0;for(e=this.edges.length;d<e;d++){j=this.edges[d];f=j.vertexIndices[0];g=j.vertexIndices[1];
 j.faceIndices=k[b(f,g)].array;for(f=0;f<j.faceIndices.length;f++)g=j.faceIndices[f],j.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,d,c,e,f,g,j){b=(c-b)*0.5;e=(e-d)*0.5;return(2*(d-c)+b+e)*j+(-3*(d-c)-2*b-e)*g+b*f+d}this.points=b;var d=[],e={x:0,y:0,z:0},f,g,j,k,m,o,n,p,t;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){f=(this.points.length-1)*b;g=Math.floor(f);j=f-g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;o=this.points[d[0]];n=this.points[d[1]];
-p=this.points[d[2]];t=this.points[d[3]];k=j*j;m=j*k;e.x=c(o.x,n.x,p.x,t.x,j,k,m);e.y=c(o.y,n.y,p.y,t.y,j,k,m);e.z=c(o.z,n.z,p.z,t.z,j,k,m);return e};this.getControlPointsArray=function(){var b,d,c=this.points.length,e=[];for(b=0;b<c;b++)d=this.points[b],e[b]=[d.x,d.y,d.z];return e};this.getLength=function(b){var d,c,e=d=d=0,f=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);c=this.points.length*b;f.copy(this.points[0]);for(b=1;b<c;b++)d=b/c,position=this.getPoint(d),g.copy(position),
-k+=g.distanceTo(f),f.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=e&&(j[d]=k,e=d);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var d,c,e,f,g,j,k=[],m=new THREE.Vector3,o=this.getLength();k.push(m.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){c=o.chunks[d]-o.chunks[d-1];j=Math.ceil(b*c/o.total);f=(d-1)/(this.points.length-1);g=d/(this.points.length-1);for(c=1;c<j-1;c++)e=f+c*(1/j)*(g-f),position=this.getPoint(e),k.push(m.copy(position).clone());
+THREE.Spline=function(b){function c(b,d,c,e,f,g,j){b=(c-b)*0.5;e=(e-d)*0.5;return(2*(d-c)+b+e)*j+(-3*(d-c)-2*b-e)*g+b*f+d}this.points=b;var d=[],e={x:0,y:0,z:0},f,g,j,k,m,n,o,p,t;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){f=(this.points.length-1)*b;g=Math.floor(f);j=f-g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;n=this.points[d[0]];o=this.points[d[1]];
+p=this.points[d[2]];t=this.points[d[3]];k=j*j;m=j*k;e.x=c(n.x,o.x,p.x,t.x,j,k,m);e.y=c(n.y,o.y,p.y,t.y,j,k,m);e.z=c(n.z,o.z,p.z,t.z,j,k,m);return e};this.getControlPointsArray=function(){var b,d,c=this.points.length,e=[];for(b=0;b<c;b++)d=this.points[b],e[b]=[d.x,d.y,d.z];return e};this.getLength=function(b){var d,c,e=d=d=0,f=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);c=this.points.length*b;f.copy(this.points[0]);for(b=1;b<c;b++)d=b/c,position=this.getPoint(d),g.copy(position),
+k+=g.distanceTo(f),f.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=e&&(j[d]=k,e=d);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var d,c,e,f,g,j,k=[],m=new THREE.Vector3,n=this.getLength();k.push(m.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){c=n.chunks[d]-n.chunks[d-1];j=Math.ceil(b*c/n.total);f=(d-1)/(this.points.length-1);g=d/(this.points.length-1);for(c=1;c<j-1;c++)e=f+c*(1/j)*(g-f),position=this.getPoint(e),k.push(m.copy(position).clone());
 k.push(m.copy(this.points[d]).clone())}this.points=k}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,f){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
@@ -126,13 +126,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(b>=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(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,d,e,f,g,j,k,m,o,n,p,t,u,v=new THREE.Geometry;v.vertices=this.geometry.vertices;e=v.faces=this.geometry.faces;var z=v.egdes=this.geometry.edges,A=v.edgeFaces=[];f=0;var x=[];b=0;for(c=e.length;b<c;b++)if(d=e[b],x.push(f),f+=d instanceof THREE.Face3?3:4,d.vertexNormals[0]=d.normal,d.vertexNormals[1]=d.normal,d.vertexNormals[2]=d.normal,d instanceof THREE.Face4)d.vertexNormals[3]=
-d.normal;b=0;for(c=z.length;b<c;b++)k=z[b],d=k.faces[0],e=k.faces[1],f=k.faceIndices[0],g=k.faceIndices[1],j=k.vertexIndices[0],k=k.vertexIndices[1],d.a===j?(m="a",n=x[f]+0):d.b===j?(m="b",n=x[f]+1):d.c===j?(m="c",n=x[f]+2):d.d===j&&(m="d",n=x[f]+3),d.a===k?(m+="a",p=x[f]+0):d.b===k?(m+="b",p=x[f]+1):d.c===k?(m+="c",p=x[f]+2):d.d===k&&(m+="d",p=x[f]+3),e.a===j?(o="a",t=x[g]+0):e.b===j?(o="b",t=x[g]+1):e.c===j?(o="c",t=x[g]+2):e.d===j&&(o="d",t=x[g]+3),e.a===k?(o+="a",u=x[g]+0):e.b===k?(o+="b",u=x[g]+
-1):e.c===k?(o+="c",u=x[g]+2):e.d===k&&(o+="d",u=x[g]+3),m==="ac"||m==="ad"||m==="ca"||m==="da"?n>p&&(d=n,n=p,p=d):n<p&&(d=n,n=p,p=d),o==="ac"||o==="ad"||o==="ca"||o==="da"?t>u&&(d=t,t=u,u=d):t<u&&(d=t,t=u,u=d),d=new THREE.Face4(n,p,t,u),d.normal.set(1,0,0),A.push(d);this.geometry=v}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,e=this.geometry.edgeFaces,f=b.faces,b=b.vertices,g=f.length,j,k,m,o,n,p=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;j=f[m];j instanceof THREE.Face4?(o=4,k=new THREE.Face4(k,k+1,k+2,k+3)):(o=3,k=new THREE.Face3(k,k+1,k+2));k.normal.copy(j.normal);d.push(k);
-for(k=0;k<o;k++)n=b[j[p[k]]],c.push(new THREE.Vertex(n.position.clone()))}for(g=0;g<f.length-1;g++){b=d[g];for(j=g+1;j<f.length;j++)k=d[j],k=this.facesShareEdge(c,b,k),k!==void 0&&(k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]),k.normal.set(1,0,0),e.push(k))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var e,f,g,j,k,m,o,n,p,t,u,v,z,A=0,x=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(v=0;v<e;v++){g=c[x[v]];k=b[g];for(z=0;z<f;z++)if(j=d[x[z]],m=b[j],Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4&&(A++,A===1&&(o=k,n=m,p=g,t=j,u=x[v]),A===2))return u+=x[v],u==="ad"||u==="ac"?{faces:[c,d],vertices:[o,n,m,k],indices:[p,t,
-j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[o,k,m,n],indices:[p,g,j,t],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,d,e,f,g,j,k,m,n,o,p,t,u,v=new THREE.Geometry;v.vertices=this.geometry.vertices;e=v.faces=this.geometry.faces;var z=v.egdes=this.geometry.edges,A=v.edgeFaces=[];f=0;var x=[];b=0;for(c=e.length;b<c;b++)if(d=e[b],x.push(f),f+=d instanceof THREE.Face3?3:4,d.vertexNormals[0]=d.normal,d.vertexNormals[1]=d.normal,d.vertexNormals[2]=d.normal,d instanceof THREE.Face4)d.vertexNormals[3]=
+d.normal;b=0;for(c=z.length;b<c;b++)k=z[b],d=k.faces[0],e=k.faces[1],f=k.faceIndices[0],g=k.faceIndices[1],j=k.vertexIndices[0],k=k.vertexIndices[1],d.a===j?(m="a",o=x[f]+0):d.b===j?(m="b",o=x[f]+1):d.c===j?(m="c",o=x[f]+2):d.d===j&&(m="d",o=x[f]+3),d.a===k?(m+="a",p=x[f]+0):d.b===k?(m+="b",p=x[f]+1):d.c===k?(m+="c",p=x[f]+2):d.d===k&&(m+="d",p=x[f]+3),e.a===j?(n="a",t=x[g]+0):e.b===j?(n="b",t=x[g]+1):e.c===j?(n="c",t=x[g]+2):e.d===j&&(n="d",t=x[g]+3),e.a===k?(n+="a",u=x[g]+0):e.b===k?(n+="b",u=x[g]+
+1):e.c===k?(n+="c",u=x[g]+2):e.d===k&&(n+="d",u=x[g]+3),m==="ac"||m==="ad"||m==="ca"||m==="da"?o>p&&(d=o,o=p,p=d):o<p&&(d=o,o=p,p=d),n==="ac"||n==="ad"||n==="ca"||n==="da"?t>u&&(d=t,t=u,u=d):t<u&&(d=t,t=u,u=d),d=new THREE.Face4(o,p,t,u),d.normal.set(1,0,0),A.push(d);this.geometry=v}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,e=this.geometry.edgeFaces,f=b.faces,b=b.vertices,g=f.length,j,k,m,n,o,p=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;j=f[m];j instanceof THREE.Face4?(n=4,k=new THREE.Face4(k,k+1,k+2,k+3)):(n=3,k=new THREE.Face3(k,k+1,k+2));k.normal.copy(j.normal);d.push(k);
+for(k=0;k<n;k++)o=b[j[p[k]]],c.push(new THREE.Vertex(o.position.clone()))}for(g=0;g<f.length-1;g++){b=d[g];for(j=g+1;j<f.length;j++)k=d[j],k=this.facesShareEdge(c,b,k),k!==void 0&&(k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]),k.normal.set(1,0,0),e.push(k))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var e,f,g,j,k,m,n,o,p,t,u,v,z,A=0,x=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(v=0;v<e;v++){g=c[x[v]];k=b[g];for(z=0;z<f;z++)if(j=d[x[z]],m=b[j],Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4&&(A++,A===1&&(n=k,o=m,p=g,t=j,u=x[v]),A===2))return u+=x[v],u==="ad"||u==="ac"?{faces:[c,d],vertices:[n,o,m,k],indices:[p,t,
+j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[n,k,m,o],indices:[p,g,j,t],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
@@ -141,56 +141,56 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Sound?(c=this.sounds.indexOf(b),c!==-1&&this.sounds.splice(c,1)):b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,d){return d.z-b.z}function d(b,d){var c=0,e=1,f=b.z+b.w,g=d.z+d.w,j=-b.z+b.w,k=-d.z+d.w;return f>=0&&g>=0&&j>=0&&k>=0?!0:f<0&&g<0||j<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var e,f,g=[],j,k,m=[],o,n,p=[],t,u=[],v,z,A=[],x,G,y=[],D=new THREE.Vector4,F=new THREE.Vector4,
-B=new THREE.Matrix4,P=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,d){B.multiply(d.projectionMatrix,d.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,d){B.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,d,h){var d=[],j,k,m;f=0;k=
-b.objects;b=0;for(j=k.length;b<j;b++){m=k[b];var o;if(!(o=!m.visible))if(o=m instanceof THREE.Mesh){a:{o=void 0;for(var p=m.matrixWorld,n=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),t=0;t<6;t++)if(o=K[t].x*p.n14+K[t].y*p.n24+K[t].z*p.n34+K[t].w,o<=n){o=!1;break a}o=!0}o=!o}if(!o)o=g[f]=g[f]||new THREE.RenderableObject,f++,e=o,D.copy(m.position),B.multiplyVector3(D),e.object=m,e.z=D.z,d.push(e)}h&&d.sort(c);return d};this.projectScene=function(e,f,h){var g=[],
-D=f.near,N=f.far,aa,U,V,ga,W,da,ea,ka,fa,I,S,Z,$,ia,Y,H,ha;G=z=t=n=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);B.multiply(f.projectionMatrix,f.matrixWorldInverse);K[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);K[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);K[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);K[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);K[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);K[5].set(B.n41+B.n31,B.n42+B.n32,
-B.n43+B.n33,B.n44+B.n34);for(aa=0;aa<6;aa++)fa=K[aa],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(e,f,!0);e=0;for(aa=fa.length;e<aa;e++)if(I=fa[e].object,I.visible)if(S=I.matrixWorld,Z=I.matrixRotationWorld,$=I.materials,ia=I.overdraw,k=0,I instanceof THREE.Mesh){Y=I.geometry;ga=Y.vertices;H=Y.faces;Y=Y.faceVertexUvs;U=0;for(V=ga.length;U<V;U++)j=b(),j.positionWorld.copy(ga[U].position),S.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),B.multiplyVector4(j.positionScreen),
-j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>D&&j.positionScreen.z<N;ga=0;for(U=H.length;ga<U;ga++){V=H[ga];if(V instanceof THREE.Face3)if(W=m[V.a],da=m[V.b],ea=m[V.c],W.visible&&da.visible&&ea.visible&&(I.doubleSided||I.flipSided!=(ea.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(ea.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)<0))ka=p[n]=p[n]||new THREE.RenderableFace3,
-n++,o=ka,o.v1.copy(W),o.v2.copy(da),o.v3.copy(ea);else continue;else if(V instanceof THREE.Face4)if(W=m[V.a],da=m[V.b],ea=m[V.c],ka=m[V.d],W.visible&&da.visible&&ea.visible&&ka.visible&&(I.doubleSided||I.flipSided!=((ka.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(ka.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)<0||(da.positionScreen.x-ea.positionScreen.x)*(ka.positionScreen.y-ea.positionScreen.y)-(da.positionScreen.y-ea.positionScreen.y)*
-(ka.positionScreen.x-ea.positionScreen.x)<0)))ha=u[t]=u[t]||new THREE.RenderableFace4,t++,o=ha,o.v1.copy(W),o.v2.copy(da),o.v3.copy(ea),o.v4.copy(ka);else continue;o.normalWorld.copy(V.normal);Z.multiplyVector3(o.normalWorld);o.centroidWorld.copy(V.centroid);S.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);B.multiplyVector3(o.centroidScreen);ea=V.vertexNormals;W=0;for(da=ea.length;W<da;W++)ka=o.vertexNormalsWorld[W],ka.copy(ea[W]),Z.multiplyVector3(ka);W=0;for(da=Y.length;W<
-da;W++)if(ha=Y[W][ga]){ea=0;for(ka=ha.length;ea<ka;ea++)o.uvs[W][ea]=ha[ea]}o.meshMaterials=$;o.faceMaterials=V.materials;o.overdraw=ia;o.z=o.centroidScreen.z;g.push(o)}}else if(I instanceof THREE.Line){P.multiply(B,S);ga=I.geometry.vertices;W=b();W.positionScreen.copy(ga[0].position);P.multiplyVector4(W.positionScreen);U=1;for(V=ga.length;U<V;U++)if(W=b(),W.positionScreen.copy(ga[U].position),P.multiplyVector4(W.positionScreen),da=m[k-2],L.copy(W.positionScreen),E.copy(da.positionScreen),d(L,E))L.multiplyScalar(1/
-L.w),E.multiplyScalar(1/E.w),S=A[z]=A[z]||new THREE.RenderableLine,z++,v=S,v.v1.positionScreen.copy(L),v.v2.positionScreen.copy(E),v.z=Math.max(L.z,E.z),v.materials=I.materials,g.push(v)}else if(I instanceof THREE.Particle&&(F.set(I.matrixWorld.n14,I.matrixWorld.n24,I.matrixWorld.n34,1),B.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))S=y[G]=y[G]||new THREE.RenderableParticle,G++,x=S,x.x=F.x/F.w,x.y=F.y/F.w,x.z=F.z,x.rotation=I.rotation.z,x.scale.x=I.scale.x*Math.abs(x.x-(F.x+f.projectionMatrix.n11)/(F.w+
+THREE.Projector=function(){function b(){var b=m[k]=m[k]||new THREE.RenderableVertex;k++;return b}function c(b,d){return d.z-b.z}function d(b,d){var c=0,e=1,f=b.z+b.w,g=d.z+d.w,j=-b.z+b.w,k=-d.z+d.w;return f>=0&&g>=0&&j>=0&&k>=0?!0:f<0&&g<0||j<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),j<0?c=Math.max(c,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var e,f,g=[],j,k,m=[],n,o,p=[],t,u=[],v,z,A=[],x,G,y=[],D=new THREE.Vector4,F=new THREE.Vector4,
+B=new THREE.Matrix4,P=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,d){B.multiply(d.projectionMatrix,d.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,d){B.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,d,h){var d=[],j,k,m;f=0;k=
+b.objects;b=0;for(j=k.length;b<j;b++){m=k[b];var n;if(!(n=!m.visible))if(n=m instanceof THREE.Mesh){a:{n=void 0;for(var p=m.matrixWorld,o=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),t=0;t<6;t++)if(n=L[t].x*p.n14+L[t].y*p.n24+L[t].z*p.n34+L[t].w,n<=o){n=!1;break a}n=!0}n=!n}if(!n)n=g[f]=g[f]||new THREE.RenderableObject,f++,e=n,D.copy(m.position),B.multiplyVector3(D),e.object=m,e.z=D.z,d.push(e)}h&&d.sort(c);return d};this.projectScene=function(e,f,h){var g=[],
+D=f.near,N=f.far,aa,U,V,ga,W,da,ea,ka,fa,I,S,Y,Z,ia,X,H,ha;G=z=t=o=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);B.multiply(f.projectionMatrix,f.matrixWorldInverse);L[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);L[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);L[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);L[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);L[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);L[5].set(B.n41+B.n31,B.n42+B.n32,
+B.n43+B.n33,B.n44+B.n34);for(aa=0;aa<6;aa++)fa=L[aa],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(e,f,!0);e=0;for(aa=fa.length;e<aa;e++)if(I=fa[e].object,I.visible)if(S=I.matrixWorld,Y=I.matrixRotationWorld,Z=I.materials,ia=I.overdraw,k=0,I instanceof THREE.Mesh){X=I.geometry;ga=X.vertices;H=X.faces;X=X.faceVertexUvs;U=0;for(V=ga.length;U<V;U++)j=b(),j.positionWorld.copy(ga[U].position),S.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),B.multiplyVector4(j.positionScreen),
+j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>D&&j.positionScreen.z<N;ga=0;for(U=H.length;ga<U;ga++){V=H[ga];if(V instanceof THREE.Face3)if(W=m[V.a],da=m[V.b],ea=m[V.c],W.visible&&da.visible&&ea.visible&&(I.doubleSided||I.flipSided!=(ea.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(ea.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)<0))ka=p[o]=p[o]||new THREE.RenderableFace3,
+o++,n=ka,n.v1.copy(W),n.v2.copy(da),n.v3.copy(ea);else continue;else if(V instanceof THREE.Face4)if(W=m[V.a],da=m[V.b],ea=m[V.c],ka=m[V.d],W.visible&&da.visible&&ea.visible&&ka.visible&&(I.doubleSided||I.flipSided!=((ka.positionScreen.x-W.positionScreen.x)*(da.positionScreen.y-W.positionScreen.y)-(ka.positionScreen.y-W.positionScreen.y)*(da.positionScreen.x-W.positionScreen.x)<0||(da.positionScreen.x-ea.positionScreen.x)*(ka.positionScreen.y-ea.positionScreen.y)-(da.positionScreen.y-ea.positionScreen.y)*
+(ka.positionScreen.x-ea.positionScreen.x)<0)))ha=u[t]=u[t]||new THREE.RenderableFace4,t++,n=ha,n.v1.copy(W),n.v2.copy(da),n.v3.copy(ea),n.v4.copy(ka);else continue;n.normalWorld.copy(V.normal);Y.multiplyVector3(n.normalWorld);n.centroidWorld.copy(V.centroid);S.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);B.multiplyVector3(n.centroidScreen);ea=V.vertexNormals;W=0;for(da=ea.length;W<da;W++)ka=n.vertexNormalsWorld[W],ka.copy(ea[W]),Y.multiplyVector3(ka);W=0;for(da=X.length;W<
+da;W++)if(ha=X[W][ga]){ea=0;for(ka=ha.length;ea<ka;ea++)n.uvs[W][ea]=ha[ea]}n.meshMaterials=Z;n.faceMaterials=V.materials;n.overdraw=ia;n.z=n.centroidScreen.z;g.push(n)}}else if(I instanceof THREE.Line){P.multiply(B,S);ga=I.geometry.vertices;W=b();W.positionScreen.copy(ga[0].position);P.multiplyVector4(W.positionScreen);U=1;for(V=ga.length;U<V;U++)if(W=b(),W.positionScreen.copy(ga[U].position),P.multiplyVector4(W.positionScreen),da=m[k-2],K.copy(W.positionScreen),E.copy(da.positionScreen),d(K,E))K.multiplyScalar(1/
+K.w),E.multiplyScalar(1/E.w),S=A[z]=A[z]||new THREE.RenderableLine,z++,v=S,v.v1.positionScreen.copy(K),v.v2.positionScreen.copy(E),v.z=Math.max(K.z,E.z),v.materials=I.materials,g.push(v)}else if(I instanceof THREE.Particle&&(F.set(I.matrixWorld.n14,I.matrixWorld.n24,I.matrixWorld.n34,1),B.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))S=y[G]=y[G]||new THREE.RenderableParticle,G++,x=S,x.x=F.x/F.w,x.y=F.y/F.w,x.z=F.z,x.rotation=I.rotation.z,x.scale.x=I.scale.x*Math.abs(x.x-(F.x+f.projectionMatrix.n11)/(F.w+
 f.projectionMatrix.n14)),x.scale.y=I.scale.y*Math.abs(x.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24)),x.materials=I.materials,g.push(x);h&&g.sort(c);return g}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;g=e/2};this.render=function(d,e){var m,o,n,p,t,u,v,z;b=c.projectScene(d,e);m=0;for(o=b.length;m<o;m++)if(t=b[m],t instanceof THREE.RenderableParticle){v=t.x*f+f;z=t.y*g+g;n=0;for(p=t.material.length;n<p;n++)if(u=t.material[n],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=v+"px",u.style.top=z+"px"}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;g=e/2};this.render=function(d,e){var m,n,o,p,t,u,v,z;b=c.projectScene(d,e);m=0;for(n=b.length;m<n;m++)if(t=b[m],t instanceof THREE.RenderableParticle){v=t.x*f+f;z=t.y*g+g;o=0;for(p=t.material.length;o<p;o++)if(u=t.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=v+"px",u.style.top=z+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(x!=b)v.globalAlpha=x=b}function d(b){if(G!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}G=b}}function e(b){if(y!=b.hex)y=b.hex,v.strokeStyle="#"+g(y.toString(16))}function f(b){if(D!=b.hex)D=b.hex,v.fillStyle="#"+g(D.toString(16))}function g(b){for(;b.length<6;)b="0"+b;return b}
-var j=this,k=null,m=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,p,t,u,v=o.getContext("2d"),z=new THREE.Color(0),A=0,x=1,G=0,y=null,D=null,F=null,B=null,P=null,K,L,E,M,T=new THREE.RenderableVertex,h=new THREE.RenderableVertex,Q,R,N,aa,U,V,ga,W,da,ea,ka,fa,I=new THREE.Color(0),S=new THREE.Color(0),Z=new THREE.Color(0),$=new THREE.Color(0),ia=new THREE.Color(0),Y,H,ha,ma,ja,na,Aa,ya,ca,O,sa=new THREE.Rectangle,pa=new THREE.Rectangle,X=new THREE.Rectangle,
-Ta=!1,ta=new THREE.Color,qa=new THREE.Color,Oa=new THREE.Color,Pa=new THREE.Color,oa=new THREE.Vector3,La,Ma,Ua,ua,Na,Qa,b=16;La=document.createElement("canvas");La.width=La.height=2;Ma=La.getContext("2d");Ma.fillStyle="rgba(0,0,0,1)";Ma.fillRect(0,0,2,2);Ua=Ma.getImageData(0,0,2,2);ua=Ua.data;Na=document.createElement("canvas");Na.width=Na.height=b;Qa=Na.getContext("2d");Qa.translate(-b/2,-b/2);Qa.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.width=n;o.height=p;sa.set(-t,-u,t,u);x=1;G=0;P=B=F=D=y=null};this.setClearColor=function(b,d){z=b;A=d};this.setClearColorHex=function(b,d){z.setHex(b);A=d};this.clear=function(){v.setTransform(1,0,0,-1,t,u);if(!pa.isEmpty())pa.inflate(1),pa.minSelf(sa),z.hex==0&&A==0?v.clearRect(pa.getX(),pa.getY(),pa.getWidth(),pa.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*
-255)+","+A+")",v.fillRect(pa.getX(),pa.getY(),pa.getWidth(),pa.getHeight())),pa.empty()};this.render=function(b,g){function o(b){var d,c,e,h=b.lights;qa.setRGB(0,0,0);Oa.setRGB(0,0,0);Pa.setRGB(0,0,0);b=0;for(d=h.length;b<d;b++)c=h[b],e=c.color,c instanceof THREE.AmbientLight?(qa.r+=e.r,qa.g+=e.g,qa.b+=e.b):c instanceof THREE.DirectionalLight?(Oa.r+=e.r,Oa.g+=e.g,Oa.b+=e.b):c instanceof THREE.PointLight&&(Pa.r+=e.r,Pa.g+=e.g,Pa.b+=e.b)}function p(b,d,c,e){var h,f,g,j,k=b.lights,b=0;for(h=k.length;b<
-h;b++)f=k[b],g=f.color,f instanceof THREE.DirectionalLight?(j=c.dot(f.position),j<=0||(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)):f instanceof THREE.PointLight&&(j=c.dot(oa.sub(f.position,d).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(d.distanceTo(f.position)/f.distance,1),j!=0&&(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)))}function n(b,h,g){c(g.opacity);d(g.blending);var j,k,m,o,p,qa;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)o=g.map.image,p=o.width>>1,qa=o.height>>
-1,g=h.scale.x*t,m=h.scale.y*u,j=g*p,k=m*qa,X.set(b.x-j,b.y-k,b.x+j,b.y+k),sa.instersects(X)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(g,-m),v.translate(-p,-qa),v.drawImage(o,0,0),v.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*t,k=h.scale.y*u,X.set(b.x-j,b.y-k,b.x+j,b.y+k),sa.instersects(X)&&(e(g.color),f(g.color),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(j,k),g.program(v),v.restore()))}function x(b,h,f,g){c(g.opacity);d(g.blending);
-v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)v.lineWidth=F=b;b=g.linecap;if(B!=b)v.lineCap=B=b;b=g.linejoin;if(P!=b)v.lineJoin=P=b;e(g.color);v.stroke();X.inflate(g.linewidth*2)}}function z(b,e,h,f,k,m,o,X,n){j.data.vertices+=3;j.data.faces++;c(X.opacity);d(X.blending);Q=b.positionScreen.x;R=b.positionScreen.y;N=e.positionScreen.x;aa=e.positionScreen.y;U=h.positionScreen.x;
-V=h.positionScreen.y;A(Q,R,N,aa,U,V);if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.mapping instanceof THREE.UVMapping&&(ma=o.uvs[0],va(Q,R,N,aa,U,V,X.map.image,ma[f].u,ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v));else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,oa.copy(o.vertexNormalsWorld[0]),ja=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,na=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[1]),Aa=(oa.x*b.n11+oa.y*
-b.n12+oa.z*b.n13)*0.5+0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[2]),ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,O=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,va(Q,R,N,aa,U,V,X.envMap.image,ja,na,Aa,ya,ca,O)}else X.wireframe?D(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(X.color);else if(X instanceof THREE.MeshLambertMaterial)X.map&&!X.wireframe&&(X.map.mapping instanceof THREE.UVMapping&&(ma=o.uvs[0],va(Q,R,N,aa,U,V,X.map.image,ma[f].u,
-ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v)),d(THREE.SubtractiveBlending)),Ta?!X.wireframe&&X.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(S.r=Z.r=$.r=qa.r,S.g=Z.g=$.g=qa.g,S.b=Z.b=$.b=qa.b,p(n,o.v1.positionWorld,o.vertexNormalsWorld[0],S),p(n,o.v2.positionWorld,o.vertexNormalsWorld[1],Z),p(n,o.v3.positionWorld,o.vertexNormalsWorld[2],$),ia.r=(Z.r+$.r)*0.5,ia.g=(Z.g+$.g)*0.5,ia.b=(Z.b+$.b)*0.5,ha=w(S,Z,$,ia),va(Q,R,N,aa,U,V,ha,0,0,1,0,0,1)):(ta.r=qa.r,ta.g=qa.g,ta.b=qa.b,p(n,o.centroidWorld,
-o.normalWorld,ta),I.r=Math.max(0,Math.min(X.color.r*ta.r,1)),I.g=Math.max(0,Math.min(X.color.g*ta.g,1)),I.b=Math.max(0,Math.min(X.color.b*ta.b,1)),I.updateHex(),X.wireframe?D(I,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(I)):X.wireframe?D(X.color,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(X.color);else if(X instanceof THREE.MeshDepthMaterial)Y=g.near,H=g.far,S.r=S.g=S.b=1-Ea(b.positionScreen.z,Y,H),Z.r=Z.g=Z.b=1-Ea(e.positionScreen.z,Y,H),$.r=$.g=$.b=1-Ea(h.positionScreen.z,
-Y,H),ia.r=(Z.r+$.r)*0.5,ia.g=(Z.g+$.g)*0.5,ia.b=(Z.b+$.b)*0.5,ha=w(S,Z,$,ia),va(Q,R,N,aa,U,V,ha,0,0,1,0,0,1);else if(X instanceof THREE.MeshNormalMaterial)I.r=Ja(o.normalWorld.x),I.g=Ja(o.normalWorld.y),I.b=Ja(o.normalWorld.z),I.updateHex(),X.wireframe?D(I,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):C(I)}function y(b,e,h,f,k,X,o,m,n){j.data.vertices+=4;j.data.faces++;c(m.opacity);d(m.blending);if(m.map||m.envMap)z(b,e,f,0,1,3,o,m,n),z(k,h,X,1,2,3,o,m,n);else if(Q=b.positionScreen.x,
-R=b.positionScreen.y,N=e.positionScreen.x,aa=e.positionScreen.y,U=h.positionScreen.x,V=h.positionScreen.y,ga=f.positionScreen.x,W=f.positionScreen.y,da=k.positionScreen.x,ea=k.positionScreen.y,ka=X.positionScreen.x,fa=X.positionScreen.y,m instanceof THREE.MeshBasicMaterial)G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ta?!m.wireframe&&m.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==
-4?(S.r=Z.r=$.r=ia.r=qa.r,S.g=Z.g=$.g=ia.g=qa.g,S.b=Z.b=$.b=ia.b=qa.b,p(n,o.v1.positionWorld,o.vertexNormalsWorld[0],S),p(n,o.v2.positionWorld,o.vertexNormalsWorld[1],Z),p(n,o.v4.positionWorld,o.vertexNormalsWorld[3],$),p(n,o.v3.positionWorld,o.vertexNormalsWorld[2],ia),ha=w(S,Z,$,ia),A(Q,R,N,aa,ga,W),va(Q,R,N,aa,ga,W,ha,0,0,1,0,0,1),A(da,ea,U,V,ka,fa),va(da,ea,U,V,ka,fa,ha,1,0,1,1,0,1)):(ta.r=qa.r,ta.g=qa.g,ta.b=qa.b,p(n,o.centroidWorld,o.normalWorld,ta),I.r=Math.max(0,Math.min(m.color.r*ta.r,1)),
-I.g=Math.max(0,Math.min(m.color.g*ta.g,1)),I.b=Math.max(0,Math.min(m.color.b*ta.b,1)),I.updateHex(),G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(I,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(I)):(G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color));else if(m instanceof THREE.MeshNormalMaterial)I.r=Ja(o.normalWorld.x),I.g=Ja(o.normalWorld.y),I.b=Ja(o.normalWorld.z),I.updateHex(),G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(I,m.wireframeLinewidth,
-m.wireframeLinecap,m.wireframeLinejoin):C(I);else if(m instanceof THREE.MeshDepthMaterial)Y=g.near,H=g.far,S.r=S.g=S.b=1-Ea(b.positionScreen.z,Y,H),Z.r=Z.g=Z.b=1-Ea(e.positionScreen.z,Y,H),$.r=$.g=$.b=1-Ea(f.positionScreen.z,Y,H),ia.r=ia.g=ia.b=1-Ea(h.positionScreen.z,Y,H),ha=w(S,Z,$,ia),A(Q,R,N,aa,ga,W),va(Q,R,N,aa,ga,W,ha,0,0,1,0,0,1),A(da,ea,U,V,ka,fa),va(da,ea,U,V,ka,fa,ha,1,0,1,1,0,1)}function A(b,d,c,e,h,f){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(b,d);v.closePath()}
-function G(b,d,c,e,h,f,g,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(g,j);v.lineTo(b,d);v.closePath()}function D(b,d,c,h){if(F!=d)v.lineWidth=F=d;if(B!=c)v.lineCap=B=c;if(P!=h)v.lineJoin=P=h;e(b);v.stroke();X.inflate(d*2)}function C(b){f(b);v.fill()}function va(b,d,c,e,h,f,g,j,k,m,o,X,p){var n,t;n=g.width-1;t=g.height-1;j*=n;k*=t;m*=n;o*=t;X*=n;p*=t;c-=b;e-=d;h-=b;f-=d;m-=j;o-=k;X-=j;p-=k;n=m*p-X*o;n!=0&&(t=1/n,n=(p*c-o*h)*t,o=(p*e-o*f)*t,c=(m*h-X*c)*t,e=(m*f-X*e)*t,b=b-n*
-j-c*k,d=d-o*j-e*k,v.save(),v.transform(n,o,c,e,b,d),v.clip(),v.drawImage(g,0,0),v.restore())}function w(b,d,c,e){var h=~~(b.r*255),f=~~(b.g*255),b=~~(b.b*255),g=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),o=~~(e.r*255),X=~~(e.g*255),e=~~(e.b*255);ua[0]=h<0?0:h>255?255:h;ua[1]=f<0?0:f>255?255:f;ua[2]=b<0?0:b>255?255:b;ua[4]=g<0?0:g>255?255:g;ua[5]=j<0?0:j>255?255:j;ua[6]=d<0?0:d>255?255:d;ua[8]=k<0?0:k>255?255:k;ua[9]=m<0?0:m>255?255:m;ua[10]=c<0?0:c>255?255:c;
-ua[12]=o<0?0:o>255?255:o;ua[13]=X<0?0:X>255?255:X;ua[14]=e<0?0:e>255?255:e;Ma.putImageData(Ua,0,0);Qa.drawImage(La,0,0);return Na}function Ea(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ja(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ba(b,d){var c=d.x-b.x,e=d.y-b.y,h=1/Math.sqrt(c*c+e*e);c*=h;e*=h;d.x+=c;d.y+=e;b.x-=c;b.y-=e}var Ra,Ya,la,wa,Ca,Ka,Sa,ra;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);(Ta=b.lights.length>
-0)&&o(b);Ra=0;for(Ya=k.length;Ra<Ya;Ra++){la=k[Ra];X.empty();if(la instanceof THREE.RenderableParticle){K=la;K.x*=t;K.y*=u;wa=0;for(Ca=la.materials.length;wa<Ca;)ra=la.materials[wa++],ra.opacity!=0&&n(K,la,ra,b)}else if(la instanceof THREE.RenderableLine){if(K=la.v1,L=la.v2,K.positionScreen.x*=t,K.positionScreen.y*=u,L.positionScreen.x*=t,L.positionScreen.y*=u,X.addPoint(K.positionScreen.x,K.positionScreen.y),X.addPoint(L.positionScreen.x,L.positionScreen.y),sa.instersects(X)){wa=0;for(Ca=la.materials.length;wa<
-Ca;)ra=la.materials[wa++],ra.opacity!=0&&x(K,L,la,ra,b)}}else if(la instanceof THREE.RenderableFace3){if(K=la.v1,L=la.v2,E=la.v3,K.positionScreen.x*=t,K.positionScreen.y*=u,L.positionScreen.x*=t,L.positionScreen.y*=u,E.positionScreen.x*=t,E.positionScreen.y*=u,la.overdraw&&(Ba(K.positionScreen,L.positionScreen),Ba(L.positionScreen,E.positionScreen),Ba(E.positionScreen,K.positionScreen)),X.add3Points(K.positionScreen.x,K.positionScreen.y,L.positionScreen.x,L.positionScreen.y,E.positionScreen.x,E.positionScreen.y),
-sa.instersects(X)){wa=0;for(Ca=la.meshMaterials.length;wa<Ca;)if(ra=la.meshMaterials[wa++],ra instanceof THREE.MeshFaceMaterial){Ka=0;for(Sa=la.faceMaterials.length;Ka<Sa;)(ra=la.faceMaterials[Ka++])&&ra.opacity!=0&&z(K,L,E,0,1,2,la,ra,b)}else ra.opacity!=0&&z(K,L,E,0,1,2,la,ra,b)}}else if(la instanceof THREE.RenderableFace4&&(K=la.v1,L=la.v2,E=la.v3,M=la.v4,K.positionScreen.x*=t,K.positionScreen.y*=u,L.positionScreen.x*=t,L.positionScreen.y*=u,E.positionScreen.x*=t,E.positionScreen.y*=u,M.positionScreen.x*=
-t,M.positionScreen.y*=u,T.positionScreen.copy(L.positionScreen),h.positionScreen.copy(M.positionScreen),la.overdraw&&(Ba(K.positionScreen,L.positionScreen),Ba(L.positionScreen,M.positionScreen),Ba(M.positionScreen,K.positionScreen),Ba(E.positionScreen,T.positionScreen),Ba(E.positionScreen,h.positionScreen)),X.addPoint(K.positionScreen.x,K.positionScreen.y),X.addPoint(L.positionScreen.x,L.positionScreen.y),X.addPoint(E.positionScreen.x,E.positionScreen.y),X.addPoint(M.positionScreen.x,M.positionScreen.y),
-sa.instersects(X))){wa=0;for(Ca=la.meshMaterials.length;wa<Ca;)if(ra=la.meshMaterials[wa++],ra instanceof THREE.MeshFaceMaterial){Ka=0;for(Sa=la.faceMaterials.length;Ka<Sa;)(ra=la.faceMaterials[Ka++])&&ra.opacity!=0&&y(K,L,E,M,T,h,la,ra,b)}else ra.opacity!=0&&y(K,L,E,M,T,h,la,ra,b)}pa.addRectangle(X)}v.setTransform(1,0,0,1,0,0)}};
+var j=this,k=null,m=new THREE.Projector,b=b||{},n=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,p,t,u,v=n.getContext("2d"),z=new THREE.Color(0),A=0,x=1,G=0,y=null,D=null,F=null,B=null,P=null,L,K,E,M,T=new THREE.RenderableVertex,h=new THREE.RenderableVertex,Q,R,N,aa,U,V,ga,W,da,ea,ka,fa,I=new THREE.Color(0),S=new THREE.Color(0),Y=new THREE.Color(0),Z=new THREE.Color(0),ia=new THREE.Color(0),X,H,ha,ma,ja,na,Aa,ya,ca,O,sa=new THREE.Rectangle,pa=new THREE.Rectangle,$=new THREE.Rectangle,
+Ta=!1,ta=new THREE.Color,qa=new THREE.Color,Oa=new THREE.Color,Pa=new THREE.Color,oa=new THREE.Vector3,La,Ma,Ua,ua,Na,Qa,b=16;La=document.createElement("canvas");La.width=La.height=2;Ma=La.getContext("2d");Ma.fillStyle="rgba(0,0,0,1)";Ma.fillRect(0,0,2,2);Ua=Ma.getImageData(0,0,2,2);ua=Ua.data;Na=document.createElement("canvas");Na.width=Na.height=b;Qa=Na.getContext("2d");Qa.translate(-b/2,-b/2);Qa.scale(b,b);b--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(b,d){o=b;p=d;t=o/2;u=p/2;n.width=o;n.height=p;sa.set(-t,-u,t,u);x=1;G=0;P=B=F=D=y=null};this.setClearColor=function(b,d){z=b;A=d};this.setClearColorHex=function(b,d){z.setHex(b);A=d};this.clear=function(){v.setTransform(1,0,0,-1,t,u);if(!pa.isEmpty())pa.inflate(1),pa.minSelf(sa),z.hex==0&&A==0?v.clearRect(pa.getX(),pa.getY(),pa.getWidth(),pa.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*
+255)+","+A+")",v.fillRect(pa.getX(),pa.getY(),pa.getWidth(),pa.getHeight())),pa.empty()};this.render=function(b,g){function n(b){var d,c,e,h=b.lights;qa.setRGB(0,0,0);Oa.setRGB(0,0,0);Pa.setRGB(0,0,0);b=0;for(d=h.length;b<d;b++)c=h[b],e=c.color,c instanceof THREE.AmbientLight?(qa.r+=e.r,qa.g+=e.g,qa.b+=e.b):c instanceof THREE.DirectionalLight?(Oa.r+=e.r,Oa.g+=e.g,Oa.b+=e.b):c instanceof THREE.PointLight&&(Pa.r+=e.r,Pa.g+=e.g,Pa.b+=e.b)}function p(b,d,c,e){var h,f,g,j,k=b.lights,b=0;for(h=k.length;b<
+h;b++)f=k[b],g=f.color,f instanceof THREE.DirectionalLight?(j=c.dot(f.position),j<=0||(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)):f instanceof THREE.PointLight&&(j=c.dot(oa.sub(f.position,d).normalize()),j<=0||(j*=f.distance==0?1:1-Math.min(d.distanceTo(f.position)/f.distance,1),j!=0&&(j*=f.intensity,e.r+=g.r*j,e.g+=g.g*j,e.b+=g.b*j)))}function o(b,h,g){c(g.opacity);d(g.blending);var j,k,m,n,p,qa;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)n=g.map.image,p=n.width>>1,qa=n.height>>
+1,g=h.scale.x*t,m=h.scale.y*u,j=g*p,k=m*qa,$.set(b.x-j,b.y-k,b.x+j,b.y+k),sa.instersects($)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(g,-m),v.translate(-p,-qa),v.drawImage(n,0,0),v.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*t,k=h.scale.y*u,$.set(b.x-j,b.y-k,b.x+j,b.y+k),sa.instersects($)&&(e(g.color),f(g.color),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(j,k),g.program(v),v.restore()))}function x(b,h,f,g){c(g.opacity);d(g.blending);
+v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)v.lineWidth=F=b;b=g.linecap;if(B!=b)v.lineCap=B=b;b=g.linejoin;if(P!=b)v.lineJoin=P=b;e(g.color);v.stroke();$.inflate(g.linewidth*2)}}function z(b,e,h,f,k,m,$,n,o){j.data.vertices+=3;j.data.faces++;c(n.opacity);d(n.blending);Q=b.positionScreen.x;R=b.positionScreen.y;N=e.positionScreen.x;aa=e.positionScreen.y;U=h.positionScreen.x;
+V=h.positionScreen.y;A(Q,R,N,aa,U,V);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ma=$.uvs[0],va(Q,R,N,aa,U,V,n.map.image,ma[f].u,ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,oa.copy($.vertexNormalsWorld[0]),ja=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,na=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy($.vertexNormalsWorld[1]),Aa=(oa.x*b.n11+oa.y*
+b.n12+oa.z*b.n13)*0.5+0.5,ya=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy($.vertexNormalsWorld[2]),ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,O=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,va(Q,R,N,aa,U,V,n.envMap.image,ja,na,Aa,ya,ca,O)}else n.wireframe?D(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):C(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ma=$.uvs[0],va(Q,R,N,aa,U,V,n.map.image,ma[f].u,
+ma[f].v,ma[k].u,ma[k].v,ma[m].u,ma[m].v)),d(THREE.SubtractiveBlending)),Ta?!n.wireframe&&n.shading==THREE.SmoothShading&&$.vertexNormalsWorld.length==3?(S.r=Y.r=Z.r=qa.r,S.g=Y.g=Z.g=qa.g,S.b=Y.b=Z.b=qa.b,p(o,$.v1.positionWorld,$.vertexNormalsWorld[0],S),p(o,$.v2.positionWorld,$.vertexNormalsWorld[1],Y),p(o,$.v3.positionWorld,$.vertexNormalsWorld[2],Z),ia.r=(Y.r+Z.r)*0.5,ia.g=(Y.g+Z.g)*0.5,ia.b=(Y.b+Z.b)*0.5,ha=w(S,Y,Z,ia),va(Q,R,N,aa,U,V,ha,0,0,1,0,0,1)):(ta.r=qa.r,ta.g=qa.g,ta.b=qa.b,p(o,$.centroidWorld,
+$.normalWorld,ta),I.r=Math.max(0,Math.min(n.color.r*ta.r,1)),I.g=Math.max(0,Math.min(n.color.g*ta.g,1)),I.b=Math.max(0,Math.min(n.color.b*ta.b,1)),I.updateHex(),n.wireframe?D(I,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):C(I)):n.wireframe?D(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):C(n.color);else if(n instanceof THREE.MeshDepthMaterial)X=g.near,H=g.far,S.r=S.g=S.b=1-Ea(b.positionScreen.z,X,H),Y.r=Y.g=Y.b=1-Ea(e.positionScreen.z,X,H),Z.r=Z.g=Z.b=1-Ea(h.positionScreen.z,
+X,H),ia.r=(Y.r+Z.r)*0.5,ia.g=(Y.g+Z.g)*0.5,ia.b=(Y.b+Z.b)*0.5,ha=w(S,Y,Z,ia),va(Q,R,N,aa,U,V,ha,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)I.r=Ja($.normalWorld.x),I.g=Ja($.normalWorld.y),I.b=Ja($.normalWorld.z),I.updateHex(),n.wireframe?D(I,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):C(I)}function y(b,e,h,f,k,n,$,m,o){j.data.vertices+=4;j.data.faces++;c(m.opacity);d(m.blending);if(m.map||m.envMap)z(b,e,f,0,1,3,$,m,o),z(k,h,n,1,2,3,$,m,o);else if(Q=b.positionScreen.x,
+R=b.positionScreen.y,N=e.positionScreen.x,aa=e.positionScreen.y,U=h.positionScreen.x,V=h.positionScreen.y,ga=f.positionScreen.x,W=f.positionScreen.y,da=k.positionScreen.x,ea=k.positionScreen.y,ka=n.positionScreen.x,fa=n.positionScreen.y,m instanceof THREE.MeshBasicMaterial)G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ta?!m.wireframe&&m.shading==THREE.SmoothShading&&$.vertexNormalsWorld.length==
+4?(S.r=Y.r=Z.r=ia.r=qa.r,S.g=Y.g=Z.g=ia.g=qa.g,S.b=Y.b=Z.b=ia.b=qa.b,p(o,$.v1.positionWorld,$.vertexNormalsWorld[0],S),p(o,$.v2.positionWorld,$.vertexNormalsWorld[1],Y),p(o,$.v4.positionWorld,$.vertexNormalsWorld[3],Z),p(o,$.v3.positionWorld,$.vertexNormalsWorld[2],ia),ha=w(S,Y,Z,ia),A(Q,R,N,aa,ga,W),va(Q,R,N,aa,ga,W,ha,0,0,1,0,0,1),A(da,ea,U,V,ka,fa),va(da,ea,U,V,ka,fa,ha,1,0,1,1,0,1)):(ta.r=qa.r,ta.g=qa.g,ta.b=qa.b,p(o,$.centroidWorld,$.normalWorld,ta),I.r=Math.max(0,Math.min(m.color.r*ta.r,1)),
+I.g=Math.max(0,Math.min(m.color.g*ta.g,1)),I.b=Math.max(0,Math.min(m.color.b*ta.b,1)),I.updateHex(),G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(I,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(I)):(G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):C(m.color));else if(m instanceof THREE.MeshNormalMaterial)I.r=Ja($.normalWorld.x),I.g=Ja($.normalWorld.y),I.b=Ja($.normalWorld.z),I.updateHex(),G(Q,R,N,aa,U,V,ga,W),m.wireframe?D(I,m.wireframeLinewidth,
+m.wireframeLinecap,m.wireframeLinejoin):C(I);else if(m instanceof THREE.MeshDepthMaterial)X=g.near,H=g.far,S.r=S.g=S.b=1-Ea(b.positionScreen.z,X,H),Y.r=Y.g=Y.b=1-Ea(e.positionScreen.z,X,H),Z.r=Z.g=Z.b=1-Ea(f.positionScreen.z,X,H),ia.r=ia.g=ia.b=1-Ea(h.positionScreen.z,X,H),ha=w(S,Y,Z,ia),A(Q,R,N,aa,ga,W),va(Q,R,N,aa,ga,W,ha,0,0,1,0,0,1),A(da,ea,U,V,ka,fa),va(da,ea,U,V,ka,fa,ha,1,0,1,1,0,1)}function A(b,d,c,e,h,f){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(b,d);v.closePath()}
+function G(b,d,c,e,h,f,g,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,f);v.lineTo(g,j);v.lineTo(b,d);v.closePath()}function D(b,d,c,h){if(F!=d)v.lineWidth=F=d;if(B!=c)v.lineCap=B=c;if(P!=h)v.lineJoin=P=h;e(b);v.stroke();$.inflate(d*2)}function C(b){f(b);v.fill()}function va(b,d,c,e,h,f,g,j,k,m,n,$,p){var o,t;o=g.width-1;t=g.height-1;j*=o;k*=t;m*=o;n*=t;$*=o;p*=t;c-=b;e-=d;h-=b;f-=d;m-=j;n-=k;$-=j;p-=k;o=m*p-$*n;o!=0&&(t=1/o,o=(p*c-n*h)*t,n=(p*e-n*f)*t,c=(m*h-$*c)*t,e=(m*f-$*e)*t,b=b-o*
+j-c*k,d=d-n*j-e*k,v.save(),v.transform(o,n,c,e,b,d),v.clip(),v.drawImage(g,0,0),v.restore())}function w(b,d,c,e){var h=~~(b.r*255),f=~~(b.g*255),b=~~(b.b*255),g=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),$=~~(e.g*255),e=~~(e.b*255);ua[0]=h<0?0:h>255?255:h;ua[1]=f<0?0:f>255?255:f;ua[2]=b<0?0:b>255?255:b;ua[4]=g<0?0:g>255?255:g;ua[5]=j<0?0:j>255?255:j;ua[6]=d<0?0:d>255?255:d;ua[8]=k<0?0:k>255?255:k;ua[9]=m<0?0:m>255?255:m;ua[10]=c<0?0:c>255?255:c;
+ua[12]=n<0?0:n>255?255:n;ua[13]=$<0?0:$>255?255:$;ua[14]=e<0?0:e>255?255:e;Ma.putImageData(Ua,0,0);Qa.drawImage(La,0,0);return Na}function Ea(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function Ja(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ba(b,d){var c=d.x-b.x,e=d.y-b.y,h=1/Math.sqrt(c*c+e*e);c*=h;e*=h;d.x+=c;d.y+=e;b.x-=c;b.y-=e}var Ra,Ya,la,wa,Ca,Ka,Sa,ra;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,u);j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,g,this.sortElements);(Ta=b.lights.length>
+0)&&n(b);Ra=0;for(Ya=k.length;Ra<Ya;Ra++){la=k[Ra];$.empty();if(la instanceof THREE.RenderableParticle){L=la;L.x*=t;L.y*=u;wa=0;for(Ca=la.materials.length;wa<Ca;)ra=la.materials[wa++],ra.opacity!=0&&o(L,la,ra,b)}else if(la instanceof THREE.RenderableLine){if(L=la.v1,K=la.v2,L.positionScreen.x*=t,L.positionScreen.y*=u,K.positionScreen.x*=t,K.positionScreen.y*=u,$.addPoint(L.positionScreen.x,L.positionScreen.y),$.addPoint(K.positionScreen.x,K.positionScreen.y),sa.instersects($)){wa=0;for(Ca=la.materials.length;wa<
+Ca;)ra=la.materials[wa++],ra.opacity!=0&&x(L,K,la,ra,b)}}else if(la instanceof THREE.RenderableFace3){if(L=la.v1,K=la.v2,E=la.v3,L.positionScreen.x*=t,L.positionScreen.y*=u,K.positionScreen.x*=t,K.positionScreen.y*=u,E.positionScreen.x*=t,E.positionScreen.y*=u,la.overdraw&&(Ba(L.positionScreen,K.positionScreen),Ba(K.positionScreen,E.positionScreen),Ba(E.positionScreen,L.positionScreen)),$.add3Points(L.positionScreen.x,L.positionScreen.y,K.positionScreen.x,K.positionScreen.y,E.positionScreen.x,E.positionScreen.y),
+sa.instersects($)){wa=0;for(Ca=la.meshMaterials.length;wa<Ca;)if(ra=la.meshMaterials[wa++],ra instanceof THREE.MeshFaceMaterial){Ka=0;for(Sa=la.faceMaterials.length;Ka<Sa;)(ra=la.faceMaterials[Ka++])&&ra.opacity!=0&&z(L,K,E,0,1,2,la,ra,b)}else ra.opacity!=0&&z(L,K,E,0,1,2,la,ra,b)}}else if(la instanceof THREE.RenderableFace4&&(L=la.v1,K=la.v2,E=la.v3,M=la.v4,L.positionScreen.x*=t,L.positionScreen.y*=u,K.positionScreen.x*=t,K.positionScreen.y*=u,E.positionScreen.x*=t,E.positionScreen.y*=u,M.positionScreen.x*=
+t,M.positionScreen.y*=u,T.positionScreen.copy(K.positionScreen),h.positionScreen.copy(M.positionScreen),la.overdraw&&(Ba(L.positionScreen,K.positionScreen),Ba(K.positionScreen,M.positionScreen),Ba(M.positionScreen,L.positionScreen),Ba(E.positionScreen,T.positionScreen),Ba(E.positionScreen,h.positionScreen)),$.addPoint(L.positionScreen.x,L.positionScreen.y),$.addPoint(K.positionScreen.x,K.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),$.addPoint(M.positionScreen.x,M.positionScreen.y),
+sa.instersects($))){wa=0;for(Ca=la.meshMaterials.length;wa<Ca;)if(ra=la.meshMaterials[wa++],ra instanceof THREE.MeshFaceMaterial){Ka=0;for(Sa=la.faceMaterials.length;Ka<Sa;)(ra=la.faceMaterials[Ka++])&&ra.opacity!=0&&y(L,K,E,M,T,h,la,ra,b)}else ra.opacity!=0&&y(L,K,E,M,T,h,la,ra,b)}pa.addRectangle($)}v.setTransform(1,0,0,1,0,0)}};
 THREE.SVGRenderer=function(){function b(b,d,c){var e,h,f,g;e=0;for(h=b.lights.length;e<h;e++)f=b.lights[e],f instanceof THREE.DirectionalLight?(g=d.normalWorld.dot(f.position)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g)):f instanceof THREE.PointLight&&(M.sub(f.position,d.centroidWorld),M.normalize(),g=d.normalWorld.dot(M)*f.intensity,g>0&&(c.r+=f.color.r*g,c.g+=f.color.g*g,c.b+=f.color.b*g))}function c(d,c,h,k,m,p){j.data.vertices+=3;j.data.faces++;Q=e(R++);Q.setAttribute("d",
 "M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?F.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?D?(B.r=P.r,B.g=P.g,B.b=P.b,b(p,k,B),F.r=Math.max(0,Math.min(m.color.r*B.r,1)),F.g=Math.max(0,Math.min(m.color.g*B.g,1)),F.b=Math.max(0,Math.min(m.color.b*B.b,1)),F.updateHex()):F.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(E=1-m.__2near/(m.__farPlusNear-
-k.z*m.__farMinusNear),F.setRGB(E,E,E)):m instanceof THREE.MeshNormalMaterial&&F.setRGB(f(k.normalWorld.x),f(k.normalWorld.y),f(k.normalWorld.z));m.wireframe?Q.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):Q.setAttribute("style","fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+m.opacity);o.appendChild(Q)}function d(d,c,h,k,
-m,p,n){j.data.vertices+=4;j.data.faces++;Q=e(R++);Q.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?D?(B.r=P.r,B.g=P.g,B.b=P.b,b(n,m,B),F.r=Math.max(0,Math.min(p.color.r*B.r,1)),F.g=Math.max(0,Math.min(p.color.g*B.g,1)),F.b=Math.max(0,Math.min(p.color.b*
+k.z*m.__farMinusNear),F.setRGB(E,E,E)):m instanceof THREE.MeshNormalMaterial&&F.setRGB(f(k.normalWorld.x),f(k.normalWorld.y),f(k.normalWorld.z));m.wireframe?Q.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):Q.setAttribute("style","fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+m.opacity);n.appendChild(Q)}function d(d,c,h,k,
+m,p,o){j.data.vertices+=4;j.data.faces++;Q=e(R++);Q.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?D?(B.r=P.r,B.g=P.g,B.b=P.b,b(o,m,B),F.r=Math.max(0,Math.min(p.color.r*B.r,1)),F.g=Math.max(0,Math.min(p.color.g*B.g,1)),F.b=Math.max(0,Math.min(p.color.b*
 B.b,1)),F.updateHex()):F.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(E=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),F.setRGB(E,E,E)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));p.wireframe?Q.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):Q.setAttribute("style",
-"fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(Q)}function e(b){T[b]==null&&(T[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),aa==0&&T[b].setAttribute("shape-rendering","crispEdges"));return T[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,t,u,v,z,A,x,G=new THREE.Rectangle,y=new THREE.Rectangle,
-D=!1,F=new THREE.Color(16777215),B=new THREE.Color(16777215),P=new THREE.Color(0),K=new THREE.Color(0),L=new THREE.Color(0),E,M=new THREE.Vector3,T=[],h=[],Q,R,N,aa=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(b,d){n=b;p=d;t=n/2;u=p/2;o.setAttribute("viewBox",-t+" "+-u+" "+n+" "+p);o.setAttribute("width",n);o.setAttribute("height",p);G.set(-t,
--u,t,u)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,e){var f,p,n,F,B,E,I,S;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,e,this.sortElements);N=R=0;if(D=b.lights.length>0){I=b.lights;P.setRGB(0,0,0);K.setRGB(0,0,0);L.setRGB(0,0,0);f=0;for(p=I.length;f<p;f++)n=I[f],F=n.color,n instanceof THREE.AmbientLight?(P.r+=F.r,P.g+=F.g,P.b+=F.b):n instanceof THREE.DirectionalLight?(K.r+=F.r,K.g+=F.g,K.b+=F.b):n instanceof
-THREE.PointLight&&(L.r+=F.r,L.g+=F.g,L.b+=F.b)}f=0;for(p=k.length;f<p;f++)if(I=k[f],y.empty(),I instanceof THREE.RenderableParticle){v=I;v.x*=t;v.y*=-u;n=0;for(F=I.materials.length;n<F;)n++}else if(I instanceof THREE.RenderableLine){if(v=I.v1,z=I.v2,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,y.addPoint(v.positionScreen.x,v.positionScreen.y),y.addPoint(z.positionScreen.x,z.positionScreen.y),G.instersects(y)){n=0;for(F=I.materials.length;n<F;)if((S=I.materials[n++])&&
+"fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+p.opacity);n.appendChild(Q)}function e(b){T[b]==null&&(T[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),aa==0&&T[b].setAttribute("shape-rendering","crispEdges"));return T[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,t,u,v,z,A,x,G=new THREE.Rectangle,y=new THREE.Rectangle,
+D=!1,F=new THREE.Color(16777215),B=new THREE.Color(16777215),P=new THREE.Color(0),L=new THREE.Color(0),K=new THREE.Color(0),E,M=new THREE.Vector3,T=[],h=[],Q,R,N,aa=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":aa=1;break;case "low":aa=0}};this.setSize=function(b,d){o=b;p=d;t=o/2;u=p/2;n.setAttribute("viewBox",-t+" "+-u+" "+o+" "+p);n.setAttribute("width",o);n.setAttribute("height",p);G.set(-t,
+-u,t,u)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(b,e){var f,p,o,F,B,E,I,S;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(b,e,this.sortElements);N=R=0;if(D=b.lights.length>0){I=b.lights;P.setRGB(0,0,0);L.setRGB(0,0,0);K.setRGB(0,0,0);f=0;for(p=I.length;f<p;f++)o=I[f],F=o.color,o instanceof THREE.AmbientLight?(P.r+=F.r,P.g+=F.g,P.b+=F.b):o instanceof THREE.DirectionalLight?(L.r+=F.r,L.g+=F.g,L.b+=F.b):o instanceof
+THREE.PointLight&&(K.r+=F.r,K.g+=F.g,K.b+=F.b)}f=0;for(p=k.length;f<p;f++)if(I=k[f],y.empty(),I instanceof THREE.RenderableParticle){v=I;v.x*=t;v.y*=-u;o=0;for(F=I.materials.length;o<F;)o++}else if(I instanceof THREE.RenderableLine){if(v=I.v1,z=I.v2,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,y.addPoint(v.positionScreen.x,v.positionScreen.y),y.addPoint(z.positionScreen.x,z.positionScreen.y),G.instersects(y)){o=0;for(F=I.materials.length;o<F;)if((S=I.materials[o++])&&
 S.opacity!=0){B=v;E=z;var M=N++;h[M]==null&&(h[M]=document.createElementNS("http://www.w3.org/2000/svg","line"),aa==0&&h[M].setAttribute("shape-rendering","crispEdges"));Q=h[M];Q.setAttribute("x1",B.positionScreen.x);Q.setAttribute("y1",B.positionScreen.y);Q.setAttribute("x2",E.positionScreen.x);Q.setAttribute("y2",E.positionScreen.y);S instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: ##"+g(S.color.hex.toString(16))+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+
-S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin),o.appendChild(Q))}}}else if(I instanceof THREE.RenderableFace3){if(v=I.v1,z=I.v2,A=I.v3,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,A.positionScreen.x*=t,A.positionScreen.y*=-u,y.addPoint(v.positionScreen.x,v.positionScreen.y),y.addPoint(z.positionScreen.x,z.positionScreen.y),y.addPoint(A.positionScreen.x,A.positionScreen.y),G.instersects(y)){n=0;for(F=I.meshMaterials.length;n<
-F;)if(S=I.meshMaterials[n++],S instanceof THREE.MeshFaceMaterial){B=0;for(E=I.faceMaterials.length;B<E;)(S=I.faceMaterials[B++])&&S.opacity!=0&&c(v,z,A,I,S,b)}else S&&S.opacity!=0&&c(v,z,A,I,S,b)}}else if(I instanceof THREE.RenderableFace4&&(v=I.v1,z=I.v2,A=I.v3,x=I.v4,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,A.positionScreen.x*=t,A.positionScreen.y*=-u,x.positionScreen.x*=t,x.positionScreen.y*=-u,y.addPoint(v.positionScreen.x,v.positionScreen.y),y.addPoint(z.positionScreen.x,
-z.positionScreen.y),y.addPoint(A.positionScreen.x,A.positionScreen.y),y.addPoint(x.positionScreen.x,x.positionScreen.y),G.instersects(y))){n=0;for(F=I.meshMaterials.length;n<F;)if(S=I.meshMaterials[n++],S instanceof THREE.MeshFaceMaterial){B=0;for(E=I.faceMaterials.length;B<E;)(S=I.faceMaterials[B++])&&S.opacity!=0&&d(v,z,A,x,I,S,b)}else S&&S.opacity!=0&&d(v,z,A,x,I,S,b)}}};
+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin),n.appendChild(Q))}}}else if(I instanceof THREE.RenderableFace3){if(v=I.v1,z=I.v2,A=I.v3,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,A.positionScreen.x*=t,A.positionScreen.y*=-u,y.addPoint(v.positionScreen.x,v.positionScreen.y),y.addPoint(z.positionScreen.x,z.positionScreen.y),y.addPoint(A.positionScreen.x,A.positionScreen.y),G.instersects(y)){o=0;for(F=I.meshMaterials.length;o<
+F;)if(S=I.meshMaterials[o++],S instanceof THREE.MeshFaceMaterial){B=0;for(E=I.faceMaterials.length;B<E;)(S=I.faceMaterials[B++])&&S.opacity!=0&&c(v,z,A,I,S,b)}else S&&S.opacity!=0&&c(v,z,A,I,S,b)}}else if(I instanceof THREE.RenderableFace4&&(v=I.v1,z=I.v2,A=I.v3,x=I.v4,v.positionScreen.x*=t,v.positionScreen.y*=-u,z.positionScreen.x*=t,z.positionScreen.y*=-u,A.positionScreen.x*=t,A.positionScreen.y*=-u,x.positionScreen.x*=t,x.positionScreen.y*=-u,y.addPoint(v.positionScreen.x,v.positionScreen.y),y.addPoint(z.positionScreen.x,
+z.positionScreen.y),y.addPoint(A.positionScreen.x,A.positionScreen.y),y.addPoint(x.positionScreen.x,x.positionScreen.y),G.instersects(y))){o=0;for(F=I.meshMaterials.length;o<F;)if(S=I.meshMaterials[o++],S instanceof THREE.MeshFaceMaterial){B=0;for(E=I.faceMaterials.length;B<E;)(S=I.faceMaterials[B++])&&S.opacity!=0&&d(v,z,A,x,I,S,b)}else S&&S.opacity!=0&&d(v,z,A,x,I,S,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -222,89 +222,89 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,d,c){var e,f,g,j=b.vertices,k=j.length,m=b.colors,o=m.length,p=b.__vertexArray,n=b.__colorArray,t=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors;if(c.sortParticles){S.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=j[e].position,ia.copy(f),S.multiplyVector3(ia),t[e]=[ia.z,e];t.sort(function(b,d){return d[0]-b[0]});for(e=0;e<k;e++)f=j[t[e][1]].position,g=e*3,p[g]=f.x,p[g+1]=f.y,p[g+2]=f.z;for(e=0;e<o;e++)g=e*3,color=m[t[e][1]],n[g]=color.r,n[g+1]=color.g,
-n[g+2]=color.b}else{if(u)for(e=0;e<k;e++)f=j[e].position,g=e*3,p[g]=f.x,p[g+1]=f.y,p[g+2]=f.z;if(v)for(e=0;e<o;e++)color=m[e],g=e*3,n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b}if(u||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,p,d);if(v||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,n,d)}function d(b,d,c,e,f){e.program||T.initMaterial(e,d,c,f);var g=e.program,j=g.uniforms,k=e.uniforms;g!=R&&(h.useProgram(g),
-R=g);h.uniformMatrix4fv(j.projectionMatrix,!1,Z);if(c&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(k.fogColor.value=c.color,c instanceof THREE.Fog)k.fogNear.value=c.near,k.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,
-o,p=0,n=0,t=0,u,v,x,z,y=Y,A=y.directional.colors,F=y.directional.positions,G=y.point.colors,D=y.point.positions,E=y.point.distances,L=0,C=0,c=o=z=0;for(m=d.length;c<m;c++)if(o=d[c],u=o.color,v=o.position,x=o.intensity,z=o.distance,o instanceof THREE.AmbientLight)p+=u.r,n+=u.g,t+=u.b;else if(o instanceof THREE.DirectionalLight)z=L*3,A[z]=u.r*x,A[z+1]=u.g*x,A[z+2]=u.b*x,F[z]=v.x,F[z+1]=v.y,F[z+2]=v.z,L+=1;else if(o instanceof THREE.PointLight)o=C*3,G[o]=u.r*x,G[o+1]=u.g*x,G[o+2]=u.b*x,D[o]=v.x,D[o+
-1]=v.y,D[o+2]=v.z,E[C]=z,C+=1;for(c=L*3;c<A.length;c++)A[c]=0;for(c=C*3;c<G.length;c++)G[c]=0;y.point.length=C;y.directional.length=L;y.ambient[0]=p;y.ambient[1]=n;y.ambient[2]=t;c=Y;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof
+THREE.WebGLRenderer=function(b){function c(b,d,c){var e,f,g,j=b.vertices,k=j.length,m=b.colors,n=m.length,p=b.__vertexArray,o=b.__colorArray,t=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors;if(c.sortParticles){S.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=j[e].position,ia.copy(f),S.multiplyVector3(ia),t[e]=[ia.z,e];t.sort(function(b,d){return d[0]-b[0]});for(e=0;e<k;e++)f=j[t[e][1]].position,g=e*3,p[g]=f.x,p[g+1]=f.y,p[g+2]=f.z;for(e=0;e<n;e++)g=e*3,color=m[t[e][1]],o[g]=color.r,o[g+1]=color.g,
+o[g+2]=color.b}else{if(u)for(e=0;e<k;e++)f=j[e].position,g=e*3,p[g]=f.x,p[g+1]=f.y,p[g+2]=f.z;if(v)for(e=0;e<n;e++)color=m[e],g=e*3,o[g]=color.r,o[g+1]=color.g,o[g+2]=color.b}if(u||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,p,d);if(v||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,o,d)}function d(b,d,c,e,f){e.program||T.initMaterial(e,d,c,f);var g=e.program,j=g.uniforms,k=e.uniforms;g!=R&&(h.useProgram(g),
+R=g);h.uniformMatrix4fv(j.projectionMatrix,!1,Y);if(c&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(k.fogColor.value=c.color,c instanceof THREE.Fog)k.fogNear.value=c.near,k.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)k.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,
+n,p=0,o=0,t=0,u,v,x,z,y=X,A=y.directional.colors,F=y.directional.positions,G=y.point.colors,D=y.point.positions,E=y.point.distances,K=0,C=0,c=n=z=0;for(m=d.length;c<m;c++)if(n=d[c],u=n.color,v=n.position,x=n.intensity,z=n.distance,n instanceof THREE.AmbientLight)p+=u.r,o+=u.g,t+=u.b;else if(n instanceof THREE.DirectionalLight)z=K*3,A[z]=u.r*x,A[z+1]=u.g*x,A[z+2]=u.b*x,F[z]=v.x,F[z+1]=v.y,F[z+2]=v.z,K+=1;else if(n instanceof THREE.PointLight)n=C*3,G[n]=u.r*x,G[n+1]=u.g*x,G[n+2]=u.b*x,D[n]=v.x,D[n+
+1]=v.y,D[n+2]=v.z,E[C]=z,C+=1;for(c=K*3;c<A.length;c++)A[c]=0;for(c=C*3;c<G.length;c++)G[c]=0;y.point.length=C;y.directional.length=K;y.ambient[0]=p;y.ambient[1]=o;y.ambient[2]=t;c=X;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof
 THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity,(k.map.texture=e.map)&&k.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),k.lightMap.texture=e.lightMap,k.envMap.texture=e.envMap,k.reflectivity.value=e.reflectivity,k.refractionRatio.value=e.refractionRatio,k.combine.value=e.combine,k.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
 if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=H.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof
-THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var va in k)if(n=g.uniforms[va])if(m=k[va],p=m.type,c=m.value,p=="i")h.uniform1i(n,c);else if(p=="f")h.uniform1f(n,c);else if(p=="fv1")h.uniform1fv(n,c);else if(p=="fv")h.uniform3fv(n,c);else if(p=="v2")h.uniform2f(n,c.x,c.y);else if(p=="v3")h.uniform3f(n,c.x,c.y,c.z);else if(p=="v4")h.uniform4f(n,c.x,c.y,c.z,c.w);else if(p=="c")h.uniform3f(n,c.r,c.g,c.b);else if(p=="t"&&(h.uniform1i(n,c),m=m.texture))if(m.image instanceof Array&&m.image.length==
+THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var va in k)if(o=g.uniforms[va])if(m=k[va],p=m.type,c=m.value,p=="i")h.uniform1i(o,c);else if(p=="f")h.uniform1f(o,c);else if(p=="fv1")h.uniform1fv(o,c);else if(p=="fv")h.uniform3fv(o,c);else if(p=="v2")h.uniform2f(o,c.x,c.y);else if(p=="v3")h.uniform3f(o,c.x,c.y,c.z);else if(p=="v4")h.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")h.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(h.uniform1i(o,c),m=m.texture))if(m.image instanceof Array&&m.image.length==
 6){if(m.image.length==6){if(m.needsUpdate){if(m.__webglInit){h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)h.texSubImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,h.RGBA,h.UNSIGNED_BYTE,m.image[p])}else{m.image.__webglTextureCube=h.createTexture();h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(p=0;p<6;++p)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,m.image[p]);m.__webglInit=!0}B(h.TEXTURE_CUBE_MAP,m,m.image[0]);h.bindTexture(h.TEXTURE_CUBE_MAP,
 null);m.needsUpdate=!1}h.activeTexture(h.TEXTURE0+c);h.bindTexture(h.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}}else P(m,c);h.uniformMatrix4fv(j.modelViewMatrix,!1,f._modelViewMatrixArray);h.uniformMatrix3fv(j.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&h.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning)&&j.objectMatrix!==
-null&&h.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&h.uniformMatrix4fv(j.viewMatrix,!1,$);if(e instanceof THREE.ShadowVolumeDynamicMaterial)b=k.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,h.uniform3fv(j.directionalLightDirection,b),h.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray),
-h.uniformMatrix4fv(j.viewMatrix,!1,$);e.skinning&&(h.uniformMatrix4fv(j.cameraInverseMatrix,!1,$),h.uniformMatrix4fv(j.boneGlobalMatrices,!1,f.boneMatrices));return g}function e(b,c,e,f,g,j){if(f.opacity!=0){var k,b=d(b,c,e,f,j).attributes;if(!f.morphTargets&&b.position>=0)h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(b.position,3,h.FLOAT,!1,0,0);else{c=f.program.attributes;j.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),
-h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0)):c.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;e<f.numSupportedMorphTargets&&e<m.length;)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[m[e]]),h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=o[m[e]],e++;else{var m=[],p=-1,
-n=0,o=j.morphTargetInfluences,t,u=o.length,e=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);e<f.numSupportedMorphTargets;){for(t=0;t<u;t++)!m[t]&&o[t]>p&&(n=t,p=o[n]);h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n]);h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;m[n]=1;p=-1;e++}}f.program.uniforms.morphTargetInfluences!==null&&h.uniform1fv(f.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=
+null&&h.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&h.uniformMatrix4fv(j.viewMatrix,!1,Z);if(e instanceof THREE.ShadowVolumeDynamicMaterial)b=k.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,h.uniform3fv(j.directionalLightDirection,b),h.uniformMatrix4fv(j.objectMatrix,!1,f._objectMatrixArray),
+h.uniformMatrix4fv(j.viewMatrix,!1,Z);e.skinning&&(h.uniformMatrix4fv(j.cameraInverseMatrix,!1,Z),h.uniformMatrix4fv(j.boneGlobalMatrices,!1,f.boneMatrices));return g}function e(b,c,e,f,g,j){if(f.opacity!=0){var k,b=d(b,c,e,f,j).attributes;if(!f.morphTargets&&b.position>=0)h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(b.position,3,h.FLOAT,!1,0,0);else{c=f.program.attributes;j.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),
+h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0)):c.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglVertexBuffer),h.vertexAttribPointer(c.position,3,h.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,m=j.morphTargetForcedOrder,n=j.morphTargetInfluences;e<f.numSupportedMorphTargets&&e<m.length;)h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[m[e]]),h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=n[m[e]],e++;else{var m=[],p=-1,
+o=0,n=j.morphTargetInfluences,t,u=n.length,e=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);e<f.numSupportedMorphTargets;){for(t=0;t<u;t++)!m[t]&&n[t]>p&&(o=t,p=n[o]);h.bindBuffer(h.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);h.vertexAttribPointer(c["morphTarget"+e],3,h.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;m[o]=1;p=-1;e++}}f.program.uniforms.morphTargetInfluences!==null&&h.uniform1fv(f.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=
 0&&(c=g.__webglCustomAttributes[k],h.bindBuffer(h.ARRAY_BUFFER,c.buffer),h.vertexAttribPointer(b[k],c.size,h.FLOAT,!1,0,0));b.color>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglColorBuffer),h.vertexAttribPointer(b.color,3,h.FLOAT,!1,0,0));b.normal>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglNormalBuffer),h.vertexAttribPointer(b.normal,3,h.FLOAT,!1,0,0));b.tangent>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglTangentBuffer),h.vertexAttribPointer(b.tangent,4,h.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(h.bindBuffer(h.ARRAY_BUFFER,
 g.__webglUVBuffer),h.vertexAttribPointer(b.uv,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv)):h.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(h.bindBuffer(h.ARRAY_BUFFER,g.__webglUV2Buffer),h.vertexAttribPointer(b.uv2,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(b.uv2)):h.disableVertexAttribArray(b.uv2));f.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexABuffer),h.vertexAttribPointer(b.skinVertexA,4,
 h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),h.vertexAttribPointer(b.skinVertexB,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),h.vertexAttribPointer(b.skinIndex,4,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),h.vertexAttribPointer(b.skinWeight,4,h.FLOAT,!1,0,0));j instanceof THREE.Mesh?(f.wireframe?(h.lineWidth(f.wireframeLinewidth),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),h.drawElements(h.LINES,g.__webglLineCount,
 h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),h.drawElements(h.TRIANGLES,g.__webglFaceCount,h.UNSIGNED_SHORT,0)),T.data.vertices+=g.__webglFaceCount,T.data.faces+=g.__webglFaceCount/3,T.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(f.linewidth),h.drawArrays(j,0,g.__webglLineCount),T.data.drawCalls++):j instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,g.__webglParticleCount),T.data.drawCalls++):j instanceof
 THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,g.__webglVertexCount),T.data.drawCalls++)}}function f(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(d.attributes.position),h.vertexAttribPointer(d.attributes.position,3,h.FLOAT,!1,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,g,j,k,m,o,p,n,t,u=b.count*3;for(t=0;t<u;t+=9)c=b.normalArray,e=c[t],f=c[t+1],g=c[t+2],j=c[t+3],m=c[t+4],p=c[t+5],k=c[t+6],o=c[t+7],n=c[t+8],e=(e+j+k)/3,f=(f+m+o)/3,g=(g+p+n)/3,c[t]=e,c[t+1]=f,c[t+2]=g,c[t+3]=e,c[t+4]=f,c[t+5]=g,c[t+6]=e,c[t+7]=f,c[t+8]=g}h.bufferData(h.ARRAY_BUFFER,b.normalArray,h.DYNAMIC_DRAW);h.enableVertexAttribArray(d.attributes.normal);h.vertexAttribPointer(d.attributes.normal,3,h.FLOAT,!1,0,0)}h.drawArrays(h.TRIANGLES,
+b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,g,j,k,m,n,p,o,t,u=b.count*3;for(t=0;t<u;t+=9)c=b.normalArray,e=c[t],f=c[t+1],g=c[t+2],j=c[t+3],m=c[t+4],p=c[t+5],k=c[t+6],n=c[t+7],o=c[t+8],e=(e+j+k)/3,f=(f+m+n)/3,g=(g+p+o)/3,c[t]=e,c[t+1]=f,c[t+2]=g,c[t+3]=e,c[t+4]=f,c[t+5]=g,c[t+6]=e,c[t+7]=f,c[t+8]=g}h.bufferData(h.ARRAY_BUFFER,b.normalArray,h.DYNAMIC_DRAW);h.enableVertexAttribArray(d.attributes.normal);h.vertexAttribPointer(d.attributes.normal,3,h.FLOAT,!1,0,0)}h.drawArrays(h.TRIANGLES,
 0,b.count);b.count=0}function g(b){if(U!=b.doubleSided)b.doubleSided?h.disable(h.CULL_FACE):h.enable(h.CULL_FACE),U=b.doubleSided;if(V!=b.flipSided)b.flipSided?h.frontFace(h.CW):h.frontFace(h.CCW),V=b.flipSided}function j(b){W!=b&&(b?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),W=b)}function k(b){I[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);I[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);I[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);I[3].set(b.n41-b.n21,b.n42-
-b.n22,b.n43-b.n23,b.n44-b.n24);I[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);I[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var d,b=0;b<6;b++)d=I[b],d.divideScalar(Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z))}function m(b){for(var d=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=I[e].x*d.n14+I[e].y*d.n24+I[e].z*d.n34+I[e].w,b<=c)return!1;return!0}function o(b,d){b.list[b.count]=d;b.count+=1}function n(b){var d,
-c,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(d=e.materials.length;b<d;b++)c=e.materials[b],c.transparent?o(g,c):o(f,c)}function p(b){var d,c,e,f,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=g.materials.length;b<e;b++)if(d=g.materials[b],d instanceof THREE.MeshFaceMaterial){d=0;for(c=h.materials.length;d<c;d++)(f=h.materials[d])&&(f.transparent?o(k,f):o(j,f))}else(f=d)&&(f.transparent?o(k,f):o(j,f))}function t(b,d){return d.z-b.z}function u(b){h.enable(h.POLYGON_OFFSET_FILL);
-h.polygonOffset(0.1,1);h.enable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(!1);h.colorMask(!1,!1,!1,!1);h.stencilFunc(h.ALWAYS,1,255);h.stencilOpSeparate(h.BACK,h.KEEP,h.INCR,h.KEEP);h.stencilOpSeparate(h.FRONT,h.KEEP,h.DECR,h.KEEP);var d,c=b.lights.length,e,f=b.lights,g=[],j,k,m,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<c;d++)if(e=b.lights[d],e instanceof THREE.DirectionalLight&&e.castShadow){g[0]=-e.position.x;g[1]=-e.position.y;g[2]=-e.position.z;for(p=0;p<n;p++)e=b.__webglShadowVolumes[p].object,
-j=b.__webglShadowVolumes[p].buffer,k=e.materials[0],k.program||T.initMaterial(k,f,void 0,e),k=k.program,m=k.uniforms,o=k.attributes,R!==k&&(h.useProgram(k),R=k,h.uniformMatrix4fv(m.projectionMatrix,!1,Z),h.uniformMatrix4fv(m.viewMatrix,!1,$),h.uniform3fv(m.directionalLightDirection,g)),e.matrixWorld.flattenToArray(e._objectMatrixArray),h.uniformMatrix4fv(m.objectMatrix,!1,e._objectMatrixArray),h.bindBuffer(h.ARRAY_BUFFER,j.__webglVertexBuffer),h.vertexAttribPointer(o.position,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,
-j.__webglNormalBuffer),h.vertexAttribPointer(o.normal,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),h.cullFace(h.FRONT),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0),h.cullFace(h.BACK),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0)}h.disable(h.POLYGON_OFFSET_FILL);h.colorMask(!0,!0,!0,!0);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP);h.disable(h.DEPTH_TEST);ga=-1;R=ca.program;h.useProgram(ca.program);h.uniformMatrix4fv(ca.projectionLocation,
-!1,Z);h.uniform1f(ca.darknessLocation,ca.darkness);h.bindBuffer(h.ARRAY_BUFFER,ca.vertexBuffer);h.vertexAttribPointer(ca.vertexLocation,3,h.FLOAT,!1,0,0);h.enableVertexAttribArray(ca.vertexLocation);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.blendEquation(h.FUNC_ADD);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.disable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function v(b,d){var c,e,f;c=_sprite.attributes;var g=_sprite.uniforms,
-j=fa/ka,k,m=[],o=ka*0.5,p=fa*0.5,n=!0;h.useProgram(_sprite.program);R=_sprite.program;ga=-1;pa||(h.enableVertexAttribArray(_sprite.attributes.position),h.enableVertexAttribArray(_sprite.attributes.uv),pa=!0);h.disable(h.CULL_FACE);h.enable(h.BLEND);h.depthMask(!0);h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.vertexAttribPointer(c.position,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.uniformMatrix4fv(g.projectionMatrix,
-!1,Z);h.activeTexture(h.TEXTURE0);h.uniform1i(g.map,0);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);b.__webglSprites.sort(t);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.material===void 0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(h.uniform1i(g.useScreenCoordinates,1),h.uniform3f(g.screenPosition,
-(f.position.x-o)/o,(p-f.position.y)/p,Math.max(0,Math.min(1,f.position.z)))):(h.uniform1i(g.useScreenCoordinates,0),h.uniform1i(g.affectedByDistance,f.affectedByDistance?1:0),h.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.affectedByDistance?1:fa),m[0]=k*j*f.scale.x,m[1]=k*f.scale.y,h.uniform2f(g.uvScale,f.uvScale.x,f.uvScale.y),h.uniform2f(g.uvOffset,f.uvOffset.x,f.uvOffset.y),h.uniform2f(g.alignment,f.alignment.x,f.alignment.y),h.uniform1f(g.opacity,f.opacity),
-h.uniform1f(g.rotation,f.rotation),h.uniform2fv(g.scale,m),f.mergeWith3D&&!n?(h.enable(h.DEPTH_TEST),n=!0):!f.mergeWith3D&&n&&(h.disable(h.DEPTH_TEST),n=!1),F(f.blending),P(f.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function z(b,d){var c,e,f=b.__webglLensFlares.length,g,j,k,m=new THREE.Vector3,o=fa/ka,p=ka*0.5,n=fa*0.5,t=16/fa,u=[t*o,t],v=[1,1,0],x=[1,1],z=O.uniforms;c=O.attributes;h.useProgram(O.program);R=O.program;ga=
+b.n22,b.n43-b.n23,b.n44-b.n24);I[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);I[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var d,b=0;b<6;b++)d=I[b],d.divideScalar(Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z))}function m(b){for(var d=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=I[e].x*d.n14+I[e].y*d.n24+I[e].z*d.n34+I[e].w,b<=c)return!1;return!0}function n(b,d){b.list[b.count]=d;b.count+=1}function o(b){var d,
+c,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(d=e.materials.length;b<d;b++)c=e.materials[b],c.transparent?n(g,c):n(f,c)}function p(b){var d,c,e,f,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=g.materials.length;b<e;b++)if(d=g.materials[b],d instanceof THREE.MeshFaceMaterial){d=0;for(c=h.materials.length;d<c;d++)(f=h.materials[d])&&(f.transparent?n(k,f):n(j,f))}else(f=d)&&(f.transparent?n(k,f):n(j,f))}function t(b,d){return d.z-b.z}function u(b){h.enable(h.POLYGON_OFFSET_FILL);
+h.polygonOffset(0.1,1);h.enable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(!1);h.colorMask(!1,!1,!1,!1);h.stencilFunc(h.ALWAYS,1,255);h.stencilOpSeparate(h.BACK,h.KEEP,h.INCR,h.KEEP);h.stencilOpSeparate(h.FRONT,h.KEEP,h.DECR,h.KEEP);var d,c=b.lights.length,e,f=b.lights,g=[],j,k,m,n,p,o=b.__webglShadowVolumes.length;for(d=0;d<c;d++)if(e=b.lights[d],e instanceof THREE.DirectionalLight&&e.castShadow){g[0]=-e.position.x;g[1]=-e.position.y;g[2]=-e.position.z;for(p=0;p<o;p++)e=b.__webglShadowVolumes[p].object,
+j=b.__webglShadowVolumes[p].buffer,k=e.materials[0],k.program||T.initMaterial(k,f,void 0,e),k=k.program,m=k.uniforms,n=k.attributes,R!==k&&(h.useProgram(k),R=k,h.uniformMatrix4fv(m.projectionMatrix,!1,Y),h.uniformMatrix4fv(m.viewMatrix,!1,Z),h.uniform3fv(m.directionalLightDirection,g)),e.matrixWorld.flattenToArray(e._objectMatrixArray),h.uniformMatrix4fv(m.objectMatrix,!1,e._objectMatrixArray),h.bindBuffer(h.ARRAY_BUFFER,j.__webglVertexBuffer),h.vertexAttribPointer(n.position,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ARRAY_BUFFER,
+j.__webglNormalBuffer),h.vertexAttribPointer(n.normal,3,h.FLOAT,!1,0,0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),h.cullFace(h.FRONT),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0),h.cullFace(h.BACK),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0)}h.disable(h.POLYGON_OFFSET_FILL);h.colorMask(!0,!0,!0,!0);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP);h.disable(h.DEPTH_TEST);ga=-1;R=ca.program;h.useProgram(ca.program);h.uniformMatrix4fv(ca.projectionLocation,
+!1,Y);h.uniform1f(ca.darknessLocation,ca.darkness);h.bindBuffer(h.ARRAY_BUFFER,ca.vertexBuffer);h.vertexAttribPointer(ca.vertexLocation,3,h.FLOAT,!1,0,0);h.enableVertexAttribArray(ca.vertexLocation);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.blendEquation(h.FUNC_ADD);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.disable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function v(b,d){var c,e,f;c=_sprite.attributes;var g=_sprite.uniforms,
+j=fa/ka,k,m=[],n=ka*0.5,p=fa*0.5,o=!0;h.useProgram(_sprite.program);R=_sprite.program;ga=-1;pa||(h.enableVertexAttribArray(_sprite.attributes.position),h.enableVertexAttribArray(_sprite.attributes.uv),pa=!0);h.disable(h.CULL_FACE);h.enable(h.BLEND);h.depthMask(!0);h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.vertexAttribPointer(c.position,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.uniformMatrix4fv(g.projectionMatrix,
+!1,Y);h.activeTexture(h.TEXTURE0);h.uniform1i(g.map,0);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);b.__webglSprites.sort(t);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.material===void 0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(h.uniform1i(g.useScreenCoordinates,1),h.uniform3f(g.screenPosition,
+(f.position.x-n)/n,(p-f.position.y)/p,Math.max(0,Math.min(1,f.position.z)))):(h.uniform1i(g.useScreenCoordinates,0),h.uniform1i(g.affectedByDistance,f.affectedByDistance?1:0),h.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.affectedByDistance?1:fa),m[0]=k*j*f.scale.x,m[1]=k*f.scale.y,h.uniform2f(g.uvScale,f.uvScale.x,f.uvScale.y),h.uniform2f(g.uvOffset,f.uvOffset.x,f.uvOffset.y),h.uniform2f(g.alignment,f.alignment.x,f.alignment.y),h.uniform1f(g.opacity,f.opacity),
+h.uniform1f(g.rotation,f.rotation),h.uniform2fv(g.scale,m),f.mergeWith3D&&!o?(h.enable(h.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(h.disable(h.DEPTH_TEST),o=!1),F(f.blending),P(f.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function z(b,d){var c,e,f=b.__webglLensFlares.length,g,j,k,m=new THREE.Vector3,n=fa/ka,p=ka*0.5,o=fa*0.5,t=16/fa,u=[t*n,t],v=[1,1,0],x=[1,1],z=O.uniforms;c=O.attributes;h.useProgram(O.program);R=O.program;ga=
 -1;sa||(h.enableVertexAttribArray(O.attributes.vertex),h.enableVertexAttribArray(O.attributes.uv),sa=!0);h.uniform1i(z.occlusionMap,0);h.uniform1i(z.map,1);h.bindBuffer(h.ARRAY_BUFFER,O.vertexBuffer);h.vertexAttribPointer(c.vertex,2,h.FLOAT,!1,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,!1,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,O.elementBuffer);h.disable(h.CULL_FACE);h.depthMask(!1);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,O.occlusionTexture);h.activeTexture(h.TEXTURE1);for(e=0;e<
-f;e++)if(c=b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,x[0]=v[0]*p+p,x[1]=v[1]*n+n,O.hasVertexTexture||x[0]>0&&x[0]<ka&&x[1]>0&&x[1]<fa){h.bindTexture(h.TEXTURE_2D,O.tempTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,x[0]-8,x[1]-8,16,16,0);h.uniform1i(z.renderType,0);h.uniform2fv(z.scale,u);h.uniform3fv(z.screenPosition,v);h.disable(h.BLEND);h.enable(h.DEPTH_TEST);
+f;e++)if(c=b.__webglLensFlares[e].object,m.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(m),d.projectionMatrix.multiplyVector3(m),v[0]=m.x,v[1]=m.y,v[2]=m.z,x[0]=v[0]*p+p,x[1]=v[1]*o+o,O.hasVertexTexture||x[0]>0&&x[0]<ka&&x[1]>0&&x[1]<fa){h.bindTexture(h.TEXTURE_2D,O.tempTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,x[0]-8,x[1]-8,16,16,0);h.uniform1i(z.renderType,0);h.uniform2fv(z.scale,u);h.uniform3fv(z.screenPosition,v);h.disable(h.BLEND);h.enable(h.DEPTH_TEST);
 h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.bindTexture(h.TEXTURE_2D,O.occlusionTexture);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGBA,x[0]-8,x[1]-8,16,16,0);h.uniform1i(z.renderType,1);h.disable(h.DEPTH_TEST);h.bindTexture(h.TEXTURE_2D,O.tempTexture);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);c.positionScreen.x=v[0];c.positionScreen.y=v[1];c.positionScreen.z=v[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();h.uniform1i(z.renderType,2);h.enable(h.BLEND);g=0;for(j=c.lensFlares.length;g<
-j;g++)if(k=c.lensFlares[g],k.opacity>0.0010&&k.scale>0.0010)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/fa,u[0]=t*o,u[1]=t,h.uniform3fv(z.screenPosition,v),h.uniform2fv(z.scale,u),h.uniform1f(z.rotation,k.rotation),h.uniform1f(z.opacity,k.opacity),F(k.blending),P(k.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function A(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function x(b){var d,e,f,g,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(g in f.__webglCustomAttributes)if(f.__webglCustomAttributes[g].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=h.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,o=void 0,p=void 0,n=void 0,t=p=void 0,u=void 0,v=void 0,x=void 0,z=void 0,y=void 0,A=void 0,
-F=void 0,G=void 0,B=void 0,D=void 0,Y=void 0,E=void 0,C=n=x=n=v=u=void 0,H=void 0,w=H=C=u=void 0,L=void 0,I=w=H=C=p=p=t=x=n=w=H=C=L=w=H=C=L=w=H=C=void 0,K=0,ha=0,N=0,O=0,P=0,ma=0,M=0,S=0,Q=0,J=0,W=0,H=C=0,V=f.__vertexArray,aa=f.__uvArray,ca=f.__uv2Array,ga=f.__normalArray,R=f.__tangentArray,ja=f.__colorArray,T=f.__skinVertexAArray,U=f.__skinVertexBArray,Z=f.__skinIndexArray,$=f.__skinWeightArray,ia=f.__morphTargetsArrays,fa=f.__webglCustomAttributes,w=void 0,da=f.__faceArray,ea=f.__lineArray,ka=f.__needsSmoothNormals,
+j;g++)if(k=c.lensFlares[g],k.opacity>0.0010&&k.scale>0.0010)v[0]=k.x,v[1]=k.y,v[2]=k.z,t=k.size*k.scale/fa,u[0]=t*n,u[1]=t,h.uniform3fv(z.screenPosition,v),h.uniform2fv(z.scale,u),h.uniform1f(z.rotation,k.rotation),h.uniform1f(z.opacity,k.opacity),F(k.blending),P(k.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(aa)}function A(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function x(b){var d,e,f,g,j;if(b instanceof THREE.Mesh){e=b.geometry;for(d in e.geometryGroups){f=e.geometryGroups[d];j=!1;for(g in f.__webglCustomAttributes)if(f.__webglCustomAttributes[g].needsUpdate){j=!0;break}if(e.__dirtyVertices||e.__dirtyMorphTargets||e.__dirtyElements||e.__dirtyUvs||e.__dirtyNormals||e.__dirtyColors||e.__dirtyTangents||j){j=b;var k=h.DYNAMIC_DRAW;if(f.__inittedArrays){var m=void 0,n=void 0,p=void 0,o=void 0,t=p=void 0,u=void 0,v=void 0,x=void 0,z=void 0,y=void 0,A=void 0,
+F=void 0,G=void 0,B=void 0,D=void 0,X=void 0,E=void 0,C=o=x=o=v=u=void 0,H=void 0,w=H=C=u=void 0,K=void 0,I=w=H=C=p=p=t=x=o=w=H=C=K=w=H=C=K=w=H=C=void 0,L=0,ha=0,N=0,O=0,P=0,ma=0,M=0,S=0,Q=0,J=0,W=0,H=C=0,V=f.__vertexArray,aa=f.__uvArray,ca=f.__uv2Array,ga=f.__normalArray,R=f.__tangentArray,ja=f.__colorArray,T=f.__skinVertexAArray,U=f.__skinVertexBArray,Y=f.__skinIndexArray,Z=f.__skinWeightArray,ia=f.__morphTargetsArrays,fa=f.__webglCustomAttributes,w=void 0,da=f.__faceArray,ea=f.__lineArray,ka=f.__needsSmoothNormals,
 y=f.__vertexColorType,z=f.__uvType,A=f.__normalType,na=j.geometry,pa=na.__dirtyVertices,Aa=na.__dirtyElements,sa=na.__dirtyUvs,ya=na.__dirtyNormals,Va=na.__dirtyTangents,Wa=na.__dirtyColors,Xa=na.__dirtyMorphTargets,Fa=na.vertices,Za=f.faces,bb=na.faces,$a=na.faceVertexUvs[0],ab=na.faceVertexUvs[1],Ga=na.skinVerticesA,Ha=na.skinVerticesB,Ia=na.skinIndices,za=na.skinWeights,Da=j instanceof THREE.ShadowVolume?na.edgeFaces:void 0,xa=na.morphTargets;if(fa)for(I in fa)fa[I].offset=0,fa[I].offsetSrc=0;
-m=0;for(o=Za.length;m<o;m++)if(p=Za[m],n=bb[p],$a&&(F=$a[p]),ab&&(G=ab[p]),p=n.vertexNormals,t=n.normal,u=n.vertexColors,v=n.color,x=n.vertexTangents,n instanceof THREE.Face3){if(pa)B=Fa[n.a].position,D=Fa[n.b].position,Y=Fa[n.c].position,V[ha]=B.x,V[ha+1]=B.y,V[ha+2]=B.z,V[ha+3]=D.x,V[ha+4]=D.y,V[ha+5]=D.z,V[ha+6]=Y.x,V[ha+7]=Y.y,V[ha+8]=Y.z,ha+=9;if(fa)for(I in fa)if(w=fa[I],w.needsUpdate)C=w.offset,H=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[C+0]=w.value[n.a],
-w.array[C+1]=w.value[n.b],w.array[C+2]=w.value[n.c]):w.boundTo==="faces"?(w.array[C+0]=w.value[H],w.array[C+1]=w.value[H],w.array[C+2]=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[C+0]=w.value[H+0],w.array[C+1]=w.value[H+1],w.array[C+2]=w.value[H+2],w.offsetSrc+=3),w.offset+=3):(w.boundTo===void 0||w.boundTo==="vertices"?(B=w.value[n.a],D=w.value[n.b],Y=w.value[n.c]):w.boundTo==="faces"?(B=w.value[H],D=w.value[H],Y=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(B=w.value[H+
-0],D=w.value[H+1],Y=w.value[H+2],w.offsetSrc+=3),w.size===2?(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=D.x,w.array[C+3]=D.y,w.array[C+4]=Y.x,w.array[C+5]=Y.y,w.offset+=6):w.size===3?(w.type==="c"?(w.array[C+0]=B.r,w.array[C+1]=B.g,w.array[C+2]=B.b,w.array[C+3]=D.r,w.array[C+4]=D.g,w.array[C+5]=D.b,w.array[C+6]=Y.r,w.array[C+7]=Y.g,w.array[C+8]=Y.b):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=D.x,w.array[C+4]=D.y,w.array[C+5]=D.z,w.array[C+6]=Y.x,w.array[C+7]=Y.y,w.array[C+
-8]=Y.z),w.offset+=9):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=B.w,w.array[C+4]=D.x,w.array[C+5]=D.y,w.array[C+6]=D.z,w.array[C+7]=D.w,w.array[C+8]=Y.x,w.array[C+9]=Y.y,w.array[C+10]=Y.z,w.array[C+11]=Y.w,w.offset+=12));if(Xa){C=0;for(H=xa.length;C<H;C++)B=xa[C].vertices[n.a].position,D=xa[C].vertices[n.b].position,Y=xa[C].vertices[n.c].position,w=ia[C],w[W+0]=B.x,w[W+1]=B.y,w[W+2]=B.z,w[W+3]=D.x,w[W+4]=D.y,w[W+5]=D.z,w[W+6]=Y.x,w[W+7]=Y.y,w[W+8]=Y.z;W+=9}if(za.length)C=za[n.a],
-H=za[n.b],w=za[n.c],$[J]=C.x,$[J+1]=C.y,$[J+2]=C.z,$[J+3]=C.w,$[J+4]=H.x,$[J+5]=H.y,$[J+6]=H.z,$[J+7]=H.w,$[J+8]=w.x,$[J+9]=w.y,$[J+10]=w.z,$[J+11]=w.w,C=Ia[n.a],H=Ia[n.b],w=Ia[n.c],Z[J]=C.x,Z[J+1]=C.y,Z[J+2]=C.z,Z[J+3]=C.w,Z[J+4]=H.x,Z[J+5]=H.y,Z[J+6]=H.z,Z[J+7]=H.w,Z[J+8]=w.x,Z[J+9]=w.y,Z[J+10]=w.z,Z[J+11]=w.w,C=Ga[n.a],H=Ga[n.b],w=Ga[n.c],T[J]=C.x,T[J+1]=C.y,T[J+2]=C.z,T[J+3]=1,T[J+4]=H.x,T[J+5]=H.y,T[J+6]=H.z,T[J+7]=1,T[J+8]=w.x,T[J+9]=w.y,T[J+10]=w.z,T[J+11]=1,C=Ha[n.a],H=Ha[n.b],w=Ha[n.c],U[J]=
-C.x,U[J+1]=C.y,U[J+2]=C.z,U[J+3]=1,U[J+4]=H.x,U[J+5]=H.y,U[J+6]=H.z,U[J+7]=1,U[J+8]=w.x,U[J+9]=w.y,U[J+10]=w.z,U[J+11]=1,J+=12;if(Wa&&y)u.length==3&&y==THREE.VertexColors?(n=u[0],C=u[1],H=u[2]):H=C=n=v,ja[Q]=n.r,ja[Q+1]=n.g,ja[Q+2]=n.b,ja[Q+3]=C.r,ja[Q+4]=C.g,ja[Q+5]=C.b,ja[Q+6]=H.r,ja[Q+7]=H.g,ja[Q+8]=H.b,Q+=9;if(Va&&na.hasTangents)u=x[0],v=x[1],n=x[2],R[M]=u.x,R[M+1]=u.y,R[M+2]=u.z,R[M+3]=u.w,R[M+4]=v.x,R[M+5]=v.y,R[M+6]=v.z,R[M+7]=v.w,R[M+8]=n.x,R[M+9]=n.y,R[M+10]=n.z,R[M+11]=n.w,M+=12;if(ya&&
-A)if(p.length==3&&ka)for(x=0;x<3;x++)t=p[x],ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;else for(x=0;x<3;x++)ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;if(sa&&F!==void 0&&z)for(x=0;x<3;x++)p=F[x],aa[N]=p.u,aa[N+1]=p.v,N+=2;if(sa&&G!==void 0&&z)for(x=0;x<3;x++)p=G[x],ca[O]=p.u,ca[O+1]=p.v,O+=2;Aa&&(da[P]=K,da[P+1]=K+1,da[P+2]=K+2,P+=3,ea[S]=K,ea[S+1]=K+1,ea[S+2]=K,ea[S+3]=K+2,ea[S+4]=K+1,ea[S+5]=K+2,S+=6,K+=3)}else if(n instanceof THREE.Face4){if(pa)B=Fa[n.a].position,D=Fa[n.b].position,Y=Fa[n.c].position,
-E=Fa[n.d].position,V[ha]=B.x,V[ha+1]=B.y,V[ha+2]=B.z,V[ha+3]=D.x,V[ha+4]=D.y,V[ha+5]=D.z,V[ha+6]=Y.x,V[ha+7]=Y.y,V[ha+8]=Y.z,V[ha+9]=E.x,V[ha+10]=E.y,V[ha+11]=E.z,ha+=12;if(fa)for(I in fa)if(w=fa[I],w.needsUpdate)C=w.offset,H=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[C+0]=w.value[n.a],w.array[C+1]=w.value[n.b],w.array[C+2]=w.value[n.c],w.array[C+3]=w.value[n.d]):w.boundTo==="faces"?(w.array[C+0]=w.value[H],w.array[C+1]=w.value[H],w.array[C+2]=w.value[H],w.array[C+
-3]=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[C+0]=w.value[H+0],w.array[C+1]=w.value[H+1],w.array[C+2]=w.value[H+2],w.array[C+3]=w.value[H+3],w.offsetSrc+=4),w.offset+=4):(w.boundTo===void 0||w.boundTo==="vertices"?(B=w.value[n.a],D=w.value[n.b],Y=w.value[n.c],E=w.value[n.d]):w.boundTo==="faces"?(B=w.value[H],D=w.value[H],Y=w.value[H],E=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(B=w.value[H+0],D=w.value[H+1],Y=w.value[H+2],E=w.value[H+3],w.offsetSrc+=4),w.size===2?
-(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=D.x,w.array[C+3]=D.y,w.array[C+4]=Y.x,w.array[C+5]=Y.y,w.array[C+6]=E.x,w.array[C+7]=E.y,w.offset+=8):w.size===3?(w.type==="c"?(w.array[C+0]=B.r,w.array[C+1]=B.g,w.array[C+2]=B.b,w.array[C+3]=D.r,w.array[C+4]=D.g,w.array[C+5]=D.b,w.array[C+6]=Y.r,w.array[C+7]=Y.g,w.array[C+8]=Y.b,w.array[C+9]=E.r,w.array[C+10]=E.g,w.array[C+11]=E.b):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=D.x,w.array[C+4]=D.y,w.array[C+5]=D.z,w.array[C+6]=Y.x,
-w.array[C+7]=Y.y,w.array[C+8]=Y.z,w.array[C+9]=E.x,w.array[C+10]=E.y,w.array[C+11]=E.z),w.offset+=12):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=B.w,w.array[C+4]=D.x,w.array[C+5]=D.y,w.array[C+6]=D.z,w.array[C+7]=D.w,w.array[C+8]=Y.x,w.array[C+9]=Y.y,w.array[C+10]=Y.z,w.array[C+11]=Y.w,w.array[C+12]=E.x,w.array[C+13]=E.y,w.array[C+14]=E.z,w.array[C+15]=E.w,w.offset+=16));if(Xa){C=0;for(H=xa.length;C<H;C++)B=xa[C].vertices[n.a].position,D=xa[C].vertices[n.b].position,Y=xa[C].vertices[n.c].position,
-E=xa[C].vertices[n.d].position,w=ia[C],w[W+0]=B.x,w[W+1]=B.y,w[W+2]=B.z,w[W+3]=D.x,w[W+4]=D.y,w[W+5]=D.z,w[W+6]=Y.x,w[W+7]=Y.y,w[W+8]=Y.z,w[W+9]=E.x,w[W+10]=E.y,w[W+11]=E.z;W+=12}if(za.length)C=za[n.a],H=za[n.b],w=za[n.c],L=za[n.d],$[J]=C.x,$[J+1]=C.y,$[J+2]=C.z,$[J+3]=C.w,$[J+4]=H.x,$[J+5]=H.y,$[J+6]=H.z,$[J+7]=H.w,$[J+8]=w.x,$[J+9]=w.y,$[J+10]=w.z,$[J+11]=w.w,$[J+12]=L.x,$[J+13]=L.y,$[J+14]=L.z,$[J+15]=L.w,C=Ia[n.a],H=Ia[n.b],w=Ia[n.c],L=Ia[n.d],Z[J]=C.x,Z[J+1]=C.y,Z[J+2]=C.z,Z[J+3]=C.w,Z[J+4]=
-H.x,Z[J+5]=H.y,Z[J+6]=H.z,Z[J+7]=H.w,Z[J+8]=w.x,Z[J+9]=w.y,Z[J+10]=w.z,Z[J+11]=w.w,Z[J+12]=L.x,Z[J+13]=L.y,Z[J+14]=L.z,Z[J+15]=L.w,C=Ga[n.a],H=Ga[n.b],w=Ga[n.c],L=Ga[n.d],T[J]=C.x,T[J+1]=C.y,T[J+2]=C.z,T[J+3]=1,T[J+4]=H.x,T[J+5]=H.y,T[J+6]=H.z,T[J+7]=1,T[J+8]=w.x,T[J+9]=w.y,T[J+10]=w.z,T[J+11]=1,T[J+12]=L.x,T[J+13]=L.y,T[J+14]=L.z,T[J+15]=1,C=Ha[n.a],H=Ha[n.b],w=Ha[n.c],n=Ha[n.d],U[J]=C.x,U[J+1]=C.y,U[J+2]=C.z,U[J+3]=1,U[J+4]=H.x,U[J+5]=H.y,U[J+6]=H.z,U[J+7]=1,U[J+8]=w.x,U[J+9]=w.y,U[J+10]=w.z,U[J+
-11]=1,U[J+12]=n.x,U[J+13]=n.y,U[J+14]=n.z,U[J+15]=1,J+=16;if(Wa&&y)u.length==4&&y==THREE.VertexColors?(n=u[0],C=u[1],H=u[2],u=u[3]):u=H=C=n=v,ja[Q]=n.r,ja[Q+1]=n.g,ja[Q+2]=n.b,ja[Q+3]=C.r,ja[Q+4]=C.g,ja[Q+5]=C.b,ja[Q+6]=H.r,ja[Q+7]=H.g,ja[Q+8]=H.b,ja[Q+9]=u.r,ja[Q+10]=u.g,ja[Q+11]=u.b,Q+=12;if(Va&&na.hasTangents)u=x[0],v=x[1],n=x[2],x=x[3],R[M]=u.x,R[M+1]=u.y,R[M+2]=u.z,R[M+3]=u.w,R[M+4]=v.x,R[M+5]=v.y,R[M+6]=v.z,R[M+7]=v.w,R[M+8]=n.x,R[M+9]=n.y,R[M+10]=n.z,R[M+11]=n.w,R[M+12]=x.x,R[M+13]=x.y,R[M+
-14]=x.z,R[M+15]=x.w,M+=16;if(ya&&A)if(p.length==4&&ka)for(x=0;x<4;x++)t=p[x],ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;else for(x=0;x<4;x++)ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;if(sa&&F!==void 0&&z)for(x=0;x<4;x++)p=F[x],aa[N]=p.u,aa[N+1]=p.v,N+=2;if(sa&&G!==void 0&&z)for(x=0;x<4;x++)p=G[x],ca[O]=p.u,ca[O+1]=p.v,O+=2;Aa&&(da[P]=K,da[P+1]=K+1,da[P+2]=K+3,da[P+3]=K+1,da[P+4]=K+2,da[P+5]=K+3,P+=6,ea[S]=K,ea[S+1]=K+1,ea[S+2]=K,ea[S+3]=K+3,ea[S+4]=K+1,ea[S+5]=K+2,ea[S+6]=K+2,ea[S+7]=K+3,S+=8,K+=
-4)}if(Da){m=0;for(o=Da.length;m<o;m++)da[P]=Da[m].a,da[P+1]=Da[m].b,da[P+2]=Da[m].c,da[P+3]=Da[m].a,da[P+4]=Da[m].c,da[P+5]=Da[m].d,P+=6}pa&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,V,k));if(fa)for(I in fa)if(w=fa[I],w.needsUpdate)h.bindBuffer(h.ARRAY_BUFFER,w.buffer),h.bufferData(h.ARRAY_BUFFER,w.array,k),w.needsUpdate=!1;if(Xa){C=0;for(H=xa.length;C<H;C++)h.bindBuffer(h.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[C]),h.bufferData(h.ARRAY_BUFFER,ia[C],k)}Wa&&
+m=0;for(n=Za.length;m<n;m++)if(p=Za[m],o=bb[p],$a&&(F=$a[p]),ab&&(G=ab[p]),p=o.vertexNormals,t=o.normal,u=o.vertexColors,v=o.color,x=o.vertexTangents,o instanceof THREE.Face3){if(pa)B=Fa[o.a].position,D=Fa[o.b].position,X=Fa[o.c].position,V[ha]=B.x,V[ha+1]=B.y,V[ha+2]=B.z,V[ha+3]=D.x,V[ha+4]=D.y,V[ha+5]=D.z,V[ha+6]=X.x,V[ha+7]=X.y,V[ha+8]=X.z,ha+=9;if(fa)for(I in fa)if(w=fa[I],w.needsUpdate)C=w.offset,H=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[C+0]=w.value[o.a],
+w.array[C+1]=w.value[o.b],w.array[C+2]=w.value[o.c]):w.boundTo==="faces"?(w.array[C+0]=w.value[H],w.array[C+1]=w.value[H],w.array[C+2]=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[C+0]=w.value[H+0],w.array[C+1]=w.value[H+1],w.array[C+2]=w.value[H+2],w.offsetSrc+=3),w.offset+=3):(w.boundTo===void 0||w.boundTo==="vertices"?(B=w.value[o.a],D=w.value[o.b],X=w.value[o.c]):w.boundTo==="faces"?(B=w.value[H],D=w.value[H],X=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(B=w.value[H+
+0],D=w.value[H+1],X=w.value[H+2],w.offsetSrc+=3),w.size===2?(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=D.x,w.array[C+3]=D.y,w.array[C+4]=X.x,w.array[C+5]=X.y,w.offset+=6):w.size===3?(w.type==="c"?(w.array[C+0]=B.r,w.array[C+1]=B.g,w.array[C+2]=B.b,w.array[C+3]=D.r,w.array[C+4]=D.g,w.array[C+5]=D.b,w.array[C+6]=X.r,w.array[C+7]=X.g,w.array[C+8]=X.b):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=D.x,w.array[C+4]=D.y,w.array[C+5]=D.z,w.array[C+6]=X.x,w.array[C+7]=X.y,w.array[C+
+8]=X.z),w.offset+=9):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=B.w,w.array[C+4]=D.x,w.array[C+5]=D.y,w.array[C+6]=D.z,w.array[C+7]=D.w,w.array[C+8]=X.x,w.array[C+9]=X.y,w.array[C+10]=X.z,w.array[C+11]=X.w,w.offset+=12));if(Xa){C=0;for(H=xa.length;C<H;C++)B=xa[C].vertices[o.a].position,D=xa[C].vertices[o.b].position,X=xa[C].vertices[o.c].position,w=ia[C],w[W+0]=B.x,w[W+1]=B.y,w[W+2]=B.z,w[W+3]=D.x,w[W+4]=D.y,w[W+5]=D.z,w[W+6]=X.x,w[W+7]=X.y,w[W+8]=X.z;W+=9}if(za.length)C=za[o.a],
+H=za[o.b],w=za[o.c],Z[J]=C.x,Z[J+1]=C.y,Z[J+2]=C.z,Z[J+3]=C.w,Z[J+4]=H.x,Z[J+5]=H.y,Z[J+6]=H.z,Z[J+7]=H.w,Z[J+8]=w.x,Z[J+9]=w.y,Z[J+10]=w.z,Z[J+11]=w.w,C=Ia[o.a],H=Ia[o.b],w=Ia[o.c],Y[J]=C.x,Y[J+1]=C.y,Y[J+2]=C.z,Y[J+3]=C.w,Y[J+4]=H.x,Y[J+5]=H.y,Y[J+6]=H.z,Y[J+7]=H.w,Y[J+8]=w.x,Y[J+9]=w.y,Y[J+10]=w.z,Y[J+11]=w.w,C=Ga[o.a],H=Ga[o.b],w=Ga[o.c],T[J]=C.x,T[J+1]=C.y,T[J+2]=C.z,T[J+3]=1,T[J+4]=H.x,T[J+5]=H.y,T[J+6]=H.z,T[J+7]=1,T[J+8]=w.x,T[J+9]=w.y,T[J+10]=w.z,T[J+11]=1,C=Ha[o.a],H=Ha[o.b],w=Ha[o.c],U[J]=
+C.x,U[J+1]=C.y,U[J+2]=C.z,U[J+3]=1,U[J+4]=H.x,U[J+5]=H.y,U[J+6]=H.z,U[J+7]=1,U[J+8]=w.x,U[J+9]=w.y,U[J+10]=w.z,U[J+11]=1,J+=12;if(Wa&&y)u.length==3&&y==THREE.VertexColors?(o=u[0],C=u[1],H=u[2]):H=C=o=v,ja[Q]=o.r,ja[Q+1]=o.g,ja[Q+2]=o.b,ja[Q+3]=C.r,ja[Q+4]=C.g,ja[Q+5]=C.b,ja[Q+6]=H.r,ja[Q+7]=H.g,ja[Q+8]=H.b,Q+=9;if(Va&&na.hasTangents)u=x[0],v=x[1],o=x[2],R[M]=u.x,R[M+1]=u.y,R[M+2]=u.z,R[M+3]=u.w,R[M+4]=v.x,R[M+5]=v.y,R[M+6]=v.z,R[M+7]=v.w,R[M+8]=o.x,R[M+9]=o.y,R[M+10]=o.z,R[M+11]=o.w,M+=12;if(ya&&
+A)if(p.length==3&&ka)for(x=0;x<3;x++)t=p[x],ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;else for(x=0;x<3;x++)ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;if(sa&&F!==void 0&&z)for(x=0;x<3;x++)p=F[x],aa[N]=p.u,aa[N+1]=p.v,N+=2;if(sa&&G!==void 0&&z)for(x=0;x<3;x++)p=G[x],ca[O]=p.u,ca[O+1]=p.v,O+=2;Aa&&(da[P]=L,da[P+1]=L+1,da[P+2]=L+2,P+=3,ea[S]=L,ea[S+1]=L+1,ea[S+2]=L,ea[S+3]=L+2,ea[S+4]=L+1,ea[S+5]=L+2,S+=6,L+=3)}else if(o instanceof THREE.Face4){if(pa)B=Fa[o.a].position,D=Fa[o.b].position,X=Fa[o.c].position,
+E=Fa[o.d].position,V[ha]=B.x,V[ha+1]=B.y,V[ha+2]=B.z,V[ha+3]=D.x,V[ha+4]=D.y,V[ha+5]=D.z,V[ha+6]=X.x,V[ha+7]=X.y,V[ha+8]=X.z,V[ha+9]=E.x,V[ha+10]=E.y,V[ha+11]=E.z,ha+=12;if(fa)for(I in fa)if(w=fa[I],w.needsUpdate)C=w.offset,H=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[C+0]=w.value[o.a],w.array[C+1]=w.value[o.b],w.array[C+2]=w.value[o.c],w.array[C+3]=w.value[o.d]):w.boundTo==="faces"?(w.array[C+0]=w.value[H],w.array[C+1]=w.value[H],w.array[C+2]=w.value[H],w.array[C+
+3]=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[C+0]=w.value[H+0],w.array[C+1]=w.value[H+1],w.array[C+2]=w.value[H+2],w.array[C+3]=w.value[H+3],w.offsetSrc+=4),w.offset+=4):(w.boundTo===void 0||w.boundTo==="vertices"?(B=w.value[o.a],D=w.value[o.b],X=w.value[o.c],E=w.value[o.d]):w.boundTo==="faces"?(B=w.value[H],D=w.value[H],X=w.value[H],E=w.value[H],w.offsetSrc++):w.boundTo==="faceVertices"&&(B=w.value[H+0],D=w.value[H+1],X=w.value[H+2],E=w.value[H+3],w.offsetSrc+=4),w.size===2?
+(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=D.x,w.array[C+3]=D.y,w.array[C+4]=X.x,w.array[C+5]=X.y,w.array[C+6]=E.x,w.array[C+7]=E.y,w.offset+=8):w.size===3?(w.type==="c"?(w.array[C+0]=B.r,w.array[C+1]=B.g,w.array[C+2]=B.b,w.array[C+3]=D.r,w.array[C+4]=D.g,w.array[C+5]=D.b,w.array[C+6]=X.r,w.array[C+7]=X.g,w.array[C+8]=X.b,w.array[C+9]=E.r,w.array[C+10]=E.g,w.array[C+11]=E.b):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=D.x,w.array[C+4]=D.y,w.array[C+5]=D.z,w.array[C+6]=X.x,
+w.array[C+7]=X.y,w.array[C+8]=X.z,w.array[C+9]=E.x,w.array[C+10]=E.y,w.array[C+11]=E.z),w.offset+=12):(w.array[C+0]=B.x,w.array[C+1]=B.y,w.array[C+2]=B.z,w.array[C+3]=B.w,w.array[C+4]=D.x,w.array[C+5]=D.y,w.array[C+6]=D.z,w.array[C+7]=D.w,w.array[C+8]=X.x,w.array[C+9]=X.y,w.array[C+10]=X.z,w.array[C+11]=X.w,w.array[C+12]=E.x,w.array[C+13]=E.y,w.array[C+14]=E.z,w.array[C+15]=E.w,w.offset+=16));if(Xa){C=0;for(H=xa.length;C<H;C++)B=xa[C].vertices[o.a].position,D=xa[C].vertices[o.b].position,X=xa[C].vertices[o.c].position,
+E=xa[C].vertices[o.d].position,w=ia[C],w[W+0]=B.x,w[W+1]=B.y,w[W+2]=B.z,w[W+3]=D.x,w[W+4]=D.y,w[W+5]=D.z,w[W+6]=X.x,w[W+7]=X.y,w[W+8]=X.z,w[W+9]=E.x,w[W+10]=E.y,w[W+11]=E.z;W+=12}if(za.length)C=za[o.a],H=za[o.b],w=za[o.c],K=za[o.d],Z[J]=C.x,Z[J+1]=C.y,Z[J+2]=C.z,Z[J+3]=C.w,Z[J+4]=H.x,Z[J+5]=H.y,Z[J+6]=H.z,Z[J+7]=H.w,Z[J+8]=w.x,Z[J+9]=w.y,Z[J+10]=w.z,Z[J+11]=w.w,Z[J+12]=K.x,Z[J+13]=K.y,Z[J+14]=K.z,Z[J+15]=K.w,C=Ia[o.a],H=Ia[o.b],w=Ia[o.c],K=Ia[o.d],Y[J]=C.x,Y[J+1]=C.y,Y[J+2]=C.z,Y[J+3]=C.w,Y[J+4]=
+H.x,Y[J+5]=H.y,Y[J+6]=H.z,Y[J+7]=H.w,Y[J+8]=w.x,Y[J+9]=w.y,Y[J+10]=w.z,Y[J+11]=w.w,Y[J+12]=K.x,Y[J+13]=K.y,Y[J+14]=K.z,Y[J+15]=K.w,C=Ga[o.a],H=Ga[o.b],w=Ga[o.c],K=Ga[o.d],T[J]=C.x,T[J+1]=C.y,T[J+2]=C.z,T[J+3]=1,T[J+4]=H.x,T[J+5]=H.y,T[J+6]=H.z,T[J+7]=1,T[J+8]=w.x,T[J+9]=w.y,T[J+10]=w.z,T[J+11]=1,T[J+12]=K.x,T[J+13]=K.y,T[J+14]=K.z,T[J+15]=1,C=Ha[o.a],H=Ha[o.b],w=Ha[o.c],o=Ha[o.d],U[J]=C.x,U[J+1]=C.y,U[J+2]=C.z,U[J+3]=1,U[J+4]=H.x,U[J+5]=H.y,U[J+6]=H.z,U[J+7]=1,U[J+8]=w.x,U[J+9]=w.y,U[J+10]=w.z,U[J+
+11]=1,U[J+12]=o.x,U[J+13]=o.y,U[J+14]=o.z,U[J+15]=1,J+=16;if(Wa&&y)u.length==4&&y==THREE.VertexColors?(o=u[0],C=u[1],H=u[2],u=u[3]):u=H=C=o=v,ja[Q]=o.r,ja[Q+1]=o.g,ja[Q+2]=o.b,ja[Q+3]=C.r,ja[Q+4]=C.g,ja[Q+5]=C.b,ja[Q+6]=H.r,ja[Q+7]=H.g,ja[Q+8]=H.b,ja[Q+9]=u.r,ja[Q+10]=u.g,ja[Q+11]=u.b,Q+=12;if(Va&&na.hasTangents)u=x[0],v=x[1],o=x[2],x=x[3],R[M]=u.x,R[M+1]=u.y,R[M+2]=u.z,R[M+3]=u.w,R[M+4]=v.x,R[M+5]=v.y,R[M+6]=v.z,R[M+7]=v.w,R[M+8]=o.x,R[M+9]=o.y,R[M+10]=o.z,R[M+11]=o.w,R[M+12]=x.x,R[M+13]=x.y,R[M+
+14]=x.z,R[M+15]=x.w,M+=16;if(ya&&A)if(p.length==4&&ka)for(x=0;x<4;x++)t=p[x],ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;else for(x=0;x<4;x++)ga[ma]=t.x,ga[ma+1]=t.y,ga[ma+2]=t.z,ma+=3;if(sa&&F!==void 0&&z)for(x=0;x<4;x++)p=F[x],aa[N]=p.u,aa[N+1]=p.v,N+=2;if(sa&&G!==void 0&&z)for(x=0;x<4;x++)p=G[x],ca[O]=p.u,ca[O+1]=p.v,O+=2;Aa&&(da[P]=L,da[P+1]=L+1,da[P+2]=L+3,da[P+3]=L+1,da[P+4]=L+2,da[P+5]=L+3,P+=6,ea[S]=L,ea[S+1]=L+1,ea[S+2]=L,ea[S+3]=L+3,ea[S+4]=L+1,ea[S+5]=L+2,ea[S+6]=L+2,ea[S+7]=L+3,S+=8,L+=
+4)}if(Da){m=0;for(n=Da.length;m<n;m++)da[P]=Da[m].a,da[P+1]=Da[m].b,da[P+2]=Da[m].c,da[P+3]=Da[m].a,da[P+4]=Da[m].c,da[P+5]=Da[m].d,P+=6}pa&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,V,k));if(fa)for(I in fa)if(w=fa[I],w.needsUpdate)h.bindBuffer(h.ARRAY_BUFFER,w.buffer),h.bufferData(h.ARRAY_BUFFER,w.array,k),w.needsUpdate=!1;if(Xa){C=0;for(H=xa.length;C<H;C++)h.bindBuffer(h.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[C]),h.bufferData(h.ARRAY_BUFFER,ia[C],k)}Wa&&
 Q>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,ja,k));ya&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,ga,k));Va&&na.hasTangents&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglTangentBuffer),h.bufferData(h.ARRAY_BUFFER,R,k));sa&&N>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUVBuffer),h.bufferData(h.ARRAY_BUFFER,aa,k));sa&&O>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUV2Buffer),h.bufferData(h.ARRAY_BUFFER,ca,k));Aa&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,
-f.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,da,k),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ea,k));J>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexABuffer),h.bufferData(h.ARRAY_BUFFER,T,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,U,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER,Z,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER,
-$,k));j.dynamic||(delete f.__inittedArrays,delete f.__colorArray,delete f.__normalArray,delete f.__tangentArray,delete f.__uvArray,delete f.__uv2Array,delete f.__faceArray,delete f.__vertexArray,delete f.__lineArray,delete f.__skinVertexAArray,delete f.__skinVertexBArray,delete f.__skinIndexArray,delete f.__skinWeightArray)}}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals=!1;e.__dirtyTangents=!1;e.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){e=
-b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=h.DYNAMIC_DRAW;z=b.vertices;f=b.colors;y=z.length;j=f.length;A=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<y;m++)o=z[m].position,g=m*3,A[g]=o.x,A[g+1]=o.y,A[g+2]=o.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,A,d)}if(F){for(m=0;m<j;m++)color=f[m],g=m*3,k[g]=color.r,k[g+1]=color.g,k[g+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,
-k,d)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.Line){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=h.DYNAMIC_DRAW;z=b.vertices;f=b.colors;y=z.length;j=f.length;A=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<y;m++)o=z[m].position,g=m*3,A[g]=o.x,A[g+1]=o.y,A[g+2]=o.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,A,d)}if(F){for(m=0;m<j;m++)color=f[m],g=m*3,k[g]=color.r,k[g+1]=color.g,k[g+2]=color.b;
+f.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,da,k),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ea,k));J>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexABuffer),h.bufferData(h.ARRAY_BUFFER,T,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,U,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER,Y,k),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER,
+Z,k));j.dynamic||(delete f.__inittedArrays,delete f.__colorArray,delete f.__normalArray,delete f.__tangentArray,delete f.__uvArray,delete f.__uv2Array,delete f.__faceArray,delete f.__vertexArray,delete f.__lineArray,delete f.__skinVertexAArray,delete f.__skinVertexBArray,delete f.__skinIndexArray,delete f.__skinWeightArray)}}}e.__dirtyVertices=!1;e.__dirtyMorphTargets=!1;e.__dirtyElements=!1;e.__dirtyUvs=!1;e.__dirtyNormals=!1;e.__dirtyTangents=!1;e.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){e=
+b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=h.DYNAMIC_DRAW;z=b.vertices;f=b.colors;y=z.length;j=f.length;A=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<y;m++)n=z[m].position,g=m*3,A[g]=n.x,A[g+1]=n.y,A[g+2]=n.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,A,d)}if(F){for(m=0;m<j;m++)color=f[m],g=m*3,k[g]=color.r,k[g+1]=color.g,k[g+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,
+k,d)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.Line){e=b.geometry;if(e.__dirtyVertices||e.__dirtyColors){b=e;d=h.DYNAMIC_DRAW;z=b.vertices;f=b.colors;y=z.length;j=f.length;A=b.__vertexArray;k=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(m=0;m<y;m++)n=z[m].position,g=m*3,A[g]=n.x,A[g+1]=n.y,A[g+2]=n.z;h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,A,d)}if(F){for(m=0;m<j;m++)color=f[m],g=m*3,k[g]=color.r,k[g+1]=color.g,k[g+2]=color.b;
 h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,k,d)}}e.__dirtyVertices=!1;e.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)e=b.geometry,(e.__dirtyVertices||e.__dirtyColors||b.sortParticles)&&c(e,h.DYNAMIC_DRAW,b),e.__dirtyVertices=!1,e.__dirtyColors=!1}function G(b,d){var c;for(c=b.length-1;c>=0;c--)b[c].object==d&&b.splice(c,1)}function y(b){function d(b){var f=[];c=0;for(e=b.length;c<e;c++)b[c]==void 0?f.push("undefined"):f.push(b[c].id);return f.join("_")}
 var c,e,f,g,h,j,k,m,n={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],j=h.materials,k=d(j),n[k]==void 0&&(n[k]={hash:k,counter:0}),m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:j,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+h>65535&&(n[k].counter+=1,m=n[k].hash+"_"+n[k].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],
 materials:j,vertices:0,numMorphTargets:o})),b.geometryGroups[m].faces.push(f),b.geometryGroups[m].vertices+=h}function D(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=ga){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD);
 h.blendFunc(h.ZERO,h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}ga=b}}function B(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,M(d.wrapS)),h.texParameteri(b,h.TEXTURE_WRAP_T,M(d.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,M(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,M(d.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S,
 h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_MAG_FILTER,E(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,E(d.minFilter)))}function P(b,d){if(b.needsUpdate)b.__webglInit?(h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,b.image)):(b.__webglTexture=h.createTexture(),h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image),b.__webglInit=
-!0),B(h.TEXTURE_2D,b,b.image),h.bindTexture(h.TEXTURE_2D,null),b.needsUpdate=!1;h.activeTexture(h.TEXTURE0+d);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function K(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,
+!0),B(h.TEXTURE_2D,b,b.image),h.bindTexture(h.TEXTURE_2D,null),b.needsUpdate=!1;h.activeTexture(h.TEXTURE0+d);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function L(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,
 M(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,M(b.wrapT));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,M(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,M(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,M(b.format),b.width,b.height,0,M(b.format),M(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER,b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&
 !b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_STENCIL,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):h.renderbufferStorage(h.RENDERBUFFER,h.RGBA4,b.width,b.height);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER,
-null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null,c=ka,b=fa);d!=N&&(h.bindFramebuffer(h.FRAMEBUFFER,d),h.viewport(da,ea,c,b),N=d)}function L(b,d){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,d);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(d),null;return c}function E(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;
+null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null,c=ka,b=fa);d!=N&&(h.bindFramebuffer(h.FRAMEBUFFER,d),h.viewport(da,ea,c,b),N=d)}function K(b,d){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,d);h.compileShader(c);if(!h.getShaderParameter(c,h.COMPILE_STATUS))return console.error(h.getShaderInfoLog(c)),console.error(d),null;return c}function E(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;
 default:return h.LINEAR}}function M(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT;case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return h.BYTE;case THREE.UnsignedByteType:return h.UNSIGNED_BYTE;case THREE.ShortType:return h.SHORT;case THREE.UnsignedShortType:return h.UNSIGNED_SHORT;case THREE.IntType:return h.INT;case THREE.UnsignedShortType:return h.UNSIGNED_INT;case THREE.FloatType:return h.FLOAT;case THREE.AlphaFormat:return h.ALPHA;case THREE.RGBFormat:return h.RGB;case THREE.RGBAFormat:return h.RGBA;case THREE.LuminanceFormat:return h.LUMINANCE;case THREE.LuminanceAlphaFormat:return h.LUMINANCE_ALPHA}return 0}
-var T=this,h,Q=[],R=null,N=null,aa=!0,U=null,V=null,ga=null,W=null,da=0,ea=0,ka=0,fa=0,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,Z=new Float32Array(16),$=new Float32Array(16),ia=new THREE.Vector4,Y={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},H=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ha=b.stencil!==void 0?b.stencil:
+var T=this,h,Q=[],R=null,N=null,aa=!0,U=null,V=null,ga=null,W=null,da=0,ea=0,ka=0,fa=0,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,Y=new Float32Array(16),Z=new Float32Array(16),ia=new THREE.Vector4,X={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},H=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ha=b.stencil!==void 0?b.stencil:
 !0,ma=b.antialias!==void 0?b.antialias:!1,ja=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),na=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=H;this.sortObjects=this.autoClear=!0;try{if(!(h=H.getContext("experimental-webgl",{antialias:ma,stencil:ha})))throw"Error creating WebGL context.";}catch(Aa){console.error(Aa)}console.log(navigator.userAgent+" | "+h.getParameter(h.VERSION)+" | "+h.getParameter(h.VENDOR)+
 " | "+h.getParameter(h.RENDERER)+" | "+h.getParameter(h.SHADING_LANGUAGE_VERSION));h.clearColor(0,0,0,1);h.clearDepth(1);h.enable(h.DEPTH_TEST);h.depthFunc(h.LEQUAL);h.frontFace(h.CCW);h.cullFace(h.BACK);h.enable(h.CULL_FACE);h.enable(h.BLEND);h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);h.clearColor(ja.r,ja.g,ja.b,na);this.context=h;var ya=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ha){var ca={};ca.vertices=new Float32Array(12);ca.faces=new Uint16Array(6);
 ca.darkness=0.5;ca.vertices[0]=-20;ca.vertices[1]=-20;ca.vertices[2]=-1;ca.vertices[3]=20;ca.vertices[4]=-20;ca.vertices[5]=-1;ca.vertices[6]=20;ca.vertices[7]=20;ca.vertices[8]=-1;ca.vertices[9]=-20;ca.vertices[10]=20;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]=1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=h.createBuffer();ca.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,ca.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,ca.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,
-ca.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,ca.faces,h.STATIC_DRAW);ca.program=h.createProgram();h.attachShader(ca.program,L("fragment",THREE.ShaderLib.shadowPost.fragmentShader));h.attachShader(ca.program,L("vertex",THREE.ShaderLib.shadowPost.vertexShader));h.linkProgram(ca.program);ca.vertexLocation=h.getAttribLocation(ca.program,"position");ca.projectionLocation=h.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=h.getUniformLocation(ca.program,"darkness")}var O={};
+ca.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,ca.faces,h.STATIC_DRAW);ca.program=h.createProgram();h.attachShader(ca.program,K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));h.attachShader(ca.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));h.linkProgram(ca.program);ca.vertexLocation=h.getAttribLocation(ca.program,"position");ca.projectionLocation=h.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=h.getUniformLocation(ca.program,"darkness")}var O={};
 O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=h.createBuffer();O.elementBuffer=h.createBuffer();
 O.tempTexture=h.createTexture();O.occlusionTexture=h.createTexture();h.bindBuffer(h.ARRAY_BUFFER,O.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,O.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,O.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,O.faces,h.STATIC_DRAW);h.bindTexture(h.TEXTURE_2D,O.tempTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGB,16,16,0,h.RGB,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);
 h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.bindTexture(h.TEXTURE_2D,O.occlusionTexture);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,16,16,0,h.RGBA,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
-0?(O.hasVertexTexture=!1,O.program=h.createProgram(),h.attachShader(O.program,L("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),h.attachShader(O.program,L("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(O.hasVertexTexture=!0,O.program=h.createProgram(),h.attachShader(O.program,L("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),h.attachShader(O.program,L("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));h.linkProgram(O.program);O.attributes={};O.uniforms={};
+0?(O.hasVertexTexture=!1,O.program=h.createProgram(),h.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),h.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(O.hasVertexTexture=!0,O.program=h.createProgram(),h.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),h.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));h.linkProgram(O.program);O.attributes={};O.uniforms={};
 O.attributes.vertex=h.getAttribLocation(O.program,"position");O.attributes.uv=h.getAttribLocation(O.program,"UV");O.uniforms.renderType=h.getUniformLocation(O.program,"renderType");O.uniforms.map=h.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=h.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=h.getUniformLocation(O.program,"opacity");O.uniforms.scale=h.getUniformLocation(O.program,"scale");O.uniforms.rotation=h.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=
 h.getUniformLocation(O.program,"screenPosition");var sa=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
 0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=h.createBuffer();_sprite.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,_sprite.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,_sprite.faces,h.STATIC_DRAW);_sprite.program=h.createProgram();
-h.attachShader(_sprite.program,L("fragment",THREE.ShaderLib.sprite.fragmentShader));h.attachShader(_sprite.program,L("vertex",THREE.ShaderLib.sprite.vertexShader));h.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program,
+h.attachShader(_sprite.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));h.attachShader(_sprite.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));h.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program,
 "uvScale");_sprite.uniforms.rotation=h.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=h.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=h.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=h.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=h.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=h.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
 h.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=h.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=h.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=h.getUniformLocation(_sprite.program,"projectionMatrix");var pa=!1;this.setSize=function(b,d){H.width=b;H.height=d;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(b,d,c,e){da=b;ea=d;ka=c;fa=e;h.viewport(da,ea,ka,fa)};
 this.setScissor=function(b,d,c,e){h.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){aa=b;h.depthMask(b)};this.setClearColorHex=function(b,d){ja.setHex(b);na=d;h.clearColor(ja.r,ja.g,ja.b,na)};this.setClearColor=function(b,d){ja.copy(b);na=d;h.clearColor(ja.r,ja.g,ja.b,na)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ca.darkness=
@@ -313,22 +313,23 @@ if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);
 lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:o},t;g=[];j?g.push(j):(g.push(m),g.push(n));for(t in c)g.push(t),g.push(c[t]);j=g.join();t=0;for(g=Q.length;t<g;t++)if(Q[t].code==j){p=Q[t].program;break a}t=h.createProgram();g=["#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");o=[ya?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
 "",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-h.attachShader(t,L("fragment",g+m));h.attachShader(t,L("vertex",o+n));h.linkProgram(t);h.getProgramParameter(t,h.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+h.getProgramParameter(t,h.VALIDATE_STATUS)+", gl error ["+h.getError()+"]");t.uniforms={};t.attributes={};var u;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)m.push(u);u=m;k=0;for(m=
+h.attachShader(t,K("fragment",g+m));h.attachShader(t,K("vertex",o+n));h.linkProgram(t);h.getProgramParameter(t,h.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+h.getProgramParameter(t,h.VALIDATE_STATUS)+", gl error ["+h.getError()+"]");t.uniforms={};t.attributes={};var u;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)m.push(u);u=m;k=0;for(m=
 u.length;k<m;k++)n=u[k],t.uniforms[n]=h.getUniformLocation(t,n);m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)m.push("morphTarget"+u);for(p in d)m.push(p);p=m;u=0;for(d=p.length;u<d;u++)c=p[u],t.attributes[c]=h.getAttribLocation(t,c);Q.push({program:t,code:j});p=t}b.program=p;p=b.program.attributes;p.position>=0&&h.enableVertexAttribArray(p.position);p.color>=0&&h.enableVertexAttribArray(p.color);p.normal>=
 0&&h.enableVertexAttribArray(p.normal);p.tangent>=0&&h.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(h.enableVertexAttribArray(p.skinVertexA),h.enableVertexAttribArray(p.skinVertexB),h.enableVertexAttribArray(p.skinIndex),h.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(f in b.attributes)p[f]!==void 0&&p[f]>=0&&h.enableVertexAttribArray(p[f]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(h.enableVertexAttribArray(p.morphTarget0),
 b.numSupportedMorphTargets++);p.morphTarget1>=0&&(h.enableVertexAttribArray(p.morphTarget1),b.numSupportedMorphTargets++);p.morphTarget2>=0&&(h.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(h.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(h.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(h.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=
-0&&(h.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(h.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(f=this.maxMorphTargets;b<f;b++)e.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,x){var y,H,B,D,Y,G,E,L,I=b.lights,M=b.fog;T.data.vertices=0;T.data.faces=0;T.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray($);
-c.projectionMatrix.flattenToArray(Z);S.multiply(c.projectionMatrix,c.matrixWorldInverse);k(S);this.initWebGLObjects(b);K(o);(this.autoClear||x)&&this.clear();Y=b.__webglObjects.length;for(x=0;x<Y;x++)if(y=b.__webglObjects[x],E=y.object,E.visible)if(!(E instanceof THREE.Mesh)||m(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),A(E,c),p(y),y.render=!0,this.sortObjects)ia.copy(E.position),S.multiplyVector3(ia),y.z=ia.z}else y.render=!1;else y.render=!1;this.sortObjects&&b.__webglObjects.sort(t);
-G=b.__webglObjectsImmediate.length;for(x=0;x<G;x++)y=b.__webglObjectsImmediate[x],E=y.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),A(E,c),n(y));F(THREE.NormalBlending);for(x=0;x<Y;x++)if(y=b.__webglObjects[x],y.render){E=y.object;L=y.buffer;B=y.opaque;g(E);for(y=0;y<B.count;y++)D=B.list[y],j(D.depthTest),e(c,I,M,D,L,E)}for(x=0;x<G;x++)if(y=b.__webglObjectsImmediate[x],E=y.object,E.visible){B=y.opaque;g(E);for(y=0;y<B.count;y++)D=B.list[y],j(D.depthTest),
-H=d(c,I,M,D,E),E.render(function(b){f(b,H,D.shading)})}for(x=0;x<Y;x++)if(y=b.__webglObjects[x],y.render){E=y.object;L=y.buffer;B=y.transparent;g(E);for(y=0;y<B.count;y++)D=B.list[y],F(D.blending),j(D.depthTest),e(c,I,M,D,L,E)}for(x=0;x<G;x++)if(y=b.__webglObjectsImmediate[x],E=y.object,E.visible){B=y.transparent;g(E);for(y=0;y<B.count;y++)D=B.list[y],F(D.blending),j(D.depthTest),H=d(c,I,M,D,E),E.render(function(b){f(b,H,D.shading)})}b.__webglSprites.length&&v(b,c);ha&&b.__webglShadowVolumes.length&&
-b.lights.length&&u(b);b.__webglLensFlares.length&&z(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(h.bindTexture(h.TEXTURE_2D,o.__webglTexture),h.generateMipmap(h.TEXTURE_2D),h.bindTexture(h.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],d=b,e=void 0,f=void 0,g=void 0;
+0&&(h.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=0&&(h.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(f=this.maxMorphTargets;b<f;b++)e.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,n,x){var y,H,B,D,X,G,E,K,I=b.lights,M=b.fog;T.data.vertices=0;T.data.faces=0;T.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Z);
+c.projectionMatrix.flattenToArray(Y);S.multiply(c.projectionMatrix,c.matrixWorldInverse);k(S);this.initWebGLObjects(b);L(n);(this.autoClear||x)&&this.clear();X=b.__webglObjects.length;for(x=0;x<X;x++)if(y=b.__webglObjects[x],E=y.object,E.visible)if(!(E instanceof THREE.Mesh)||m(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),A(E,c),p(y),y.render=!0,this.sortObjects)ia.copy(E.position),S.multiplyVector3(ia),y.z=ia.z}else y.render=!1;else y.render=!1;this.sortObjects&&b.__webglObjects.sort(t);
+G=b.__webglObjectsImmediate.length;for(x=0;x<G;x++)y=b.__webglObjectsImmediate[x],E=y.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),A(E,c),o(y));F(THREE.NormalBlending);for(x=0;x<X;x++)if(y=b.__webglObjects[x],y.render)if(E=y.object,K=y.buffer,B=y.opaque,g(E),b.overrideMaterial)j(b.overrideMaterial.depthTest),e(c,I,M,b.overrideMaterial,K,E);else for(y=0;y<B.count;y++)D=B.list[y],j(D.depthTest),e(c,I,M,D,K,E);for(x=0;x<G;x++)if(y=b.__webglObjectsImmediate[x],
+E=y.object,E.visible)if(B=y.opaque,g(E),b.overrideMaterial)j(b.overrideMaterial.depthTest),H=d(c,I,M,b.overrideMaterial,E),E.render(function(c){f(c,H,b.overrideMaterial.shading)});else for(y=0;y<B.count;y++)D=B.list[y],j(D.depthTest),H=d(c,I,M,D,E),E.render(function(b){f(b,H,D.shading)});for(x=0;x<X;x++)if(y=b.__webglObjects[x],y.render)if(E=y.object,K=y.buffer,B=y.transparent,g(E),b.overrideMaterial)F(b.overrideMaterial.blending),j(b.overrideMaterial.depthTest),e(c,I,M,b.overrideMaterial,K,E);else for(y=
+0;y<B.count;y++)D=B.list[y],F(D.blending),j(D.depthTest),e(c,I,M,D,K,E);for(x=0;x<G;x++)if(y=b.__webglObjectsImmediate[x],E=y.object,E.visible)if(B=y.transparent,g(E),b.overrideMaterial)F(b.overrideMaterial.blending),j(b.overrideMaterial.depthTest),H=d(c,I,M,b.overrideMaterial,E),E.render(function(c){f(c,H,b.overrideMaterial.shading)});else for(y=0;y<B.count;y++)D=B.list[y],F(D.blending),j(D.depthTest),H=d(c,I,M,D,E),E.render(function(b){f(b,H,D.shading)});b.__webglSprites.length&&v(b,c);ha&&b.__webglShadowVolumes.length&&
+b.lights.length&&u(b);b.__webglLensFlares.length&&z(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(h.bindTexture(h.TEXTURE_2D,n.__webglTexture),h.generateMipmap(h.TEXTURE_2D),h.bindTexture(h.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],d=b,e=void 0,f=void 0,g=void 0;
 if(c._modelViewMatrix==void 0)c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray);if(c instanceof THREE.Mesh)for(e in f=c.geometry,f.geometryGroups==void 0&&y(f),f.geometryGroups){g=f.geometryGroups[e];if(!g.__webglVertexBuffer){var j=g;j.__webglVertexBuffer=h.createBuffer();j.__webglNormalBuffer=h.createBuffer();j.__webglTangentBuffer=
 h.createBuffer();j.__webglColorBuffer=h.createBuffer();j.__webglUVBuffer=h.createBuffer();j.__webglUV2Buffer=h.createBuffer();j.__webglSkinVertexABuffer=h.createBuffer();j.__webglSkinVertexBBuffer=h.createBuffer();j.__webglSkinIndicesBuffer=h.createBuffer();j.__webglSkinWeightsBuffer=h.createBuffer();j.__webglFaceBuffer=h.createBuffer();j.__webglLineBuffer=h.createBuffer();if(j.numMorphTargets){var k=void 0,m=void 0;j.__webglMorphTargetsBuffers=[];k=0;for(m=j.numMorphTargets;k<m;k++)j.__webglMorphTargetsBuffers.push(h.createBuffer())}for(var j=
-g,k=c,o=void 0,n=void 0,p=void 0,t=p=void 0,u=void 0,v=void 0,z=v=m=0,A=p=n=void 0,n=o=void 0,t=k.geometry,A=t.faces,u=j.faces,o=0,n=u.length;o<n;o++)p=u[o],p=A[p],p instanceof THREE.Face3?(m+=3,v+=1,z+=3):p instanceof THREE.Face4&&(m+=4,v+=2,z+=4);for(var o=j,n=k,H=u=A=void 0,B=void 0,H=void 0,p=[],A=0,u=n.materials.length;A<u;A++)if(H=n.materials[A],H instanceof THREE.MeshFaceMaterial){H=0;for(l=o.materials.length;H<l;H++)(B=o.materials[H])&&p.push(B)}else(B=H)&&p.push(B);o=p;a:{A=n=void 0;u=o.length;
-for(n=0;n<u;n++)if(A=o[n],A.map||A.lightMap||A instanceof THREE.MeshShaderMaterial){n=!0;break a}n=!1}a:{A=o;p=u=void 0;H=A.length;for(u=0;u<H;u++)if(p=A[u],!(p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial)){A=p&&p.shading!=void 0&&p.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{p=u=void 0;H=o.length;for(u=0;u<H;u++)if(p=o[u],p.vertexColors){p=p.vertexColors;break a}p=!1}j.__vertexArray=new Float32Array(m*3);if(A)j.__normalArray=
-new Float32Array(m*3);if(t.hasTangents)j.__tangentArray=new Float32Array(m*4);if(p)j.__colorArray=new Float32Array(m*3);if(n){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=
-new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=A==THREE.SmoothShading;j.__uvType=n;j.__vertexColorType=p;j.__normalType=A;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=z*2;t=0;for(u=o.length;t<
-u;t++)if(o[t].attributes)for(a in j.__webglCustomAttributes={},o[t].attributes){n={};for(prop in o[t].attributes[a])n[prop]=o[t].attributes[a][prop];if(!n.__webglInitialized||n.createUniqueBuffers)n.__webglInitialized=!0,v=1,n.type==="v2"?v=2:n.type==="v3"?v=3:n.type==="v4"?v=4:n.type==="c"&&(v=3),n.size=v,n.needsUpdate=!0,n.array=new Float32Array(m*v),n.buffer=h.createBuffer(),n.buffer.belongsToAttribute=a;j.__webglCustomAttributes[a]=n}j.__inittedArrays=!0;f.__dirtyVertices=!0;f.__dirtyMorphTargets=
+g,k=c,n=void 0,o=void 0,p=void 0,t=p=void 0,u=void 0,v=void 0,z=v=m=0,A=p=o=void 0,o=n=void 0,t=k.geometry,A=t.faces,u=j.faces,n=0,o=u.length;n<o;n++)p=u[n],p=A[p],p instanceof THREE.Face3?(m+=3,v+=1,z+=3):p instanceof THREE.Face4&&(m+=4,v+=2,z+=4);for(var n=j,o=k,H=u=A=void 0,B=void 0,H=void 0,p=[],A=0,u=o.materials.length;A<u;A++)if(H=o.materials[A],H instanceof THREE.MeshFaceMaterial){H=0;for(l=n.materials.length;H<l;H++)(B=n.materials[H])&&p.push(B)}else(B=H)&&p.push(B);n=p;a:{A=o=void 0;u=n.length;
+for(o=0;o<u;o++)if(A=n[o],A.map||A.lightMap||A instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{A=n;p=u=void 0;H=A.length;for(u=0;u<H;u++)if(p=A[u],!(p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial)){A=p&&p.shading!=void 0&&p.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}A=!1}a:{p=u=void 0;H=n.length;for(u=0;u<H;u++)if(p=n[u],p.vertexColors){p=p.vertexColors;break a}p=!1}j.__vertexArray=new Float32Array(m*3);if(A)j.__normalArray=
+new Float32Array(m*3);if(t.hasTangents)j.__tangentArray=new Float32Array(m*4);if(p)j.__colorArray=new Float32Array(m*3);if(o){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=
+new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=A==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=p;j.__normalType=A;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=z*2;t=0;for(u=n.length;t<
+u;t++)if(n[t].attributes)for(a in j.__webglCustomAttributes={},n[t].attributes){o={};for(prop in n[t].attributes[a])o[prop]=n[t].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,v=1,o.type==="v2"?v=2:o.type==="v3"?v=3:o.type==="v4"?v=4:o.type==="c"&&(v=3),o.size=v,o.needsUpdate=!0,o.array=new Float32Array(m*v),o.buffer=h.createBuffer(),o.buffer.belongsToAttribute=a;j.__webglCustomAttributes[a]=o}j.__inittedArrays=!0;f.__dirtyVertices=!0;f.__dirtyMorphTargets=
 !0;f.__dirtyElements=!0;f.__dirtyUvs=!0;f.__dirtyNormals=!0;f.__dirtyTangents=!0;f.__dirtyColors=!0}c instanceof THREE.ShadowVolume?D(d.__webglShadowVolumes,g,c):D(d.__webglObjects,g,c)}else if(c instanceof THREE.LensFlare)D(d.__webglLensFlares,void 0,c);else if(c instanceof THREE.Ribbon){f=c.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=f,g=e.vertices.length,e.__vertexArray=new Float32Array(g*3),e.__colorArray=new Float32Array(g*
 3),e.__webglVertexCount=g,f.__dirtyVertices=!0,f.__dirtyColors=!0;D(d.__webglObjects,f,c)}else if(c instanceof THREE.Line){f=c.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=f,g=e.vertices.length,e.__vertexArray=new Float32Array(g*3),e.__colorArray=new Float32Array(g*3),e.__webglLineCount=g,f.__dirtyVertices=!0,f.__dirtyColors=!0;D(d.__webglObjects,f,c)}else if(c instanceof THREE.ParticleSystem){f=c.geometry;if(!f.__webglVertexBuffer)e=
 f,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=f,g=e.vertices.length,e.__vertexArray=new Float32Array(g*3),e.__colorArray=new Float32Array(g*3),e.__sortArray=[],e.__webglParticleCount=g,f.__dirtyVertices=!0,f.__dirtyColors=!0;D(d.__webglObjects,f,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?d.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):c instanceof THREE.Sprite&&d.__webglSprites.push(c);
@@ -343,10 +344,10 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,c,d,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,f);f.h=THREE.ColorUtils.clamp(f.h+c,0,1);f.s=THREE.ColorUtils.clamp(f.s+d,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);b.setHSV(f.h,f.s,f.v)},rgbToHsv:function(b,c){var d=b.r,e=b.g,f=b.b,g=Math.max(Math.max(d,e),f),j=Math.min(Math.min(d,e),f);if(j==g)j=d=0;else{var k=g-j,j=k/g,d=d==g?(e-f)/k:e==g?2+(f-d)/k:4+(d-e)/k;d/=6;d<0&&(d+=1);d>1&&(d-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=d;c.s=j;c.v=g;return c},
 clamp:function(b,c,d){return b<c?c:b>d?d:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,g=b.vertices,j=f.vertices,k=b.faces,m=f.faces,o=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,p=j.length;n<p;n++){var t=new THREE.Vertex(j[n].position.clone());d&&c.matrix.multiplyVector3(t.position);g.push(t)}n=0;for(p=m.length;n<p;n++){var j=m[n],u,v,z=j.vertexNormals,t=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+e,j.b+e,j.c+e):
-j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));u.normal.copy(j.normal);d=0;for(g=z.length;d<g;d++)v=z[d],u.vertexNormals.push(v.clone());u.color.copy(j.color);d=0;for(g=t.length;d<g;d++)v=t[d],u.vertexColors.push(v.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}n=0;for(p=f.length;n<p;n++){e=f[n];k=[];d=0;for(g=e.length;d<g;d++)k.push(new THREE.UV(e[d].u,e[d].v));o.push(k)}}};
+var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,g=b.vertices,j=f.vertices,k=b.faces,m=f.faces,n=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,p=j.length;o<p;o++){var t=new THREE.Vertex(j[o].position.clone());d&&c.matrix.multiplyVector3(t.position);g.push(t)}o=0;for(p=m.length;o<p;o++){var j=m[o],u,v,z=j.vertexNormals,t=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+e,j.b+e,j.c+e):
+j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));u.normal.copy(j.normal);d=0;for(g=z.length;d<g;d++)v=z[d],u.vertexNormals.push(v.clone());u.color.copy(j.color);d=0;for(g=t.length;d<g;d++)v=t[d],u.vertexColors.push(v.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}o=0;for(p=f.length;o<p;o++){e=f[o];k=[];d=0;for(g=e.length;d<g;d++)k.push(new THREE.UV(e[d].u,e[d].v));n.push(k)}}};
 THREE.ImageUtils={loadTexture:function(b,c,d){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;d&&d(this)};e.src=b;return f},loadTextureCube:function(b,c,d){var e,f=[],g=new THREE.Texture(f,c),c=f.loadCount=0;for(e=b.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;d&&d(this)},f[c].src=b[c];return g}};
-THREE.SceneUtils={addMesh:function(b,c,d,e,f,g,j,k,m,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.CubeGeometry(c,c,c,1,1,1,null,!0),d);b.addObject(c);
+THREE.SceneUtils={addMesh:function(b,c,d,e,f,g,j,k,m,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.CubeGeometry(c,c,c,1,1,1,null,!0),d);b.addObject(c);
 return c},addPanoramaCube:function(b,c,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,e,!0),
 new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,d){var e=c/2,c=new THREE.Plane(c,c),f=Math.PI,g=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));THREE.SceneUtils.addMesh(b,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));THREE.SceneUtils.addMesh(b,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));THREE.SceneUtils.addMesh(b,c,1,0,e,0,g,0,f,
 new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))},showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var d,e,f=b.children.length;for(e=0;e<f;e++)d=b.children[e],c(d),THREE.SceneUtils.traverseHierarchy(d,c)}};
@@ -361,20 +362,20 @@ film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0}
 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(b){var c,d,e,f,g=2*Math.ceil(b*3)+1;g>25&&(g=25);f=(g-1)*0.5;d=Array(g);for(c=e=0;c<g;++c)d[c]=Math.exp(-((c-f)*(c-f))/(2*b*b)),e+=d[c];for(c=0;c<g;++c)d[c]/=e;return d}};
 THREE.AnimationHandler=function(){var b=[],c={},d={update:function(c){for(var d=0;d<b.length;d++)b[d].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var d=0;d<b.hierarchy.length;d++){for(var e=0;e<b.hierarchy[d].keys.length;e++){if(b.hierarchy[d].keys[e].time<
-0)b.hierarchy[d].keys[e].time=0;if(b.hierarchy[d].keys[e].rot!==void 0&&!(b.hierarchy[d].keys[e].rot instanceof THREE.Quaternion)){var k=b.hierarchy[d].keys[e].rot;b.hierarchy[d].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[d].keys[0].morphTargets!==void 0){k={};for(e=0;e<b.hierarchy[d].keys.length;e++)for(var m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++){var o=b.hierarchy[d].keys[e].morphTargets[m];k[o]=-1}b.hierarchy[d].usedMorphTargets=k;for(e=0;e<b.hierarchy[d].keys.length;e++){var n=
-{};for(o in k){for(m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++)if(b.hierarchy[d].keys[e].morphTargets[m]===o){n[o]=b.hierarchy[d].keys[e].morphTargetsInfluences[m];break}m===b.hierarchy[d].keys[e].morphTargets.length&&(n[o]=0)}b.hierarchy[d].keys[e].morphTargetsInfluences=n}}for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].time===b.hierarchy[d].keys[e-1].time&&(b.hierarchy[d].keys.splice(e,1),e--);for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].index=e}e=parseInt(b.length*
+0)b.hierarchy[d].keys[e].time=0;if(b.hierarchy[d].keys[e].rot!==void 0&&!(b.hierarchy[d].keys[e].rot instanceof THREE.Quaternion)){var k=b.hierarchy[d].keys[e].rot;b.hierarchy[d].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[d].keys[0].morphTargets!==void 0){k={};for(e=0;e<b.hierarchy[d].keys.length;e++)for(var m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++){var n=b.hierarchy[d].keys[e].morphTargets[m];k[n]=-1}b.hierarchy[d].usedMorphTargets=k;for(e=0;e<b.hierarchy[d].keys.length;e++){var o=
+{};for(n in k){for(m=0;m<b.hierarchy[d].keys[e].morphTargets.length;m++)if(b.hierarchy[d].keys[e].morphTargets[m]===n){o[n]=b.hierarchy[d].keys[e].morphTargetsInfluences[m];break}m===b.hierarchy[d].keys[e].morphTargets.length&&(o[n]=0)}b.hierarchy[d].keys[e].morphTargetsInfluences=o}}for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].time===b.hierarchy[d].keys[e-1].time&&(b.hierarchy[d].keys.splice(e,1),e--);for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].index=e}e=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(d=0;d<b.hierarchy.length;d++)b.JIT.hierarchy.push(Array(e));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var c=[];if(b instanceof THREE.SkinnedMesh)for(var d=0;d<b.bones.length;d++)c.push(b.bones[d]);else e(b,c);return c}},e=function(b,c){c.push(b);for(var d=0;d<b.children.length;d++)e(b.children[d],c)};d.LINEAR=0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=
 2;return d}();THREE.Animation=function(b,c,d,e){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=d!==void 0?d:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var d,e=this.hierarchy.length,f;for(d=0;d<e;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
 THREE.Bone?f.skinMatrix:f.matrix;var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[d].keys[0];g.rot=this.data.hierarchy[d].keys[0];g.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,e,f,g,j,k,m,o,n=this.data.JIT.hierarchy,p,t;this.currentTime+=b*this.timeScale;t=this.currentTime;p=this.currentTime%=this.data.length;o=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(b=this.hierarchy[u],m=b.animationCache,this.JITCompile&&n[u][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=n[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){d=c[z];j=m.prevKey[d];k=m.nextKey[d];if(k.time<=t){if(p<t)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(d,u,1);k.time<p;)j=k,k=this.getNextKeyWith(d,u,k.index+1)}else{this.stop();return}else{do j=k,k=this.getNextKeyWith(d,u,k.index+1);while(k.time<
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,e,f,g,j,k,m,n,o=this.data.JIT.hierarchy,p,t;this.currentTime+=b*this.timeScale;t=this.currentTime;p=this.currentTime%=this.data.length;n=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(b=this.hierarchy[u],m=b.animationCache,this.JITCompile&&o[u][n]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[u][n],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=o[u][n],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){d=c[z];j=m.prevKey[d];k=m.nextKey[d];if(k.time<=t){if(p<t)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(d,u,1);k.time<p;)j=k,k=this.getNextKeyWith(d,u,k.index+1)}else{this.stop();return}else{do j=k,k=this.getNextKeyWith(d,u,k.index+1);while(k.time<
 p)}m.prevKey[d]=j;m.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;e=(p-j.time)/(k.time-j.time);f=j[d];g=k[d];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(d==="pos")if(d=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),d.x=f[0],d.y=f[1],d.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(d),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,e,0)}else if(d===
-"rot")THREE.Quaternion.slerp(f,g,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&n[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],f,g,j,k,m,o;f=(b.length-1)*c;g=Math.floor(f);f-=g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>b.length-2?g:g+1;d[3]=g>b.length-3?g:g+2;g=b[d[0]];k=b[d[1]];m=b[d[2]];o=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(g[0],k[0],m[0],o[0],f,d,j);e[1]=this.interpolate(g[1],k[1],m[1],o[1],f,d,j);e[2]=this.interpolate(g[2],k[2],m[2],o[2],f,d,j);return e};
+"rot")THREE.Quaternion.slerp(f,g,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&o[0][n]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)o[u][n]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],f,g,j,k,m,n;f=(b.length-1)*c;g=Math.floor(f);f-=g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>b.length-2?g:g+1;d[3]=g>b.length-3?g:g+2;g=b[d[0]];k=b[d[1]];m=b[d[2]];n=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(g[0],k[0],m[0],n[0],f,d,j);e[1]=this.interpolate(g[1],k[1],m[1],n[1],f,d,j);e[2]=this.interpolate(g[2],k[2],m[2],n[2],f,d,j);return e};
 THREE.Animation.prototype.interpolate=function(b,c,d,e,f,g,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*g+b*f+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d<e.length-1?d:e.length-1:d%=e.length;d<e.length;d++)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){for(var e=this.data.hierarchy[c].keys,d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
@@ -407,64 +408,64 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,d,e){THREE.Camera.call(this,b,c,d,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,n=0,p=0,t=0,u=0,v=0,z=window.innerWidth/2,A=window.innerHeight/2;this.update=
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*v));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*p);this.translateY(b*t);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(b,c,d,e){THREE.Camera.call(this,b,c,d,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,o=0,p=0,t=0,u=0,v=0,z=window.innerWidth/2,A=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*v));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*p);this.translateY(b*t);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();j.copy(this.forward);g.set(0,1,0);f.cross(g,j).normalize();g.cross(j,f).normalize();this.matrix.n11=f.x;this.matrix.n12=g.x;this.matrix.n13=j.x;this.matrix.n21=f.y;this.matrix.n22=g.y;this.matrix.n23=j.y;this.matrix.n31=f.z;this.matrix.n32=g.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
 this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(b);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(b){g.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);g.multiplyScalar(b);this.forward.addSelf(g);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){u=(b.clientX-z)/window.innerWidth;v=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;
-case 40:case 83:n=-1;break;case 39:case 68:p=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:p=0;break;case 40:case 83:n=0;break;case 39:case 68:p=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:t=0;break;case 70:t=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+function(b){u=(b.clientX-z)/window.innerWidth;v=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:p=-1;break;
+case 40:case 83:o=-1;break;case 39:case 68:p=1;break;case 81:m=!0;n=1;break;case 69:m=!0;n=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:p=0;break;case 40:case 83:o=0;break;case 39:case 68:p=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:t=0;break;case 70:t=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var d=!1,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var d=!1,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
 this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var d=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(d.y);e.addSelf(this.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};
 this.rotateCamera=function(){var b=Math.acos(g.dot(j)/g.length()/j.length());if(b){var c=(new THREE.Vector3).cross(g,j).normalize(),d=new THREE.Quaternion;b*=this.rotateSpeed;d.setFromAxisAngle(c,-b);d.multiplyVector3(f);d.multiplyVector3(this.up);d.multiplyVector3(j);this.staticMoving?g=j:(d.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),d.multiplyVector3(g))}};this.zoomCamera=function(){var b=1+(m.y-k.y)*this.zoomSpeed;b!==1&&b>0&&(f.multiplyScalar(b),this.staticMoving?k=m:k.y+=(m.y-k.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var b=n.clone().subSelf(o);if(b.lengthSq()){b.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?o=n:o.addSelf(b.sub(n,o).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
+this.panCamera=function(){var b=o.clone().subSelf(n);if(b.lengthSq()){b.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?n=o:n.addSelf(b.sub(o,n).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
 f.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,f.setLength(this.minDistance))};this.update=function(b,c,d){f=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,f);this.checkDistances();this.supr.update.call(this,b,c,d)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(b){d&&(g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=m=this.getMouseOnScreen(b.clientX,b.clientY),o=n=this.getMouseOnScreen(b.clientX,b.clientY),d=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(b.clientX,b.clientY):e===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
-b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=m=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=n=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(e===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e=
+c(this,function(b){d&&(g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=m=this.getMouseOnScreen(b.clientX,b.clientY),n=o=this.getMouseOnScreen(b.clientX,b.clientY),d=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?m=this.getMouseOnScreen(b.clientX,b.clientY):e===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
+b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=m=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(n=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(e===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(d=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(b,c,d,e,f,g,j,k,m){function o(b,c,d,j,k,m,o,p){var t,u,v=e||1,z=f||1,T=k/2,h=m/2,Q=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=g||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=g||1;var R=v+1,N=z+1;k/=v;var aa=m/z;for(u=0;u<N;u++)for(m=0;m<R;m++){var U=new THREE.Vector3;U[b]=(m*k-T)*d;U[c]=(u*aa-h)*j;U[t]=o;n.vertices.push(new THREE.Vertex(U))}for(u=0;u<z;u++)for(m=0;m<v;m++)n.faces.push(new THREE.Face4(m+R*
-u+Q,m+R*(u+1)+Q,m+1+R*(u+1)+Q,m+1+R*u+Q,null,null,p)),n.faceVertexUvs[0].push([new THREE.UV(m/v,u/z),new THREE.UV(m/v,(u+1)/z),new THREE.UV((m+1)/v,(u+1)/z),new THREE.UV((m+1)/v,u/z)])}THREE.Geometry.call(this);var n=this,p=b/2,t=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var z in m)this.sides[z]!=void 0&&(this.sides[z]=
-m[z]);this.sides.px&&o("z","y",1*k,-1,d,c,-p,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,d,c,p,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,d,t,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,d,-t,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=n.vertices.length;d<e;d++){for(var f=n.vertices[d],g=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(f.position.x==m.position.x&&
-f.position.y==m.position.y&&f.position.z==m.position.z){c[d]=j;g=!0;break}}if(!g)c[d]=b.length,b.push(new THREE.Vertex(f.position.clone()))}d=0;for(e=n.faces.length;d<e;d++)f=n.faces[d],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];n.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,c,d,e,f,g){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,n=e/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,-n);for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,n);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-n-(g||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(c>0){j(0,0,n+
-(f||0));for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){var c=[],d=this.faces[m],f=this.vertices[d.a],g=this.vertices[d.b],n=this.vertices[d.c],p=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/o,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/o,0.5+n.position.z/
-e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(b,c,d,e,f,g,j,k,m){function n(b,c,d,j,k,m,n,p){var t,u,v=e||1,z=f||1,T=k/2,h=m/2,Q=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=g||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=g||1;var R=v+1,N=z+1;k/=v;var aa=m/z;for(u=0;u<N;u++)for(m=0;m<R;m++){var U=new THREE.Vector3;U[b]=(m*k-T)*d;U[c]=(u*aa-h)*j;U[t]=n;o.vertices.push(new THREE.Vertex(U))}for(u=0;u<z;u++)for(m=0;m<v;m++)o.faces.push(new THREE.Face4(m+R*
+u+Q,m+R*(u+1)+Q,m+1+R*(u+1)+Q,m+1+R*u+Q,null,null,p)),o.faceVertexUvs[0].push([new THREE.UV(m/v,u/z),new THREE.UV(m/v,(u+1)/z),new THREE.UV((m+1)/v,(u+1)/z),new THREE.UV((m+1)/v,u/z)])}THREE.Geometry.call(this);var o=this,p=b/2,t=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=void 0)for(var z in m)this.sides[z]!=void 0&&(this.sides[z]=
+m[z]);this.sides.px&&n("z","y",1*k,-1,d,c,-p,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,d,c,p,this.materials[1]);this.sides.py&&n("x","z",1*k,1,b,d,t,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,b,d,-t,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=o.vertices.length;d<e;d++){for(var f=o.vertices[d],g=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(f.position.x==m.position.x&&
+f.position.y==m.position.y&&f.position.z==m.position.z){c[d]=j;g=!0;break}}if(!g)c[d]=b.length,b.push(new THREE.Vertex(f.position.clone()))}d=0;for(e=o.faces.length;d<e;d++)f=o.faces[d],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(b,c,d,e,f,g){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,m,n=Math.PI*2,o=e/2;for(m=0;m<b;m++)j(Math.sin(n*m/b)*c,Math.cos(n*m/b)*c,-o);for(m=0;m<b;m++)j(Math.sin(n*m/b)*d,Math.cos(n*m/b)*d,o);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-o-(g||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(c>0){j(0,0,o+
+(f||0));for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){var c=[],d=this.faces[m],f=this.vertices[d.a],g=this.vertices[d.b],o=this.vertices[d.c],p=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/n,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/n,0.5+g.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/n,0.5+o.position.z/
+e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/n,0.5+p.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.IcosahedronGeometry=function(b){function c(b,c,d){var e=Math.sqrt(b*b+c*c+d*d);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(b/e,c/e,d/e)))-1}function d(b,c,d,e){e.faces.push(new THREE.Face3(b,c,d))}function e(b,d){var e=f.vertices[b].position,g=f.vertices[d].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,g=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),o=e(g.faces[k].b,g.faces[k].c),n=e(g.faces[k].c,g.faces[k].a);d(g.faces[k].a,m,n,j);d(g.faces[k].b,o,m,j);
-d(g.faces[k].c,n,o,j);d(m,o,n,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),n=e(g.faces[k].b,g.faces[k].c),o=e(g.faces[k].c,g.faces[k].a);d(g.faces[k].a,m,o,j);d(g.faces[k].b,n,m,j);
+d(g.faces[k].c,o,n,j);d(m,n,o,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],f=[],g=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)m<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),f[k]=this.vertices.length-1):f=g;m==0&&(g=e);
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,k/b.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(b,c,d,e){THREE.Geometry.call(this);var f,g=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var o=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-g,-(f*o-j),0)));for(f=0;f<e;f++)for(c=0;c<d;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(b,c,d,e){THREE.Geometry.call(this);var f,g=b/2,j=c/2,d=d||1,e=e||1,k=d+1,m=e+1;b/=d;var n=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-g,-(f*n-j),0)));for(f=0;f<e;f++)for(c=0;c<d;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,d){THREE.Geometry.call(this);for(var b=b||50,e,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*f),m=b*Math.sin(e*f),o=[],n=0;for(e=0;e<g;e++){var p=2*e/g,t=m*Math.sin(p*f),p=m*Math.cos(p*f);(d==0||d==j)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,t)))-1);o.push(n)}c.push(o)}for(var u,v,z,f=c.length,d=0;d<f;d++)if(g=c[d].length,d>0)for(e=0;e<g;e++){o=e==g-1;j=c[d][o?0:e+1];k=c[d][o?g-1:e];m=c[d-1][o?
-g-1:e];o=c[d-1][o?0:e+1];t=d/(f-1);u=(d-1)/(f-1);v=(e+1)/g;var p=e/g,n=new THREE.UV(1-v,t),t=new THREE.UV(1-p,t),p=new THREE.UV(1-p,u),A=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),z=this.vertices[m].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,t,p]));d>1&&(u=
-this.vertices[j].position.clone(),v=this.vertices[m].position.clone(),z=this.vertices[o].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,p,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,c,d){THREE.Geometry.call(this);for(var b=b||50,e,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*f),m=b*Math.sin(e*f),n=[],o=0;for(e=0;e<g;e++){var p=2*e/g,t=m*Math.sin(p*f),p=m*Math.cos(p*f);(d==0||d==j)&&e>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,t)))-1);n.push(o)}c.push(n)}for(var u,v,z,f=c.length,d=0;d<f;d++)if(g=c[d].length,d>0)for(e=0;e<g;e++){n=e==g-1;j=c[d][n?0:e+1];k=c[d][n?g-1:e];m=c[d-1][n?
+g-1:e];n=c[d-1][n?0:e+1];t=d/(f-1);u=(d-1)/(f-1);v=(e+1)/g;var p=e/g,o=new THREE.UV(1-v,t),t=new THREE.UV(1-p,t),p=new THREE.UV(1-p,u),A=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),z=this.vertices[m].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,t,p]));d>1&&(u=
+this.vertices[j].position.clone(),v=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),u.normalize(),v.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,p,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TextGeometry.prototype.set=function(b,c){function d(b,c,d){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}function e(b,c,d,e){v.faces.push(new THREE.Face4(b,c,d,e))}this.text=b;var c=c||this.parameters,f=c.height!==void 0?c.height:50,g=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",m=c.style!==void 0?c.style:"normal",o=c.bezelThickness!==void 0?c.bezelThickness:10,n=c.bezelSize!==void 0?c.bezelSize:8,p=c.bezelEnabled!==
-void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=g;THREE.FontUtils.face=j;THREE.FontUtils.weight=k;THREE.FontUtils.style=m;THREE.FontUtils.bezelSize=n;var k=THREE.FontUtils.drawText(b),g=k.points,t=k.faces,j=k.contour,u=k.bezel,v=this;v.vertices=[];v.faces=[];for(var z,m=g.length,A=t.length,n=u.length,k=0;k<m;k++)z=g[k],d(z.x,z.y,0);for(k=0;k<m;k++)z=g[k],d(z.x,z.y,f);if(p){for(k=0;k<n;k++)z=u[k],d(z.x,z.y,o);for(k=0;k<n;k++)z=u[k],d(z.x,z.y,f-o)}for(k=
-0;k<A;k++)f=t[k],v.faces.push(new THREE.Face3(f[2],f[1],f[0]));for(k=0;k<A;k++)f=t[k],v.faces.push(new THREE.Face3(f[0]+m,f[1]+m,f[2]+m));var x;if(p)for(k=u.length;--k>0;){if(x){if(x.equals(j[k])){x=null;continue}}else x=j[k];o=m*2+k;t=o-1;e(o,t,t+n,o+n);for(p=0;p<m;p++)if(g[p].equals(j[k]))break;for(f=0;f<m;f++)if(g[f].equals(j[k-1]))break;e(p,f,t,o);e(o+n,t+n,f+m,p+m)}else for(k=j.length;--k>0;){if(x){if(x.equals(j[k])){x=null;continue}}else x=j[k];for(p=0;p<m;p++)if(g[p].equals(j[k]))break;for(f=
+THREE.TextGeometry.prototype.set=function(b,c){function d(b,c,d){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}function e(b,c,d,e){v.faces.push(new THREE.Face4(b,c,d,e))}this.text=b;var c=c||this.parameters,f=c.height!==void 0?c.height:50,g=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",m=c.style!==void 0?c.style:"normal",n=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,p=c.bezelEnabled!==
+void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=g;THREE.FontUtils.face=j;THREE.FontUtils.weight=k;THREE.FontUtils.style=m;THREE.FontUtils.bezelSize=o;var k=THREE.FontUtils.drawText(b),g=k.points,t=k.faces,j=k.contour,u=k.bezel,v=this;v.vertices=[];v.faces=[];for(var z,m=g.length,A=t.length,o=u.length,k=0;k<m;k++)z=g[k],d(z.x,z.y,0);for(k=0;k<m;k++)z=g[k],d(z.x,z.y,f);if(p){for(k=0;k<o;k++)z=u[k],d(z.x,z.y,n);for(k=0;k<o;k++)z=u[k],d(z.x,z.y,f-n)}for(k=
+0;k<A;k++)f=t[k],v.faces.push(new THREE.Face3(f[2],f[1],f[0]));for(k=0;k<A;k++)f=t[k],v.faces.push(new THREE.Face3(f[0]+m,f[1]+m,f[2]+m));var x;if(p)for(k=u.length;--k>0;){if(x){if(x.equals(j[k])){x=null;continue}}else x=j[k];n=m*2+k;t=n-1;e(n,t,t+o,n+o);for(p=0;p<m;p++)if(g[p].equals(j[k]))break;for(f=0;f<m;f++)if(g[f].equals(j[k-1]))break;e(p,f,t,n);e(n+o,t+o,f+m,p+m)}else for(k=j.length;--k>0;){if(x){if(x.equals(j[k])){x=null;continue}}else x=j[k];for(p=0;p<m;p++)if(g[p].equals(j[k]))break;for(f=
 0;f<m;f++)if(g[f].equals(j[k-1]))break;e(p,f,f+m,p+m)}this.computeCentroids();this.computeFaceNormals()};
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
-{points:b,faces:[]};var d,e,f,g,j=[],k;for(k in c){b=c[k];g=[];for(d in b)e=b[d],g.push(e.x+","+e.y);var m,o;o=g.slice(1).indexOf(g[0]);var n=this.Triangulate.area(b.slice(0,o+1))<0;e=[];for(o=-1;o<g.length;){m=o+1;o=g[m];o=g.slice(m+1).indexOf(o)+m;if(o<=m)break;var p=b.slice(m,o+1);n?this.Triangulate.area(p)<0?(m>0&&j.push({shape:f,holes:e}),f=p,e=[]):e.push(p):this.Triangulate.area(p)<0?(j.push({shape:p,holes:e}),e=[]):e.push(p);o++}n&&j.push({shape:f,holes:e})}var t,u,v,z,A,x;g=[];for(k=0;k<j.length;k++){m=
-j[k];f=m.shape;e=m.holes;for(n=0;n<e.length;n++){o=e[n];v=Number.POSITIVE_INFINITY;for(p=0;p<o.length;p++){A=o[p];for(d=0;d<f.length;d++)z=f[d],z=A.distanceTo(z),z<v&&(v=z,t=p,u=d)}d=u-1>=0?u-1:f.length-1;var p=t-1>=0?t-1:o.length-1,G=[];G.push(o[t]);G.push(f[u]);G.push(f[d]);v=this.Triangulate.area(G);var y=[];y.push(o[t]);y.push(o[p]);y.push(f[u]);A=this.Triangulate.area(y);z=u;x=t;u+=1;t+=-1;u<0&&(u+=f.length);u%=f.length;t<0&&(t+=o.length);t%=f.length;d=u-1>=0?u-1:f.length-1;p=t-1>=0?t-1:o.length-
-1;G=[];G.push(o[t]);G.push(f[u]);G.push(f[d]);G=this.Triangulate.area(G);y=[];y.push(o[t]);y.push(o[p]);y.push(f[u]);y=this.Triangulate.area(y);v+A>G+y&&(u=z,t=x,u<0&&(u+=f.length),u%=f.length,t<0&&(t+=o.length),t%=f.length,d=u-1>=0?u-1:f.length-1,p=t-1>=0?t-1:o.length-1);v=f.slice(0,u);A=f.slice(u);z=o.slice(t);x=o.slice(0,t);g.push(o[t]);g.push(f[u]);g.push(f[d]);g.push(o[t]);g.push(o[p]);g.push(f[u]);f=v.concat(z).concat(x).concat(A)}m.shape=f}b=[];t=[];for(k=n=0;k<j.length;k++){m=j[k];f=m.shape;
-b=b.concat(f);m=THREE.FontUtils.Triangulate(f,!0);for(u=0;u<m.length;u++)e=m[u],e[0]+=n,e[1]+=n,e[2]+=n;t=t.concat(m);n+=f.length}var D;for(u=0;u<g.length/3;u++){e=[];for(j=0;j<3;j++){k=!1;for(f=0;f<b.length&&!k;f++)D=u*3+j,b[f].equals(g[D])&&(e.push(f),k=!0);k||(b.push(g[D]),e.push(b.length-1),console.log("not found"))}t.push(e)}return{points:b,faces:t}},drawText:function(b){var c=[],d=[],e,f=this.getFace(),g=this.size/f.resolution,j=0;e=String(b).split("");for(var k=e.length,b=0;b<k;b++){var m=
-this.extractGlyphPoints(e[b],f,g,j);j+=m.offset;c.push(m.points);d=d.concat(m.points)}b=j/2;for(e=0;e<d.length;e++)d[e].x-=b;c=this.extractPoints(d,c);c.contour=d;f=[];g=[];e=[];for(var j=[],k=new THREE.Vector2,o,b=d.length;--b>=0;){if(o){if(o.equals(d[b])){o=null;m=this.Triangulate.area(e)>0;j.push(m);g.push(k.divideScalar(e.length));e=[];k=new THREE.Vector2;continue}}else o=d[b];k.addSelf(d[b]);e.push(d[b])}b=d.length;e=0;for(var n;--b>=0;)m=d[b],k=g[e],m=m.clone().subSelf(k),n=this.bezelSize/m.length(),
-j[e]?n+=1:n=1-n,n=m.multiplyScalar(n).addSelf(k),f.unshift(n),o?o.equals(d[b])&&(o=null,e++):o=d[b];c.bezel=f;return c},b2p0:function(b,c){var d=1-b;return d*d*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,d,e){return this.b2p0(b,c)+this.b2p1(b,d)+this.b2p2(b,e)},b3p0:function(b,c){var d=1-b;return d*d*d*c},b3p1:function(b,c){var d=1-b;return 3*d*d*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,d,e,f){return this.b3p0(b,
-c)+this.b3p1(b,d)+this.b3p2(b,e)+this.b3p3(b,f)},extractGlyphPoints:function(b,c,d,e){var f=[],g,j,k,m,o,n,p,t,u,v,z=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));k=c.length;for(b=0;b<k;)switch(j=c[b++],j){case "m":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "l":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "q":j=c[b++]*d+e;m=c[b++]*d;p=c[b++]*d+e;t=c[b++]*d;if(g=f[f.length-1]){o=
-g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var A=g/divisions,x=THREE.FontUtils.b2(A,o,p,j),A=THREE.FontUtils.b2(A,n,t,m);f.push(new THREE.Vector2(x,A))}}break;case "b":if(j=c[b++]*d+e,m=c[b++]*d,p=c[b++]*d+e,t=c[b++]*-d,u=c[b++]*d+e,v=c[b++]*-d,g=f[f.length-1]){o=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)A=g/divisions,x=THREE.FontUtils.b3(A,o,p,u,j),A=THREE.FontUtils.b3(A,n,t,v,m),f.push(new THREE.Vector2(x,A))}}}return{offset:z.ha*d,points:f}}}};
-(function(b){var c=function(b){for(var c=b.length,f=0,g=c-1,j=0;j<c;g=j++)f+=b[g].x*b[j].y-b[j].x*b[g].y;return f*0.5};b.Triangulate=function(b,e){var f=b.length;if(f<3)return null;var g=[],j=[],k=[],m,o,n;if(c(b)>0)for(o=0;o<f;o++)j[o]=o;else for(o=0;o<f;o++)j[o]=f-1-o;var p=2*f;for(o=f-1;f>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return g}m=o;f<=m&&(m=0);o=m+1;f<=o&&(o=0);n=o+1;f<=n&&(n=0);var t;a:{t=b;var u=m,v=o,z=n,A=f,x=j,G=void 0,y=void 0,D=void 0,
-F=void 0,B=void 0,P=void 0,K=void 0,L=void 0,E=void 0,y=t[x[u]].x,D=t[x[u]].y,F=t[x[v]].x,B=t[x[v]].y,P=t[x[z]].x,K=t[x[z]].y;if(1.0E-10>(F-y)*(K-D)-(B-D)*(P-y))t=!1;else{for(G=0;G<A;G++)if(!(G==u||G==v||G==z)){var L=t[x[G]].x,E=t[x[G]].y,M=void 0,T=void 0,h=void 0,Q=void 0,R=void 0,N=void 0,aa=void 0,U=void 0,V=void 0,ga=void 0,W=void 0,da=void 0,M=h=R=void 0,M=P-F,T=K-B,h=y-P,Q=D-K,R=F-y,N=B-D,aa=L-y,U=E-D,V=L-F,ga=E-B,W=L-P,da=E-K,M=M*ga-T*V,R=R*U-N*aa,h=h*da-Q*W;if(M>=0&&h>=0&&R>=0){t=!1;break a}}t=
-!0}}if(t){p=j[m];t=j[o];u=j[n];g.push(b[p]);g.push(b[t]);g.push(b[u]);k.push([j[m],j[o],j[n]]);m=o;for(n=o+1;n<f;m++,n++)j[m]=j[n];f--;p=2*f}}if(e)return k;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+{points:b,faces:[]};var d,e,f,g,j=[],k;for(k in c){b=c[k];g=[];for(d in b)e=b[d],g.push(e.x+","+e.y);var m,n;n=g.slice(1).indexOf(g[0]);var o=this.Triangulate.area(b.slice(0,n+1))<0;e=[];for(n=-1;n<g.length;){m=n+1;n=g[m];n=g.slice(m+1).indexOf(n)+m;if(n<=m)break;var p=b.slice(m,n+1);o?this.Triangulate.area(p)<0?(m>0&&j.push({shape:f,holes:e}),f=p,e=[]):e.push(p):this.Triangulate.area(p)<0?(j.push({shape:p,holes:e}),e=[]):e.push(p);n++}o&&j.push({shape:f,holes:e})}var t,u,v,z,A,x;g=[];for(k=0;k<j.length;k++){m=
+j[k];f=m.shape;e=m.holes;for(o=0;o<e.length;o++){n=e[o];v=Number.POSITIVE_INFINITY;for(p=0;p<n.length;p++){A=n[p];for(d=0;d<f.length;d++)z=f[d],z=A.distanceTo(z),z<v&&(v=z,t=p,u=d)}d=u-1>=0?u-1:f.length-1;var p=t-1>=0?t-1:n.length-1,G=[];G.push(n[t]);G.push(f[u]);G.push(f[d]);v=this.Triangulate.area(G);var y=[];y.push(n[t]);y.push(n[p]);y.push(f[u]);A=this.Triangulate.area(y);z=u;x=t;u+=1;t+=-1;u<0&&(u+=f.length);u%=f.length;t<0&&(t+=n.length);t%=f.length;d=u-1>=0?u-1:f.length-1;p=t-1>=0?t-1:n.length-
+1;G=[];G.push(n[t]);G.push(f[u]);G.push(f[d]);G=this.Triangulate.area(G);y=[];y.push(n[t]);y.push(n[p]);y.push(f[u]);y=this.Triangulate.area(y);v+A>G+y&&(u=z,t=x,u<0&&(u+=f.length),u%=f.length,t<0&&(t+=n.length),t%=f.length,d=u-1>=0?u-1:f.length-1,p=t-1>=0?t-1:n.length-1);v=f.slice(0,u);A=f.slice(u);z=n.slice(t);x=n.slice(0,t);g.push(n[t]);g.push(f[u]);g.push(f[d]);g.push(n[t]);g.push(n[p]);g.push(f[u]);f=v.concat(z).concat(x).concat(A)}m.shape=f}b=[];t=[];for(k=o=0;k<j.length;k++){m=j[k];f=m.shape;
+b=b.concat(f);m=THREE.FontUtils.Triangulate(f,!0);for(u=0;u<m.length;u++)e=m[u],e[0]+=o,e[1]+=o,e[2]+=o;t=t.concat(m);o+=f.length}var D;for(u=0;u<g.length/3;u++){e=[];for(j=0;j<3;j++){k=!1;for(f=0;f<b.length&&!k;f++)D=u*3+j,b[f].equals(g[D])&&(e.push(f),k=!0);k||(b.push(g[D]),e.push(b.length-1),console.log("not found"))}t.push(e)}return{points:b,faces:t}},drawText:function(b){var c=[],d=[],e,f=this.getFace(),g=this.size/f.resolution,j=0;e=String(b).split("");for(var k=e.length,b=0;b<k;b++){var m=
+this.extractGlyphPoints(e[b],f,g,j);j+=m.offset;c.push(m.points);d=d.concat(m.points)}b=j/2;for(e=0;e<d.length;e++)d[e].x-=b;c=this.extractPoints(d,c);c.contour=d;f=[];g=[];e=[];for(var j=[],k=new THREE.Vector2,n,b=d.length;--b>=0;){if(n){if(n.equals(d[b])){n=null;m=this.Triangulate.area(e)>0;j.push(m);g.push(k.divideScalar(e.length));e=[];k=new THREE.Vector2;continue}}else n=d[b];k.addSelf(d[b]);e.push(d[b])}b=d.length;e=0;for(var o;--b>=0;)m=d[b],k=g[e],m=m.clone().subSelf(k),o=this.bezelSize/m.length(),
+j[e]?o+=1:o=1-o,o=m.multiplyScalar(o).addSelf(k),f.unshift(o),n?n.equals(d[b])&&(n=null,e++):n=d[b];c.bezel=f;return c},b2p0:function(b,c){var d=1-b;return d*d*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,d,e){return this.b2p0(b,c)+this.b2p1(b,d)+this.b2p2(b,e)},b3p0:function(b,c){var d=1-b;return d*d*d*c},b3p1:function(b,c){var d=1-b;return 3*d*d*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,d,e,f){return this.b3p0(b,
+c)+this.b3p1(b,d)+this.b3p2(b,e)+this.b3p3(b,f)},extractGlyphPoints:function(b,c,d,e){var f=[],g,j,k,m,n,o,p,t,u,v,z=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));k=c.length;for(b=0;b<k;)switch(j=c[b++],j){case "m":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "l":j=c[b++]*d+e;m=c[b++]*d;f.push(new THREE.Vector2(j,m));break;case "q":j=c[b++]*d+e;m=c[b++]*d;p=c[b++]*d+e;t=c[b++]*d;if(g=f[f.length-1]){n=
+g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var A=g/divisions,x=THREE.FontUtils.b2(A,n,p,j),A=THREE.FontUtils.b2(A,o,t,m);f.push(new THREE.Vector2(x,A))}}break;case "b":if(j=c[b++]*d+e,m=c[b++]*d,p=c[b++]*d+e,t=c[b++]*-d,u=c[b++]*d+e,v=c[b++]*-d,g=f[f.length-1]){n=g.x;o=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)A=g/divisions,x=THREE.FontUtils.b3(A,n,p,u,j),A=THREE.FontUtils.b3(A,o,t,v,m),f.push(new THREE.Vector2(x,A))}}}return{offset:z.ha*d,points:f}}}};
+(function(b){var c=function(b){for(var c=b.length,f=0,g=c-1,j=0;j<c;g=j++)f+=b[g].x*b[j].y-b[j].x*b[g].y;return f*0.5};b.Triangulate=function(b,e){var f=b.length;if(f<3)return null;var g=[],j=[],k=[],m,n,o;if(c(b)>0)for(n=0;n<f;n++)j[n]=n;else for(n=0;n<f;n++)j[n]=f-1-n;var p=2*f;for(n=f-1;f>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return g}m=n;f<=m&&(m=0);n=m+1;f<=n&&(n=0);o=n+1;f<=o&&(o=0);var t;a:{t=b;var u=m,v=n,z=o,A=f,x=j,G=void 0,y=void 0,D=void 0,
+F=void 0,B=void 0,P=void 0,L=void 0,K=void 0,E=void 0,y=t[x[u]].x,D=t[x[u]].y,F=t[x[v]].x,B=t[x[v]].y,P=t[x[z]].x,L=t[x[z]].y;if(1.0E-10>(F-y)*(L-D)-(B-D)*(P-y))t=!1;else{for(G=0;G<A;G++)if(!(G==u||G==v||G==z)){var K=t[x[G]].x,E=t[x[G]].y,M=void 0,T=void 0,h=void 0,Q=void 0,R=void 0,N=void 0,aa=void 0,U=void 0,V=void 0,ga=void 0,W=void 0,da=void 0,M=h=R=void 0,M=P-F,T=L-B,h=y-P,Q=D-L,R=F-y,N=B-D,aa=K-y,U=E-D,V=K-F,ga=E-B,W=K-P,da=E-L,M=M*ga-T*V,R=R*U-N*aa,h=h*da-Q*W;if(M>=0&&h>=0&&R>=0){t=!1;break a}}t=
+!0}}if(t){p=j[m];t=j[n];u=j[o];g.push(b[p]);g.push(b[t]);g.push(b[u]);k.push([j[m],j[n],j[o]]);m=n;for(o=n+1;o<f;m++,o++)j[m]=j[o];f--;p=2*f}}if(e)return k;return g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
 1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,g,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(b,c,d,e,f,g,j){function k(b,c,d,e,f,g){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(f*(2+d)*0.5*Math.cos(b),f*(2+d)*Math.sin(b)*0.5,g*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var m=b/this.segmentsR*2*this.p*Math.PI,j=c/this.segmentsT*2*Math.PI,f=k(m,j,this.q,this.p,this.radius,this.heightScale),m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=m.x-f.x;d.y=m.y-f.y;d.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(d,e);e.cross(g,d);g.normalize();e.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);f.x+=m*e.x+j*g.x;f.y+=m*e.y+j*g.y;f.z+=m*e.z+j*g.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
-f.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var e=(b+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][g],g=this.grid[b][g],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,d,e,g));this.faceVertexUvs[0].push([j,m,o,n])}this.computeCentroids();
+f.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var e=(b+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][g],g=this.grid[b][g],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,d,e,g));this.faceVertexUvs[0].push([j,m,n,o])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var e=0;e<c.length;++e)b.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],d)]},createMaterial:function(b,c){function d(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function e(b,c){var e=new Image;e.onload=function(){if(!d(this.width)||!d(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/
@@ -473,53 +474,53 @@ Math.LN2));b.image.width=c;b.image.height=e;b.image.getContext("2d").drawImage(t
 g.map.wrapT=THREE.RepeatWrapping;b.mapDiffuseOffset&&g.map.offset.set(b.mapDiffuseOffset[0],b.mapDiffuseOffset[1]);e(g.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse)j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255,g.color=j,g.opacity=b.transparency;else if(b.DbgColor)g.color=b.DbgColor;if(b.mapLight&&c){j=document.createElement("canvas");g.lightMap=new THREE.Texture(j);g.lightMap.sourceFile=b.mapLight;if(b.mapLightmapRepeat)g.lightMap.repeat.set(b.mapLightRepeat[0],
 b.mapLightRepeat[1]),g.lightMap.wrapS=g.lightMap.wrapT=THREE.RepeatWrapping;b.mapLightmapOffset&&g.lightMap.offset.set(b.mapLightmapOffset[0],b.mapLightmapOffset[1]);e(g.lightMap,c+"/"+b.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,e=b.callback,f=b.texture_path?b.texture_path:this.extractUrlbase(d),b=new Worker(d);b.onmessage=function(b){c.createModel(b.data,e,f);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,f=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,f,m,o,n,p,t,u,v,z,A,x,G,y,D=b.faces;p=b.vertices;var F=b.normals,B=b.colors,P=0;for(d=0;d<b.uvs.length;d++)b.uvs[d].length&&P++;for(d=0;d<P;d++)e.faceUvs[d]=[],e.faceVertexUvs[d]=[];o=0;for(n=p.length;o<n;)t=new THREE.Vertex,t.position.x=p[o++]*c,t.position.y=
-p[o++]*c,t.position.z=p[o++]*c,e.vertices.push(t);o=0;for(n=D.length;o<n;){c=D[o++];p=c&1;m=c&2;d=c&4;f=c&8;u=c&16;t=c&32;z=c&64;c&=128;p?(A=new THREE.Face4,A.a=D[o++],A.b=D[o++],A.c=D[o++],A.d=D[o++],p=4):(A=new THREE.Face3,A.a=D[o++],A.b=D[o++],A.c=D[o++],p=3);if(m)m=D[o++],A.materials=e.materials[m];m=e.faces.length;if(d)for(d=0;d<P;d++)x=b.uvs[d],v=D[o++],y=x[v*2],v=x[v*2+1],e.faceUvs[d][m]=new THREE.UV(y,v);if(f)for(d=0;d<P;d++){x=b.uvs[d];G=[];for(f=0;f<p;f++)v=D[o++],y=x[v*2],v=x[v*2+1],G[f]=
-new THREE.UV(y,v);e.faceVertexUvs[d][m]=G}if(u)u=D[o++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],A.normal=f;if(t)for(d=0;d<p;d++)u=D[o++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],A.vertexNormals.push(f);if(z)t=D[o++],t=new THREE.Color(B[t]),A.color=t;if(c)for(d=0;d<p;d++)t=D[o++],t=new THREE.Color(B[t]),A.vertexColors.push(t);e.faces.push(A)}}})(f);(function(){var c,d,f,m;if(b.skinWeights){c=0;for(d=b.skinWeights.length;c<d;c+=2)f=b.skinWeights[c],m=b.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
-m,0,0))}if(b.skinIndices){c=0;for(d=b.skinIndices.length;c<d;c+=2)f=b.skinIndices[c],m=b.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,m,0,0))}e.bones=b.bones;e.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var d,f,m,o,n,p,t,u,v;d=0;for(f=b.morphTargets.length;d<f;d++){e.morphTargets[d]={};e.morphTargets[d].name=b.morphTargets[d].name;e.morphTargets[d].vertices=[];u=e.morphTargets[d].vertices;v=b.morphTargets[d].vertices;m=0;for(o=v.length;m<o;m+=3)n=v[m]*c,p=v[m+1]*
-c,t=v[m+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,p,t)))}}if(b.morphColors!==void 0){d=0;for(f=b.morphColors.length;d<f;d++){e.morphColors[d]={};e.morphColors[d].name=b.morphColors[d].name;e.morphColors[d].colors=[];o=e.morphColors[d].colors;n=b.morphColors[d].colors;c=0;for(m=n.length;c<m;c+=3)p=new THREE.Color(16755200),p.setRGB(n[c],n[c+1],n[c+2]),o.push(p)}}})(f);(function(){if(b.edges!==void 0){var c,d,f;for(c=0;c<b.edges.length;c+=2)d=b.edges[c],f=b.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[d],
+THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,f=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,f,m,n,o,p,t,u,v,z,A,x,G,y,D=b.faces;p=b.vertices;var F=b.normals,B=b.colors,P=0;for(d=0;d<b.uvs.length;d++)b.uvs[d].length&&P++;for(d=0;d<P;d++)e.faceUvs[d]=[],e.faceVertexUvs[d]=[];n=0;for(o=p.length;n<o;)t=new THREE.Vertex,t.position.x=p[n++]*c,t.position.y=
+p[n++]*c,t.position.z=p[n++]*c,e.vertices.push(t);n=0;for(o=D.length;n<o;){c=D[n++];p=c&1;m=c&2;d=c&4;f=c&8;u=c&16;t=c&32;z=c&64;c&=128;p?(A=new THREE.Face4,A.a=D[n++],A.b=D[n++],A.c=D[n++],A.d=D[n++],p=4):(A=new THREE.Face3,A.a=D[n++],A.b=D[n++],A.c=D[n++],p=3);if(m)m=D[n++],A.materials=e.materials[m];m=e.faces.length;if(d)for(d=0;d<P;d++)x=b.uvs[d],v=D[n++],y=x[v*2],v=x[v*2+1],e.faceUvs[d][m]=new THREE.UV(y,v);if(f)for(d=0;d<P;d++){x=b.uvs[d];G=[];for(f=0;f<p;f++)v=D[n++],y=x[v*2],v=x[v*2+1],G[f]=
+new THREE.UV(y,v);e.faceVertexUvs[d][m]=G}if(u)u=D[n++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],A.normal=f;if(t)for(d=0;d<p;d++)u=D[n++]*3,f=new THREE.Vector3,f.x=F[u++],f.y=F[u++],f.z=F[u],A.vertexNormals.push(f);if(z)t=D[n++],t=new THREE.Color(B[t]),A.color=t;if(c)for(d=0;d<p;d++)t=D[n++],t=new THREE.Color(B[t]),A.vertexColors.push(t);e.faces.push(A)}}})(f);(function(){var c,d,f,m;if(b.skinWeights){c=0;for(d=b.skinWeights.length;c<d;c+=2)f=b.skinWeights[c],m=b.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
+m,0,0))}if(b.skinIndices){c=0;for(d=b.skinIndices.length;c<d;c+=2)f=b.skinIndices[c],m=b.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,m,0,0))}e.bones=b.bones;e.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var d,f,m,n,o,p,t,u,v;d=0;for(f=b.morphTargets.length;d<f;d++){e.morphTargets[d]={};e.morphTargets[d].name=b.morphTargets[d].name;e.morphTargets[d].vertices=[];u=e.morphTargets[d].vertices;v=b.morphTargets[d].vertices;m=0;for(n=v.length;m<n;m+=3)o=v[m]*c,p=v[m+1]*
+c,t=v[m+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,p,t)))}}if(b.morphColors!==void 0){d=0;for(f=b.morphColors.length;d<f;d++){e.morphColors[d]={};e.morphColors[d].name=b.morphColors[d].name;e.morphColors[d].colors=[];n=e.morphColors[d].colors;o=b.morphColors[d].colors;c=0;for(m=o.length;c<m;c+=3)p=new THREE.Color(16755200),p.setRGB(o[c],o[c+1],o[c+2]),n.push(p)}}})(f);(function(){if(b.edges!==void 0){var c,d,f;for(c=0;c<b.edges.length;c+=2)d=b.edges[c],f=b.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[d],
 e.vertices[f],d,f))}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,d=b.callback,e=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,d,f,e,g)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,d,e,f,g){var j=new XMLHttpRequest,k=e+"/"+b,m=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,f,c):alert("Couldn't load ["+k+"] ["+j.status+"]"):j.readyState==3?g&&(m==0&&(m=j.getResponseHeader("Content-Length")),g({total:m,loaded:j.responseText.length})):j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,e){var f=function(c){function d(b,c){var e=n(b,c),f=n(b,c+1),g=n(b,c+2),h=n(b,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(b,c){var d=n(b,c),e=n(b,c+1),g=n(b,c+2);return(n(b,c+3)<<24)+(g<<16)+(e<<8)+d}function m(b,c){var d=n(b,c);return(n(b,c+1)<<8)+d}function o(b,c){var d=n(b,c);return d>127?d-256:d}function n(b,
-c){return b.charCodeAt(c)&255}function p(c){var d,e,g;d=f(b,c);e=f(b,c+B);g=f(b,c+P);c=m(b,c+K);THREE.BinaryLoader.prototype.f3(x,d,e,g,c)}function t(c){var d,e,g,h,j,n;d=f(b,c);e=f(b,c+B);g=f(b,c+P);h=m(b,c+K);j=f(b,c+L);n=f(b,c+E);c=f(b,c+M);THREE.BinaryLoader.prototype.f3n(x,D,d,e,g,h,j,n,c)}function u(c){var d,e,g,j;d=f(b,c);e=f(b,c+T);g=f(b,c+h);j=f(b,c+Q);c=m(b,c+R);THREE.BinaryLoader.prototype.f4(x,d,e,g,j,c)}function v(c){var d,e,g,j,n,o,p,t;d=f(b,c);e=f(b,c+T);g=f(b,c+h);j=f(b,c+Q);n=m(b,
-c+R);o=f(b,c+N);p=f(b,c+aa);t=f(b,c+U);c=f(b,c+V);THREE.BinaryLoader.prototype.f4n(x,D,d,e,g,j,n,o,p,t,c)}function z(c){var d,e;d=f(b,c);e=f(b,c+ga);c=f(b,c+W);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[c*2],F[c*2+1])}function A(c){var d,e,g;d=f(b,c);e=f(b,c+da);g=f(b,c+ea);c=f(b,c+ka);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[g*2],F[g*2+1],F[c*2],F[c*2+1])}var x=this,G=0,y,D=[],F=[],B,P,K,L,E,M,T,h,Q,R,N,aa,U,
-V,ga,W,da,ea,ka,fa,I,S,Z,$,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,e,c);y={signature:b.substr(G,8),header_bytes:n(b,G+8),vertex_coordinate_bytes:n(b,G+9),normal_coordinate_bytes:n(b,G+10),uv_coordinate_bytes:n(b,G+11),vertex_index_bytes:n(b,G+12),normal_index_bytes:n(b,G+13),uv_index_bytes:n(b,G+14),material_index_bytes:n(b,G+15),nvertices:f(b,G+16),nnormals:f(b,G+16+4),nuvs:f(b,G+16+8),ntri_flat:f(b,G+16+12),ntri_smooth:f(b,G+16+16),ntri_flat_uv:f(b,G+16+20),ntri_smooth_uv:f(b,
-G+16+24),nquad_flat:f(b,G+16+28),nquad_smooth:f(b,G+16+32),nquad_flat_uv:f(b,G+16+36),nquad_smooth_uv:f(b,G+16+40)};G+=y.header_bytes;B=y.vertex_index_bytes;P=y.vertex_index_bytes*2;K=y.vertex_index_bytes*3;L=y.vertex_index_bytes*3+y.material_index_bytes;E=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;M=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;T=y.vertex_index_bytes;h=y.vertex_index_bytes*2;Q=y.vertex_index_bytes*3;R=y.vertex_index_bytes*4;N=y.vertex_index_bytes*
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,e){var f=function(c){function d(b,c){var e=o(b,c),f=o(b,c+1),g=o(b,c+2),h=o(b,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(b,c){var d=o(b,c),e=o(b,c+1),g=o(b,c+2);return(o(b,c+3)<<24)+(g<<16)+(e<<8)+d}function m(b,c){var d=o(b,c);return(o(b,c+1)<<8)+d}function n(b,c){var d=o(b,c);return d>127?d-256:d}function o(b,
+c){return b.charCodeAt(c)&255}function p(c){var d,e,g;d=f(b,c);e=f(b,c+B);g=f(b,c+P);c=m(b,c+L);THREE.BinaryLoader.prototype.f3(x,d,e,g,c)}function t(c){var d,e,g,h,j,n;d=f(b,c);e=f(b,c+B);g=f(b,c+P);h=m(b,c+L);j=f(b,c+K);n=f(b,c+E);c=f(b,c+M);THREE.BinaryLoader.prototype.f3n(x,D,d,e,g,h,j,n,c)}function u(c){var d,e,g,j;d=f(b,c);e=f(b,c+T);g=f(b,c+h);j=f(b,c+Q);c=m(b,c+R);THREE.BinaryLoader.prototype.f4(x,d,e,g,j,c)}function v(c){var d,e,g,j,n,o,p,t;d=f(b,c);e=f(b,c+T);g=f(b,c+h);j=f(b,c+Q);n=m(b,
+c+R);o=f(b,c+N);p=f(b,c+aa);t=f(b,c+U);c=f(b,c+V);THREE.BinaryLoader.prototype.f4n(x,D,d,e,g,j,n,o,p,t,c)}function z(c){var d,e;d=f(b,c);e=f(b,c+ga);c=f(b,c+W);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[c*2],F[c*2+1])}function A(c){var d,e,g;d=f(b,c);e=f(b,c+da);g=f(b,c+ea);c=f(b,c+ka);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],F[d*2],F[d*2+1],F[e*2],F[e*2+1],F[g*2],F[g*2+1],F[c*2],F[c*2+1])}var x=this,G=0,y,D=[],F=[],B,P,L,K,E,M,T,h,Q,R,N,aa,U,
+V,ga,W,da,ea,ka,fa,I,S,Y,Z,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,e,c);y={signature:b.substr(G,8),header_bytes:o(b,G+8),vertex_coordinate_bytes:o(b,G+9),normal_coordinate_bytes:o(b,G+10),uv_coordinate_bytes:o(b,G+11),vertex_index_bytes:o(b,G+12),normal_index_bytes:o(b,G+13),uv_index_bytes:o(b,G+14),material_index_bytes:o(b,G+15),nvertices:f(b,G+16),nnormals:f(b,G+16+4),nuvs:f(b,G+16+8),ntri_flat:f(b,G+16+12),ntri_smooth:f(b,G+16+16),ntri_flat_uv:f(b,G+16+20),ntri_smooth_uv:f(b,
+G+16+24),nquad_flat:f(b,G+16+28),nquad_smooth:f(b,G+16+32),nquad_flat_uv:f(b,G+16+36),nquad_smooth_uv:f(b,G+16+40)};G+=y.header_bytes;B=y.vertex_index_bytes;P=y.vertex_index_bytes*2;L=y.vertex_index_bytes*3;K=y.vertex_index_bytes*3+y.material_index_bytes;E=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes;M=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*2;T=y.vertex_index_bytes;h=y.vertex_index_bytes*2;Q=y.vertex_index_bytes*3;R=y.vertex_index_bytes*4;N=y.vertex_index_bytes*
 4+y.material_index_bytes;aa=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes;U=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*2;V=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*3;ga=y.uv_index_bytes;W=y.uv_index_bytes*2;da=y.uv_index_bytes;ea=y.uv_index_bytes*2;ka=y.uv_index_bytes*3;c=y.vertex_index_bytes*3+y.material_index_bytes;ia=y.vertex_index_bytes*4+y.material_index_bytes;fa=y.ntri_flat*c;I=y.ntri_smooth*(c+y.normal_index_bytes*3);S=
-y.ntri_flat_uv*(c+y.uv_index_bytes*3);Z=y.ntri_smooth_uv*(c+y.normal_index_bytes*3+y.uv_index_bytes*3);$=y.nquad_flat*ia;c=y.nquad_smooth*(ia+y.normal_index_bytes*4);ia=y.nquad_flat_uv*(ia+y.uv_index_bytes*4);G+=function(c){for(var e,f,g,h=y.vertex_coordinate_bytes*3,k=c+y.nvertices*h;c<k;c+=h)e=d(b,c),f=d(b,c+y.vertex_coordinate_bytes),g=d(b,c+y.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,e,f,g);return y.nvertices*h}(G);G+=function(c){for(var d,e,f,g=y.normal_coordinate_bytes*3,h=
-c+y.nnormals*g;c<h;c+=g)d=o(b,c),e=o(b,c+y.normal_coordinate_bytes),f=o(b,c+y.normal_coordinate_bytes*2),D.push(d/127,e/127,f/127);return y.nnormals*g}(G);G+=function(c){for(var e,f,g=y.uv_coordinate_bytes*2,h=c+y.nuvs*g;c<h;c+=g)e=d(b,c),f=d(b,c+y.uv_coordinate_bytes),F.push(e,f);return y.nuvs*g}(G);fa=G+fa;I=fa+I;S=I+S;Z=S+Z;$=Z+$;c=$+c;ia=c+ia;(function(b){var c,d=y.vertex_index_bytes*3+y.material_index_bytes,e=d+y.uv_index_bytes*3,f=b+y.ntri_flat_uv*e;for(c=b;c<f;c+=e)p(c),z(c+d);return f-b})(I);
+y.ntri_flat_uv*(c+y.uv_index_bytes*3);Y=y.ntri_smooth_uv*(c+y.normal_index_bytes*3+y.uv_index_bytes*3);Z=y.nquad_flat*ia;c=y.nquad_smooth*(ia+y.normal_index_bytes*4);ia=y.nquad_flat_uv*(ia+y.uv_index_bytes*4);G+=function(c){for(var e,f,g,h=y.vertex_coordinate_bytes*3,k=c+y.nvertices*h;c<k;c+=h)e=d(b,c),f=d(b,c+y.vertex_coordinate_bytes),g=d(b,c+y.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,e,f,g);return y.nvertices*h}(G);G+=function(c){for(var d,e,f,g=y.normal_coordinate_bytes*3,h=
+c+y.nnormals*g;c<h;c+=g)d=n(b,c),e=n(b,c+y.normal_coordinate_bytes),f=n(b,c+y.normal_coordinate_bytes*2),D.push(d/127,e/127,f/127);return y.nnormals*g}(G);G+=function(c){for(var e,f,g=y.uv_coordinate_bytes*2,h=c+y.nuvs*g;c<h;c+=g)e=d(b,c),f=d(b,c+y.uv_coordinate_bytes),F.push(e,f);return y.nuvs*g}(G);fa=G+fa;I=fa+I;S=I+S;Y=S+Y;Z=Y+Z;c=Z+c;ia=c+ia;(function(b){var c,d=y.vertex_index_bytes*3+y.material_index_bytes,e=d+y.uv_index_bytes*3,f=b+y.ntri_flat_uv*e;for(c=b;c<f;c+=e)p(c),z(c+d);return f-b})(I);
 (function(b){var c,d=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,e=d+y.uv_index_bytes*3,f=b+y.ntri_smooth_uv*e;for(c=b;c<f;c+=e)t(c),z(c+d);return f-b})(S);(function(b){var c,d=y.vertex_index_bytes*4+y.material_index_bytes,e=d+y.uv_index_bytes*4,f=b+y.nquad_flat_uv*e;for(c=b;c<f;c+=e)u(c),A(c+d);return f-b})(c);(function(b){var c,d=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*4,e=d+y.uv_index_bytes*4,f=b+y.nquad_smooth_uv*e;for(c=b;c<f;c+=e)v(c),A(c+
-d);return f-b})(ia);(function(b){var c,d=y.vertex_index_bytes*3+y.material_index_bytes,e=b+y.ntri_flat*d;for(c=b;c<e;c+=d)p(c);return e-b})(G);(function(b){var c,d=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,e=b+y.ntri_smooth*d;for(c=b;c<e;c+=d)t(c);return e-b})(fa);(function(b){var c,d=y.vertex_index_bytes*4+y.material_index_bytes,e=b+y.nquad_flat*d;for(c=b;c<e;c+=d)u(c);return e-b})(Z);(function(b){var c,d=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*
-4,e=b+y.nquad_smooth*d;for(c=b;c<e;c+=d)v(c);return e-b})($);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},v:function(b,c,d,e){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(b,c,d,e,f){b.faces.push(new THREE.Face3(c,d,e,null,null,b.materials[f]))},f4:function(b,c,d,e,f,g){b.faces.push(new THREE.Face4(c,d,e,f,null,null,b.materials[g]))},f3n:function(b,c,d,e,f,g,j,k,m){var g=b.materials[g],o=c[k*3],
-n=c[k*3+1],k=c[k*3+2],p=c[m*3],t=c[m*3+1],m=c[m*3+2];b.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(p,t,m)],null,g))},f4n:function(b,c,d,e,f,g,j,k,m,o,n){var j=b.materials[j],p=c[m*3],t=c[m*3+1],m=c[m*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2],z=c[n*3],A=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(d,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(p,t,m),new THREE.Vector3(u,v,o),new THREE.Vector3(z,A,n)],
-null,j))},uv3:function(b,c,d,e,f,g,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,j));b.push(k)},uv4:function(b,c,d,e,f,g,j,k,m){var o=[];o.push(new THREE.UV(c,d));o.push(new THREE.UV(e,f));o.push(new THREE.UV(g,j));o.push(new THREE.UV(k,m));b.push(o)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var d=this,e=new Worker(b);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(b);e.onmessage=function(b){function e(b,c){return c=="relativeToHTML"?b:f+"/"+b}function k(){for(u in E.objects)if(!N.objects[u])if(G=E.objects[u],G.geometry!==void 0){if(B=N.geometries[G.geometry]){L=[];for(V=0;V<G.materials.length;V++)L[V]=N.materials[G.materials[V]];y=G.position;r=G.rotation;q=G.quaternion;s=G.scale;q=0;L.length==0&&(L[0]=new THREE.MeshFaceMaterial);
-L.length>1&&(L=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,L);object.name=u;object.position.set(y[0],y[1],y[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;N.scene.addObject(object);N.objects[u]=object;if(G.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);N.scene.collisions.colliders.push(b)}if(G.castsShadow)b=new THREE.ShadowVolume(B),N.scene.addChild(b),
+d);return f-b})(ia);(function(b){var c,d=y.vertex_index_bytes*3+y.material_index_bytes,e=b+y.ntri_flat*d;for(c=b;c<e;c+=d)p(c);return e-b})(G);(function(b){var c,d=y.vertex_index_bytes*3+y.material_index_bytes+y.normal_index_bytes*3,e=b+y.ntri_smooth*d;for(c=b;c<e;c+=d)t(c);return e-b})(fa);(function(b){var c,d=y.vertex_index_bytes*4+y.material_index_bytes,e=b+y.nquad_flat*d;for(c=b;c<e;c+=d)u(c);return e-b})(Y);(function(b){var c,d=y.vertex_index_bytes*4+y.material_index_bytes+y.normal_index_bytes*
+4,e=b+y.nquad_smooth*d;for(c=b;c<e;c+=d)v(c);return e-b})(Z);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},v:function(b,c,d,e){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(b,c,d,e,f){b.faces.push(new THREE.Face3(c,d,e,null,null,b.materials[f]))},f4:function(b,c,d,e,f,g){b.faces.push(new THREE.Face4(c,d,e,f,null,null,b.materials[g]))},f3n:function(b,c,d,e,f,g,j,k,m){var g=b.materials[g],n=c[k*3],
+o=c[k*3+1],k=c[k*3+2],p=c[m*3],t=c[m*3+1],m=c[m*3+2];b.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,t,m)],null,g))},f4n:function(b,c,d,e,f,g,j,k,m,n,o){var j=b.materials[j],p=c[m*3],t=c[m*3+1],m=c[m*3+2],u=c[n*3],v=c[n*3+1],n=c[n*3+2],z=c[o*3],A=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(d,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(p,t,m),new THREE.Vector3(u,v,n),new THREE.Vector3(z,A,o)],
+null,j))},uv3:function(b,c,d,e,f,g,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,j));b.push(k)},uv4:function(b,c,d,e,f,g,j,k,m){var n=[];n.push(new THREE.UV(c,d));n.push(new THREE.UV(e,f));n.push(new THREE.UV(g,j));n.push(new THREE.UV(k,m));b.push(n)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(b,c){var d=this,e=new Worker(b);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(b);e.onmessage=function(b){function e(b,c){return c=="relativeToHTML"?b:f+"/"+b}function k(){for(u in E.objects)if(!N.objects[u])if(G=E.objects[u],G.geometry!==void 0){if(B=N.geometries[G.geometry]){K=[];for(V=0;V<G.materials.length;V++)K[V]=N.materials[G.materials[V]];y=G.position;r=G.rotation;q=G.quaternion;s=G.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);
+K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,K);object.name=u;object.position.set(y[0],y[1],y[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;N.scene.addObject(object);N.objects[u]=object;if(G.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);N.scene.collisions.colliders.push(b)}if(G.castsShadow)b=new THREE.ShadowVolume(B),N.scene.addChild(b),
 b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}}else y=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(y[0],y[1],y[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,N.scene.addObject(object),
-N.objects[u]=object,N.empties[u]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}function m(b){return function(c){N.geometries[b]=c;k();T-=1;d.onLoadComplete();n()}}function o(b){return function(c){N.geometries[b]=c}}function n(){d.callbackProgress({totalModels:Q,totalTextures:R,loadedModels:Q-T,loadedTextures:R-h},N);d.onLoadProgress();T==0&&h==0&&c(N)}var p,t,u,v,z,A,x,G,y,D,F,B,P,K,L,E,M,T,h,Q,R,N;E=b.data;b=new THREE.BinaryLoader;M=new THREE.JSONLoader;
+N.objects[u]=object,N.empties[u]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},N.triggers[object.name]=b)}function m(b){return function(c){N.geometries[b]=c;k();T-=1;d.onLoadComplete();o()}}function n(b){return function(c){N.geometries[b]=c}}function o(){d.callbackProgress({totalModels:Q,totalTextures:R,loadedModels:Q-T,loadedTextures:R-h},N);d.onLoadProgress();T==0&&h==0&&c(N)}var p,t,u,v,z,A,x,G,y,D,F,B,P,L,K,E,M,T,h,Q,R,N;E=b.data;b=new THREE.BinaryLoader;M=new THREE.JSONLoader;
 h=T=0;N={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var aa=!1;for(u in E.objects)if(G=E.objects[u],G.meshCollider){aa=!0;break}if(aa)N.scene.collisions=new THREE.CollisionSystem;if(E.transform){aa=E.transform.position;D=E.transform.rotation;var U=E.transform.scale;aa&&N.scene.position.set(aa[0],aa[1],aa[2]);D&&N.scene.rotation.set(D[0],D[1],D[2]);U&&N.scene.scale.set(U[0],U[1],U[2]);(aa||D||U)&&N.scene.updateMatrix()}aa=
-function(){h-=1;n();d.onLoadComplete()};for(z in E.cameras){D=E.cameras[z];if(D.type=="perspective")P=new THREE.Camera(D.fov,D.aspect,D.near,D.far);else if(D.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(D.left,D.right,D.top,D.bottom,D.near,D.far);y=D.position;D=D.target;P.position.set(y[0],y[1],y[2]);P.target.position.set(D[0],D[1],D[2]);N.cameras[z]=P}for(v in E.lights){z=E.lights[v];P=z.color!==void 0?z.color:16777215;D=z.intensity!==void 0?z.intensity:1;if(z.type==
-"directional")y=z.direction,light=new THREE.DirectionalLight(P,D),light.position.set(y[0],y[1],y[2]),light.position.normalize();else if(z.type=="point")y=z.position,light=new THREE.PointLight(P,D),light.position.set(y[0],y[1],y[2]);N.scene.addLight(light);N.lights[v]=light}for(A in E.fogs)v=E.fogs[A],v.type=="linear"?K=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(K=new THREE.FogExp2(0,v.density)),D=v.color,K.color.setRGB(D[0],D[1],D[2]),N.fogs[A]=K;if(N.cameras&&E.defaults.camera)N.currentCamera=
+function(){h-=1;o();d.onLoadComplete()};for(z in E.cameras){D=E.cameras[z];if(D.type=="perspective")P=new THREE.Camera(D.fov,D.aspect,D.near,D.far);else if(D.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(D.left,D.right,D.top,D.bottom,D.near,D.far);y=D.position;D=D.target;P.position.set(y[0],y[1],y[2]);P.target.position.set(D[0],D[1],D[2]);N.cameras[z]=P}for(v in E.lights){z=E.lights[v];P=z.color!==void 0?z.color:16777215;D=z.intensity!==void 0?z.intensity:1;if(z.type==
+"directional")y=z.direction,light=new THREE.DirectionalLight(P,D),light.position.set(y[0],y[1],y[2]),light.position.normalize();else if(z.type=="point")y=z.position,light=new THREE.PointLight(P,D),light.position.set(y[0],y[1],y[2]);N.scene.addLight(light);N.lights[v]=light}for(A in E.fogs)v=E.fogs[A],v.type=="linear"?L=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(L=new THREE.FogExp2(0,v.density)),D=v.color,L.color.setRGB(D[0],D[1],D[2]),N.fogs[A]=L;if(N.cameras&&E.defaults.camera)N.currentCamera=
 N.cameras[E.defaults.camera];if(N.fogs&&E.defaults.fog)N.scene.fog=N.fogs[E.defaults.fog];D=E.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(D[0],D[1],D[2]);N.bgColorAlpha=E.defaults.bgalpha;for(p in E.geometries)if(A=E.geometries[p],A.type=="bin_mesh"||A.type=="ascii_mesh")T+=1,d.onLoadStart();Q=T;for(p in E.geometries)A=E.geometries[p],A.type=="cube"?(B=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),N.geometries[p]=
 B):A.type=="plane"?(B=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),N.geometries[p]=B):A.type=="sphere"?(B=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),N.geometries[p]=B):A.type=="cylinder"?(B=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),N.geometries[p]=B):A.type=="torus"?(B=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),N.geometries[p]=B):A.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(A.subdivisions),
-N.geometries[p]=B):A.type=="bin_mesh"?b.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="ascii_mesh"?M.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="embedded_mesh"&&(A=E.embeds[A.id])&&M.createModel(A,o(p),"");for(x in E.textures)if(p=E.textures[x],p.url instanceof Array){h+=p.url.length;for(b=0;b<p.url.length;b++)d.onLoadStart()}else h+=1,d.onLoadStart();R=h;for(x in E.textures){p=E.textures[x];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];
+N.geometries[p]=B):A.type=="bin_mesh"?b.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="ascii_mesh"?M.load({model:e(A.url,E.urlBaseType),callback:m(p)}):A.type=="embedded_mesh"&&(A=E.embeds[A.id])&&M.createModel(A,n(p),"");for(x in E.textures)if(p=E.textures[x],p.url instanceof Array){h+=p.url.length;for(b=0;b<p.url.length;b++)d.onLoadStart()}else h+=1,d.onLoadStart();R=h;for(x in E.textures){p=E.textures[x];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];
 if(p.url instanceof Array){for(var b=[],V=0;V<p.url.length;V++)b[V]=e(p.url[V],E.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,p.mapping,aa)}else{b=THREE.ImageUtils.loadTexture(e(p.url,E.urlBaseType),p.mapping,aa);if(THREE[p.minFilter]!=void 0)b.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)b.magFilter=THREE[p.magFilter];if(p.repeat)b.repeat.set(p.repeat[0],p.repeat[1]),b.wrapS=b.wrapT=THREE.RepeatWrapping}N.textures[x]=b}for(t in E.materials){x=E.materials[t];for(F in x.parameters)if(F==
 "envMap"||F=="map"||F=="lightMap")x.parameters[F]=N.textures[x.parameters[F]];else if(F=="shading")x.parameters[F]=x.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")x.parameters[F]=THREE[x.parameters[F]]?THREE[x.parameters[F]]:THREE.NormalBlending;else if(F=="combine")x.parameters[F]=x.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(x.parameters[F]=="face")x.parameters[F]=THREE.FaceColors;else if(x.parameters[F])x.parameters[F]=
 THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=!0;x=new THREE[x.type](x.parameters);N.materials[t]=x}k();d.callbackSync(N)}}};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,f){return b+(c-b)*f};this.VIntX=function(b,c,f,g,j,k,m,o,n,p){j=(j-n)/(p-n);n=this.normal_cache;c[g]=k+j*this.delta;c[g+1]=m;c[g+2]=o;f[g]=this.lerp(n[b],n[b+3],j);f[g+1]=this.lerp(n[b+1],n[b+4],j);f[g+2]=this.lerp(n[b+2],n[b+5],j)};this.VIntY=function(b,c,f,g,j,k,m,o,n,p){j=(j-n)/(p-n);n=this.normal_cache;c[g]=k;c[g+1]=m+j*this.delta;c[g+
-2]=o;c=b+this.yd*3;f[g]=this.lerp(n[b],n[c],j);f[g+1]=this.lerp(n[b+1],n[c+1],j);f[g+2]=this.lerp(n[b+2],n[c+2],j)};this.VIntZ=function(b,c,f,g,j,k,m,o,n,p){j=(j-n)/(p-n);n=this.normal_cache;c[g]=k;c[g+1]=m;c[g+2]=o+j*this.delta;c=b+this.zd*3;f[g]=this.lerp(n[b],n[c],j);f[g+1]=this.lerp(n[b+1],n[c+1],j);f[g+2]=this.lerp(n[b+2],n[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,f,g,j,k){var m=g+1,o=g+this.yd,n=g+this.zd,p=m+this.yd,t=m+this.zd,u=g+this.yd+this.zd,v=m+this.yd+this.zd,z=0,A=this.field[g],x=this.field[m],G=this.field[o],y=this.field[p],D=this.field[n],F=this.field[t],B=this.field[u],P=this.field[v];A<j&&(z|=1);x<j&&(z|=2);G<j&&(z|=8);y<j&&(z|=4);D<j&&(z|=16);F<j&&(z|=32);B<j&&(z|=128);P<j&&(z|=64);var K=THREE.edgeTable[z];if(K==0)return 0;var L=this.delta,
-E=b+L,M=c+L,L=f+L;K&1&&(this.compNorm(g),this.compNorm(m),this.VIntX(g*3,this.vlist,this.nlist,0,j,b,c,f,A,x));K&2&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,3,j,E,c,f,x,y));K&4&&(this.compNorm(o),this.compNorm(p),this.VIntX(o*3,this.vlist,this.nlist,6,j,b,M,f,G,y));K&8&&(this.compNorm(g),this.compNorm(o),this.VIntY(g*3,this.vlist,this.nlist,9,j,b,c,f,A,G));K&16&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,12,j,b,c,L,D,F));K&32&&(this.compNorm(t),
-this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,j,E,c,L,F,P));K&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,M,L,B,P));K&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,j,b,c,L,D,B));K&256&&(this.compNorm(g),this.compNorm(n),this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,c,f,A,D));K&512&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,27,j,E,c,f,x,F));K&1024&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*
-3,this.vlist,this.nlist,30,j,E,M,f,y,P));K&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,M,f,G,B));z<<=4;for(j=g=0;THREE.triTable[z+j]!=-1;)b=z+j,c=b+1,f=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[f],k),j+=3,g++;return g};this.posnormtriv=function(b,c,f,g,j,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[g];this.positionArray[m+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,f){return b+(c-b)*f};this.VIntX=function(b,c,f,g,j,k,m,n,o,p){j=(j-o)/(p-o);o=this.normal_cache;c[g]=k+j*this.delta;c[g+1]=m;c[g+2]=n;f[g]=this.lerp(o[b],o[b+3],j);f[g+1]=this.lerp(o[b+1],o[b+4],j);f[g+2]=this.lerp(o[b+2],o[b+5],j)};this.VIntY=function(b,c,f,g,j,k,m,n,o,p){j=(j-o)/(p-o);o=this.normal_cache;c[g]=k;c[g+1]=m+j*this.delta;c[g+
+2]=n;c=b+this.yd*3;f[g]=this.lerp(o[b],o[c],j);f[g+1]=this.lerp(o[b+1],o[c+1],j);f[g+2]=this.lerp(o[b+2],o[c+2],j)};this.VIntZ=function(b,c,f,g,j,k,m,n,o,p){j=(j-o)/(p-o);o=this.normal_cache;c[g]=k;c[g+1]=m;c[g+2]=n+j*this.delta;c=b+this.zd*3;f[g]=this.lerp(o[b],o[c],j);f[g+1]=this.lerp(o[b+1],o[c+1],j);f[g+2]=this.lerp(o[b+2],o[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,f,g,j,k){var m=g+1,n=g+this.yd,o=g+this.zd,p=m+this.yd,t=m+this.zd,u=g+this.yd+this.zd,v=m+this.yd+this.zd,z=0,A=this.field[g],x=this.field[m],G=this.field[n],y=this.field[p],D=this.field[o],F=this.field[t],B=this.field[u],P=this.field[v];A<j&&(z|=1);x<j&&(z|=2);G<j&&(z|=8);y<j&&(z|=4);D<j&&(z|=16);F<j&&(z|=32);B<j&&(z|=128);P<j&&(z|=64);var L=THREE.edgeTable[z];if(L==0)return 0;var K=this.delta,
+E=b+K,M=c+K,K=f+K;L&1&&(this.compNorm(g),this.compNorm(m),this.VIntX(g*3,this.vlist,this.nlist,0,j,b,c,f,A,x));L&2&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,3,j,E,c,f,x,y));L&4&&(this.compNorm(n),this.compNorm(p),this.VIntX(n*3,this.vlist,this.nlist,6,j,b,M,f,G,y));L&8&&(this.compNorm(g),this.compNorm(n),this.VIntY(g*3,this.vlist,this.nlist,9,j,b,c,f,A,G));L&16&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,12,j,b,c,K,D,F));L&32&&(this.compNorm(t),
+this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,15,j,E,c,K,F,P));L&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,M,K,B,P));L&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,j,b,c,K,D,B));L&256&&(this.compNorm(g),this.compNorm(o),this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,c,f,A,D));L&512&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,27,j,E,c,f,x,F));L&1024&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*
+3,this.vlist,this.nlist,30,j,E,M,f,y,P));L&2048&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,33,j,b,M,f,G,B));z<<=4;for(j=g=0;THREE.triTable[z+j]!=-1;)b=z+j,c=b+1,f=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[f],k),j+=3,g++;return g};this.posnormtriv=function(b,c,f,g,j,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+3]=b[g];this.positionArray[m+
 4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[j];this.positionArray[m+7]=b[j+1];this.positionArray[m+8]=b[j+2];this.normalArray[m]=c[f];this.normalArray[m+1]=c[f+1];this.normalArray[m+2]=c[f+2];this.normalArray[m+3]=c[g];this.normalArray[m+4]=c[g+1];this.normalArray[m+5]=c[g+2];this.normalArray[m+6]=c[j];this.normalArray[m+7]=c[j+1];this.normalArray[m+8]=c[j+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,f,g,j){var k=this.size*Math.sqrt(g/j),m=f*this.size,o=c*this.size,n=b*this.size,p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
-1);for(var v,z,A,x,G,y;p<m;p++){n=this.size2*p;z=p/this.size-f;G=z*z;for(z=t;z<o;z++){A=n+this.size*z;v=z/this.size-c;y=v*v;for(v=u;v<k;v++)x=v/this.size-b,x=g/(1.0E-6+x*x+y+G)-j,x>0&&(this.field[A+v]+=x)}}};this.addPlaneX=function(b,c){var f,g,j,k,m,o=this.size,n=this.yd,p=this.zd,t=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(f=0;f<u;f++)if(g=f/o,g*=g,k=b/(1.0E-4+g)-c,k>0)for(g=0;g<o;g++){m=f+g*n;for(j=0;j<o;j++)t[p*j+m]+=k}};this.addPlaneY=function(b,c){var f,g,j,k,m,o,n=this.size,p=this.yd,t=
-this.zd,u=this.field,v=n*Math.sqrt(b/c);v>n&&(v=n);for(g=0;g<v;g++)if(f=g/n,f*=f,k=b/(1.0E-4+f)-c,k>0){m=g*p;for(f=0;f<n;f++){o=m+f;for(j=0;j<n;j++)u[t*j+o]+=k}}};this.addPlaneZ=function(b,c){var f,g,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(f=j/size,f*=f,k=b/(1.0E-4+f)-c,k>0){m=zd*j;for(g=0;g<size;g++){o=m+g*yd;for(f=0;f<size;f++)field[o+f]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,f,g,j,k,m,o,n,p,t=this.size-2;for(j=1;j<t;j++){p=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(g=1;g<t;g++){n=p+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,m,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,f=[];this.render(function(g){var j,k,m,o,n,p,t,u;for(j=0;j<g.count;j++)t=j*3,n=t+1,u=t+2,k=g.positionArray[t],
-m=g.positionArray[n],o=g.positionArray[u],p=new THREE.Vector3(k,m,o),k=g.normalArray[t],m=g.normalArray[n],o=g.normalArray[u],t=new THREE.Vector3(k,m,o),t.normalize(),n=new THREE.Vertex(p),c.vertices.push(n),f.push(t);nfaces=g.count/3;for(j=0;j<nfaces;j++)t=(b+j)*3,n=t+1,u=t+2,p=f[t],k=f[n],m=f[u],t=new THREE.Face3(t,n,u,[p,k,m]),c.faces.push(t);b+=nfaces;g.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,f,g,j){var k=this.size*Math.sqrt(g/j),m=f*this.size,n=c*this.size,o=b*this.size,p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(n-k);t<1&&(t=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var u=Math.floor(o-k);u<1&&(u=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-
+1);for(var v,z,A,x,G,y;p<m;p++){o=this.size2*p;z=p/this.size-f;G=z*z;for(z=t;z<n;z++){A=o+this.size*z;v=z/this.size-c;y=v*v;for(v=u;v<k;v++)x=v/this.size-b,x=g/(1.0E-6+x*x+y+G)-j,x>0&&(this.field[A+v]+=x)}}};this.addPlaneX=function(b,c){var f,g,j,k,m,n=this.size,o=this.yd,p=this.zd,t=this.field,u=n*Math.sqrt(b/c);u>n&&(u=n);for(f=0;f<u;f++)if(g=f/n,g*=g,k=b/(1.0E-4+g)-c,k>0)for(g=0;g<n;g++){m=f+g*o;for(j=0;j<n;j++)t[p*j+m]+=k}};this.addPlaneY=function(b,c){var f,g,j,k,m,n,o=this.size,p=this.yd,t=
+this.zd,u=this.field,v=o*Math.sqrt(b/c);v>o&&(v=o);for(g=0;g<v;g++)if(f=g/o,f*=f,k=b/(1.0E-4+f)-c,k>0){m=g*p;for(f=0;f<o;f++){n=m+f;for(j=0;j<o;j++)u[t*j+n]+=k}}};this.addPlaneZ=function(b,c){var f,g,j,k,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(f=j/size,f*=f,k=b/(1.0E-4+f)-c,k>0){m=zd*j;for(g=0;g<size;g++){n=m+g*yd;for(f=0;f<size;f++)field[n+f]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,f,g,j,k,m,n,o,p,t=this.size-2;for(j=1;j<t;j++){p=this.size2*j;n=(j-this.halfsize)/this.halfsize;for(g=1;g<t;g++){o=p+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<t;f++)k=(f-this.halfsize)/this.halfsize,c=o+f,this.polygonize(k,m,n,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,f=[];this.render(function(g){var j,k,m,n,o,p,t,u;for(j=0;j<g.count;j++)t=j*3,o=t+1,u=t+2,k=g.positionArray[t],
+m=g.positionArray[o],n=g.positionArray[u],p=new THREE.Vector3(k,m,n),k=g.normalArray[t],m=g.normalArray[o],n=g.normalArray[u],t=new THREE.Vector3(k,m,n),t.normalize(),o=new THREE.Vertex(p),c.vertices.push(o),f.push(t);nfaces=g.count/3;for(j=0;j<nfaces;j++)t=(b+j)*3,o=t+1,u=t+2,p=f[t],k=f[o],m=f[u],t=new THREE.Face3(t,o,u,[p,k,m]),c.faces.push(t);b+=nfaces;g.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -551,19 +552,19 @@ THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,d,e,f,g=0;c=0;for(d=this.colliders.length;c<d;c++)if(f=this.colliders[c],e=this.rayCast(b,f),e<Number.MAX_VALUE)f.distance=e,e>g?this.hits.push(f):this.hits.unshift(f),g=e;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var d=0;c[d]instanceof THREE.MeshCollider;){var e=this.rayMesh(b,c[d]);if(e.dist<Number.MAX_VALUE){c[d].distance=e.dist;c[d].faceIndex=e.faceIndex;break}d++}if(d>c.length)return null;return c[d]};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),e=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var j=c.mesh.geometry.faces[g],k=c.mesh.geometry.vertices[j.a].position,m=c.mesh.geometry.vertices[j.b].position,o=c.mesh.geometry.vertices[j.c].position,n=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(d,k,m,o,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-j instanceof THREE.Face4&&(j=this.rayTriangle(d,k,m,n,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(d,m,o,n,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:f}};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),e=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var j=c.mesh.geometry.faces[g],k=c.mesh.geometry.vertices[j.a].position,m=c.mesh.geometry.vertices[j.b].position,n=c.mesh.geometry.vertices[j.c].position,o=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(d,k,m,n,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+j instanceof THREE.Face4&&(j=this.rayTriangle(d,k,m,o,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(d,m,n,o,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:f}};
 THREE.CollisionSystem.prototype.rayTriangle=function(b,c,d,e,f,g){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;g.set(0,0,0);j.sub(d,c);k.sub(e,d);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*f))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);Math.abs(g.x)>Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(b=k.y-c.y,g=d.y-c.y,
 f=e.y-c.y,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y):Math.abs(g.y)>Math.abs(g.z)?(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y);c=g*e-d*f;if(c==0)return Number.MAX_VALUE;c=1/c;e=(b*e-k*f)*c;if(!(e>=0))return Number.MAX_VALUE;c*=g*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return j};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,d);var e=THREE.CollisionSystem.__r;e.origin.copy(b.origin);e.direction.copy(b.direction);d.multiplyVector3(e.origin);d.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;c.dynamic&&c.mesh&&c.mesh.matrixWorld?d=this.makeRayLocal(b,c.mesh):(d=THREE.CollisionSystem.__r,d.origin.copy(b.origin),d.direction.copy(b.direction));var e=0,f=0,g=0,j=0,k=0,m=0,o=!0;d.origin.x<c.min.x?(e=c.min.x-d.origin.x,e/=d.direction.x,o=!1,j=-1):d.origin.x>c.max.x&&(e=c.max.x-d.origin.x,e/=d.direction.x,o=!1,j=1);d.origin.y<c.min.y?(f=c.min.y-d.origin.y,f/=d.direction.y,o=!1,k=-1):d.origin.y>c.max.y&&(f=c.max.y-d.origin.y,f/=d.direction.y,
-o=!1,k=1);d.origin.z<c.min.z?(g=c.min.z-d.origin.z,g/=d.direction.z,o=!1,m=-1):d.origin.z>c.max.z&&(g=c.max.z-d.origin.z,g/=d.direction.z,o=!1,m=1);if(o)return-1;o=0;f>e&&(o=1,e=f);g>e&&(o=2,e=g);switch(o){case 0:k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;c.dynamic&&c.mesh&&c.mesh.matrixWorld?d=this.makeRayLocal(b,c.mesh):(d=THREE.CollisionSystem.__r,d.origin.copy(b.origin),d.direction.copy(b.direction));var e=0,f=0,g=0,j=0,k=0,m=0,n=!0;d.origin.x<c.min.x?(e=c.min.x-d.origin.x,e/=d.direction.x,n=!1,j=-1):d.origin.x>c.max.x&&(e=c.max.x-d.origin.x,e/=d.direction.x,n=!1,j=1);d.origin.y<c.min.y?(f=c.min.y-d.origin.y,f/=d.direction.y,n=!1,k=-1):d.origin.y>c.max.y&&(f=c.max.y-d.origin.y,f/=d.direction.y,
+n=!1,k=1);d.origin.z<c.min.z?(g=c.min.z-d.origin.z,g/=d.direction.z,n=!1,m=-1):d.origin.z>c.max.z&&(g=c.max.z-d.origin.z,g/=d.direction.z,n=!1,m=1);if(n)return-1;n=0;f>e&&(n=1,e=f);g>e&&(n=2,e=g);switch(n){case 0:k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*
 e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,m)}return e};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),e=c.point.dot(c.normal);if(d<0)d=(e-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var e=d.dot(b.direction.clone());if(e<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-e*e);if(d>=0)return Math.abs(e)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,f=new THREE.Camera,g=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},j=new THREE.WebGLRenderTarget(512,512,b),k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.Camera(53,1,1,1E4);m.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:j},mapRight:{type:"t",value:1,
-texture:k}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});var o=
-new THREE.Scene;o.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);j.width=b;j.height=e;k.width=b;k.height=e};this.render=function(b,d){f.projectionMatrix=d.projectionMatrix;f.position.copy(d.position);f.target.position.copy(d.target.position);f.translateX(-10);g.projectionMatrix=d.projectionMatrix;g.position.copy(d.position);g.target.position.copy(d.target.position);g.translateX(10);e.call(c,b,f,j,!0);e.call(c,b,g,k,!0);e.call(c,o,m)}};
+texture:k}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});var n=
+new THREE.Scene;n.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);j.width=b;j.height=e;k.width=b;k.height=e};this.render=function(b,d){f.projectionMatrix=d.projectionMatrix;f.position.copy(d.position);f.target.position.copy(d.target.position);f.translateX(-10);g.projectionMatrix=d.projectionMatrix;g.position.copy(d.position);g.target.position.copy(d.target.position);g.translateX(10);e.call(c,b,f,j,!0);e.call(c,b,g,k,!0);e.call(c,n,m)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,d=this.setSize,e=this.render,f,g,j=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,e){d.call(c,b,e);f=b/2;g=e};this.render=function(b,d){this.clear();j.fov=d.fov;j.aspect=0.5*d.aspect;j.near=d.near;j.far=d.far;
 j.updateProjectionMatrix();j.position.copy(d.position);j.target.position.copy(d.target.position);j.translateX(c.separation);k.projectionMatrix=j.projectionMatrix;k.position.copy(d.position);k.target.position.copy(d.target.position);k.translateX(-c.separation);this.setViewport(0,0,f,g);e.call(c,b,j);this.setViewport(f,0,f,g);e.call(c,b,k,!1)}};

+ 70 - 68
build/custom/ThreeWebGL.js

@@ -15,19 +15,19 @@ b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,d){this.x+=(b.x-this.x)*d;this.y+=(b.y-this.y)*d;this.z+=(b.z-this.z)*d;this.w+=(b.w-this.w)*d;return this}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d<e;d++)f=f.concat(this.intersectObject(b[d]));f.sort(function(b,d){return b.distance-d.distance});return f},intersectObject:function(b){function d(b,d,e){var f;f=e.position.clone().subSelf(b).dot(d);b=b.clone().addSelf(d.clone().multiplyScalar(f));return e.position.distanceTo(b)}function e(b,d,e,f){var f=f.clone().subSelf(d),e=e.clone().subSelf(d),
 h=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(h),g=e.dot(e),e=e.dot(h),h=1/(b*g-d*d),g=(g*f-d*e)*h,b=(b*e-d*f)*h;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,i,g,j,p,k,n,v,r,q,y=b.geometry,
-B=y.vertices,D=[],f=0;for(h=y.faces.length;f<h;f++)if(i=y.faces[f],r=this.origin.clone(),q=this.direction.clone(),k=b.matrixWorld,g=k.multiplyVector3(B[i.a].position.clone()),j=k.multiplyVector3(B[i.b].position.clone()),p=k.multiplyVector3(B[i.c].position.clone()),k=i instanceof THREE.Face4?k.multiplyVector3(B[i.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),v=q.dot(n),b.doubleSided||(b.flipSided?v>0:v<0))if(n=n.dot((new THREE.Vector3).sub(g,r))/v,r=r.addSelf(q.multiplyScalar(n)),
+C=y.vertices,D=[],f=0;for(h=y.faces.length;f<h;f++)if(i=y.faces[f],r=this.origin.clone(),q=this.direction.clone(),k=b.matrixWorld,g=k.multiplyVector3(C[i.a].position.clone()),j=k.multiplyVector3(C[i.b].position.clone()),p=k.multiplyVector3(C[i.c].position.clone()),k=i instanceof THREE.Face4?k.multiplyVector3(C[i.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),v=q.dot(n),b.doubleSided||(b.flipSided?v>0:v<0))if(n=n.dot((new THREE.Vector3).sub(g,r))/v,r=r.addSelf(q.multiplyScalar(n)),
 i instanceof THREE.Face3)e(r,g,j,p)&&(i={distance:this.origin.distanceTo(r),point:r,face:i,object:b},D.push(i));else if(i instanceof THREE.Face4&&(e(r,g,j,k)||e(r,j,p,k)))i={distance:this.origin.distanceTo(r),point:r,face:i,object:b},D.push(i);return D}else return[]}};
 THREE.Rectangle=function(){function b(){i=f-d;g=h-e}var d,e,f,h,i,g,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return g};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,i,n,v){j=!1;d=g;e=i;f=n;h=v;b()};this.addPoint=function(g,i){j?(j=!1,d=g,e=i,f=g,h=i):(d=d<g?d:g,e=e<i?e:i,f=f>g?f:g,h=h>i?h:i);b()};this.add3Points=
 function(g,i,n,v,r,q){j?(j=!1,d=g<n?g<r?g:r:n<r?n:r,e=i<v?i<q?i:q:v<q?v:q,f=g>n?g>r?g:r:n>r?n:r,h=i>v?i>q?i:q:v>q?v:q):(d=g<n?g<r?g<d?g:d:r<d?r:d:n<r?n<d?n:d:r<d?r:d,e=i<v?i<q?i<e?i:e:q<e?q:e:v<q?v<e?v:e:q<e?q:e,f=g>n?g>r?g>f?g:f:r>f?r:f:n>r?n>f?n:f:r>f?r:f,h=i>v?i>q?i>h?i:h:q>h?q:h:v>q?v>h?v:h:q>h?q:h);b()};this.addRectangle=function(g){j?(j=!1,d=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(d=d<g.getLeft()?d:g.getLeft(),e=e<g.getTop()?e:g.getTop(),f=f>g.getRight()?f:g.getRight(),h=h>
 g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){d-=g;e-=g;f+=g;h+=g;b()};this.minSelf=function(g){d=d>g.getLeft()?d:g.getLeft();e=e>g.getTop()?e:g.getTop();f=f<g.getRight()?f:g.getRight();h=h<g.getBottom()?h:g.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;h=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,h,i,g,j,p,k,n,v,r,q,y,B){this.set(b||1,d||0,e||0,f||0,h||0,i||1,g||0,j||0,p||0,k||0,n||1,v||0,r||0,q||0,y||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,e,f,h,i,g,j,p,k,n,v,r,q,y,B){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=p;this.n32=k;this.n33=n;this.n34=v;this.n41=r;this.n42=q;this.n43=y;this.n44=B;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
+THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,h,i,g,j,p,k,n,v,r,q,y,C){this.set(b||1,d||0,e||0,f||0,h||0,i||1,g||0,j||0,p||0,k||0,n||1,v||0,r||0,q||0,y||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,e,f,h,i,g,j,p,k,n,v,r,q,y,C){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=p;this.n32=k;this.n33=n;this.n34=v;this.n41=r;this.n42=q;this.n43=y;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
 h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());h.cross(i,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=i.x;this.n21=f.y;this.n22=h.y;this.n23=i.y;this.n31=f.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,h=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*h;b.y=(this.n21*d+this.n22*e+this.n23*
 f+this.n24)*h;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,p=b.n23,k=b.n24,n=b.n31,v=b.n32,r=b.n33,q=b.n34,y=b.n41,B=b.n42,D=b.n43,A=b.n44,O=d.n11,ha=d.n12,T=d.n13,E=d.n14,x=d.n21,ca=d.n22,
-M=d.n23,C=d.n24,Q=d.n31,$=d.n32,aa=d.n33,c=d.n34;this.n11=e*O+f*x+h*Q;this.n12=e*ha+f*ca+h*$;this.n13=e*T+f*M+h*aa;this.n14=e*E+f*C+h*c+i;this.n21=g*O+j*x+p*Q;this.n22=g*ha+j*ca+p*$;this.n23=g*T+j*M+p*aa;this.n24=g*E+j*C+p*c+k;this.n31=n*O+v*x+r*Q;this.n32=n*ha+v*ca+r*$;this.n33=n*T+v*M+r*aa;this.n34=n*E+v*C+r*c+q;this.n41=y*O+B*x+D*Q;this.n42=y*ha+B*ca+D*$;this.n43=y*T+B*M+D*aa;this.n44=y*E+B*C+D*c+A;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,p=b.n23,k=b.n24,n=b.n31,v=b.n32,r=b.n33,q=b.n34,y=b.n41,C=b.n42,D=b.n43,A=b.n44,O=d.n11,ha=d.n12,T=d.n13,L=d.n14,x=d.n21,ca=d.n22,
+M=d.n23,E=d.n24,Q=d.n31,$=d.n32,aa=d.n33,c=d.n34;this.n11=e*O+f*x+h*Q;this.n12=e*ha+f*ca+h*$;this.n13=e*T+f*M+h*aa;this.n14=e*L+f*E+h*c+i;this.n21=g*O+j*x+p*Q;this.n22=g*ha+j*ca+p*$;this.n23=g*T+j*M+p*aa;this.n24=g*L+j*E+p*c+k;this.n31=n*O+v*x+r*Q;this.n32=n*ha+v*ca+r*$;this.n33=n*T+v*M+r*aa;this.n34=n*L+v*E+r*c+q;this.n41=y*O+C*x+D*Q;this.n42=y*ha+C*ca+D*$;this.n43=y*T+C*M+D*aa;this.n44=y*L+C*E+D*c+A;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=
 this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},
-determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,p=this.n31,k=this.n32,n=this.n33,v=this.n34,r=this.n41,q=this.n42,y=this.n43,B=this.n44;return f*g*k*r-e*j*k*r-f*i*n*r+d*j*n*r+e*i*v*r-d*g*v*r-f*g*p*q+e*j*p*q+f*h*n*q-b*j*n*q-e*h*v*q+b*g*v*q+f*i*p*y-d*j*p*y-f*h*k*y+b*j*k*y+d*h*v*y-b*i*v*y-e*i*p*B+d*g*p*B+e*h*k*B-b*g*k*B-d*h*n*B+b*i*n*B},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=
+determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,p=this.n31,k=this.n32,n=this.n33,v=this.n34,r=this.n41,q=this.n42,y=this.n43,C=this.n44;return f*g*k*r-e*j*k*r-f*i*n*r+d*j*n*r+e*i*v*r-d*g*v*r-f*g*p*q+e*j*p*q+f*h*n*q-b*j*n*q-e*h*v*q+b*g*v*q+f*i*p*y-d*j*p*y-f*h*k*y+b*j*k*y+d*h*v*y-b*i*v*y-e*i*p*C+d*g*p*C+e*h*k*C-b*g*k*C-d*h*n*C+b*i*n*C},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=
 b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;
 this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;
 b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},
@@ -36,8 +36,8 @@ b.z,p=h*i,k=h*g;this.set(p*i+e,p*g-f*j,p*j+f*g,0,p*g+f*j,k*g+e,k*j-f*i,0,p*j-f*g
 new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,e=b.y,f=b.z,b=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),g=b*e,j=d*e;this.n11=h*i;this.n12=-h*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*h;this.n31=-g*i+d*f;this.n32=g*f+d*i;this.n33=
 b*h;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,h=b.w,i=d+d,g=e+e,j=f+f,b=d*i,p=d*g;d*=j;var k=e*g;e*=j;f*=j;i*=h;g*=h;h*=j;this.n11=1-(k+f);this.n12=p-h;this.n13=d+g;this.n21=p+h;this.n22=1-(b+f);this.n23=e-i;this.n31=d-g;this.n32=e+i;this.n33=1-(b+k);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,p=b.n23,k=b.n24,n=b.n31,v=b.n32,r=b.n33,q=b.n34,y=b.n41,B=b.n42,D=b.n43,A=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=p*q*B-k*r*B+k*v*D-j*q*D-p*v*A+j*r*A;d.n12=i*r*B-h*q*B-i*v*D+f*q*D+h*v*A-f*r*A;d.n13=h*k*B-i*p*B+i*j*D-f*k*D-h*j*A+f*p*A;d.n14=i*p*v-h*k*v-i*j*r+f*k*r+h*j*q-f*p*q;d.n21=k*r*y-p*q*y-k*n*D+g*q*D+p*n*A-g*r*A;d.n22=h*q*y-i*r*y+i*n*D-e*q*D-h*n*A+e*r*A;d.n23=i*p*y-h*k*y-i*g*D+e*k*D+h*g*A-e*p*A;d.n24=
-h*k*n-i*p*n+i*g*r-e*k*r-h*g*q+e*p*q;d.n31=j*q*y-k*v*y+k*n*B-g*q*B-j*n*A+g*v*A;d.n32=i*v*y-f*q*y-i*n*B+e*q*B+f*n*A-e*v*A;d.n33=h*k*y-i*j*y+i*g*B-e*k*B-f*g*A+e*j*A;d.n34=i*j*n-f*k*n-i*g*v+e*k*v+f*g*q-e*j*q;d.n41=p*v*y-j*r*y-p*n*B+g*r*B+j*n*D-g*v*D;d.n42=f*r*y-h*v*y+h*n*B-e*r*B-f*n*D+e*v*D;d.n43=h*j*y-f*p*y-h*g*B+e*p*B+f*g*D-e*j*D;d.n44=f*p*n-h*j*n+h*g*v-e*p*v-f*g*r+e*j*r;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,p=b.n23,k=b.n24,n=b.n31,v=b.n32,r=b.n33,q=b.n34,y=b.n41,C=b.n42,D=b.n43,A=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=p*q*C-k*r*C+k*v*D-j*q*D-p*v*A+j*r*A;d.n12=i*r*C-h*q*C-i*v*D+f*q*D+h*v*A-f*r*A;d.n13=h*k*C-i*p*C+i*j*D-f*k*D-h*j*A+f*p*A;d.n14=i*p*v-h*k*v-i*j*r+f*k*r+h*j*q-f*p*q;d.n21=k*r*y-p*q*y-k*n*D+g*q*D+p*n*A-g*r*A;d.n22=h*q*y-i*r*y+i*n*D-e*q*D-h*n*A+e*r*A;d.n23=i*p*y-h*k*y-i*g*D+e*k*D+h*g*A-e*p*A;d.n24=
+h*k*n-i*p*n+i*g*r-e*k*r-h*g*q+e*p*q;d.n31=j*q*y-k*v*y+k*n*C-g*q*C-j*n*A+g*v*A;d.n32=i*v*y-f*q*y-i*n*C+e*q*C+f*n*A-e*v*A;d.n33=h*k*y-i*j*y+i*g*C-e*k*C-f*g*A+e*j*A;d.n34=i*j*n-f*k*n-i*g*v+e*k*v+f*g*q-e*j*q;d.n41=p*v*y-j*r*y-p*n*C+g*r*C+j*n*D-g*v*D;d.n42=f*r*y-h*v*y+h*n*C-e*r*C-f*n*D+e*v*D;d.n43=h*j*y-f*p*y-h*g*C+e*p*C+f*g*D-e*j*D;d.n44=f*p*n-h*j*n+h*g*v-e*p*v-f*g*r+e*j*r;d.multiplyScalar(1/b.determinant());return d};
 THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,k=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*k;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*i;e[3]=b*g;e[4]=b*j;e[5]=b*p;e[6]=b*k;e[7]=b*n;e[8]=b*v;return d};
 THREE.Matrix4.makeFrustum=function(b,d,e,f,h,i){var g;g=new THREE.Matrix4;g.n11=2*h/(d-b);g.n12=0;g.n13=(d+b)/(d-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(i+h)/(i-h);g.n34=-2*i*h/(i-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,d,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,f)};
 THREE.Matrix4.makeOrtho=function(b,d,e,f,h,i){var g,j,p,k;g=new THREE.Matrix4;j=d-b;p=e-f;k=i-h;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((d+b)/j);g.n21=0;g.n22=2/p;g.n23=0;g.n24=-((e+f)/p);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((i+h)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -59,9 +59,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.f
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,h,i,g,j=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);d=0;for(e=i.vertexNormals.length;d<e;d++)j.addSelf(i.vertexNormals[d]);j.divideScalar(3)}else d=this.vertices[i.a],e=this.vertices[i.b],g=this.vertices[i.c],j.sub(g.position,e.position),p.sub(d.position,e.position),j.crossSelf(p);j.isZero()||
 j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,d,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,d,e,f,h,i){j=b.vertices[c].position;p=b.vertices[d].position;k=b.vertices[e].position;n=g[f];v=g[h];r=g[i];q=p.x-j.x;y=k.x-j.x;B=p.y-j.y;D=k.y-j.y;A=p.z-j.z;O=k.z-j.z;ha=v.u-n.u;T=r.u-n.u;E=v.v-n.v;x=r.v-n.v;ca=1/(ha*x-T*E);$.set((x*q-E*
-y)*ca,(x*B-E*D)*ca,(x*A-E*O)*ca);aa.set((ha*y-T*q)*ca,(ha*D-T*B)*ca,(ha*O-T*A)*ca);C[c].addSelf($);C[d].addSelf($);C[e].addSelf($);Q[c].addSelf(aa);Q[d].addSelf(aa);Q[e].addSelf(aa)}var d,e,f,h,i,g,j,p,k,n,v,r,q,y,B,D,A,O,ha,T,E,x,ca,M,C=[],Q=[],$=new THREE.Vector3,aa=new THREE.Vector3,c=new THREE.Vector3,ta=new THREE.Vector3,ma=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)C[d]=new THREE.Vector3,Q[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],g=this.faceVertexUvs[0][d],
-i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var Ba=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)ma.copy(i.vertexNormals[f]),h=i[Ba[f]],M=C[h],c.copy(M),c.subSelf(ma.multiplyScalar(ma.dot(M))).normalize(),ta.cross(i.vertexNormals[f],M),h=ta.dot(Q[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(c.x,c.y,c.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,d,e,f,h,i){j=b.vertices[c].position;p=b.vertices[d].position;k=b.vertices[e].position;n=g[f];v=g[h];r=g[i];q=p.x-j.x;y=k.x-j.x;C=p.y-j.y;D=k.y-j.y;A=p.z-j.z;O=k.z-j.z;ha=v.u-n.u;T=r.u-n.u;L=v.v-n.v;x=r.v-n.v;ca=1/(ha*x-T*L);$.set((x*q-L*
+y)*ca,(x*C-L*D)*ca,(x*A-L*O)*ca);aa.set((ha*y-T*q)*ca,(ha*D-T*C)*ca,(ha*O-T*A)*ca);E[c].addSelf($);E[d].addSelf($);E[e].addSelf($);Q[c].addSelf(aa);Q[d].addSelf(aa);Q[e].addSelf(aa)}var d,e,f,h,i,g,j,p,k,n,v,r,q,y,C,D,A,O,ha,T,L,x,ca,M,E=[],Q=[],$=new THREE.Vector3,aa=new THREE.Vector3,c=new THREE.Vector3,ta=new THREE.Vector3,ma=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)E[d]=new THREE.Vector3,Q[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],g=this.faceVertexUvs[0][d],
+i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var Ba=["a","b","c","d"];d=0;for(e=this.faces.length;d<e;d++){i=this.faces[d];for(f=0;f<i.vertexNormals.length;f++)ma.copy(i.vertexNormals[f]),h=i[Ba[f]],M=E[h],c.copy(M),c.subSelf(ma.multiplyScalar(ma.dot(M))).normalize(),ta.cross(i.vertexNormals[f],M),h=ta.dot(Q[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(c.x,c.y,c.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;d<e;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,d=0,e=this.vertices.length;d<e;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function d(b,d,e){b[d]===
 void 0?(b[d]={set:{},array:[]},b[d].set[e]=1,b[d].array.push(e)):b[d].set[e]===void 0&&(b[d].set[e]=1,b[d].array.push(e))}var e,f,h,i,g,j={};e=0;for(f=this.faces.length;e<f;e++)g=this.faces[e],g instanceof THREE.Face3?(h=b(g.a,g.b),d(j,h,e),h=b(g.b,g.c),d(j,h,e),h=b(g.a,g.c),d(j,h,e)):g instanceof THREE.Face4&&(h=b(g.b,g.d),d(j,h,e),h=b(g.a,g.b),d(j,h,e),h=b(g.a,g.d),d(j,h,e),h=b(g.b,g.c),d(j,h,e),h=b(g.c,g.d),d(j,h,e));e=0;for(f=this.edges.length;e<f;e++){g=this.edges[e];h=g.vertexIndices[0];i=g.vertexIndices[1];
@@ -125,12 +125,12 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,h,i,g,j,p,k,n,v,r,q,y=new THREE.Geometry;y.vertices=this.geometry.vertices;f=y.faces=this.geometry.faces;var B=y.egdes=this.geometry.edges,D=y.edgeFaces=[];h=0;var A=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],A.push(h),h+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
-e.normal;b=0;for(d=B.length;b<d;b++)j=B[b],e=j.faces[0],f=j.faces[1],h=j.faceIndices[0],i=j.faceIndices[1],g=j.vertexIndices[0],j=j.vertexIndices[1],e.a===g?(p="a",n=A[h]+0):e.b===g?(p="b",n=A[h]+1):e.c===g?(p="c",n=A[h]+2):e.d===g&&(p="d",n=A[h]+3),e.a===j?(p+="a",v=A[h]+0):e.b===j?(p+="b",v=A[h]+1):e.c===j?(p+="c",v=A[h]+2):e.d===j&&(p+="d",v=A[h]+3),f.a===g?(k="a",r=A[i]+0):f.b===g?(k="b",r=A[i]+1):f.c===g?(k="c",r=A[i]+2):f.d===g&&(k="d",r=A[i]+3),f.a===j?(k+="a",q=A[i]+0):f.b===j?(k+="b",q=A[i]+
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,h,i,g,j,p,k,n,v,r,q,y=new THREE.Geometry;y.vertices=this.geometry.vertices;f=y.faces=this.geometry.faces;var C=y.egdes=this.geometry.edges,D=y.edgeFaces=[];h=0;var A=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],A.push(h),h+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
+e.normal;b=0;for(d=C.length;b<d;b++)j=C[b],e=j.faces[0],f=j.faces[1],h=j.faceIndices[0],i=j.faceIndices[1],g=j.vertexIndices[0],j=j.vertexIndices[1],e.a===g?(p="a",n=A[h]+0):e.b===g?(p="b",n=A[h]+1):e.c===g?(p="c",n=A[h]+2):e.d===g&&(p="d",n=A[h]+3),e.a===j?(p+="a",v=A[h]+0):e.b===j?(p+="b",v=A[h]+1):e.c===j?(p+="c",v=A[h]+2):e.d===j&&(p+="d",v=A[h]+3),f.a===g?(k="a",r=A[i]+0):f.b===g?(k="b",r=A[i]+1):f.c===g?(k="c",r=A[i]+2):f.d===g&&(k="d",r=A[i]+3),f.a===j?(k+="a",q=A[i]+0):f.b===j?(k+="b",q=A[i]+
 1):f.c===j?(k+="c",q=A[i]+2):f.d===j&&(k+="d",q=A[i]+3),p==="ac"||p==="ad"||p==="ca"||p==="da"?n>v&&(e=n,n=v,v=e):n<v&&(e=n,n=v,v=e),k==="ac"||k==="ad"||k==="ca"||k==="da"?r>q&&(e=r,r=q,q=e):r<q&&(e=r,r=q,q=e),e=new THREE.Face4(n,v,r,q),e.normal.set(1,0,0),D.push(e);this.geometry=y}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
 THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,h=b.faces,b=b.vertices,i=h.length,g,j,p,k,n,v=["a","b","c","d"];for(p=0;p<i;p++){j=d.length;g=h[p];g instanceof THREE.Face4?(k=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(k=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(g.normal);e.push(j);
 for(j=0;j<k;j++)n=b[g[v[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<h.length-1;i++){b=e[i];for(g=i+1;g<h.length;g++)j=e[g],j=this.facesShareEdge(d,b,j),j!==void 0&&(j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]),j.normal.set(1,0,0),f.push(j))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,h,i,g,j,p,k,n,v,r,q,y,B,D=0,A=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(y=0;y<f;y++){i=d[A[y]];j=b[i];for(B=0;B<h;B++)if(g=e[A[B]],p=b[g],Math.abs(j.position.x-p.position.x)<1.0E-4&&Math.abs(j.position.y-p.position.y)<1.0E-4&&Math.abs(j.position.z-p.position.z)<1.0E-4&&(D++,D===1&&(k=j,n=p,v=i,r=g,q=A[y]),D===2))return q+=A[y],q==="ad"||q==="ac"?{faces:[d,e],vertices:[k,n,p,j],indices:[v,r,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,h,i,g,j,p,k,n,v,r,q,y,C,D=0,A=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(y=0;y<f;y++){i=d[A[y]];j=b[i];for(C=0;C<h;C++)if(g=e[A[C]],p=b[g],Math.abs(j.position.x-p.position.x)<1.0E-4&&Math.abs(j.position.y-p.position.y)<1.0E-4&&Math.abs(j.position.z-p.position.z)<1.0E-4&&(D++,D===1&&(k=j,n=p,v=i,r=g,q=A[y]),D===2))return q+=A[y],q==="ad"||q==="ac"?{faces:[d,e],vertices:[k,n,p,j],indices:[v,r,
 g,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[k,j,p,n],indices:[v,i,g,r],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
@@ -140,17 +140,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else b instanceof THREE.Sound?(d=this.sounds.indexOf(b),d!==-1&&this.sounds.splice(d,1)):b instanceof THREE.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d:2.5E-4};
-THREE.Projector=function(){function b(){var b=p[j]=p[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var c=0,e=1,f=b.z+b.w,h=d.z+d.w,g=-b.z+b.w,i=-d.z+d.w;return f>=0&&h>=0&&g>=0&&i>=0?!0:f<0&&h<0||g<0&&i<0?!1:(f<0?c=Math.max(c,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),g<0?c=Math.max(c,g/(g-i)):i<0&&(e=Math.min(e,g/(g-i))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var f,h,i=[],g,j,p=[],k,n,v=[],r,q=[],y,B,D=[],A,O,ha=[],T=new THREE.Vector4,E=new THREE.Vector4,
-x=new THREE.Matrix4,ca=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,d){x.multiply(d.projectionMatrix,d.matrixWorldInverse);x.multiplyVector3(b);return b};this.unprojectVector=function(b,d){x.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));x.multiplyVector3(b);return b};this.projectObjects=function(b,e,c){var e=[],g,j,k;h=0;
+THREE.Projector=function(){function b(){var b=p[j]=p[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var c=0,e=1,f=b.z+b.w,h=d.z+d.w,g=-b.z+b.w,i=-d.z+d.w;return f>=0&&h>=0&&g>=0&&i>=0?!0:f<0&&h<0||g<0&&i<0?!1:(f<0?c=Math.max(c,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),g<0?c=Math.max(c,g/(g-i)):i<0&&(e=Math.min(e,g/(g-i))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var f,h,i=[],g,j,p=[],k,n,v=[],r,q=[],y,C,D=[],A,O,ha=[],T=new THREE.Vector4,L=new THREE.Vector4,
+x=new THREE.Matrix4,ca=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,d){x.multiply(d.projectionMatrix,d.matrixWorldInverse);x.multiplyVector3(b);return b};this.unprojectVector=function(b,d){x.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));x.multiplyVector3(b);return b};this.projectObjects=function(b,e,c){var e=[],g,j,k;h=0;
 j=b.objects;b=0;for(g=j.length;b<g;b++){k=j[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var n=k.matrixWorld,r=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),v=0;v<6;v++)if(p=M[v].x*n.n14+M[v].y*n.n24+M[v].z*n.n34+M[v].w,p<=r){p=!1;break a}p=!0}p=!p}if(!p)p=i[h]=i[h]||new THREE.RenderableObject,h++,f=p,T.copy(k.position),x.multiplyVector3(T),f.object=k,f.z=T.z,e.push(f)}c&&e.sort(d);return e};this.projectScene=function(f,h,c){var i=
-[],T=h.near,Ba=h.far,ia,ka,P,R,J,H,S,L,N,F,ja,la,ra,qa,pa,na,sa;O=B=r=n=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);x.multiply(h.projectionMatrix,h.matrixWorldInverse);M[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);M[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);M[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);M[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);M[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);M[5].set(x.n41+x.n31,x.n42+
+[],T=h.near,Ba=h.far,ia,ka,P,R,B,G,S,J,N,F,ja,la,ra,qa,pa,na,sa;O=C=r=n=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);x.multiply(h.projectionMatrix,h.matrixWorldInverse);M[0].set(x.n41-x.n11,x.n42-x.n12,x.n43-x.n13,x.n44-x.n14);M[1].set(x.n41+x.n11,x.n42+x.n12,x.n43+x.n13,x.n44+x.n14);M[2].set(x.n41+x.n21,x.n42+x.n22,x.n43+x.n23,x.n44+x.n24);M[3].set(x.n41-x.n21,x.n42-x.n22,x.n43-x.n23,x.n44-x.n24);M[4].set(x.n41-x.n31,x.n42-x.n32,x.n43-x.n33,x.n44-x.n34);M[5].set(x.n41+x.n31,x.n42+
 x.n32,x.n43+x.n33,x.n44+x.n34);for(ia=0;ia<6;ia++)N=M[ia],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,h,!0);f=0;for(ia=N.length;f<ia;f++)if(F=N[f].object,F.visible)if(ja=F.matrixWorld,la=F.matrixRotationWorld,ra=F.materials,qa=F.overdraw,j=0,F instanceof THREE.Mesh){pa=F.geometry;R=pa.vertices;na=pa.faces;pa=pa.faceVertexUvs;ka=0;for(P=R.length;ka<P;ka++)g=b(),g.positionWorld.copy(R[ka].position),ja.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),
-x.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>T&&g.positionScreen.z<Ba;R=0;for(ka=na.length;R<ka;R++){P=na[R];if(P instanceof THREE.Face3)if(J=p[P.a],H=p[P.b],S=p[P.c],J.visible&&H.visible&&S.visible&&(F.doubleSided||F.flipSided!=(S.positionScreen.x-J.positionScreen.x)*(H.positionScreen.y-J.positionScreen.y)-(S.positionScreen.y-J.positionScreen.y)*(H.positionScreen.x-J.positionScreen.x)<0))L=v[n]=v[n]||
-new THREE.RenderableFace3,n++,k=L,k.v1.copy(J),k.v2.copy(H),k.v3.copy(S);else continue;else if(P instanceof THREE.Face4)if(J=p[P.a],H=p[P.b],S=p[P.c],L=p[P.d],J.visible&&H.visible&&S.visible&&L.visible&&(F.doubleSided||F.flipSided!=((L.positionScreen.x-J.positionScreen.x)*(H.positionScreen.y-J.positionScreen.y)-(L.positionScreen.y-J.positionScreen.y)*(H.positionScreen.x-J.positionScreen.x)<0||(H.positionScreen.x-S.positionScreen.x)*(L.positionScreen.y-S.positionScreen.y)-(H.positionScreen.y-S.positionScreen.y)*
-(L.positionScreen.x-S.positionScreen.x)<0)))sa=q[r]=q[r]||new THREE.RenderableFace4,r++,k=sa,k.v1.copy(J),k.v2.copy(H),k.v3.copy(S),k.v4.copy(L);else continue;k.normalWorld.copy(P.normal);la.multiplyVector3(k.normalWorld);k.centroidWorld.copy(P.centroid);ja.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);x.multiplyVector3(k.centroidScreen);S=P.vertexNormals;J=0;for(H=S.length;J<H;J++)L=k.vertexNormalsWorld[J],L.copy(S[J]),la.multiplyVector3(L);J=0;for(H=pa.length;J<H;J++)if(sa=
-pa[J][R]){S=0;for(L=sa.length;S<L;S++)k.uvs[J][S]=sa[S]}k.meshMaterials=ra;k.faceMaterials=P.materials;k.overdraw=qa;k.z=k.centroidScreen.z;i.push(k)}}else if(F instanceof THREE.Line){ca.multiply(x,ja);R=F.geometry.vertices;J=b();J.positionScreen.copy(R[0].position);ca.multiplyVector4(J.positionScreen);ka=1;for(P=R.length;ka<P;ka++)if(J=b(),J.positionScreen.copy(R[ka].position),ca.multiplyVector4(J.positionScreen),H=p[j-2],C.copy(J.positionScreen),Q.copy(H.positionScreen),e(C,Q))C.multiplyScalar(1/
-C.w),Q.multiplyScalar(1/Q.w),ja=D[B]=D[B]||new THREE.RenderableLine,B++,y=ja,y.v1.positionScreen.copy(C),y.v2.positionScreen.copy(Q),y.z=Math.max(C.z,Q.z),y.materials=F.materials,i.push(y)}else if(F instanceof THREE.Particle&&(E.set(F.matrixWorld.n14,F.matrixWorld.n24,F.matrixWorld.n34,1),x.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))ja=ha[O]=ha[O]||new THREE.RenderableParticle,O++,A=ja,A.x=E.x/E.w,A.y=E.y/E.w,A.z=E.z,A.rotation=F.rotation.z,A.scale.x=F.scale.x*Math.abs(A.x-(E.x+h.projectionMatrix.n11)/
-(E.w+h.projectionMatrix.n14)),A.scale.y=F.scale.y*Math.abs(A.y-(E.y+h.projectionMatrix.n22)/(E.w+h.projectionMatrix.n24)),A.materials=F.materials,i.push(A);c&&i.sort(d);return i}};
+x.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>T&&g.positionScreen.z<Ba;R=0;for(ka=na.length;R<ka;R++){P=na[R];if(P instanceof THREE.Face3)if(B=p[P.a],G=p[P.b],S=p[P.c],B.visible&&G.visible&&S.visible&&(F.doubleSided||F.flipSided!=(S.positionScreen.x-B.positionScreen.x)*(G.positionScreen.y-B.positionScreen.y)-(S.positionScreen.y-B.positionScreen.y)*(G.positionScreen.x-B.positionScreen.x)<0))J=v[n]=v[n]||
+new THREE.RenderableFace3,n++,k=J,k.v1.copy(B),k.v2.copy(G),k.v3.copy(S);else continue;else if(P instanceof THREE.Face4)if(B=p[P.a],G=p[P.b],S=p[P.c],J=p[P.d],B.visible&&G.visible&&S.visible&&J.visible&&(F.doubleSided||F.flipSided!=((J.positionScreen.x-B.positionScreen.x)*(G.positionScreen.y-B.positionScreen.y)-(J.positionScreen.y-B.positionScreen.y)*(G.positionScreen.x-B.positionScreen.x)<0||(G.positionScreen.x-S.positionScreen.x)*(J.positionScreen.y-S.positionScreen.y)-(G.positionScreen.y-S.positionScreen.y)*
+(J.positionScreen.x-S.positionScreen.x)<0)))sa=q[r]=q[r]||new THREE.RenderableFace4,r++,k=sa,k.v1.copy(B),k.v2.copy(G),k.v3.copy(S),k.v4.copy(J);else continue;k.normalWorld.copy(P.normal);la.multiplyVector3(k.normalWorld);k.centroidWorld.copy(P.centroid);ja.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);x.multiplyVector3(k.centroidScreen);S=P.vertexNormals;B=0;for(G=S.length;B<G;B++)J=k.vertexNormalsWorld[B],J.copy(S[B]),la.multiplyVector3(J);B=0;for(G=pa.length;B<G;B++)if(sa=
+pa[B][R]){S=0;for(J=sa.length;S<J;S++)k.uvs[B][S]=sa[S]}k.meshMaterials=ra;k.faceMaterials=P.materials;k.overdraw=qa;k.z=k.centroidScreen.z;i.push(k)}}else if(F instanceof THREE.Line){ca.multiply(x,ja);R=F.geometry.vertices;B=b();B.positionScreen.copy(R[0].position);ca.multiplyVector4(B.positionScreen);ka=1;for(P=R.length;ka<P;ka++)if(B=b(),B.positionScreen.copy(R[ka].position),ca.multiplyVector4(B.positionScreen),G=p[j-2],E.copy(B.positionScreen),Q.copy(G.positionScreen),e(E,Q))E.multiplyScalar(1/
+E.w),Q.multiplyScalar(1/Q.w),ja=D[C]=D[C]||new THREE.RenderableLine,C++,y=ja,y.v1.positionScreen.copy(E),y.v2.positionScreen.copy(Q),y.z=Math.max(E.z,Q.z),y.materials=F.materials,i.push(y)}else if(F instanceof THREE.Particle&&(L.set(F.matrixWorld.n14,F.matrixWorld.n24,F.matrixWorld.n34,1),x.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))ja=ha[O]=ha[O]||new THREE.RenderableParticle,O++,A=ja,A.x=L.x/L.w,A.y=L.y/L.w,A.z=L.z,A.rotation=F.rotation.z,A.scale.x=F.scale.x*Math.abs(A.x-(L.x+h.projectionMatrix.n11)/
+(L.w+h.projectionMatrix.n14)),A.scale.y=F.scale.y*Math.abs(A.y-(L.y+h.projectionMatrix.n22)/(L.w+h.projectionMatrix.n24)),A.materials=F.materials,i.push(A);c&&i.sort(d);return i}};
 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(b,d,e){e&&b.update(void 0,!1,d);var e=b.sounds,f,h=e.length;for(f=0;f<h;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(d.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
@@ -183,60 +183,60 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function d(b,d,e){var f,h,g,i=b.vertices,j=i.length,k=b.colors,p=k.length,o=b.__vertexArray,G=b.__colorArray,va=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){ja.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)h=i[f].position,qa.copy(h),ja.multiplyVector3(qa),va[f]=[qa.z,f];va.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)h=i[va[f][1]].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;for(f=0;f<p;f++)g=f*3,color=k[va[f][1]],G[g]=color.r,G[g+
-1]=color.g,G[g+2]=color.b}else{if(n)for(f=0;f<j;f++)h=i[f].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;if(r)for(f=0;f<p;f++)color=k[f],g=f*3,G[g]=color.r,G[g+1]=color.g,G[g+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,o,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,G,d)}function e(b,d,e,f,h){f.program||aa.initMaterial(f,d,e,h);var g=f.program,i=g.uniforms,j=f.uniforms;g!=ma&&
+THREE.WebGLRenderer=function(b){function d(b,d,e){var f,h,g,i=b.vertices,j=i.length,k=b.colors,p=k.length,o=b.__vertexArray,H=b.__colorArray,va=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){ja.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)h=i[f].position,qa.copy(h),ja.multiplyVector3(qa),va[f]=[qa.z,f];va.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)h=i[va[f][1]].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;for(f=0;f<p;f++)g=f*3,color=k[va[f][1]],H[g]=color.r,H[g+
+1]=color.g,H[g+2]=color.b}else{if(n)for(f=0;f<j;f++)h=i[f].position,g=f*3,o[g]=h.x,o[g+1]=h.y,o[g+2]=h.z;if(r)for(f=0;f<p;f++)color=k[f],g=f*3,H[g]=color.r,H[g+1]=color.g,H[g+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,o,d);if(r||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,H,d)}function e(b,d,e,f,h){f.program||aa.initMaterial(f,d,e,h);var g=f.program,i=g.uniforms,j=f.uniforms;g!=ma&&
 (c.useProgram(g),ma=g);c.uniformMatrix4fv(i.projectionMatrix,!1,la);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(j.fogColor.value=e.color,e instanceof THREE.Fog)j.fogNear.value=e.near,j.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)j.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||
-f.lights){var k,p,o=0,G=0,va=0,n,r,v,q,t=pa,y=t.directional.colors,A=t.directional.positions,B=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=p=q=0;for(k=d.length;e<k;e++)if(p=d[e],n=p.color,r=p.position,v=p.intensity,q=p.distance,p instanceof THREE.AmbientLight)o+=n.r,G+=n.g,va+=n.b;else if(p instanceof THREE.DirectionalLight)q=u*3,y[q]=n.r*v,y[q+1]=n.g*v,y[q+2]=n.b*v,A[q]=r.x,A[q+1]=r.y,A[q+2]=r.z,u+=1;else if(p instanceof THREE.PointLight)p=s*3,B[p]=n.r*v,B[p+1]=n.g*v,B[p+2]=
-n.b*v,I[p]=r.x,I[p+1]=r.y,I[p+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<y.length;e++)y[e]=0;for(e=s*3;e<B.length;e++)B[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=o;t.ambient[1]=G;t.ambient[2]=va;e=pa;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
+f.lights){var k,p,o=0,H=0,va=0,n,r,v,q,t=pa,y=t.directional.colors,A=t.directional.positions,C=t.point.colors,I=t.point.positions,K=t.point.distances,u=0,s=0,e=p=q=0;for(k=d.length;e<k;e++)if(p=d[e],n=p.color,r=p.position,v=p.intensity,q=p.distance,p instanceof THREE.AmbientLight)o+=n.r,H+=n.g,va+=n.b;else if(p instanceof THREE.DirectionalLight)q=u*3,y[q]=n.r*v,y[q+1]=n.g*v,y[q+2]=n.b*v,A[q]=r.x,A[q+1]=r.y,A[q+2]=r.z,u+=1;else if(p instanceof THREE.PointLight)p=s*3,C[p]=n.r*v,C[p+1]=n.g*v,C[p+2]=
+n.b*v,I[p]=r.x,I[p+1]=r.y,I[p+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<y.length;e++)y[e]=0;for(e=s*3;e<C.length;e++)C[e]=0;t.point.length=s;t.directional.length=u;t.ambient[0]=o;t.ambient[1]=H;t.ambient[2]=va;e=pa;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
 e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,(j.map.texture=f.map)&&j.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof
 THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=na.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var z in j)if(G=g.uniforms[z])if(k=j[z],o=k.type,e=k.value,o=="i")c.uniform1i(G,e);else if(o=="f")c.uniform1f(G,e);else if(o=="fv1")c.uniform1fv(G,e);else if(o=="fv")c.uniform3fv(G,e);else if(o=="v2")c.uniform2f(G,e.x,e.y);else if(o=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(o=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(o=="c")c.uniform3f(G,e.r,e.g,e.b);else if(o=="t"&&(c.uniform1i(G,e),k=k.texture))if(k.image instanceof
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var z in j)if(H=g.uniforms[z])if(k=j[z],o=k.type,e=k.value,o=="i")c.uniform1i(H,e);else if(o=="f")c.uniform1f(H,e);else if(o=="fv1")c.uniform1fv(H,e);else if(o=="fv")c.uniform3fv(H,e);else if(o=="v2")c.uniform2f(H,e.x,e.y);else if(o=="v3")c.uniform3f(H,e.x,e.y,e.z);else if(o=="v4")c.uniform4f(H,e.x,e.y,e.z,e.w);else if(o=="c")c.uniform3f(H,e.r,e.g,e.b);else if(o=="t"&&(c.uniform1i(H,e),k=k.texture))if(k.image instanceof
 Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(o=0;o<6;++o)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[o])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(o=0;o<6;++o)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[o]);k.__webglInit=!0}x(c.TEXTURE_CUBE_MAP,
 k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}}else ca(k,e);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||
 f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,ra);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,
 !1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,ra);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,ra),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,d,f,h,g,i){if(h.opacity!=0){var j,b=e(b,d,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),
 c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,p=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=p[k[f]],f++;else{var k=[],n=-1,
-o=0,p=i.morphTargetInfluences,G,va=p.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(G=0;G<va;G++)!k[G]&&p[G]>n&&(o=G,n=p[o]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[o]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=
+o=0,p=i.morphTargetInfluences,H,va=p.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(H=0;H<va;H++)!k[H]&&p[H]>n&&(o=H,n=p[o]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[o]=1;n=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=
 0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,
 g.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,
 c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,
 c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),aa.data.vertices+=g.__webglFaceCount,aa.data.faces+=g.__webglFaceCount/3,aa.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),aa.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),aa.data.drawCalls++):i instanceof
 THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),aa.data.drawCalls++)}}function h(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,i,j,k,p,o,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],o=e[n+5],j=e[n+6],p=e[n+7],G=e[n+8],f=(f+i+j)/3,g=(g+k+p)/3,h=(h+o+G)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,
-0,b.count);b.count=0}function i(b){if(ka!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),ka=b.doubleSided;if(P!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),P=b.flipSided}function g(b){J!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),J=b)}function j(b){F[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);F[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);F[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);F[3].set(b.n41-b.n21,b.n42-
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,i,j,k,p,o,H,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],g=e[n+1],h=e[n+2],i=e[n+3],k=e[n+4],o=e[n+5],j=e[n+6],p=e[n+7],H=e[n+8],f=(f+i+j)/3,g=(g+k+p)/3,h=(h+o+H)/3,e[n]=f,e[n+1]=g,e[n+2]=h,e[n+3]=f,e[n+4]=g,e[n+5]=h,e[n+6]=f,e[n+7]=g,e[n+8]=h}c.bufferData(c.ARRAY_BUFFER,b.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(d.attributes.normal);c.vertexAttribPointer(d.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,
+0,b.count);b.count=0}function i(b){if(ka!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),ka=b.doubleSided;if(P!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),P=b.flipSided}function g(b){B!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),B=b)}function j(b){F[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);F[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);F[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);F[3].set(b.n41-b.n21,b.n42-
 b.n22,b.n43-b.n23,b.n44-b.n24);F[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);F[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=F[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,d=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=F[e].x*c.n14+F[e].y*c.n24+F[e].z*c.n34+F[e].w,b<=d)return!1;return!0}function k(b,c){b.list[b.count]=c;b.count+=1}function n(b){var c,
 d,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?k(g,d):k(f,d)}function v(b){var c,d,e,f,g=b.object,h=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=g.materials.length;b<e;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(f=h.materials[c])&&(f.transparent?k(j,f):k(i,f))}else(f=c)&&(f.transparent?k(j,f):k(i,f))}function r(b,c){return c.z-b.z}function q(b){c.enable(c.POLYGON_OFFSET_FILL);
 c.polygonOffset(0.1,1);c.enable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(!1);c.colorMask(!1,!1,!1,!1);c.stencilFunc(c.ALWAYS,1,255);c.stencilOpSeparate(c.BACK,c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var d,e=b.lights.length,f,g=b.lights,h=[],i,j,k,p,o,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(o=0;o<n;o++)f=b.__webglShadowVolumes[o].object,
 i=b.__webglShadowVolumes[o].buffer,j=f.materials[0],j.program||aa.initMaterial(j,g,void 0,f),j=j.program,k=j.uniforms,p=j.attributes,ma!==j&&(c.useProgram(j),ma=j,c.uniformMatrix4fv(k.projectionMatrix,!1,la),c.uniformMatrix4fv(k.viewMatrix,!1,ra),c.uniform3fv(k.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(p.position,3,c.FLOAT,!1,0,
 0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(p.normal,3,c.FLOAT,!1,0,0),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),c.cullFace(c.FRONT),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0),c.cullFace(c.BACK),c.drawElements(c.TRIANGLES,i.__webglFaceCount,c.UNSIGNED_SHORT,0)}c.disable(c.POLYGON_OFFSET_FILL);c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.NOTEQUAL,0,255);c.stencilOp(c.KEEP,c.KEEP,c.KEEP);c.disable(c.DEPTH_TEST);R=-1;ma=u.program;c.useProgram(u.program);
 c.uniformMatrix4fv(u.projectionLocation,!1,la);c.uniform1f(u.darknessLocation,u.darkness);c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.vertexAttribPointer(u.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(u.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function y(b,d){var e,f,g;e=_sprite.attributes;
-var h=_sprite.uniforms,i=N/L,j,k=[],p=L*0.5,o=N*0.5,n=!0;c.useProgram(_sprite.program);ma=_sprite.program;R=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
+var h=_sprite.uniforms,i=N/J,j,k=[],p=J*0.5,o=N*0.5,n=!0;c.useProgram(_sprite.program);ma=_sprite.program;R=-1;Da||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Da=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(e.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(h.projectionMatrix,
 !1,la);c.activeTexture(c.TEXTURE0);c.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(c.uniform1i(h.useScreenCoordinates,1),c.uniform3f(h.screenPosition,
 (g.position.x-p)/p,(o-g.position.y)/o,Math.max(0,Math.min(1,g.position.z)))):(c.uniform1i(h.useScreenCoordinates,0),c.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),c.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),j=g.map.image.width/(g.affectedByDistance?1:N),k[0]=j*i*g.scale.x,k[1]=j*g.scale.y,c.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),c.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),c.uniform2f(h.alignment,g.alignment.x,g.alignment.y),c.uniform1f(h.opacity,g.opacity),
-c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),E(g.blending),ca(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function B(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,p=N/L,o=L*0.5,n=N*0.5,r=16/N,v=[r*p,r],q=[1,1,0],x=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);ma=t.program;R=-1;Ea||
+c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),L(g.blending),ca(g.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function C(b,d){var e,f,g=b.__webglLensFlares.length,h,i,j,k=new THREE.Vector3,p=N/J,o=J*0.5,n=N*0.5,r=16/N,v=[r*p,r],q=[1,1,0],x=[1,1],y=t.uniforms;e=t.attributes;c.useProgram(t.program);ma=t.program;R=-1;Ea||
 (c.enableVertexAttribArray(t.attributes.vertex),c.enableVertexAttribArray(t.attributes.uv),Ea=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.vertexAttribPointer(e.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(e.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<g;f++)if(e=
-b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),q[0]=k.x,q[1]=k.y,q[2]=k.z,x[0]=q[0]*o+o,x[1]=q[1]*n+n,t.hasVertexTexture||x[0]>0&&x[0]<L&&x[1]>0&&x[1]<N){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,x[0]-8,x[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,q);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
+b.__webglLensFlares[f].object,k.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(k),d.projectionMatrix.multiplyVector3(k),q[0]=k.x,q[1]=k.y,q[2]=k.z,x[0]=q[0]*o+o,x[1]=q[1]*n+n,t.hasVertexTexture||x[0]>0&&x[0]<J&&x[1]>0&&x[1]<N){c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,x[0]-8,x[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,q);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);
 c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,x[0]-8,x[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);e.positionScreen.x=q[0];e.positionScreen.y=q[1];e.positionScreen.z=q[2];e.customUpdateCallback?e.customUpdateCallback(e):e.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);h=0;for(i=e.lensFlares.length;h<
-i;h++)if(j=e.lensFlares[h],j.opacity>0.0010&&j.scale>0.0010)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/N,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),E(j.blending),ca(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function A(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,p=void 0,n=void 0,o=void 0,G=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,x=void 0,y=void 0,
-A=void 0,B=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=o=q=o=v=r=void 0,z=void 0,m=z=s=r=void 0,F=void 0,J=m=z=s=n=n=G=q=o=m=z=s=F=m=z=s=F=m=z=s=void 0,E=0,C=0,S=0,T=0,M=0,L=0,U=0,N=0,da=0,w=0,ea=0,z=s=0,H=g.__vertexArray,$=g.__uvArray,aa=g.__uv2Array,P=g.__normalArray,V=g.__tangentArray,fa=g.__colorArray,W=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ca=g.__morphTargetsArrays,Q=g.__webglCustomAttributes,m=void 0,O=g.__faceArray,R=g.__lineArray,ha=g.__needsSmoothNormals,
-x=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ja=ga.__dirtyVertices,ka=ga.__dirtyElements,ia=ga.__dirtyUvs,ma=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,sa=ga.faces,ra=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],ya=ga.skinVerticesA,za=ga.skinVerticesB,Aa=ga.skinIndices,wa=ga.skinWeights,xa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0,ua=ga.morphTargets;if(Q)for(J in Q)Q[J].offset=0,Q[J].offsetSrc=0;k=0;
-for(p=qa.length;k<p;k++)if(n=qa[k],o=sa[n],ra&&(A=ra[n]),ta&&(B=ta[n]),n=o.vertexNormals,G=o.normal,r=o.vertexColors,v=o.color,q=o.vertexTangents,o instanceof THREE.Face3){if(ja)u=la[o.a].position,I=la[o.b].position,K=la[o.c].position,H[C]=u.x,H[C+1]=u.y,H[C+2]=u.z,H[C+3]=I.x,H[C+4]=I.y,H[C+5]=I.z,H[C+6]=K.x,H[C+7]=K.y,H[C+8]=K.z,C+=9;if(Q)for(J in Q)if(m=Q[J],m.needsUpdate)s=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=m.value[o.b],
+i;h++)if(j=e.lensFlares[h],j.opacity>0.0010&&j.scale>0.0010)q[0]=j.x,q[1]=j.y,q[2]=j.z,r=j.size*j.scale/N,v[0]=r*p,v[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),L(j.blending),ca(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function A(b){var e,f,g,h,i;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];i=!1;for(h in g.__webglCustomAttributes)if(g.__webglCustomAttributes[h].needsUpdate){i=!0;break}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||i){i=b;var j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,p=void 0,n=void 0,o=void 0,H=n=void 0,r=void 0,v=void 0,q=void 0,t=void 0,x=void 0,y=void 0,
+A=void 0,C=void 0,u=void 0,I=void 0,K=void 0,D=void 0,s=o=q=o=v=r=void 0,z=void 0,m=z=s=r=void 0,F=void 0,L=m=z=s=n=n=H=q=o=m=z=s=F=m=z=s=F=m=z=s=void 0,B=0,E=0,S=0,T=0,M=0,J=0,U=0,N=0,da=0,w=0,ea=0,z=s=0,G=g.__vertexArray,$=g.__uvArray,aa=g.__uv2Array,P=g.__normalArray,V=g.__tangentArray,fa=g.__colorArray,W=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ca=g.__morphTargetsArrays,Q=g.__webglCustomAttributes,m=void 0,O=g.__faceArray,R=g.__lineArray,ha=g.__needsSmoothNormals,
+x=g.__vertexColorType,t=g.__uvType,y=g.__normalType,ga=i.geometry,ja=ga.__dirtyVertices,ka=ga.__dirtyElements,ia=ga.__dirtyUvs,ma=ga.__dirtyNormals,na=ga.__dirtyTangents,oa=ga.__dirtyColors,pa=ga.__dirtyMorphTargets,la=ga.vertices,qa=g.faces,sa=ga.faces,ra=ga.faceVertexUvs[0],ta=ga.faceVertexUvs[1],ya=ga.skinVerticesA,za=ga.skinVerticesB,Aa=ga.skinIndices,wa=ga.skinWeights,xa=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0,ua=ga.morphTargets;if(Q)for(L in Q)Q[L].offset=0,Q[L].offsetSrc=0;k=0;
+for(p=qa.length;k<p;k++)if(n=qa[k],o=sa[n],ra&&(A=ra[n]),ta&&(C=ta[n]),n=o.vertexNormals,H=o.normal,r=o.vertexColors,v=o.color,q=o.vertexTangents,o instanceof THREE.Face3){if(ja)u=la[o.a].position,I=la[o.b].position,K=la[o.c].position,G[E]=u.x,G[E+1]=u.y,G[E+2]=u.z,G[E+3]=I.x,G[E+4]=I.y,G[E+5]=I.z,G[E+6]=K.x,G[E+7]=K.y,G[E+8]=K.z,E+=9;if(Q)for(L in Q)if(m=Q[L],m.needsUpdate)s=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=m.value[o.b],
 m.array[s+2]=m.value[o.c]):m.boundTo==="faces"?(m.array[s+0]=m.value[z],m.array[s+1]=m.value[z],m.array[s+2]=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[z+0],m.array[s+1]=m.value[z+1],m.array[s+2]=m.value[z+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(u=m.value[o.a],I=m.value[o.b],K=m.value[o.c]):m.boundTo==="faces"?(u=m.value[z],I=m.value[z],K=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[z+0],I=m.value[z+1],K=m.value[z+
 2],m.offsetSrc+=3),m.size===2?(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=I.x,m.array[s+3]=I.y,m.array[s+4]=K.x,m.array[s+5]=K.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s+0]=u.r,m.array[s+1]=u.g,m.array[s+2]=u.b,m.array[s+3]=I.r,m.array[s+4]=I.g,m.array[s+5]=I.b,m.array[s+6]=K.r,m.array[s+7]=K.g,m.array[s+8]=K.b):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=I.x,m.array[s+4]=I.y,m.array[s+5]=I.z,m.array[s+6]=K.x,m.array[s+7]=K.y,m.array[s+8]=K.z),m.offset+=9):(m.array[s+
 0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=u.w,m.array[s+4]=I.x,m.array[s+5]=I.y,m.array[s+6]=I.z,m.array[s+7]=I.w,m.array[s+8]=K.x,m.array[s+9]=K.y,m.array[s+10]=K.z,m.array[s+11]=K.w,m.offset+=12));if(pa){s=0;for(z=ua.length;s<z;s++)u=ua[s].vertices[o.a].position,I=ua[s].vertices[o.b].position,K=ua[s].vertices[o.c].position,m=ca[s],m[ea+0]=u.x,m[ea+1]=u.y,m[ea+2]=u.z,m[ea+3]=I.x,m[ea+4]=I.y,m[ea+5]=I.z,m[ea+6]=K.x,m[ea+7]=K.y,m[ea+8]=K.z;ea+=9}if(wa.length)s=wa[o.a],z=wa[o.b],m=wa[o.c],
 Z[w]=s.x,Z[w+1]=s.y,Z[w+2]=s.z,Z[w+3]=s.w,Z[w+4]=z.x,Z[w+5]=z.y,Z[w+6]=z.z,Z[w+7]=z.w,Z[w+8]=m.x,Z[w+9]=m.y,Z[w+10]=m.z,Z[w+11]=m.w,s=Aa[o.a],z=Aa[o.b],m=Aa[o.c],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=z.x,Y[w+5]=z.y,Y[w+6]=z.z,Y[w+7]=z.w,Y[w+8]=m.x,Y[w+9]=m.y,Y[w+10]=m.z,Y[w+11]=m.w,s=ya[o.a],z=ya[o.b],m=ya[o.c],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=z.x,W[w+5]=z.y,W[w+6]=z.z,W[w+7]=1,W[w+8]=m.x,W[w+9]=m.y,W[w+10]=m.z,W[w+11]=1,s=za[o.a],z=za[o.b],m=za[o.c],X[w]=s.x,X[w+1]=s.y,X[w+
 2]=s.z,X[w+3]=1,X[w+4]=z.x,X[w+5]=z.y,X[w+6]=z.z,X[w+7]=1,X[w+8]=m.x,X[w+9]=m.y,X[w+10]=m.z,X[w+11]=1,w+=12;if(oa&&x)r.length==3&&x==THREE.VertexColors?(o=r[0],s=r[1],z=r[2]):z=s=o=v,fa[da]=o.r,fa[da+1]=o.g,fa[da+2]=o.b,fa[da+3]=s.r,fa[da+4]=s.g,fa[da+5]=s.b,fa[da+6]=z.r,fa[da+7]=z.g,fa[da+8]=z.b,da+=9;if(na&&ga.hasTangents)r=q[0],v=q[1],o=q[2],V[U]=r.x,V[U+1]=r.y,V[U+2]=r.z,V[U+3]=r.w,V[U+4]=v.x,V[U+5]=v.y,V[U+6]=v.z,V[U+7]=v.w,V[U+8]=o.x,V[U+9]=o.y,V[U+10]=o.z,V[U+11]=o.w,U+=12;if(ma&&y)if(n.length==
-3&&ha)for(q=0;q<3;q++)G=n[q],P[L]=G.x,P[L+1]=G.y,P[L+2]=G.z,L+=3;else for(q=0;q<3;q++)P[L]=G.x,P[L+1]=G.y,P[L+2]=G.z,L+=3;if(ia&&A!==void 0&&t)for(q=0;q<3;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ia&&B!==void 0&&t)for(q=0;q<3;q++)n=B[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;ka&&(O[M]=E,O[M+1]=E+1,O[M+2]=E+2,M+=3,R[N]=E,R[N+1]=E+1,R[N+2]=E,R[N+3]=E+2,R[N+4]=E+1,R[N+5]=E+2,N+=6,E+=3)}else if(o instanceof THREE.Face4){if(ja)u=la[o.a].position,I=la[o.b].position,K=la[o.c].position,D=la[o.d].position,H[C]=u.x,H[C+
-1]=u.y,H[C+2]=u.z,H[C+3]=I.x,H[C+4]=I.y,H[C+5]=I.z,H[C+6]=K.x,H[C+7]=K.y,H[C+8]=K.z,H[C+9]=D.x,H[C+10]=D.y,H[C+11]=D.z,C+=12;if(Q)for(J in Q)if(m=Q[J],m.needsUpdate)s=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=m.value[o.b],m.array[s+2]=m.value[o.c],m.array[s+3]=m.value[o.d]):m.boundTo==="faces"?(m.array[s+0]=m.value[z],m.array[s+1]=m.value[z],m.array[s+2]=m.value[z],m.array[s+3]=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&
+3&&ha)for(q=0;q<3;q++)H=n[q],P[J]=H.x,P[J+1]=H.y,P[J+2]=H.z,J+=3;else for(q=0;q<3;q++)P[J]=H.x,P[J+1]=H.y,P[J+2]=H.z,J+=3;if(ia&&A!==void 0&&t)for(q=0;q<3;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ia&&C!==void 0&&t)for(q=0;q<3;q++)n=C[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;ka&&(O[M]=B,O[M+1]=B+1,O[M+2]=B+2,M+=3,R[N]=B,R[N+1]=B+1,R[N+2]=B,R[N+3]=B+2,R[N+4]=B+1,R[N+5]=B+2,N+=6,B+=3)}else if(o instanceof THREE.Face4){if(ja)u=la[o.a].position,I=la[o.b].position,K=la[o.c].position,D=la[o.d].position,G[E]=u.x,G[E+
+1]=u.y,G[E+2]=u.z,G[E+3]=I.x,G[E+4]=I.y,G[E+5]=I.z,G[E+6]=K.x,G[E+7]=K.y,G[E+8]=K.z,G[E+9]=D.x,G[E+10]=D.y,G[E+11]=D.z,E+=12;if(Q)for(L in Q)if(m=Q[L],m.needsUpdate)s=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[o.a],m.array[s+1]=m.value[o.b],m.array[s+2]=m.value[o.c],m.array[s+3]=m.value[o.d]):m.boundTo==="faces"?(m.array[s+0]=m.value[z],m.array[s+1]=m.value[z],m.array[s+2]=m.value[z],m.array[s+3]=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&
 (m.array[s+0]=m.value[z+0],m.array[s+1]=m.value[z+1],m.array[s+2]=m.value[z+2],m.array[s+3]=m.value[z+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(u=m.value[o.a],I=m.value[o.b],K=m.value[o.c],D=m.value[o.d]):m.boundTo==="faces"?(u=m.value[z],I=m.value[z],K=m.value[z],D=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[z+0],I=m.value[z+1],K=m.value[z+2],D=m.value[z+3],m.offsetSrc+=4),m.size===2?(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=I.x,m.array[s+
 3]=I.y,m.array[s+4]=K.x,m.array[s+5]=K.y,m.array[s+6]=D.x,m.array[s+7]=D.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s+0]=u.r,m.array[s+1]=u.g,m.array[s+2]=u.b,m.array[s+3]=I.r,m.array[s+4]=I.g,m.array[s+5]=I.b,m.array[s+6]=K.r,m.array[s+7]=K.g,m.array[s+8]=K.b,m.array[s+9]=D.r,m.array[s+10]=D.g,m.array[s+11]=D.b):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=I.x,m.array[s+4]=I.y,m.array[s+5]=I.z,m.array[s+6]=K.x,m.array[s+7]=K.y,m.array[s+8]=K.z,m.array[s+9]=D.x,m.array[s+
 10]=D.y,m.array[s+11]=D.z),m.offset+=12):(m.array[s+0]=u.x,m.array[s+1]=u.y,m.array[s+2]=u.z,m.array[s+3]=u.w,m.array[s+4]=I.x,m.array[s+5]=I.y,m.array[s+6]=I.z,m.array[s+7]=I.w,m.array[s+8]=K.x,m.array[s+9]=K.y,m.array[s+10]=K.z,m.array[s+11]=K.w,m.array[s+12]=D.x,m.array[s+13]=D.y,m.array[s+14]=D.z,m.array[s+15]=D.w,m.offset+=16));if(pa){s=0;for(z=ua.length;s<z;s++)u=ua[s].vertices[o.a].position,I=ua[s].vertices[o.b].position,K=ua[s].vertices[o.c].position,D=ua[s].vertices[o.d].position,m=ca[s],
 m[ea+0]=u.x,m[ea+1]=u.y,m[ea+2]=u.z,m[ea+3]=I.x,m[ea+4]=I.y,m[ea+5]=I.z,m[ea+6]=K.x,m[ea+7]=K.y,m[ea+8]=K.z,m[ea+9]=D.x,m[ea+10]=D.y,m[ea+11]=D.z;ea+=12}if(wa.length)s=wa[o.a],z=wa[o.b],m=wa[o.c],F=wa[o.d],Z[w]=s.x,Z[w+1]=s.y,Z[w+2]=s.z,Z[w+3]=s.w,Z[w+4]=z.x,Z[w+5]=z.y,Z[w+6]=z.z,Z[w+7]=z.w,Z[w+8]=m.x,Z[w+9]=m.y,Z[w+10]=m.z,Z[w+11]=m.w,Z[w+12]=F.x,Z[w+13]=F.y,Z[w+14]=F.z,Z[w+15]=F.w,s=Aa[o.a],z=Aa[o.b],m=Aa[o.c],F=Aa[o.d],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=z.x,Y[w+5]=z.y,Y[w+6]=z.z,
 Y[w+7]=z.w,Y[w+8]=m.x,Y[w+9]=m.y,Y[w+10]=m.z,Y[w+11]=m.w,Y[w+12]=F.x,Y[w+13]=F.y,Y[w+14]=F.z,Y[w+15]=F.w,s=ya[o.a],z=ya[o.b],m=ya[o.c],F=ya[o.d],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=z.x,W[w+5]=z.y,W[w+6]=z.z,W[w+7]=1,W[w+8]=m.x,W[w+9]=m.y,W[w+10]=m.z,W[w+11]=1,W[w+12]=F.x,W[w+13]=F.y,W[w+14]=F.z,W[w+15]=1,s=za[o.a],z=za[o.b],m=za[o.c],o=za[o.d],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=1,X[w+4]=z.x,X[w+5]=z.y,X[w+6]=z.z,X[w+7]=1,X[w+8]=m.x,X[w+9]=m.y,X[w+10]=m.z,X[w+11]=1,X[w+12]=o.x,X[w+13]=
 o.y,X[w+14]=o.z,X[w+15]=1,w+=16;if(oa&&x)r.length==4&&x==THREE.VertexColors?(o=r[0],s=r[1],z=r[2],r=r[3]):r=z=s=o=v,fa[da]=o.r,fa[da+1]=o.g,fa[da+2]=o.b,fa[da+3]=s.r,fa[da+4]=s.g,fa[da+5]=s.b,fa[da+6]=z.r,fa[da+7]=z.g,fa[da+8]=z.b,fa[da+9]=r.r,fa[da+10]=r.g,fa[da+11]=r.b,da+=12;if(na&&ga.hasTangents)r=q[0],v=q[1],o=q[2],q=q[3],V[U]=r.x,V[U+1]=r.y,V[U+2]=r.z,V[U+3]=r.w,V[U+4]=v.x,V[U+5]=v.y,V[U+6]=v.z,V[U+7]=v.w,V[U+8]=o.x,V[U+9]=o.y,V[U+10]=o.z,V[U+11]=o.w,V[U+12]=q.x,V[U+13]=q.y,V[U+14]=q.z,V[U+
-15]=q.w,U+=16;if(ma&&y)if(n.length==4&&ha)for(q=0;q<4;q++)G=n[q],P[L]=G.x,P[L+1]=G.y,P[L+2]=G.z,L+=3;else for(q=0;q<4;q++)P[L]=G.x,P[L+1]=G.y,P[L+2]=G.z,L+=3;if(ia&&A!==void 0&&t)for(q=0;q<4;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ia&&B!==void 0&&t)for(q=0;q<4;q++)n=B[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;ka&&(O[M]=E,O[M+1]=E+1,O[M+2]=E+3,O[M+3]=E+1,O[M+4]=E+2,O[M+5]=E+3,M+=6,R[N]=E,R[N+1]=E+1,R[N+2]=E,R[N+3]=E+3,R[N+4]=E+1,R[N+5]=E+2,R[N+6]=E+2,R[N+7]=E+3,N+=8,E+=4)}if(xa){k=0;for(p=xa.length;k<p;k++)O[M]=
-xa[k].a,O[M+1]=xa[k].b,O[M+2]=xa[k].c,O[M+3]=xa[k].a,O[M+4]=xa[k].c,O[M+5]=xa[k].d,M+=6}ja&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,H,j));if(Q)for(J in Q)if(m=Q[J],m.needsUpdate)c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j),m.needsUpdate=!1;if(pa){s=0;for(z=ua.length;s<z;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,ca[s],j)}oa&&da>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),
+15]=q.w,U+=16;if(ma&&y)if(n.length==4&&ha)for(q=0;q<4;q++)H=n[q],P[J]=H.x,P[J+1]=H.y,P[J+2]=H.z,J+=3;else for(q=0;q<4;q++)P[J]=H.x,P[J+1]=H.y,P[J+2]=H.z,J+=3;if(ia&&A!==void 0&&t)for(q=0;q<4;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ia&&C!==void 0&&t)for(q=0;q<4;q++)n=C[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;ka&&(O[M]=B,O[M+1]=B+1,O[M+2]=B+3,O[M+3]=B+1,O[M+4]=B+2,O[M+5]=B+3,M+=6,R[N]=B,R[N+1]=B+1,R[N+2]=B,R[N+3]=B+3,R[N+4]=B+1,R[N+5]=B+2,R[N+6]=B+2,R[N+7]=B+3,N+=8,B+=4)}if(xa){k=0;for(p=xa.length;k<p;k++)O[M]=
+xa[k].a,O[M+1]=xa[k].b,O[M+2]=xa[k].c,O[M+3]=xa[k].a,O[M+4]=xa[k].c,O[M+5]=xa[k].d,M+=6}ja&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,G,j));if(Q)for(L in Q)if(m=Q[L],m.needsUpdate)c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j),m.needsUpdate=!1;if(pa){s=0;for(z=ua.length;s<z;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,ca[s],j)}oa&&da>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),
 c.bufferData(c.ARRAY_BUFFER,fa,j));ma&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,P,j));na&&ga.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,j));ia&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ia&&T>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ka&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,
 O,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,R,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));i.dynamic||(delete g.__inittedArrays,
 delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=
@@ -244,56 +244,58 @@ f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;x=t.length;i=g.length;y=b.__vertexArr
 THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;t=b.vertices;g=b.colors;x=t.length;i=g.length;y=b.__vertexArray;j=b.__colorArray;A=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<x;k++)p=t[k].position,h=k*3,y[h]=p.x,y[h+1]=p.y,y[h+2]=p.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,y,e)}if(A){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,
 j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function O(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function ha(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,g,h,i,j,k,o={},p=b.morphTargets!==void 0?b.morphTargets.length:
 0;b.geometryGroups={};f=0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,j=c(i),o[j]==void 0&&(o[j]={hash:j,counter:0}),k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+h>65535&&(o[j].counter+=1,k=o[j].hash+"_"+o[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:p})),b.geometryGroups[k].faces.push(f),
-b.geometryGroups[k].vertices+=h}function T(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(b){if(b!=R){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,
+b.geometryGroups[k].vertices+=h}function T(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=R){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,
 c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}R=b}}function x(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,$(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,$(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,$(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,$(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,
 c.TEXTURE_MAG_FILTER,Q(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,Q(d.minFilter)))}function ca(b,d){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),x(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+
 d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function M(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,$(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,$(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,
 $(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,$(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,$(b.format),b.width,b.height,0,$(b.format),$(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,
 c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,
-e=L,b=N);d!=Ba&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(H,S,e,b),Ba=d)}function C(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}
+e=J,b=N);d!=Ba&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(G,S,e,b),Ba=d)}function E(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}
 function $(b){switch(b){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.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 aa=this,c,ta=[],ma=null,Ba=null,ia=!0,ka=null,P=null,R=null,J=null,H=0,S=0,L=0,N=0,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,la=new Float32Array(16),ra=new Float32Array(16),qa=new THREE.Vector4,pa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},na=b.canvas!==void 0?b.canvas:document.createElement("canvas"),sa=b.stencil!==void 0?
+var aa=this,c,ta=[],ma=null,Ba=null,ia=!0,ka=null,P=null,R=null,B=null,G=0,S=0,J=0,N=0,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,la=new Float32Array(16),ra=new Float32Array(16),qa=new THREE.Vector4,pa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},na=b.canvas!==void 0?b.canvas:document.createElement("canvas"),sa=b.stencil!==void 0?
 b.stencil:!0,Ga=b.antialias!==void 0?b.antialias:!1,oa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ca=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=na;this.sortObjects=this.autoClear=!0;try{if(!(c=na.getContext("experimental-webgl",{antialias:Ga,stencil:sa})))throw"Error creating WebGL context.";}catch(Ha){console.error(Ha)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+
 " | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));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.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(oa.r,oa.g,oa.b,Ca);this.context=c;var Fa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(sa){var u={};u.vertices=new Float32Array(12);u.faces=new Uint16Array(6);u.darkness=
 0.5;u.vertices[0]=-20;u.vertices[1]=-20;u.vertices[2]=-1;u.vertices[3]=20;u.vertices[4]=-20;u.vertices[5]=-1;u.vertices[6]=20;u.vertices[7]=20;u.vertices[8]=-1;u.vertices[9]=-20;u.vertices[10]=20;u.vertices[11]=-1;u.faces[0]=0;u.faces[1]=1;u.faces[2]=2;u.faces[3]=0;u.faces[4]=2;u.faces[5]=3;u.vertexBuffer=c.createBuffer();u.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,u.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,u.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.elementBuffer);
-c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,C("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,C("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var t={};t.vertices=new Float32Array(16);
+c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.faces,c.STATIC_DRAW);u.program=c.createProgram();c.attachShader(u.program,E("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,E("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(u.program);u.vertexLocation=c.getAttribLocation(u.program,"position");u.projectionLocation=c.getUniformLocation(u.program,"projectionMatrix");u.darknessLocation=c.getUniformLocation(u.program,"darkness")}var t={};t.vertices=new Float32Array(16);
 t.faces=new Uint16Array(6);b=0;t.vertices[b++]=-1;t.vertices[b++]=-1;t.vertices[b++]=0;t.vertices[b++]=0;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=0;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=1;t.vertices[b++]=-1;t.vertices[b++]=1;t.vertices[b++]=0;t.vertices[b++]=1;b=0;t.faces[b++]=0;t.faces[b++]=1;t.faces[b++]=2;t.faces[b++]=0;t.faces[b++]=2;t.faces[b++]=3;t.vertexBuffer=c.createBuffer();t.elementBuffer=c.createBuffer();t.tempTexture=c.createTexture();
 t.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,t.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,t.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,t.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,t.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,
 c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,t.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
-0?(t.hasVertexTexture=!1,t.program=c.createProgram(),c.attachShader(t.program,C("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(t.program,C("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(t.hasVertexTexture=!0,t.program=c.createProgram(),c.attachShader(t.program,C("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(t.program,C("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(t.program);t.attributes={};t.uniforms={};
+0?(t.hasVertexTexture=!1,t.program=c.createProgram(),c.attachShader(t.program,E("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(t.program,E("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(t.hasVertexTexture=!0,t.program=c.createProgram(),c.attachShader(t.program,E("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(t.program,E("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(t.program);t.attributes={};t.uniforms={};
 t.attributes.vertex=c.getAttribLocation(t.program,"position");t.attributes.uv=c.getAttribLocation(t.program,"UV");t.uniforms.renderType=c.getUniformLocation(t.program,"renderType");t.uniforms.map=c.getUniformLocation(t.program,"map");t.uniforms.occlusionMap=c.getUniformLocation(t.program,"occlusionMap");t.uniforms.opacity=c.getUniformLocation(t.program,"opacity");t.uniforms.scale=c.getUniformLocation(t.program,"scale");t.uniforms.rotation=c.getUniformLocation(t.program,"rotation");t.uniforms.screenPosition=
 c.getUniformLocation(t.program,"screenPosition");var Ea=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
 0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();
-c.attachShader(_sprite.program,C("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,C("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,
+c.attachShader(_sprite.program,E("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,E("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,
 "uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=
-c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var Da=!1;this.setSize=function(b,c){na.width=b;na.height=c;this.setViewport(0,0,na.width,na.height)};this.setViewport=function(b,d,e,f){H=b;S=d;L=e;N=f;c.viewport(H,S,L,N)};this.setScissor=
+c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var Da=!1;this.setSize=function(b,c){na.width=b;na.height=c;this.setViewport(0,0,na.width,na.height)};this.setViewport=function(b,d,e,f){G=b;S=d;J=e;N=f;c.viewport(G,S,J,N)};this.setScissor=
 function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ia=b;c.depthMask(b)};this.setClearColorHex=function(b,d){oa.setHex(b);Ca=d;c.clearColor(oa.r,oa.g,oa.b,Ca)};this.setClearColor=function(b,d){oa.copy(b);Ca=d;c.clearColor(oa.r,oa.g,oa.b,Ca)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){u.darkness=
 b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var g,h,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");
 if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,p,o;k=o=j=0;for(p=d.length;k<p;k++)h=d[k],h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&j++;j+o<=4?d=o:(d=Math.ceil(4*o/(j+o)),j=4-d);h={directional:d,point:j};o=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)o=f.bones.length;var n;a:{k=b.fragmentShader;p=b.vertexShader;var j=b.uniforms,d=b.attributes,e={map:!!b.map,envMap:!!b.envMap,
 lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:o},q;h=[];i?h.push(i):(h.push(k),h.push(p));for(q in e)h.push(q),h.push(e[q]);i=h.join();q=0;for(h=ta.length;q<h;q++)if(ta[q].code==i){n=ta[q].program;break a}q=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,
 "#define MAX_POINT_LIGHTS "+e.maxPointLights,e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o=[Fa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":
 "",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-c.attachShader(q,C("fragment",h+k));c.attachShader(q,C("vertex",o+p));c.linkProgram(q);c.getProgramParameter(q,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(q,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");q.uniforms={};q.attributes={};var r;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(r in j)k.push(r);r=k;j=0;for(k=
+c.attachShader(q,E("fragment",h+k));c.attachShader(q,E("vertex",o+p));c.linkProgram(q);c.getProgramParameter(q,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(q,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");q.uniforms={};q.attributes={};var r;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(r in j)k.push(r);r=k;j=0;for(k=
 r.length;j<k;j++)p=r[j],q.uniforms[p]=c.getUniformLocation(q,p);k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<e.maxMorphTargets;r++)k.push("morphTarget"+r);for(n in d)k.push(n);n=k;r=0;for(d=n.length;r<d;r++)e=n[r],q.attributes[e]=c.getAttribLocation(q,e);ta.push({program:q,code:i});n=q}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);n.normal>=
 0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0),
 b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>=
-0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,k,u){var t,x,A,C,F,H,o,G,J=b.lights,L=b.fog;aa.data.vertices=0;aa.data.faces=0;aa.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);
-d.matrixWorldInverse.flattenToArray(ra);d.projectionMatrix.flattenToArray(la);ja.multiply(d.projectionMatrix,d.matrixWorldInverse);j(ja);this.initWebGLObjects(b);M(k);(this.autoClear||u)&&this.clear();F=b.__webglObjects.length;for(u=0;u<F;u++)if(t=b.__webglObjects[u],o=t.object,o.visible)if(!(o instanceof THREE.Mesh)||p(o)){if(o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),v(t),t.render=!0,this.sortObjects)qa.copy(o.position),ja.multiplyVector3(qa),t.z=qa.z}else t.render=!1;else t.render=
-!1;this.sortObjects&&b.__webglObjects.sort(r);H=b.__webglObjectsImmediate.length;for(u=0;u<H;u++)t=b.__webglObjectsImmediate[u],o=t.object,o.visible&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),n(t));E(THREE.NormalBlending);for(u=0;u<F;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;A=t.opaque;i(o);for(t=0;t<A.count;t++)C=A.list[t],g(C.depthTest),f(d,J,L,C,G,o)}for(u=0;u<H;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible){A=t.opaque;i(o);for(t=
-0;t<A.count;t++)C=A.list[t],g(C.depthTest),x=e(d,J,L,C,o),o.render(function(b){h(b,x,C.shading)})}for(u=0;u<F;u++)if(t=b.__webglObjects[u],t.render){o=t.object;G=t.buffer;A=t.transparent;i(o);for(t=0;t<A.count;t++)C=A.list[t],E(C.blending),g(C.depthTest),f(d,J,L,C,G,o)}for(u=0;u<H;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible){A=t.transparent;i(o);for(t=0;t<A.count;t++)C=A.list[t],E(C.blending),g(C.depthTest),x=e(d,J,L,C,o),o.render(function(b){h(b,x,C.shading)})}b.__webglSprites.length&&
-y(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&B(b,d);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(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],
-e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&ha(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=c.createBuffer();
-i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=i.numMorphTargets;j<
-k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,o=void 0,p=void 0,q=p=void 0,r=void 0,t=void 0,v=t=k=0,u=p=o=void 0,o=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,o=r.length;n<o;n++)p=r[n],p=u[p],p instanceof THREE.Face3?(k+=3,t+=1,v+=3):p instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,o=j,x=r=u=void 0,y=void 0,x=void 0,p=[],u=0,r=o.materials.length;u<r;u++)if(x=o.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=n.materials.length;x<l;x++)(y=n.materials[x])&&
-p.push(y)}else(y=x)&&p.push(y);n=p;a:{u=o=void 0;r=n.length;for(o=0;o<r;o++)if(u=n[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{r=u=void 0;p=n.length;for(u=0;u<p;u++)if(r=n[u],!(r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial)){u=r&&r.shading!=void 0&&r.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{p=r=void 0;x=n.length;for(r=0;r<x;r++)if(p=n[r],p.vertexColors){p=p.vertexColors;break a}p=
-!1}i.__vertexArray=new Float32Array(k*3);if(u)i.__normalArray=new Float32Array(k*3);if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(p)i.__colorArray=new Float32Array(k*3);if(o){if(q.faceUvs.length>0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),
-i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q<r;q++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=o;i.__vertexColorType=p;i.__normalType=u;i.__webglFaceCount=t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*
-6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(n[q].attributes)for(a in i.__webglCustomAttributes={},n[q].attributes){o={};for(prop in n[q].attributes[a])o[prop]=n[q].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,t=1,o.type==="v2"?t=2:o.type==="v3"?t=3:o.type==="v4"?t=4:o.type==="c"&&(t=3),o.size=t,o.needsUpdate=!0,o.array=new Float32Array(k*t),o.buffer=c.createBuffer(),o.buffer.belongsToAttribute=a;i.__webglCustomAttributes[a]=o}i.__inittedArrays=
-!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?T(e.__webglShadowVolumes,h,d):T(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)T(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*
-3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;T(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;T(e.__webglObjects,g,d)}else if(d instanceof THREE.ParticleSystem){g=
-d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;T(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof
-THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)d=b.__objectsRemoved[0],e=b,d instanceof THREE.ShadowVolume?O(e.__webglShadowVolumes,d):d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line?O(e.__webglObjects,d):d instanceof THREE.Sprite?O(e.__webglSprites,d):d instanceof THREE.LensFlare?O(e.__webglLensFlares,d):d instanceof THREE.MarchingCubes&&O(e.__webglObjectsImmediate,d),b.__objectsRemoved.splice(0,
-1);d=0;for(e=b.__webglObjects.length;d<e;d++)A(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)A(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)A(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Fa}};
+0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,k,u){var t,x,A,B,E,F,o,H,G=b.lights,J=b.fog;aa.data.vertices=0;aa.data.faces=0;aa.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);
+d.matrixWorldInverse.flattenToArray(ra);d.projectionMatrix.flattenToArray(la);ja.multiply(d.projectionMatrix,d.matrixWorldInverse);j(ja);this.initWebGLObjects(b);M(k);(this.autoClear||u)&&this.clear();E=b.__webglObjects.length;for(u=0;u<E;u++)if(t=b.__webglObjects[u],o=t.object,o.visible)if(!(o instanceof THREE.Mesh)||p(o)){if(o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),v(t),t.render=!0,this.sortObjects)qa.copy(o.position),ja.multiplyVector3(qa),t.z=qa.z}else t.render=!1;else t.render=
+!1;this.sortObjects&&b.__webglObjects.sort(r);F=b.__webglObjectsImmediate.length;for(u=0;u<F;u++)t=b.__webglObjectsImmediate[u],o=t.object,o.visible&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),D(o,d),n(t));L(THREE.NormalBlending);for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render)if(o=t.object,H=t.buffer,A=t.opaque,i(o),b.overrideMaterial)g(b.overrideMaterial.depthTest),f(d,G,J,b.overrideMaterial,H,o);else for(t=0;t<A.count;t++)B=A.list[t],g(B.depthTest),f(d,G,J,B,H,o);
+for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible)if(A=t.opaque,i(o),b.overrideMaterial)g(b.overrideMaterial.depthTest),x=e(d,G,J,b.overrideMaterial,o),o.render(function(c){h(c,x,b.overrideMaterial.shading)});else for(t=0;t<A.count;t++)B=A.list[t],g(B.depthTest),x=e(d,G,J,B,o),o.render(function(b){h(b,x,B.shading)});for(u=0;u<E;u++)if(t=b.__webglObjects[u],t.render)if(o=t.object,H=t.buffer,A=t.transparent,i(o),b.overrideMaterial)L(b.overrideMaterial.blending),g(b.overrideMaterial.depthTest),
+f(d,G,J,b.overrideMaterial,H,o);else for(t=0;t<A.count;t++)B=A.list[t],L(B.blending),g(B.depthTest),f(d,G,J,B,H,o);for(u=0;u<F;u++)if(t=b.__webglObjectsImmediate[u],o=t.object,o.visible)if(A=t.transparent,i(o),b.overrideMaterial)L(b.overrideMaterial.blending),g(b.overrideMaterial.depthTest),x=e(d,G,J,b.overrideMaterial,o),o.render(function(c){h(c,x,b.overrideMaterial.shading)});else for(t=0;t<A.count;t++)B=A.list[t],L(B.blending),g(B.depthTest),x=e(d,G,J,B,o),o.render(function(b){h(b,x,B.shading)});
+b.__webglSprites.length&&y(b,d);sa&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&C(b,d);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(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=
+b.__objectsAdded[0],e=b,f=void 0,g=void 0,h=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(f in g=d.geometry,g.geometryGroups==void 0&&ha(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=
+c.createBuffer();i.__webglTangentBuffer=c.createBuffer();i.__webglColorBuffer=c.createBuffer();i.__webglUVBuffer=c.createBuffer();i.__webglUV2Buffer=c.createBuffer();i.__webglSkinVertexABuffer=c.createBuffer();i.__webglSkinVertexBBuffer=c.createBuffer();i.__webglSkinIndicesBuffer=c.createBuffer();i.__webglSkinWeightsBuffer=c.createBuffer();i.__webglFaceBuffer=c.createBuffer();i.__webglLineBuffer=c.createBuffer();if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=
+i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,o=void 0,p=void 0,q=p=void 0,r=void 0,t=void 0,v=t=k=0,u=p=o=void 0,o=n=void 0,q=j.geometry,u=q.faces,r=i.faces,n=0,o=r.length;n<o;n++)p=r[n],p=u[p],p instanceof THREE.Face3?(k+=3,t+=1,v+=3):p instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,o=j,x=r=u=void 0,y=void 0,x=void 0,p=[],u=0,r=o.materials.length;u<r;u++)if(x=o.materials[u],x instanceof THREE.MeshFaceMaterial){x=0;for(l=n.materials.length;x<
+l;x++)(y=n.materials[x])&&p.push(y)}else(y=x)&&p.push(y);n=p;a:{u=o=void 0;r=n.length;for(o=0;o<r;o++)if(u=n[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{r=u=void 0;p=n.length;for(u=0;u<p;u++)if(r=n[u],!(r instanceof THREE.MeshBasicMaterial&&!r.envMap||r instanceof THREE.MeshDepthMaterial)){u=r&&r.shading!=void 0&&r.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{p=r=void 0;x=n.length;for(r=0;r<x;r++)if(p=n[r],p.vertexColors){p=
+p.vertexColors;break a}p=!1}i.__vertexArray=new Float32Array(k*3);if(u)i.__normalArray=new Float32Array(k*3);if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(p)i.__colorArray=new Float32Array(k*3);if(o){if(q.faceUvs.length>0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=
+new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q<r;q++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=o;i.__vertexColorType=p;i.__normalType=u;i.__webglFaceCount=t*3+(j.geometry.edgeFaces?
+j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(n[q].attributes)for(a in i.__webglCustomAttributes={},n[q].attributes){o={};for(prop in n[q].attributes[a])o[prop]=n[q].attributes[a][prop];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,t=1,o.type==="v2"?t=2:o.type==="v3"?t=3:o.type==="v4"?t=4:o.type==="c"&&(t=3),o.size=t,o.needsUpdate=!0,o.array=new Float32Array(k*t),o.buffer=c.createBuffer(),o.buffer.belongsToAttribute=a;i.__webglCustomAttributes[a]=
+o}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?T(e.__webglShadowVolumes,h,d):T(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)T(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=
+new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;T(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;T(e.__webglObjects,g,d)}else if(d instanceof
+THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;T(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],
+count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)d=b.__objectsRemoved[0],e=b,d instanceof THREE.ShadowVolume?O(e.__webglShadowVolumes,d):d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line?O(e.__webglObjects,d):d instanceof THREE.Sprite?O(e.__webglSprites,d):d instanceof THREE.LensFlare?O(e.__webglLensFlares,d):d instanceof THREE.MarchingCubes&&O(e.__webglObjectsImmediate,
+d),b.__objectsRemoved.splice(0,1);d=0;for(e=b.__webglObjects.length;d<e;d++)A(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)A(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)A(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=
+function(){return Fa}};
 THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};

+ 67 - 20
src/renderers/WebGLRenderer.js

@@ -3198,12 +3198,22 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				setObjectFaces( object );
 
-				for ( i = 0; i < opaque.count; i ++ ) {
+				if (scene.overrideMaterial)
+				{
+					
+					setDepthTest( scene.overrideMaterial.depthTest );
+					renderBuffer( camera, lights, fog, scene.overrideMaterial, buffer, object );
 
-					material = opaque.list[ i ];
+				} else {
+					
+					for ( i = 0; i < opaque.count; i ++ ) {
+
+						material = opaque.list[ i ];
 
-					setDepthTest( material.depthTest );
-					renderBuffer( camera, lights, fog, material, buffer, object );
+						setDepthTest( material.depthTest );
+						renderBuffer( camera, lights, fog, material, buffer, object );
+
+					}
 
 				}
 
@@ -3224,14 +3234,26 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				setObjectFaces( object );
 
-				for( i = 0; i < opaque.count; i++ ) {
+				if (scene.overrideMaterial)
+				{
+					
+					setDepthTest( scene.overrideMaterial.depthTest );
+
+					program = setProgram( camera, lights, fog, scene.overrideMaterial, object );
+					object.render( function( object ) { renderBufferImmediate( object, program, scene.overrideMaterial.shading ); } );
 
-					material = opaque.list[ i ];
+				} else {
+					
+					for( i = 0; i < opaque.count; i++ ) {
+
+						material = opaque.list[ i ];
 
-					setDepthTest( material.depthTest );
+						setDepthTest( material.depthTest );
 
-					program = setProgram( camera, lights, fog, material, object );
-					object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
+						program = setProgram( camera, lights, fog, material, object );
+						object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
+
+					}
 
 				}
 
@@ -3253,14 +3275,26 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				setObjectFaces( object );
 
-				for ( i = 0; i < transparent.count; i ++ ) {
+				if (scene.overrideMaterial)
+				{
+					
+					setBlending( scene.overrideMaterial.blending );
+					setDepthTest( scene.overrideMaterial.depthTest );
 
-					material = transparent.list[ i ];
+					renderBuffer( camera, lights, fog, scene.overrideMaterial, buffer, object );
 
-					setBlending( material.blending );
-					setDepthTest( material.depthTest );
+				} else {
+					
+					for ( i = 0; i < transparent.count; i ++ ) {
 
-					renderBuffer( camera, lights, fog, material, buffer, object );
+						material = transparent.list[ i ];
+
+						setBlending( material.blending );
+						setDepthTest( material.depthTest );
+
+						renderBuffer( camera, lights, fog, material, buffer, object );
+
+					}
 
 				}
 
@@ -3281,15 +3315,28 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				setObjectFaces( object );
 
-				for ( i = 0; i < transparent.count; i ++ ) {
+				if (scene.overrideMaterial)
+				{
 
-					material = transparent.list[ i ];
+					setBlending( scene.overrideMaterial.blending );
+					setDepthTest( scene.overrideMaterial.depthTest );
 
-					setBlending( material.blending );
-					setDepthTest( material.depthTest );
+					program = setProgram( camera, lights, fog, scene.overrideMaterial, object );
+					object.render( function( object ) { renderBufferImmediate( object, program, scene.overrideMaterial.shading ); } );
+					
+				} else {
+					
+					for ( i = 0; i < transparent.count; i ++ ) {
 
-					program = setProgram( camera, lights, fog, material, object );
-					object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
+						material = transparent.list[ i ];
+
+						setBlending( material.blending );
+						setDepthTest( material.depthTest );
+
+						program = setProgram( camera, lights, fog, material, object );
+						object.render( function( object ) { renderBufferImmediate( object, program, material.shading ); } );
+
+					}
 
 				}