Browse Source

Fixed runaway _sprite global in WebGLRenderer.

alteredq 14 years ago
parent
commit
d6345d7113
3 changed files with 361 additions and 362 deletions
  1. 262 263
      build/Three.js
  2. 98 98
      build/custom/ThreeWebGL.js
  3. 1 1
      src/renderers/WebGLRenderer.js

+ 262 - 263
build/Three.js

@@ -14,33 +14,33 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;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())},
 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};
 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,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f;f=c.position.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.position.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
 THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f;f=c.position.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.position.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
-g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(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=c(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 g,h,k,m,n,p,o,t,u,v,w=b.geometry,
-A=w.vertices,B=[],f=0;for(g=w.faces.length;f<g;f++)if(h=w.faces[f],u=this.origin.clone(),v=this.direction.clone(),p=b.matrixWorld,k=p.multiplyVector3(A[h.a].position.clone()),m=p.multiplyVector3(A[h.b].position.clone()),n=p.multiplyVector3(A[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(A[h.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),t=v.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(k,u))/t,u=u.addSelf(v.multiplyScalar(o)),
-h instanceof THREE.Face3)e(u,k,m,n)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},B.push(h));else if(h instanceof THREE.Face4&&(e(u,k,m,p)||e(u,m,n,p)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},B.push(h);return B}else return[]}};
-THREE.Rectangle=function(){function b(){h=f-c;k=g-e}var c,e,f,g,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,o,t){m=!1;c=h;e=k;f=o;g=t;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,g=g>k?g:k);b()};this.add3Points=
-function(h,k,o,t,u,v){m?(m=!1,c=h<o?h<u?h:u:o<u?o:u,e=k<t?k<v?k:v:t<v?t:v,f=h>o?h>u?h:u:o>u?o:u,g=k>t?k>v?k:v:t>v?t:v):(c=h<o?h<u?h<c?h:c:u<c?u:c:o<u?o<c?o:c:u<c?u:c,e=k<t?k<v?k<e?k:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=h>o?h>u?h>f?h:f:u>f?u:f:o>u?o>f?o:f:u>f?u:f,g=k>t?k>v?k>g?k:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
+g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(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=c(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 g,h,k,m,n,o,p,t,u,v,w=b.geometry,
+A=w.vertices,B=[],f=0;for(g=w.faces.length;f<g;f++)if(h=w.faces[f],u=this.origin.clone(),v=this.direction.clone(),o=b.matrixWorld,k=o.multiplyVector3(A[h.a].position.clone()),m=o.multiplyVector3(A[h.b].position.clone()),n=o.multiplyVector3(A[h.c].position.clone()),o=h instanceof THREE.Face4?o.multiplyVector3(A[h.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),t=v.dot(p),b.doubleSided||(b.flipSided?t>0:t<0))if(p=p.dot((new THREE.Vector3).sub(k,u))/t,u=u.addSelf(v.multiplyScalar(p)),
+h instanceof THREE.Face3)e(u,k,m,n)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},B.push(h));else if(h instanceof THREE.Face4&&(e(u,k,m,o)||e(u,m,n,o)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},B.push(h);return B}else return[]}};
+THREE.Rectangle=function(){function b(){h=f-c;k=g-e}var c,e,f,g,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,k,p,t){m=!1;c=h;e=k;f=p;g=t;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,g=g>k?g:k);b()};this.add3Points=
+function(h,k,p,t,u,v){m?(m=!1,c=h<p?h<u?h:u:p<u?p:u,e=k<t?k<v?k:v:t<v?t:v,f=h>p?h>u?h:u:p>u?p:u,g=k>t?k>v?k:v:t>v?t:v):(c=h<p?h<u?h<c?h:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c,e=k<t?k<v?k<e?k:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=h>p?h>u?h>f?h:f:u>f?u:f:p>u?p>f?p:f:u>f?u:f,g=k>t?k>v?k>g?k:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
 h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
 h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};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,e,f,g,h,k,m,n,p,o,t,u,v,w,A){this.set(b||1,c||0,e||0,f||0,g||0,h||1,k||0,m||0,n||0,p||0,o||1,t||0,u||0,v||0,w||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,k,m,n,p,o,t,u,v,w,A){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=h;this.n23=k;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=u;this.n42=v;this.n43=w;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=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,e,f,g,h,k,m,n,o,p,t,u,v,w,A){this.set(b||1,c||0,e||0,f||0,g||0,h||1,k||0,m||0,n||0,o||0,p||1,t||0,u||0,v||0,w||0,A||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,k,m,n,o,p,t,u,v,w,A){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=h;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=w;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,h).normalize());g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,h).normalize());g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
 f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
 f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,A=b.n42,B=b.n43,x=b.n44,G=c.n11,z=c.n12,E=c.n13,H=c.n14,C=c.n21,O=c.n22,
-M=c.n23,F=c.n24,Q=c.n31,S=c.n32,N=c.n33,j=c.n34;this.n11=e*G+f*C+g*Q;this.n12=e*z+f*O+g*S;this.n13=e*E+f*M+g*N;this.n14=e*H+f*F+g*j+h;this.n21=k*G+m*C+n*Q;this.n22=k*z+m*O+n*S;this.n23=k*E+m*M+n*N;this.n24=k*H+m*F+n*j+p;this.n31=o*G+t*C+u*Q;this.n32=o*z+t*O+u*S;this.n33=o*E+t*M+u*N;this.n34=o*H+t*F+u*j+v;this.n41=w*G+A*C+B*Q;this.n42=w*z+A*O+B*S;this.n43=w*E+A*M+B*N;this.n44=w*H+A*F+B*j+x;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,A=b.n42,B=b.n43,x=b.n44,G=c.n11,z=c.n12,E=c.n13,H=c.n14,C=c.n21,S=c.n22,
+L=c.n23,F=c.n24,R=c.n31,O=c.n32,N=c.n33,j=c.n34;this.n11=e*G+f*C+g*R;this.n12=e*z+f*S+g*O;this.n13=e*E+f*L+g*N;this.n14=e*H+f*F+g*j+h;this.n21=k*G+m*C+n*R;this.n22=k*z+m*S+n*O;this.n23=k*E+m*L+n*N;this.n24=k*H+m*F+n*j+o;this.n31=p*G+t*C+u*R;this.n32=p*z+t*S+u*O;this.n33=p*E+t*L+u*N;this.n34=p*H+t*F+u*j+v;this.n41=w*G+A*C+B*R;this.n42=w*z+A*S+B*O;this.n43=w*E+A*L+B*N;this.n44=w*H+A*F+B*j+x;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=
 this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
 this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
-this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,u=this.n41,v=this.n42,w=this.n43,A=this.n44;return f*k*p*u-e*m*p*u-f*h*o*u+c*m*o*u+e*h*t*u-c*k*t*u-f*k*n*v+e*m*n*v+f*g*o*v-b*m*o*v-e*g*t*v+b*k*t*v+f*h*n*w-c*m*n*w-f*g*p*w+b*m*p*w+c*g*t*w-b*h*t*w-e*h*n*A+c*k*n*A+e*g*p*A-b*k*p*A-c*g*o*A+b*h*o*A},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,e=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,m=this.n24,n=this.n31,o=this.n32,p=this.n33,t=this.n34,u=this.n41,v=this.n42,w=this.n43,A=this.n44;return f*k*o*u-e*m*o*u-f*h*p*u+c*m*p*u+e*h*t*u-c*k*t*u-f*k*n*v+e*m*n*v+f*g*p*v-b*m*p*v-e*g*t*v+b*k*t*v+f*h*n*w-c*m*n*w-f*g*o*w+b*m*o*w+c*g*t*w-b*h*t*w-e*h*n*A+c*k*n*A+e*g*o*A-b*k*o*A-c*g*p*A+b*h*p*A},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.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.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
 this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,
 this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,
-c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,h=b.x,k=b.y,m=b.z,n=g*h,p=g*k;this.set(n*
-h+e,n*k-f*m,n*m+f*k,0,n*k+f*m,p*k+e,p*m-f*h,0,n*m-f*k,p*m+f*h,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
+c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,h=b.x,k=b.y,m=b.z,n=g*h,o=g*k;this.set(n*
+h+e,n*k-f*m,n*m+f*k,0,n*k+f*m,o*k+e,o*m-f*h,0,n*m-f*k,o*m+f*h,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
 this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,e=b.y,f=b.z,b=Math.cos(c),c=Math.sin(c),g=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=b*e,m=c*e;this.n11=g*h;this.n12=-g*f;this.n13=e;this.n21=m*h+b*f;this.n22=-m*f+b*h;this.n23=-c*g;this.n31=-k*h+c*f;this.n32=k*f+c*h;this.n33=b*g;return this},
 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,e=b.y,f=b.z,b=Math.cos(c),c=Math.sin(c),g=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=b*e,m=c*e;this.n11=g*h;this.n12=-g*f;this.n13=e;this.n21=m*h+b*f;this.n22=-m*f+b*h;this.n23=-c*g;this.n31=-k*h+c*f;this.n32=k*f+c*h;this.n33=b*g;return this},
-setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,h=c+c,k=e+e,m=f+f,b=c*h,n=c*k;c*=m;var p=e*k;e*=m;f*=m;h*=g;k*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+k;this.n21=n+g;this.n22=1-(b+f);this.n23=e-h;this.n31=c-k;this.n32=e+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
+setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,h=c+c,k=e+e,m=f+f,b=c*h,n=c*k;c*=m;var o=e*k;e*=m;f*=m;h*=g;k*=g;g*=m;this.n11=1-(o+f);this.n12=n-g;this.n13=c+k;this.n21=n+g;this.n22=1-(b+f);this.n23=e-h;this.n31=c-k;this.n32=e+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,A=b.n42,B=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*v*A-p*u*A+p*t*B-m*v*B-n*t*x+m*u*x;c.n12=h*u*A-g*v*A-h*t*B+f*v*B+g*t*x-f*u*x;c.n13=g*p*A-h*n*A+h*m*B-f*p*B-g*m*x+f*n*x;c.n14=h*n*t-g*p*t-h*m*u+f*p*u+g*m*v-f*n*v;c.n21=p*u*w-n*v*w-p*o*B+k*v*B+n*o*x-k*u*x;c.n22=g*v*w-h*u*w+h*o*B-e*v*B-g*o*x+e*u*x;c.n23=h*n*w-g*p*w-h*k*B+e*p*B+g*k*x-e*n*x;c.n24=
-g*p*o-h*n*o+h*k*u-e*p*u-g*k*v+e*n*v;c.n31=m*v*w-p*t*w+p*o*A-k*v*A-m*o*x+k*t*x;c.n32=h*t*w-f*v*w-h*o*A+e*v*A+f*o*x-e*t*x;c.n33=g*p*w-h*m*w+h*k*A-e*p*A-f*k*x+e*m*x;c.n34=h*m*o-f*p*o-h*k*t+e*p*t+f*k*v-e*m*v;c.n41=n*t*w-m*u*w-n*o*A+k*u*A+m*o*B-k*t*B;c.n42=f*u*w-g*t*w+g*o*A-e*u*A-f*o*B+e*t*B;c.n43=g*m*w-f*n*w-g*k*A+e*n*A+f*k*B-e*m*B;c.n44=f*n*o-g*m*o+g*k*t-e*n*t-f*k*u+e*m*u;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*k;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*t;return c};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,k=b.n21,m=b.n22,n=b.n23,o=b.n24,p=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,A=b.n42,B=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*v*A-o*u*A+o*t*B-m*v*B-n*t*x+m*u*x;c.n12=h*u*A-g*v*A-h*t*B+f*v*B+g*t*x-f*u*x;c.n13=g*o*A-h*n*A+h*m*B-f*o*B-g*m*x+f*n*x;c.n14=h*n*t-g*o*t-h*m*u+f*o*u+g*m*v-f*n*v;c.n21=o*u*w-n*v*w-o*p*B+k*v*B+n*p*x-k*u*x;c.n22=g*v*w-h*u*w+h*p*B-e*v*B-g*p*x+e*u*x;c.n23=h*n*w-g*o*w-h*k*B+e*o*B+g*k*x-e*n*x;c.n24=
+g*o*p-h*n*p+h*k*u-e*o*u-g*k*v+e*n*v;c.n31=m*v*w-o*t*w+o*p*A-k*v*A-m*p*x+k*t*x;c.n32=h*t*w-f*v*w-h*p*A+e*v*A+f*p*x-e*t*x;c.n33=g*o*w-h*m*w+h*k*A-e*o*A-f*k*x+e*m*x;c.n34=h*m*p-f*o*p-h*k*t+e*o*t+f*k*v-e*m*v;c.n41=n*t*w-m*u*w-n*p*A+k*u*A+m*p*B-k*t*B;c.n42=f*u*w-g*t*w+g*p*A-e*u*A-f*p*B+e*t*B;c.n43=g*m*w-f*n*w-g*k*A+e*n*A+f*k*B-e*m*B;c.n44=f*n*p-g*m*p+g*k*t-e*n*t-f*k*u+e*m*u;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*k;e[4]=b*m;e[5]=b*n;e[6]=b*o;e[7]=b*p;e[8]=b*t;return c};
 THREE.Matrix4.makeFrustum=function(b,c,e,f,g,h){var k;k=new THREE.Matrix4;k.n11=2*g/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*g/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+g)/(h-g);k.n34=-2*h*g/(h-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
 THREE.Matrix4.makeFrustum=function(b,c,e,f,g,h){var k;k=new THREE.Matrix4;k.n11=2*g/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*g/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+g)/(h-g);k.n34=-2*h*g/(h-g);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
-THREE.Matrix4.makeOrtho=function(b,c,e,f,g,h){var k,m,n,p;k=new THREE.Matrix4;m=c-b;n=e-f;p=h-g;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((e+f)/n);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+g)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(b,c,e,f,g,h){var k,m,n,o;k=new THREE.Matrix4;m=c-b;n=e-f;o=h-g;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((e+f)/n);k.n31=0;k.n32=0;k.n33=-2/o;k.n34=-((h+g)/o);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=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=
 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=""};
 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)===
 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,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),h=Math.cos(e),e=Math.sin(e),k=b*c,m=f*g;this.w=k*h-m*e;this.x=k*e+m*h;this.y=f*c*h+b*g*e;this.z=b*g*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
 THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),h=Math.cos(e),e=Math.sin(e),k=b*c,m=f*g;this.w=k*h-m*e;this.x=k*e+m*h;this.y=f*c*h+b*g*e;this.z=b*g*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
 f;this.z=b.z*f;this.w=Math.cos(e);return this},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},
 f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
-multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+g*h+e*m-f*k;this.y=e*b+g*k+f*h-c*m;this.z=f*b+g*m+c*k-e*h;this.w=g*b-c*h-e*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,h=this.x,k=this.y,m=this.z,n=this.w,p=n*e+k*g-m*f,o=
-n*f+m*e-h*g,t=n*g+h*f-k*e,e=-h*e-k*f-m*g;c.x=p*n+e*-h+o*-m-t*-k;c.y=o*n+e*-k+t*-h-p*-m;c.z=t*n+e*-m+p*-k-o*-h;return c}};
+multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+g*h+e*m-f*k;this.y=e*b+g*k+f*h-c*m;this.z=f*b+g*m+c*k-e*h;this.w=g*b-c*h-e*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,h=this.x,k=this.y,m=this.z,n=this.w,o=n*e+k*g-m*f,p=
+n*f+m*e-h*g,t=n*g+h*f-k*e,e=-h*e-k*f-m*g;c.x=o*n+e*-h+p*-m-t*-k;c.y=p*n+e*-k+t*-h-o*-m;c.z=t*n+e*-m+o*-k-p*-h;return c}};
 THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var h=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var h=Math.acos(g),k=Math.sqrt(1-g*g);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,e,f,g,h){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face3=function(b,c,e,f,g,h){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,g,h,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.Face4=function(b,c,e,f,g,h,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
@@ -59,16 +59,16 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.f
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,h,k,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,h,k,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
 m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,j,g,h){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=k[j];t=k[g];u=k[h];v=n.x-m.x;w=p.x-m.x;A=n.y-m.y;B=p.y-m.y;x=n.z-m.z;G=p.z-m.z;z=t.u-o.u;E=u.u-o.u;H=t.v-o.v;C=u.v-o.v;O=1/(z*C-E*H);S.set((C*v-H*w)*
-O,(C*A-H*B)*O,(C*x-H*G)*O);N.set((z*w-E*v)*O,(z*B-E*A)*O,(z*G-E*x)*O);F[e].addSelf(S);F[c].addSelf(S);F[f].addSelf(S);Q[e].addSelf(N);Q[c].addSelf(N);Q[f].addSelf(N)}var c,e,f,g,h,k,m,n,p,o,t,u,v,w,A,B,x,G,z,E,H,C,O,M,F=[],Q=[],S=new THREE.Vector3,N=new THREE.Vector3,j=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)F[c]=new THREE.Vector3,Q[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],h instanceof
-THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var ia=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)T.copy(h.vertexNormals[f]),g=h[ia[f]],M=F[g],j.copy(M),j.subSelf(T.multiplyScalar(T.dot(M))).normalize(),R.cross(h.vertexNormals[f],M),g=R.dot(Q[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(j.x,j.y,j.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,j,g,h){m=b.vertices[e].position;n=b.vertices[c].position;o=b.vertices[f].position;p=k[j];t=k[g];u=k[h];v=n.x-m.x;w=o.x-m.x;A=n.y-m.y;B=o.y-m.y;x=n.z-m.z;G=o.z-m.z;z=t.u-p.u;E=u.u-p.u;H=t.v-p.v;C=u.v-p.v;S=1/(z*C-E*H);O.set((C*v-H*w)*
+S,(C*A-H*B)*S,(C*x-H*G)*S);N.set((z*w-E*v)*S,(z*B-E*A)*S,(z*G-E*x)*S);F[e].addSelf(O);F[c].addSelf(O);F[f].addSelf(O);R[e].addSelf(N);R[c].addSelf(N);R[f].addSelf(N)}var c,e,f,g,h,k,m,n,o,p,t,u,v,w,A,B,x,G,z,E,H,C,S,L,F=[],R=[],O=new THREE.Vector3,N=new THREE.Vector3,j=new THREE.Vector3,T=new THREE.Vector3,ca=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)F[c]=new THREE.Vector3,R[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],h instanceof
+THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var ga=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)ca.copy(h.vertexNormals[f]),g=h[ga[f]],L=F[g],j.copy(L),j.subSelf(ca.multiplyScalar(ca.dot(L))).normalize(),T.cross(h.vertexNormals[f],L),g=T.dot(R[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(j.x,j.y,j.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
 void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,h,k,m={};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(g=b(k.a,k.b),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.a,k.c),c(m,g,e)):k instanceof THREE.Face4&&(g=b(k.b,k.d),c(m,g,e),g=b(k.a,k.b),c(m,g,e),g=b(k.a,k.d),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.c,k.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];g=k.vertexIndices[0];h=k.vertexIndices[1];
 void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,h,k,m={};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(g=b(k.a,k.b),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.a,k.c),c(m,g,e)):k instanceof THREE.Face4&&(g=b(k.b,k.d),c(m,g,e),g=b(k.a,k.b),c(m,g,e),g=b(k.a,k.d),c(m,g,e),g=b(k.b,k.c),c(m,g,e),g=b(k.c,k.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];g=k.vertexIndices[0];h=k.vertexIndices[1];
 k.faceIndices=m[b(g,h)].array;for(g=0;g<k.faceIndices.length;g++)h=k.faceIndices[g],k.faces.push(this.faces[h])}}};THREE.GeometryIdCounter=0;
 k.faceIndices=m[b(g,h)].array;for(g=0;g<k.faceIndices.length;g++)h=k.faceIndices[g],k.faces.push(this.faces[h])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,e,c,f,g,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,k,m,n,p,o,t,u;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);k=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;p=this.points[e[0]];o=this.points[e[1]];
-t=this.points[e[2]];u=this.points[e[3]];m=k*k;n=k*m;f.x=c(p.x,o.x,t.x,u.x,k,m,n);f.y=c(p.y,o.y,t.y,u.y,k,m,n);f.z=c(p.z,o.z,t.z,u.z,k,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
-m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,k,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];k=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<k-1;c++)f=g+c*(1/k)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
+THREE.Spline=function(b){function c(b,e,c,f,g,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,k,m,n,o,p,t,u;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);k=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;o=this.points[e[0]];p=this.points[e[1]];
+t=this.points[e[2]];u=this.points[e[3]];m=k*k;n=k*m;f.x=c(o.x,p.x,t.x,u.x,k,m,n);f.y=c(o.y,p.y,t.y,u.y,k,m,n);f.z=c(o.z,p.z,t.z,u.z,k,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
+m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,k,m=[],n=new THREE.Vector3,o=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=o.chunks[e]-o.chunks[e-1];k=Math.ceil(b*c/o.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<k-1;c++)f=g+c*(1/k)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
 m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
@@ -126,13 +126,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,c,e){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=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,
 THREE.LOD.prototype.update=function(b,c,e){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=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,c,e)};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()};
 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,c,e)};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=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,e,f,g,h,k,m,n,p,o,t,u,v,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var A=w.egdes=this.geometry.edges,B=w.edgeFaces=[];g=0;var x=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],x.push(g),g+=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(c=A.length;b<c;b++)m=A[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],k=m.vertexIndices[0],m=m.vertexIndices[1],e.a===k?(n="a",o=x[g]+0):e.b===k?(n="b",o=x[g]+1):e.c===k?(n="c",o=x[g]+2):e.d===k&&(n="d",o=x[g]+3),e.a===m?(n+="a",t=x[g]+0):e.b===m?(n+="b",t=x[g]+1):e.c===m?(n+="c",t=x[g]+2):e.d===m&&(n+="d",t=x[g]+3),f.a===k?(p="a",u=x[h]+0):f.b===k?(p="b",u=x[h]+1):f.c===k?(p="c",u=x[h]+2):f.d===k&&(p="d",u=x[h]+3),f.a===m?(p+="a",v=x[h]+0):f.b===m?(p+="b",v=x[h]+
-1):f.c===m?(p+="c",v=x[h]+2):f.d===m&&(p+="d",v=x[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>t&&(e=o,o=t,t=e):o<t&&(e=o,o=t,t=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(o,t,u,v),e.normal.set(1,0,0),B.push(e);this.geometry=w}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,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,k,m,n,p,o,t=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;k=g[n];k instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(k.normal);e.push(m);
-for(m=0;m<p;m++)o=b[k[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(k=h+1;k<g.length;k++)m=e[k],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,k,m,n,p,o,t,u,v,w,A,B=0,x=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){h=c[x[w]];m=b[h];for(A=0;A<g;A++)if(k=e[x[A]],n=b[k],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(B++,B===1&&(p=m,o=n,t=h,u=k,v=x[w]),B===2))return v+=x[w],v==="ad"||v==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,u,
-k,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[t,h,k,u],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,h,k,m,n,o,p,t,u,v,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var A=w.egdes=this.geometry.edges,B=w.edgeFaces=[];g=0;var x=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],x.push(g),g+=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(c=A.length;b<c;b++)m=A[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],k=m.vertexIndices[0],m=m.vertexIndices[1],e.a===k?(n="a",p=x[g]+0):e.b===k?(n="b",p=x[g]+1):e.c===k?(n="c",p=x[g]+2):e.d===k&&(n="d",p=x[g]+3),e.a===m?(n+="a",t=x[g]+0):e.b===m?(n+="b",t=x[g]+1):e.c===m?(n+="c",t=x[g]+2):e.d===m&&(n+="d",t=x[g]+3),f.a===k?(o="a",u=x[h]+0):f.b===k?(o="b",u=x[h]+1):f.c===k?(o="c",u=x[h]+2):f.d===k&&(o="d",u=x[h]+3),f.a===m?(o+="a",v=x[h]+0):f.b===m?(o+="b",v=x[h]+
+1):f.c===m?(o+="c",v=x[h]+2):f.d===m&&(o+="d",v=x[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?p>t&&(e=p,p=t,t=e):p<t&&(e=p,p=t,t=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(p,t,u,v),e.normal.set(1,0,0),B.push(e);this.geometry=w}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,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,k,m,n,o,p,t=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;k=g[n];k instanceof THREE.Face4?(o=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(o=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(k.normal);e.push(m);
+for(m=0;m<o;m++)p=b[k[t[m]]],c.push(new THREE.Vertex(p.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(k=h+1;k<g.length;k++)m=e[k],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,k,m,n,o,p,t,u,v,w,A,B=0,x=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){h=c[x[w]];m=b[h];for(A=0;A<g;A++)if(k=e[x[A]],n=b[k],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(B++,B===1&&(o=m,p=n,t=h,u=k,v=x[w]),B===2))return v+=x[w],v==="ad"||v==="ac"?{faces:[c,e],vertices:[o,p,n,m],indices:[t,u,
+k,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[o,m,n,p],indices:[t,h,k,u],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;
 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;
 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);
 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.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.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,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&k>=0&&m>=0?!0:g<0&&h<0||k<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],k,m,n=[],p,o,t=[],u,v=[],w,A,B=[],x,G,z=[],E=new THREE.Vector4,H=new THREE.Vector4,
-C=new THREE.Matrix4,O=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,e){C.multiply(e.projectionMatrix,e.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,e){C.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var e=[],k,m,n;g=0;m=
-b.objects;b=0;for(k=m.length;b<k;b++){n=m[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh){a:{p=void 0;for(var t=n.matrixWorld,o=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(p=M[u].x*t.n14+M[u].y*t.n24+M[u].z*t.n34+M[u].w,p<=o){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,E.copy(n.position),C.multiplyVector3(E),f.object=n,f.z=E.z,e.push(f)}j&&e.sort(c);return e};this.projectScene=function(f,g,j){var h=[],
-E=g.near,ia=g.far,V,K,da,$,aa,ca,ha,ka,fa,I,Y,X,Z,ga,U,J,na;G=A=u=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);C.multiply(g.projectionMatrix,g.matrixWorldInverse);M[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);M[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);M[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);M[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);M[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);M[5].set(C.n41+C.n31,C.n42+
-C.n32,C.n43+C.n33,C.n44+C.n34);for(V=0;V<6;V++)fa=M[V],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,g,!0);f=0;for(V=fa.length;f<V;f++)if(I=fa[f].object,I.visible)if(Y=I.matrixWorld,X=I.matrixRotationWorld,Z=I.materials,ga=I.overdraw,m=0,I instanceof THREE.Mesh){U=I.geometry;$=U.vertices;J=U.faces;U=U.faceVertexUvs;K=0;for(da=$.length;K<da;K++)k=b(),k.positionWorld.copy($[K].position),Y.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),C.multiplyVector4(k.positionScreen),
-k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>E&&k.positionScreen.z<ia;$=0;for(K=J.length;$<K;$++){da=J[$];if(da instanceof THREE.Face3)if(aa=n[da.a],ca=n[da.b],ha=n[da.c],aa.visible&&ca.visible&&ha.visible&&(I.doubleSided||I.flipSided!=(ha.positionScreen.x-aa.positionScreen.x)*(ca.positionScreen.y-aa.positionScreen.y)-(ha.positionScreen.y-aa.positionScreen.y)*(ca.positionScreen.x-aa.positionScreen.x)<0))ka=t[o]=t[o]||new THREE.RenderableFace3,
-o++,p=ka,p.v1.copy(aa),p.v2.copy(ca),p.v3.copy(ha);else continue;else if(da instanceof THREE.Face4)if(aa=n[da.a],ca=n[da.b],ha=n[da.c],ka=n[da.d],aa.visible&&ca.visible&&ha.visible&&ka.visible&&(I.doubleSided||I.flipSided!=((ka.positionScreen.x-aa.positionScreen.x)*(ca.positionScreen.y-aa.positionScreen.y)-(ka.positionScreen.y-aa.positionScreen.y)*(ca.positionScreen.x-aa.positionScreen.x)<0||(ca.positionScreen.x-ha.positionScreen.x)*(ka.positionScreen.y-ha.positionScreen.y)-(ca.positionScreen.y-ha.positionScreen.y)*
-(ka.positionScreen.x-ha.positionScreen.x)<0)))na=v[u]=v[u]||new THREE.RenderableFace4,u++,p=na,p.v1.copy(aa),p.v2.copy(ca),p.v3.copy(ha),p.v4.copy(ka);else continue;p.normalWorld.copy(da.normal);X.multiplyVector3(p.normalWorld);p.centroidWorld.copy(da.centroid);Y.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);C.multiplyVector3(p.centroidScreen);ha=da.vertexNormals;aa=0;for(ca=ha.length;aa<ca;aa++)ka=p.vertexNormalsWorld[aa],ka.copy(ha[aa]),X.multiplyVector3(ka);aa=0;for(ca=
-U.length;aa<ca;aa++)if(na=U[aa][$]){ha=0;for(ka=na.length;ha<ka;ha++)p.uvs[aa][ha]=na[ha]}p.meshMaterials=Z;p.faceMaterials=da.materials;p.overdraw=ga;p.z=p.centroidScreen.z;h.push(p)}}else if(I instanceof THREE.Line){O.multiply(C,Y);$=I.geometry.vertices;aa=b();aa.positionScreen.copy($[0].position);O.multiplyVector4(aa.positionScreen);K=1;for(da=$.length;K<da;K++)if(aa=b(),aa.positionScreen.copy($[K].position),O.multiplyVector4(aa.positionScreen),ca=n[m-2],F.copy(aa.positionScreen),Q.copy(ca.positionScreen),
-e(F,Q))F.multiplyScalar(1/F.w),Q.multiplyScalar(1/Q.w),Y=B[A]=B[A]||new THREE.RenderableLine,A++,w=Y,w.v1.positionScreen.copy(F),w.v2.positionScreen.copy(Q),w.z=Math.max(F.z,Q.z),w.materials=I.materials,h.push(w)}else if(I instanceof THREE.Particle&&(H.set(I.matrixWorld.n14,I.matrixWorld.n24,I.matrixWorld.n34,1),C.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))Y=z[G]=z[G]||new THREE.RenderableParticle,G++,x=Y,x.x=H.x/H.w,x.y=H.y/H.w,x.z=H.z,x.rotation=I.rotation.z,x.scale.x=I.scale.x*Math.abs(x.x-(H.x+
-g.projectionMatrix.n11)/(H.w+g.projectionMatrix.n14)),x.scale.y=I.scale.y*Math.abs(x.y-(H.y+g.projectionMatrix.n22)/(H.w+g.projectionMatrix.n24)),x.materials=I.materials,h.push(x);j&&h.sort(c);return h}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,p,o,t,u,v,w,A;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(u=b[n],u instanceof THREE.RenderableParticle){w=u.x*g+g;A=u.y*h+h;o=0;for(t=u.material.length;o<t;o++)if(v=u.material[o],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=w+"px",v.style.top=A+"px"}}};
+THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&k>=0&&m>=0?!0:g<0&&h<0||k<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],k,m,n=[],o,p,t=[],u,v=[],w,A,B=[],x,G,z=[],E=new THREE.Vector4,H=new THREE.Vector4,
+C=new THREE.Matrix4,S=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){C.multiply(e.projectionMatrix,e.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,e){C.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var e=[],k,m,n;g=0;m=
+b.objects;b=0;for(k=m.length;b<k;b++){n=m[b];var o;if(!(o=!n.visible))if(o=n instanceof THREE.Mesh){a:{o=void 0;for(var t=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),u=0;u<6;u++)if(o=L[u].x*t.n14+L[u].y*t.n24+L[u].z*t.n34+L[u].w,o<=p){o=!1;break a}o=!0}o=!o}if(!o)o=h[g]=h[g]||new THREE.RenderableObject,g++,f=o,E.copy(n.position),C.multiplyVector3(E),f.object=n,f.z=E.z,e.push(f)}j&&e.sort(c);return e};this.projectScene=function(f,g,j){var h=[],
+E=g.near,ga=g.far,Z,K,$,V,W,aa,ma,ea,ha,I,Y,X,ja,fa,U,J,la;G=A=u=p=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);C.multiply(g.projectionMatrix,g.matrixWorldInverse);L[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);L[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);L[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);L[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);L[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);L[5].set(C.n41+C.n31,C.n42+C.n32,
+C.n43+C.n33,C.n44+C.n34);for(Z=0;Z<6;Z++)ha=L[Z],ha.divideScalar(Math.sqrt(ha.x*ha.x+ha.y*ha.y+ha.z*ha.z));ha=this.projectObjects(f,g,!0);f=0;for(Z=ha.length;f<Z;f++)if(I=ha[f].object,I.visible)if(Y=I.matrixWorld,X=I.matrixRotationWorld,ja=I.materials,fa=I.overdraw,m=0,I instanceof THREE.Mesh){U=I.geometry;V=U.vertices;J=U.faces;U=U.faceVertexUvs;K=0;for($=V.length;K<$;K++)k=b(),k.positionWorld.copy(V[K].position),Y.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),C.multiplyVector4(k.positionScreen),
+k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>E&&k.positionScreen.z<ga;V=0;for(K=J.length;V<K;V++){$=J[V];if($ instanceof THREE.Face3)if(W=n[$.a],aa=n[$.b],ma=n[$.c],W.visible&&aa.visible&&ma.visible&&(I.doubleSided||I.flipSided!=(ma.positionScreen.x-W.positionScreen.x)*(aa.positionScreen.y-W.positionScreen.y)-(ma.positionScreen.y-W.positionScreen.y)*(aa.positionScreen.x-W.positionScreen.x)<0))ea=t[p]=t[p]||new THREE.RenderableFace3,p++,
+o=ea,o.v1.copy(W),o.v2.copy(aa),o.v3.copy(ma);else continue;else if($ instanceof THREE.Face4)if(W=n[$.a],aa=n[$.b],ma=n[$.c],ea=n[$.d],W.visible&&aa.visible&&ma.visible&&ea.visible&&(I.doubleSided||I.flipSided!=((ea.positionScreen.x-W.positionScreen.x)*(aa.positionScreen.y-W.positionScreen.y)-(ea.positionScreen.y-W.positionScreen.y)*(aa.positionScreen.x-W.positionScreen.x)<0||(aa.positionScreen.x-ma.positionScreen.x)*(ea.positionScreen.y-ma.positionScreen.y)-(aa.positionScreen.y-ma.positionScreen.y)*
+(ea.positionScreen.x-ma.positionScreen.x)<0)))la=v[u]=v[u]||new THREE.RenderableFace4,u++,o=la,o.v1.copy(W),o.v2.copy(aa),o.v3.copy(ma),o.v4.copy(ea);else continue;o.normalWorld.copy($.normal);X.multiplyVector3(o.normalWorld);o.centroidWorld.copy($.centroid);Y.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);C.multiplyVector3(o.centroidScreen);ma=$.vertexNormals;W=0;for(aa=ma.length;W<aa;W++)ea=o.vertexNormalsWorld[W],ea.copy(ma[W]),X.multiplyVector3(ea);W=0;for(aa=U.length;W<
+aa;W++)if(la=U[W][V]){ma=0;for(ea=la.length;ma<ea;ma++)o.uvs[W][ma]=la[ma]}o.meshMaterials=ja;o.faceMaterials=$.materials;o.overdraw=fa;o.z=o.centroidScreen.z;h.push(o)}}else if(I instanceof THREE.Line){S.multiply(C,Y);V=I.geometry.vertices;W=b();W.positionScreen.copy(V[0].position);S.multiplyVector4(W.positionScreen);K=1;for($=V.length;K<$;K++)if(W=b(),W.positionScreen.copy(V[K].position),S.multiplyVector4(W.positionScreen),aa=n[m-2],F.copy(W.positionScreen),R.copy(aa.positionScreen),e(F,R))F.multiplyScalar(1/
+F.w),R.multiplyScalar(1/R.w),Y=B[A]=B[A]||new THREE.RenderableLine,A++,w=Y,w.v1.positionScreen.copy(F),w.v2.positionScreen.copy(R),w.z=Math.max(F.z,R.z),w.materials=I.materials,h.push(w)}else if(I instanceof THREE.Particle&&(H.set(I.matrixWorld.n14,I.matrixWorld.n24,I.matrixWorld.n34,1),C.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))Y=z[G]=z[G]||new THREE.RenderableParticle,G++,x=Y,x.x=H.x/H.w,x.y=H.y/H.w,x.z=H.z,x.rotation=I.rotation.z,x.scale.x=I.scale.x*Math.abs(x.x-(H.x+g.projectionMatrix.n11)/(H.w+
+g.projectionMatrix.n14)),x.scale.y=I.scale.y*Math.abs(x.y-(H.y+g.projectionMatrix.n22)/(H.w+g.projectionMatrix.n24)),x.materials=I.materials,h.push(x);j&&h.sort(c);return h}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,o,p,t,u,v,w,A;b=c.projectScene(e,f);n=0;for(o=b.length;n<o;n++)if(u=b[n],u instanceof THREE.RenderableParticle){w=u.x*g+g;A=u.y*h+h;p=0;for(t=u.material.length;p<t;p++)if(v=u.material[p],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=w+"px",v.style.top=A+"px"}}};
 THREE.CanvasRenderer=function(b){function c(b){if(x!=b)w.globalAlpha=x=b}function e(b){if(G!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}G=b}}function f(b){if(z!=b.hex)z=b.hex,w.strokeStyle="#"+h(z.toString(16))}function g(b){if(E!=b.hex)E=b.hex,w.fillStyle="#"+h(E.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
 THREE.CanvasRenderer=function(b){function c(b){if(x!=b)w.globalAlpha=x=b}function e(b){if(G!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}G=b}}function f(b){if(z!=b.hex)z=b.hex,w.strokeStyle="#"+h(z.toString(16))}function g(b){if(E!=b.hex)E=b.hex,w.fillStyle="#"+h(E.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
-var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,u,v,w=p.getContext("2d"),A=new THREE.Color(0),B=0,x=1,G=0,z=null,E=null,H=null,C=null,O=null,M,F,Q,S,N=new THREE.RenderableVertex,j=new THREE.RenderableVertex,R,T,ia,V,K,da,$,aa,ca,ha,ka,fa,I=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),Z=new THREE.Color(0),ga=new THREE.Color(0),U,J,na,ja,oa,ma,Ca,Aa,ea,P,ua=new THREE.Rectangle,qa=new THREE.Rectangle,W=new THREE.Rectangle,
-Va=!1,ta=new THREE.Color,va=new THREE.Color,Qa=new THREE.Color,Ra=new THREE.Color,pa=new THREE.Vector3,Na,Oa,Wa,wa,Pa,Sa,b=16;Na=document.createElement("canvas");Na.width=Na.height=2;Oa=Na.getContext("2d");Oa.fillStyle="rgba(0,0,0,1)";Oa.fillRect(0,0,2,2);Wa=Oa.getImageData(0,0,2,2);wa=Wa.data;Pa=document.createElement("canvas");Pa.width=Pa.height=b;Sa=Pa.getContext("2d");Sa.translate(-b/2,-b/2);Sa.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
-faces:0};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.width=o;p.height=t;ua.set(-u,-v,u,v);x=1;G=0;O=C=H=E=z=null};this.setClearColor=function(b,e){A=b;B=e};this.setClearColorHex=function(b,e){A.setHex(b);B=e};this.clear=function(){w.setTransform(1,0,0,-1,u,v);if(!qa.isEmpty())qa.inflate(1),qa.minSelf(ua),A.hex==0&&B==0?w.clearRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*
-255)+","+B+")",w.fillRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight())),qa.empty()};this.render=function(b,h){function p(b){var e,c,f,j=b.lights;va.setRGB(0,0,0);Qa.setRGB(0,0,0);Ra.setRGB(0,0,0);b=0;for(e=j.length;b<e;b++)c=j[b],f=c.color,c instanceof THREE.AmbientLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):c instanceof THREE.DirectionalLight?(Qa.r+=f.r,Qa.g+=f.g,Qa.b+=f.b):c instanceof THREE.PointLight&&(Ra.r+=f.r,Ra.g+=f.g,Ra.b+=f.b)}function t(b,e,c,f){var j,g,h,k,m=b.lights,b=0;for(j=m.length;b<
-j;b++)g=m[b],h=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):g instanceof THREE.PointLight&&(k=c.dot(pa.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function o(b,j,h){c(h.opacity);e(h.blending);var k,m,n,p,t,ta;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)p=h.map.image,t=p.width>>1,ta=p.height>>
-1,h=j.scale.x*u,n=j.scale.y*v,k=h*t,m=n*ta,W.set(b.x-k,b.y-m,b.x+k,b.y+m),ua.instersects(W)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-n),w.translate(-t,-ta),w.drawImage(p,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,W.set(b.x-k,b.y-m,b.x+k,b.y+m),ua.instersects(W)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function x(b,j,g,h){c(h.opacity);e(h.blending);
-w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(H!=b)w.lineWidth=H=b;b=h.linecap;if(C!=b)w.lineCap=C=b;b=h.linejoin;if(O!=b)w.lineJoin=O=b;f(h.color);w.stroke();W.inflate(h.linewidth*2)}}function A(b,f,j,g,m,n,p,W,o){k.data.vertices+=3;k.data.faces++;c(W.opacity);e(W.blending);R=b.positionScreen.x;T=b.positionScreen.y;ia=f.positionScreen.x;V=f.positionScreen.y;K=j.positionScreen.x;
-da=j.positionScreen.y;B(R,T,ia,V,K,da);if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&(ja=p.uvs[0],xa(R,T,ia,V,K,da,W.map.image,ja[g].u,ja[g].v,ja[m].u,ja[m].v,ja[n].u,ja[n].v));else if(W.envMap){if(W.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,pa.copy(p.vertexNormalsWorld[0]),oa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ma=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[1]),Ca=(pa.x*b.n11+
-pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[2]),ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,P=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,xa(R,T,ia,V,K,da,W.envMap.image,oa,ma,Ca,Aa,ea,P)}else W.wireframe?E(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):D(W.color);else if(W instanceof THREE.MeshLambertMaterial)W.map&&!W.wireframe&&(W.map.mapping instanceof THREE.UVMapping&&(ja=p.uvs[0],xa(R,T,ia,V,K,da,W.map.image,
-ja[g].u,ja[g].v,ja[m].u,ja[m].v,ja[n].u,ja[n].v)),e(THREE.SubtractiveBlending)),Va?!W.wireframe&&W.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(Y.r=X.r=Z.r=va.r,Y.g=X.g=Z.g=va.g,Y.b=X.b=Z.b=va.b,t(o,p.v1.positionWorld,p.vertexNormalsWorld[0],Y),t(o,p.v2.positionWorld,p.vertexNormalsWorld[1],X),t(o,p.v3.positionWorld,p.vertexNormalsWorld[2],Z),ga.r=(X.r+Z.r)*0.5,ga.g=(X.g+Z.g)*0.5,ga.b=(X.b+Z.b)*0.5,na=y(Y,X,Z,ga),xa(R,T,ia,V,K,da,na,0,0,1,0,0,1)):(ta.r=va.r,ta.g=va.g,ta.b=va.b,t(o,
-p.centroidWorld,p.normalWorld,ta),I.r=Math.max(0,Math.min(W.color.r*ta.r,1)),I.g=Math.max(0,Math.min(W.color.g*ta.g,1)),I.b=Math.max(0,Math.min(W.color.b*ta.b,1)),I.updateHex(),W.wireframe?E(I,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):D(I)):W.wireframe?E(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):D(W.color);else if(W instanceof THREE.MeshDepthMaterial)U=h.near,J=h.far,Y.r=Y.g=Y.b=1-Ga(b.positionScreen.z,U,J),X.r=X.g=X.b=1-Ga(f.positionScreen.z,U,J),Z.r=
-Z.g=Z.b=1-Ga(j.positionScreen.z,U,J),ga.r=(X.r+Z.r)*0.5,ga.g=(X.g+Z.g)*0.5,ga.b=(X.b+Z.b)*0.5,na=y(Y,X,Z,ga),xa(R,T,ia,V,K,da,na,0,0,1,0,0,1);else if(W instanceof THREE.MeshNormalMaterial)I.r=La(p.normalWorld.x),I.g=La(p.normalWorld.y),I.b=La(p.normalWorld.z),I.updateHex(),W.wireframe?E(I,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):D(I)}function z(b,f,j,g,m,W,n,p,o){k.data.vertices+=4;k.data.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,g,0,1,3,n,p,o),A(m,j,W,1,2,3,
-n,p,o);else if(R=b.positionScreen.x,T=b.positionScreen.y,ia=f.positionScreen.x,V=f.positionScreen.y,K=j.positionScreen.x,da=j.positionScreen.y,$=g.positionScreen.x,aa=g.positionScreen.y,ca=m.positionScreen.x,ha=m.positionScreen.y,ka=W.positionScreen.x,fa=W.positionScreen.y,p instanceof THREE.MeshBasicMaterial)G(R,T,ia,V,K,da,$,aa),p.wireframe?E(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(p.color);else if(p instanceof THREE.MeshLambertMaterial)Va?!p.wireframe&&p.shading==
-THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(Y.r=X.r=Z.r=ga.r=va.r,Y.g=X.g=Z.g=ga.g=va.g,Y.b=X.b=Z.b=ga.b=va.b,t(o,n.v1.positionWorld,n.vertexNormalsWorld[0],Y),t(o,n.v2.positionWorld,n.vertexNormalsWorld[1],X),t(o,n.v4.positionWorld,n.vertexNormalsWorld[3],Z),t(o,n.v3.positionWorld,n.vertexNormalsWorld[2],ga),na=y(Y,X,Z,ga),B(R,T,ia,V,$,aa),xa(R,T,ia,V,$,aa,na,0,0,1,0,0,1),B(ca,ha,K,da,ka,fa),xa(ca,ha,K,da,ka,fa,na,1,0,1,1,0,1)):(ta.r=va.r,ta.g=va.g,ta.b=va.b,t(o,n.centroidWorld,n.normalWorld,
-ta),I.r=Math.max(0,Math.min(p.color.r*ta.r,1)),I.g=Math.max(0,Math.min(p.color.g*ta.g,1)),I.b=Math.max(0,Math.min(p.color.b*ta.b,1)),I.updateHex(),G(R,T,ia,V,K,da,$,aa),p.wireframe?E(I,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(I)):(G(R,T,ia,V,K,da,$,aa),p.wireframe?E(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(p.color));else if(p instanceof THREE.MeshNormalMaterial)I.r=La(n.normalWorld.x),I.g=La(n.normalWorld.y),I.b=La(n.normalWorld.z),I.updateHex(),
-G(R,T,ia,V,K,da,$,aa),p.wireframe?E(I,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):D(I);else if(p instanceof THREE.MeshDepthMaterial)U=h.near,J=h.far,Y.r=Y.g=Y.b=1-Ga(b.positionScreen.z,U,J),X.r=X.g=X.b=1-Ga(f.positionScreen.z,U,J),Z.r=Z.g=Z.b=1-Ga(g.positionScreen.z,U,J),ga.r=ga.g=ga.b=1-Ga(j.positionScreen.z,U,J),na=y(Y,X,Z,ga),B(R,T,ia,V,$,aa),xa(R,T,ia,V,$,aa,na,0,0,1,0,0,1),B(ca,ha,K,da,ka,fa),xa(ca,ha,K,da,ka,fa,na,1,0,1,1,0,1)}function B(b,e,c,f,j,g){w.beginPath();w.moveTo(b,
-e);w.lineTo(c,f);w.lineTo(j,g);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,j,g,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,g);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function E(b,e,c,j){if(H!=e)w.lineWidth=H=e;if(C!=c)w.lineCap=C=c;if(O!=j)w.lineJoin=O=j;f(b);w.stroke();W.inflate(e*2)}function D(b){g(b);w.fill()}function xa(b,e,c,f,j,g,h,k,m,p,n,W,t){var o,u;o=h.width-1;u=h.height-1;k*=o;m*=u;p*=o;n*=u;W*=o;t*=u;c-=b;f-=e;j-=b;g-=e;p-=k;n-=m;W-=k;t-=m;o=p*t-W*n;o!=0&&(u=1/o,o=(t*
-c-n*j)*u,n=(t*f-n*g)*u,c=(p*j-W*c)*u,f=(p*g-W*f)*u,b=b-o*k-c*m,e=e-n*k-f*m,w.save(),w.transform(o,n,c,f,b,e),w.clip(),w.drawImage(h,0,0),w.restore())}function y(b,e,c,f){var j=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),W=~~(f.g*255),f=~~(f.b*255);wa[0]=j<0?0:j>255?255:j;wa[1]=g<0?0:g>255?255:g;wa[2]=b<0?0:b>255?255:b;wa[4]=h<0?0:h>255?255:h;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:e;wa[8]=m<0?0:m>255?
-255:m;wa[9]=p<0?0:p>255?255:p;wa[10]=c<0?0:c>255?255:c;wa[12]=n<0?0:n>255?255:n;wa[13]=W<0?0:W>255?255:W;wa[14]=f<0?0:f>255?255:f;Oa.putImageData(Wa,0,0);Sa.drawImage(Na,0,0);return Pa}function Ga(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function La(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Da(b,e){var c=e.x-b.x,f=e.y-b.y,j=1/Math.sqrt(c*c+f*f);c*=j;f*=j;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ta,$a,la,ya,Ea,Ma,Ua,ra;this.autoClear?this.clear():w.setTransform(1,0,0,-1,u,v);k.data.vertices=0;k.data.faces=
-0;m=n.projectScene(b,h,this.sortElements);(Va=b.lights.length>0)&&p(b);Ta=0;for($a=m.length;Ta<$a;Ta++){la=m[Ta];W.empty();if(la instanceof THREE.RenderableParticle){M=la;M.x*=u;M.y*=v;ya=0;for(Ea=la.materials.length;ya<Ea;)ra=la.materials[ya++],ra.opacity!=0&&o(M,la,ra,b)}else if(la instanceof THREE.RenderableLine){if(M=la.v1,F=la.v2,M.positionScreen.x*=u,M.positionScreen.y*=v,F.positionScreen.x*=u,F.positionScreen.y*=v,W.addPoint(M.positionScreen.x,M.positionScreen.y),W.addPoint(F.positionScreen.x,
-F.positionScreen.y),ua.instersects(W)){ya=0;for(Ea=la.materials.length;ya<Ea;)ra=la.materials[ya++],ra.opacity!=0&&x(M,F,la,ra,b)}}else if(la instanceof THREE.RenderableFace3){if(M=la.v1,F=la.v2,Q=la.v3,M.positionScreen.x*=u,M.positionScreen.y*=v,F.positionScreen.x*=u,F.positionScreen.y*=v,Q.positionScreen.x*=u,Q.positionScreen.y*=v,la.overdraw&&(Da(M.positionScreen,F.positionScreen),Da(F.positionScreen,Q.positionScreen),Da(Q.positionScreen,M.positionScreen)),W.add3Points(M.positionScreen.x,M.positionScreen.y,
-F.positionScreen.x,F.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y),ua.instersects(W)){ya=0;for(Ea=la.meshMaterials.length;ya<Ea;)if(ra=la.meshMaterials[ya++],ra instanceof THREE.MeshFaceMaterial){Ma=0;for(Ua=la.faceMaterials.length;Ma<Ua;)(ra=la.faceMaterials[Ma++])&&ra.opacity!=0&&A(M,F,Q,0,1,2,la,ra,b)}else ra.opacity!=0&&A(M,F,Q,0,1,2,la,ra,b)}}else if(la instanceof THREE.RenderableFace4&&(M=la.v1,F=la.v2,Q=la.v3,S=la.v4,M.positionScreen.x*=u,M.positionScreen.y*=v,F.positionScreen.x*=
-u,F.positionScreen.y*=v,Q.positionScreen.x*=u,Q.positionScreen.y*=v,S.positionScreen.x*=u,S.positionScreen.y*=v,N.positionScreen.copy(F.positionScreen),j.positionScreen.copy(S.positionScreen),la.overdraw&&(Da(M.positionScreen,F.positionScreen),Da(F.positionScreen,S.positionScreen),Da(S.positionScreen,M.positionScreen),Da(Q.positionScreen,N.positionScreen),Da(Q.positionScreen,j.positionScreen)),W.addPoint(M.positionScreen.x,M.positionScreen.y),W.addPoint(F.positionScreen.x,F.positionScreen.y),W.addPoint(Q.positionScreen.x,
-Q.positionScreen.y),W.addPoint(S.positionScreen.x,S.positionScreen.y),ua.instersects(W))){ya=0;for(Ea=la.meshMaterials.length;ya<Ea;)if(ra=la.meshMaterials[ya++],ra instanceof THREE.MeshFaceMaterial){Ma=0;for(Ua=la.faceMaterials.length;Ma<Ua;)(ra=la.faceMaterials[Ma++])&&ra.opacity!=0&&z(M,F,Q,S,N,j,la,ra,b)}else ra.opacity!=0&&z(M,F,Q,S,N,j,la,ra,b)}qa.addRectangle(W)}w.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,j,g,h;f=0;for(j=b.lights.length;f<j;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(g.position)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h)):g instanceof THREE.PointLight&&(S.sub(g.position,e.centroidWorld),S.normalize(),h=e.normalWorld.dot(S)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h))}function c(e,c,j,m,n,t){k.data.vertices+=3;k.data.faces++;R=f(T++);R.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?E?(C.r=O.r,C.g=O.g,C.b=O.b,b(t,m,C),H.r=Math.max(0,Math.min(n.color.r*C.r,1)),H.g=Math.max(0,Math.min(n.color.g*C.g,1)),H.b=Math.max(0,Math.min(n.color.b*C.b,1)),H.updateHex()):H.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(Q=1-n.__2near/(n.__farPlusNear-
-m.z*n.__farMinusNear),H.setRGB(Q,Q,Q)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: #"+h(H.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: #"+h(H.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(R)}function e(e,c,j,m,
-n,t,o){k.data.vertices+=4;k.data.faces++;R=f(T++);R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?E?(C.r=O.r,C.g=O.g,C.b=O.b,b(o,n,C),H.r=Math.max(0,Math.min(t.color.r*C.r,1)),H.g=Math.max(0,Math.min(t.color.g*C.g,1)),H.b=Math.max(0,Math.min(t.color.b*
-C.b,1)),H.updateHex()):H.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(Q=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),H.setRGB(Q,Q,Q)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));t.wireframe?R.setAttribute("style","fill: none; stroke: #"+h(H.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):R.setAttribute("style",
-"fill: #"+h(H.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(R)}function f(b){N[b]==null&&(N[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&N[b].setAttribute("shape-rendering","crispEdges"));return N[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,v,w,A,B,x,G=new THREE.Rectangle,z=new THREE.Rectangle,E=
-!1,H=new THREE.Color(16777215),C=new THREE.Color(16777215),O=new THREE.Color(0),M=new THREE.Color(0),F=new THREE.Color(0),Q,S=new THREE.Vector3,N=[],j=[],R,T,ia,V=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,e){o=b;t=e;u=o/2;v=t/2;p.setAttribute("viewBox",-u+" "+-v+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);G.set(-u,
--v,u,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,t,o,H,C,Q,I,N;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,f,this.sortElements);ia=T=0;if(E=b.lights.length>0){I=b.lights;O.setRGB(0,0,0);M.setRGB(0,0,0);F.setRGB(0,0,0);g=0;for(t=I.length;g<t;g++)o=I[g],H=o.color,o instanceof THREE.AmbientLight?(O.r+=H.r,O.g+=H.g,O.b+=H.b):o instanceof THREE.DirectionalLight?(M.r+=H.r,M.g+=H.g,M.b+=H.b):o instanceof
-THREE.PointLight&&(F.r+=H.r,F.g+=H.g,F.b+=H.b)}g=0;for(t=m.length;g<t;g++)if(I=m[g],z.empty(),I instanceof THREE.RenderableParticle){w=I;w.x*=u;w.y*=-v;o=0;for(H=I.materials.length;o<H;)o++}else if(I instanceof THREE.RenderableLine){if(w=I.v1,A=I.v2,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,z.addPoint(w.positionScreen.x,w.positionScreen.y),z.addPoint(A.positionScreen.x,A.positionScreen.y),G.instersects(z)){o=0;for(H=I.materials.length;o<H;)if((N=I.materials[o++])&&
-N.opacity!=0){C=w;Q=A;var S=ia++;j[S]==null&&(j[S]=document.createElementNS("http://www.w3.org/2000/svg","line"),V==0&&j[S].setAttribute("shape-rendering","crispEdges"));R=j[S];R.setAttribute("x1",C.positionScreen.x);R.setAttribute("y1",C.positionScreen.y);R.setAttribute("x2",Q.positionScreen.x);R.setAttribute("y2",Q.positionScreen.y);N instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: ##"+h(N.color.hex.toString(16))+"; stroke-width: "+N.linewidth+"; stroke-opacity: "+
-N.opacity+"; stroke-linecap: "+N.linecap+"; stroke-linejoin: "+N.linejoin),p.appendChild(R))}}}else if(I instanceof THREE.RenderableFace3){if(w=I.v1,A=I.v2,B=I.v3,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,z.addPoint(w.positionScreen.x,w.positionScreen.y),z.addPoint(A.positionScreen.x,A.positionScreen.y),z.addPoint(B.positionScreen.x,B.positionScreen.y),G.instersects(z)){o=0;for(H=I.meshMaterials.length;o<
-H;)if(N=I.meshMaterials[o++],N instanceof THREE.MeshFaceMaterial){C=0;for(Q=I.faceMaterials.length;C<Q;)(N=I.faceMaterials[C++])&&N.opacity!=0&&c(w,A,B,I,N,b)}else N&&N.opacity!=0&&c(w,A,B,I,N,b)}}else if(I instanceof THREE.RenderableFace4&&(w=I.v1,A=I.v2,B=I.v3,x=I.v4,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,z.addPoint(w.positionScreen.x,w.positionScreen.y),z.addPoint(A.positionScreen.x,
-A.positionScreen.y),z.addPoint(B.positionScreen.x,B.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),G.instersects(z))){o=0;for(H=I.meshMaterials.length;o<H;)if(N=I.meshMaterials[o++],N instanceof THREE.MeshFaceMaterial){C=0;for(Q=I.faceMaterials.length;C<Q;)(N=I.faceMaterials[C++])&&N.opacity!=0&&e(w,A,B,x,I,N,b)}else N&&N.opacity!=0&&e(w,A,B,x,I,N,b)}}};
+var k=this,m=null,n=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),p,t,u,v,w=o.getContext("2d"),A=new THREE.Color(0),B=0,x=1,G=0,z=null,E=null,H=null,C=null,S=null,L,F,R,O,N=new THREE.RenderableVertex,j=new THREE.RenderableVertex,T,ca,ga,Z,K,$,V,W,aa,ma,ea,ha,I=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),ja=new THREE.Color(0),fa=new THREE.Color(0),U,J,la,ka,ia,xa,za,Ba,da,P,ta=new THREE.Rectangle,Q=new THREE.Rectangle,oa=new THREE.Rectangle,
+va=!1,ua=new THREE.Color,sa=new THREE.Color,Qa=new THREE.Color,Ra=new THREE.Color,pa=new THREE.Vector3,Na,Oa,Wa,wa,Pa,Sa,b=16;Na=document.createElement("canvas");Na.width=Na.height=2;Oa=Na.getContext("2d");Oa.fillStyle="rgba(0,0,0,1)";Oa.fillRect(0,0,2,2);Wa=Oa.getImageData(0,0,2,2);wa=Wa.data;Pa=document.createElement("canvas");Pa.width=Pa.height=b;Sa=Pa.getContext("2d");Sa.translate(-b/2,-b/2);Sa.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
+faces:0};this.setSize=function(b,e){p=b;t=e;u=p/2;v=t/2;o.width=p;o.height=t;ta.set(-u,-v,u,v);x=1;G=0;S=C=H=E=z=null};this.setClearColor=function(b,e){A=b;B=e};this.setClearColorHex=function(b,e){A.setHex(b);B=e};this.clear=function(){w.setTransform(1,0,0,-1,u,v);if(!Q.isEmpty())Q.inflate(1),Q.minSelf(ta),A.hex==0&&B==0?w.clearRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*255)+","+
+B+")",w.fillRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight())),Q.empty()};this.render=function(b,h){function o(b){var e,c,f,j=b.lights;sa.setRGB(0,0,0);Qa.setRGB(0,0,0);Ra.setRGB(0,0,0);b=0;for(e=j.length;b<e;b++)c=j[b],f=c.color,c instanceof THREE.AmbientLight?(sa.r+=f.r,sa.g+=f.g,sa.b+=f.b):c instanceof THREE.DirectionalLight?(Qa.r+=f.r,Qa.g+=f.g,Qa.b+=f.b):c instanceof THREE.PointLight&&(Ra.r+=f.r,Ra.g+=f.g,Ra.b+=f.b)}function t(b,e,c,f){var j,g,h,k,m=b.lights,b=0;for(j=m.length;b<j;b++)g=m[b],
+h=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):g instanceof THREE.PointLight&&(k=c.dot(pa.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function p(b,j,h){c(h.opacity);e(h.blending);var k,m,n,o,va,t;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)o=h.map.image,va=o.width>>1,t=o.height>>1,h=j.scale.x*
+u,n=j.scale.y*v,k=h*va,m=n*t,oa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(oa)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-n),w.translate(-va,-t),w.drawImage(o,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,oa.set(b.x-k,b.y-m,b.x+k,b.y+m),ta.instersects(oa)&&(f(h.color),g(h.color),w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(k,m),h.program(w),w.restore()))}function x(b,j,g,h){c(h.opacity);e(h.blending);w.beginPath();
+w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(j.positionScreen.x,j.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(H!=b)w.lineWidth=H=b;b=h.linecap;if(C!=b)w.lineCap=C=b;b=h.linejoin;if(S!=b)w.lineJoin=S=b;f(h.color);w.stroke();oa.inflate(h.linewidth*2)}}function A(b,f,j,g,m,n,o,p,u){k.data.vertices+=3;k.data.faces++;c(p.opacity);e(p.blending);T=b.positionScreen.x;ca=b.positionScreen.y;ga=f.positionScreen.x;Z=f.positionScreen.y;K=j.positionScreen.x;
+$=j.positionScreen.y;B(T,ca,ga,Z,K,$);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ka=o.uvs[0],D(T,ca,ga,Z,K,$,p.map.image,ka[g].u,ka[g].v,ka[m].u,ka[m].v,ka[n].u,ka[n].v));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,pa.copy(o.vertexNormalsWorld[0]),ia=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,xa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(o.vertexNormalsWorld[1]),za=(pa.x*b.n11+pa.y*
+b.n12+pa.z*b.n13)*0.5+0.5,Ba=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(o.vertexNormalsWorld[2]),da=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,P=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,D(T,ca,ga,Z,K,$,p.envMap.image,ia,xa,za,Ba,da,P)}else p.wireframe?E(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ka=o.uvs[0],D(T,ca,ga,Z,K,$,p.map.image,ka[g].u,
+ka[g].v,ka[m].u,ka[m].v,ka[n].u,ka[n].v)),e(THREE.SubtractiveBlending)),va?!p.wireframe&&p.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(Y.r=X.r=ja.r=sa.r,Y.g=X.g=ja.g=sa.g,Y.b=X.b=ja.b=sa.b,t(u,o.v1.positionWorld,o.vertexNormalsWorld[0],Y),t(u,o.v2.positionWorld,o.vertexNormalsWorld[1],X),t(u,o.v3.positionWorld,o.vertexNormalsWorld[2],ja),fa.r=(X.r+ja.r)*0.5,fa.g=(X.g+ja.g)*0.5,fa.b=(X.b+ja.b)*0.5,la=Ta(Y,X,ja,fa),D(T,ca,ga,Z,K,$,la,0,0,1,0,0,1)):(ua.r=sa.r,ua.g=sa.g,ua.b=sa.b,t(u,
+o.centroidWorld,o.normalWorld,ua),I.r=Math.max(0,Math.min(p.color.r*ua.r,1)),I.g=Math.max(0,Math.min(p.color.g*ua.g,1)),I.b=Math.max(0,Math.min(p.color.b*ua.b,1)),I.updateHex(),p.wireframe?E(I,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(I)):p.wireframe?E(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshDepthMaterial)U=h.near,J=h.far,Y.r=Y.g=Y.b=1-y(b.positionScreen.z,U,J),X.r=X.g=X.b=1-y(f.positionScreen.z,U,J),ja.r=
+ja.g=ja.b=1-y(j.positionScreen.z,U,J),fa.r=(X.r+ja.r)*0.5,fa.g=(X.g+ja.g)*0.5,fa.b=(X.b+ja.b)*0.5,la=Ta(Y,X,ja,fa),D(T,ca,ga,Z,K,$,la,0,0,1,0,0,1);else if(p instanceof THREE.MeshNormalMaterial)I.r=La(o.normalWorld.x),I.g=La(o.normalWorld.y),I.b=La(o.normalWorld.z),I.updateHex(),p.wireframe?E(I,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(I)}function z(b,f,j,g,m,n,o,p,u){k.data.vertices+=4;k.data.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,g,0,1,3,o,p,u),A(m,j,n,
+1,2,3,o,p,u);else if(T=b.positionScreen.x,ca=b.positionScreen.y,ga=f.positionScreen.x,Z=f.positionScreen.y,K=j.positionScreen.x,$=j.positionScreen.y,V=g.positionScreen.x,W=g.positionScreen.y,aa=m.positionScreen.x,ma=m.positionScreen.y,ea=n.positionScreen.x,ha=n.positionScreen.y,p instanceof THREE.MeshBasicMaterial)G(T,ca,ga,Z,K,$,V,W),p.wireframe?E(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)va?!p.wireframe&&p.shading==
+THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(Y.r=X.r=ja.r=fa.r=sa.r,Y.g=X.g=ja.g=fa.g=sa.g,Y.b=X.b=ja.b=fa.b=sa.b,t(u,o.v1.positionWorld,o.vertexNormalsWorld[0],Y),t(u,o.v2.positionWorld,o.vertexNormalsWorld[1],X),t(u,o.v4.positionWorld,o.vertexNormalsWorld[3],ja),t(u,o.v3.positionWorld,o.vertexNormalsWorld[2],fa),la=Ta(Y,X,ja,fa),B(T,ca,ga,Z,V,W),D(T,ca,ga,Z,V,W,la,0,0,1,0,0,1),B(aa,ma,K,$,ea,ha),D(aa,ma,K,$,ea,ha,la,1,0,1,1,0,1)):(ua.r=sa.r,ua.g=sa.g,ua.b=sa.b,t(u,o.centroidWorld,o.normalWorld,
+ua),I.r=Math.max(0,Math.min(p.color.r*ua.r,1)),I.g=Math.max(0,Math.min(p.color.g*ua.g,1)),I.b=Math.max(0,Math.min(p.color.b*ua.b,1)),I.updateHex(),G(T,ca,ga,Z,K,$,V,W),p.wireframe?E(I,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(I)):(G(T,ca,ga,Z,K,$,V,W),p.wireframe?E(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color));else if(p instanceof THREE.MeshNormalMaterial)I.r=La(o.normalWorld.x),I.g=La(o.normalWorld.y),I.b=La(o.normalWorld.z),I.updateHex(),
+G(T,ca,ga,Z,K,$,V,W),p.wireframe?E(I,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(I);else if(p instanceof THREE.MeshDepthMaterial)U=h.near,J=h.far,Y.r=Y.g=Y.b=1-y(b.positionScreen.z,U,J),X.r=X.g=X.b=1-y(f.positionScreen.z,U,J),ja.r=ja.g=ja.b=1-y(g.positionScreen.z,U,J),fa.r=fa.g=fa.b=1-y(j.positionScreen.z,U,J),la=Ta(Y,X,ja,fa),B(T,ca,ga,Z,V,W),D(T,ca,ga,Z,V,W,la,0,0,1,0,0,1),B(aa,ma,K,$,ea,ha),D(aa,ma,K,$,ea,ha,la,1,0,1,1,0,1)}function B(b,e,c,f,j,g){w.beginPath();w.moveTo(b,e);
+w.lineTo(c,f);w.lineTo(j,g);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,j,g,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(j,g);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function E(b,e,c,j){if(H!=e)w.lineWidth=H=e;if(C!=c)w.lineCap=C=c;if(S!=j)w.lineJoin=S=j;f(b);w.stroke();oa.inflate(e*2)}function Da(b){g(b);w.fill()}function D(b,e,c,f,j,g,h,k,m,o,n,p,va){var t,u;t=h.width-1;u=h.height-1;k*=t;m*=u;o*=t;n*=u;p*=t;va*=u;c-=b;f-=e;j-=b;g-=e;o-=k;n-=m;p-=k;va-=m;t=o*va-p*n;t!=0&&(u=1/t,t=
+(va*c-n*j)*u,n=(va*f-n*g)*u,c=(o*j-p*c)*u,f=(o*g-p*f)*u,b=b-t*k-c*m,e=e-n*k-f*m,w.save(),w.transform(t,n,c,f,b,e),w.clip(),w.drawImage(h,0,0),w.restore())}function Ta(b,e,c,f){var j=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),o=~~(f.r*255),p=~~(f.g*255),f=~~(f.b*255);wa[0]=j<0?0:j>255?255:j;wa[1]=g<0?0:g>255?255:g;wa[2]=b<0?0:b>255?255:b;wa[4]=h<0?0:h>255?255:h;wa[5]=k<0?0:k>255?255:k;wa[6]=e<0?0:e>255?255:e;wa[8]=m<0?
+0:m>255?255:m;wa[9]=n<0?0:n>255?255:n;wa[10]=c<0?0:c>255?255:c;wa[12]=o<0?0:o>255?255:o;wa[13]=p<0?0:p>255?255:p;wa[14]=f<0?0:f>255?255:f;Oa.putImageData(Wa,0,0);Sa.drawImage(Na,0,0);return Pa}function y(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function La(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ea(b,e){var c=e.x-b.x,f=e.y-b.y,j=1/Math.sqrt(c*c+f*f);c*=j;f*=j;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ua,Za,na,ya,Fa,Ma,Va,qa;this.autoClear?this.clear():w.setTransform(1,0,0,-1,u,v);k.data.vertices=0;k.data.faces=
+0;m=n.projectScene(b,h,this.sortElements);(va=b.lights.length>0)&&o(b);Ua=0;for(Za=m.length;Ua<Za;Ua++){na=m[Ua];oa.empty();if(na instanceof THREE.RenderableParticle){L=na;L.x*=u;L.y*=v;ya=0;for(Fa=na.materials.length;ya<Fa;)qa=na.materials[ya++],qa.opacity!=0&&p(L,na,qa,b)}else if(na instanceof THREE.RenderableLine){if(L=na.v1,F=na.v2,L.positionScreen.x*=u,L.positionScreen.y*=v,F.positionScreen.x*=u,F.positionScreen.y*=v,oa.addPoint(L.positionScreen.x,L.positionScreen.y),oa.addPoint(F.positionScreen.x,
+F.positionScreen.y),ta.instersects(oa)){ya=0;for(Fa=na.materials.length;ya<Fa;)qa=na.materials[ya++],qa.opacity!=0&&x(L,F,na,qa,b)}}else if(na instanceof THREE.RenderableFace3){if(L=na.v1,F=na.v2,R=na.v3,L.positionScreen.x*=u,L.positionScreen.y*=v,F.positionScreen.x*=u,F.positionScreen.y*=v,R.positionScreen.x*=u,R.positionScreen.y*=v,na.overdraw&&(Ea(L.positionScreen,F.positionScreen),Ea(F.positionScreen,R.positionScreen),Ea(R.positionScreen,L.positionScreen)),oa.add3Points(L.positionScreen.x,L.positionScreen.y,
+F.positionScreen.x,F.positionScreen.y,R.positionScreen.x,R.positionScreen.y),ta.instersects(oa)){ya=0;for(Fa=na.meshMaterials.length;ya<Fa;)if(qa=na.meshMaterials[ya++],qa instanceof THREE.MeshFaceMaterial){Ma=0;for(Va=na.faceMaterials.length;Ma<Va;)(qa=na.faceMaterials[Ma++])&&qa.opacity!=0&&A(L,F,R,0,1,2,na,qa,b)}else qa.opacity!=0&&A(L,F,R,0,1,2,na,qa,b)}}else if(na instanceof THREE.RenderableFace4&&(L=na.v1,F=na.v2,R=na.v3,O=na.v4,L.positionScreen.x*=u,L.positionScreen.y*=v,F.positionScreen.x*=
+u,F.positionScreen.y*=v,R.positionScreen.x*=u,R.positionScreen.y*=v,O.positionScreen.x*=u,O.positionScreen.y*=v,N.positionScreen.copy(F.positionScreen),j.positionScreen.copy(O.positionScreen),na.overdraw&&(Ea(L.positionScreen,F.positionScreen),Ea(F.positionScreen,O.positionScreen),Ea(O.positionScreen,L.positionScreen),Ea(R.positionScreen,N.positionScreen),Ea(R.positionScreen,j.positionScreen)),oa.addPoint(L.positionScreen.x,L.positionScreen.y),oa.addPoint(F.positionScreen.x,F.positionScreen.y),oa.addPoint(R.positionScreen.x,
+R.positionScreen.y),oa.addPoint(O.positionScreen.x,O.positionScreen.y),ta.instersects(oa))){ya=0;for(Fa=na.meshMaterials.length;ya<Fa;)if(qa=na.meshMaterials[ya++],qa instanceof THREE.MeshFaceMaterial){Ma=0;for(Va=na.faceMaterials.length;Ma<Va;)(qa=na.faceMaterials[Ma++])&&qa.opacity!=0&&z(L,F,R,O,N,j,na,qa,b)}else qa.opacity!=0&&z(L,F,R,O,N,j,na,qa,b)}Q.addRectangle(oa)}w.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,j,g,h;f=0;for(j=b.lights.length;f<j;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(g.position)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h)):g instanceof THREE.PointLight&&(O.sub(g.position,e.centroidWorld),O.normalize(),h=e.normalWorld.dot(O)*g.intensity,h>0&&(c.r+=g.color.r*h,c.g+=g.color.g*h,c.b+=g.color.b*h))}function c(e,c,j,m,n,p){k.data.vertices+=3;k.data.faces++;T=f(ca++);T.setAttribute("d",
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?E?(C.r=S.r,C.g=S.g,C.b=S.b,b(p,m,C),H.r=Math.max(0,Math.min(n.color.r*C.r,1)),H.g=Math.max(0,Math.min(n.color.g*C.g,1)),H.b=Math.max(0,Math.min(n.color.b*C.b,1)),H.updateHex()):H.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(R=1-n.__2near/(n.__farPlusNear-
+m.z*n.__farMinusNear),H.setRGB(R,R,R)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: #"+h(H.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style","fill: #"+h(H.hex.toString(16))+"; fill-opacity: "+n.opacity);o.appendChild(T)}function e(e,c,j,m,
+n,p,t){k.data.vertices+=4;k.data.faces++;T=f(ca++);T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?H.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?E?(C.r=S.r,C.g=S.g,C.b=S.b,b(t,n,C),H.r=Math.max(0,Math.min(p.color.r*C.r,1)),H.g=Math.max(0,Math.min(p.color.g*C.g,1)),H.b=Math.max(0,Math.min(p.color.b*
+C.b,1)),H.updateHex()):H.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(R=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),H.setRGB(R,R,R)):p instanceof THREE.MeshNormalMaterial&&H.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));p.wireframe?T.setAttribute("style","fill: none; stroke: #"+h(H.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):T.setAttribute("style",
+"fill: #"+h(H.hex.toString(16))+"; fill-opacity: "+p.opacity);o.appendChild(T)}function f(b){N[b]==null&&(N[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),Z==0&&N[b].setAttribute("shape-rendering","crispEdges"));return N[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var k=this,m=null,n=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,u,v,w,A,B,x,G=new THREE.Rectangle,z=new THREE.Rectangle,E=
+!1,H=new THREE.Color(16777215),C=new THREE.Color(16777215),S=new THREE.Color(0),L=new THREE.Color(0),F=new THREE.Color(0),R,O=new THREE.Vector3,N=[],j=[],T,ca,ga,Z=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":Z=1;break;case "low":Z=0}};this.setSize=function(b,e){p=b;t=e;u=p/2;v=t/2;o.setAttribute("viewBox",-u+" "+-v+" "+p+" "+t);o.setAttribute("width",p);o.setAttribute("height",t);G.set(-u,
+-v,u,v)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(b,f){var g,p,t,H,C,R,I,N;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;m=n.projectScene(b,f,this.sortElements);ga=ca=0;if(E=b.lights.length>0){I=b.lights;S.setRGB(0,0,0);L.setRGB(0,0,0);F.setRGB(0,0,0);g=0;for(p=I.length;g<p;g++)t=I[g],H=t.color,t instanceof THREE.AmbientLight?(S.r+=H.r,S.g+=H.g,S.b+=H.b):t instanceof THREE.DirectionalLight?(L.r+=H.r,L.g+=H.g,L.b+=H.b):t instanceof
+THREE.PointLight&&(F.r+=H.r,F.g+=H.g,F.b+=H.b)}g=0;for(p=m.length;g<p;g++)if(I=m[g],z.empty(),I instanceof THREE.RenderableParticle){w=I;w.x*=u;w.y*=-v;t=0;for(H=I.materials.length;t<H;)t++}else if(I instanceof THREE.RenderableLine){if(w=I.v1,A=I.v2,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,z.addPoint(w.positionScreen.x,w.positionScreen.y),z.addPoint(A.positionScreen.x,A.positionScreen.y),G.instersects(z)){t=0;for(H=I.materials.length;t<H;)if((N=I.materials[t++])&&
+N.opacity!=0){C=w;R=A;var O=ga++;j[O]==null&&(j[O]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&j[O].setAttribute("shape-rendering","crispEdges"));T=j[O];T.setAttribute("x1",C.positionScreen.x);T.setAttribute("y1",C.positionScreen.y);T.setAttribute("x2",R.positionScreen.x);T.setAttribute("y2",R.positionScreen.y);N instanceof THREE.LineBasicMaterial&&(T.setAttribute("style","fill: none; stroke: ##"+h(N.color.hex.toString(16))+"; stroke-width: "+N.linewidth+"; stroke-opacity: "+
+N.opacity+"; stroke-linecap: "+N.linecap+"; stroke-linejoin: "+N.linejoin),o.appendChild(T))}}}else if(I instanceof THREE.RenderableFace3){if(w=I.v1,A=I.v2,B=I.v3,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,z.addPoint(w.positionScreen.x,w.positionScreen.y),z.addPoint(A.positionScreen.x,A.positionScreen.y),z.addPoint(B.positionScreen.x,B.positionScreen.y),G.instersects(z)){t=0;for(H=I.meshMaterials.length;t<
+H;)if(N=I.meshMaterials[t++],N instanceof THREE.MeshFaceMaterial){C=0;for(R=I.faceMaterials.length;C<R;)(N=I.faceMaterials[C++])&&N.opacity!=0&&c(w,A,B,I,N,b)}else N&&N.opacity!=0&&c(w,A,B,I,N,b)}}else if(I instanceof THREE.RenderableFace4&&(w=I.v1,A=I.v2,B=I.v3,x=I.v4,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,z.addPoint(w.positionScreen.x,w.positionScreen.y),z.addPoint(A.positionScreen.x,
+A.positionScreen.y),z.addPoint(B.positionScreen.x,B.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),G.instersects(z))){t=0;for(H=I.meshMaterials.length;t<H;)if(N=I.meshMaterials[t++],N instanceof THREE.MeshFaceMaterial){C=0;for(R=I.faceMaterials.length;C<R;)(N=I.faceMaterials[C++])&&N.opacity!=0&&e(w,A,B,x,I,N,b)}else N&&N.opacity!=0&&e(w,A,B,x,I,N,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",
 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_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -222,120 +222,119 @@ 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,
 "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.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.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,e,c){var f,g,h,k=b.vertices,m=k.length,n=b.colors,p=n.length,t=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Y.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=k[f].position,ga.copy(g),Y.multiplyVector3(ga),u[f]=[ga.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=k[u[f][1]].position,h=f*3,t[h]=g.x,t[h+1]=g.y,t[h+2]=g.z;for(f=0;f<p;f++)h=f*3,color=n[u[f][1]],o[h]=color.r,o[h+1]=color.g,
-o[h+2]=color.b}else{if(v)for(f=0;f<m;f++)g=k[f].position,h=f*3,t[h]=g.x,t[h+1]=g.y,t[h+2]=g.z;if(w)for(f=0;f<p;f++)color=n[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,t,e);if(w||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,o,e)}function e(b,e,c,f,g){f.program||N.initMaterial(f,e,c,g);var h=f.program,k=h.uniforms,m=f.uniforms;h!=T&&(j.useProgram(h),
-T=h);j.uniformMatrix4fv(k.projectionMatrix,!1,X);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,
-p,t=0,o=0,u=0,v,w,x,A,z=U,B=z.directional.colors,H=z.directional.positions,G=z.point.colors,E=z.point.positions,F=z.point.distances,I=0,D=0,c=p=A=0;for(n=e.length;c<n;c++)if(p=e[c],v=p.color,w=p.position,x=p.intensity,A=p.distance,p instanceof THREE.AmbientLight)t+=v.r,o+=v.g,u+=v.b;else if(p instanceof THREE.DirectionalLight)A=I*3,B[A]=v.r*x,B[A+1]=v.g*x,B[A+2]=v.b*x,H[A]=w.x,H[A+1]=w.y,H[A+2]=w.z,I+=1;else if(p instanceof THREE.PointLight)p=D*3,G[p]=v.r*x,G[p+1]=v.g*x,G[p+2]=v.b*x,E[p]=w.x,E[p+
-1]=w.y,E[p+2]=w.z,F[D]=A,D+=1;for(c=I*3;c<B.length;c++)B[c]=0;for(c=D*3;c<G.length;c++)G[c]=0;z.point.length=D;z.directional.length=I;z.ambient[0]=t;z.ambient[1]=o;z.ambient[2]=u;c=U;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,h,k=b.vertices,m=k.length,n=b.colors,p=n.length,o=b.__vertexArray,t=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Y.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=k[f].position,fa.copy(g),Y.multiplyVector3(fa),u[f]=[fa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=k[u[f][1]].position,h=f*3,o[h]=g.x,o[h+1]=g.y,o[h+2]=g.z;for(f=0;f<p;f++)h=f*3,color=n[u[f][1]],t[h]=color.r,t[h+1]=color.g,
+t[h+2]=color.b}else{if(v)for(f=0;f<m;f++)g=k[f].position,h=f*3,o[h]=g.x,o[h+1]=g.y,o[h+2]=g.z;if(w)for(f=0;f<p;f++)color=n[f],h=f*3,t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,o,e);if(w||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,t,e)}function e(b,e,c,f,g){f.program||N.initMaterial(f,e,c,g);var h=f.program,k=h.uniforms,m=f.uniforms;h!=ca&&(j.useProgram(h),
+ca=h);j.uniformMatrix4fv(k.projectionMatrix,!1,X);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,
+p,o=0,t=0,u=0,v,w,x,A,z=U,B=z.directional.colors,H=z.directional.positions,G=z.point.colors,E=z.point.positions,F=z.point.distances,I=0,D=0,c=p=A=0;for(n=e.length;c<n;c++)if(p=e[c],v=p.color,w=p.position,x=p.intensity,A=p.distance,p instanceof THREE.AmbientLight)o+=v.r,t+=v.g,u+=v.b;else if(p instanceof THREE.DirectionalLight)A=I*3,B[A]=v.r*x,B[A+1]=v.g*x,B[A+2]=v.b*x,H[A]=w.x,H[A+1]=w.y,H[A+2]=w.z,I+=1;else if(p instanceof THREE.PointLight)p=D*3,G[p]=v.r*x,G[p+1]=v.g*x,G[p+2]=v.b*x,E[p]=w.x,E[p+
+1]=w.y,E[p+2]=w.z,F[D]=A,D+=1;for(c=I*3;c<B.length;c++)B[c]=0;for(c=D*3;c<G.length;c++)G[c]=0;z.point.length=D;z.directional.length=I;z.ambient[0]=o;z.ambient[1]=t;z.ambient[2]=u;c=U;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof
 THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;
 THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;
 if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=J.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof
 if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=J.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof
-THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var xa in m)if(o=h.uniforms[xa])if(n=m[xa],t=n.type,c=n.value,t=="i")j.uniform1i(o,c);else if(t=="f")j.uniform1f(o,c);else if(t=="fv1")j.uniform1fv(o,c);else if(t=="fv")j.uniform3fv(o,c);else if(t=="v2")j.uniform2f(o,c.x,c.y);else if(t=="v3")j.uniform3f(o,c.x,c.y,c.z);else if(t=="v4")j.uniform4f(o,c.x,c.y,c.z,c.w);else if(t=="c")j.uniform3f(o,c.r,c.g,c.b);else if(t=="t"&&(j.uniform1i(o,c),n=n.texture))if(n.image instanceof Array&&n.image.length==
-6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,j.RGBA,j.UNSIGNED_BYTE,n.image[t])}else{n.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[t]);n.__webglInit=!0}C(j.TEXTURE_CUBE_MAP,n,n.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,
-null);n.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else O(n,c);j.uniformMatrix4fv(k.modelViewMatrix,!1,g._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&j.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==
-null&&j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,Z);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,j.uniform3fv(k.directionalLightDirection,b),j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray),
-j.uniformMatrix4fv(k.viewMatrix,!1,Z);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,Z),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,k){if(g.opacity!=0){var m,b=e(b,c,f,g,k).attributes;if(!g.morphTargets&&b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),
-j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,p=k.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=p[n[f]],f++;else{var n=[],t=-1,
-o=0,p=k.morphTargetInfluences,u,v=p.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&p[u]>t&&(o=u,t=p[o]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=t;n[o]=1;t=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=
+THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var L in m)if(t=h.uniforms[L])if(n=m[L],o=n.type,c=n.value,o=="i")j.uniform1i(t,c);else if(o=="f")j.uniform1f(t,c);else if(o=="fv1")j.uniform1fv(t,c);else if(o=="fv")j.uniform3fv(t,c);else if(o=="v2")j.uniform2f(t,c.x,c.y);else if(o=="v3")j.uniform3f(t,c.x,c.y,c.z);else if(o=="v4")j.uniform4f(t,c.x,c.y,c.z,c.w);else if(o=="c")j.uniform3f(t,c.r,c.g,c.b);else if(o=="t"&&(j.uniform1i(t,c),n=n.texture))if(n.image instanceof Array&&n.image.length==
+6){if(n.image.length==6){if(n.needsUpdate){if(n.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,j.RGBA,j.UNSIGNED_BYTE,n.image[o])}else{n.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(o=0;o<6;++o)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[o]);n.__webglInit=!0}C(j.TEXTURE_CUBE_MAP,n,n.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,
+null);n.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else S(n,c);j.uniformMatrix4fv(k.modelViewMatrix,!1,g._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&j.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&k.objectMatrix!==
+null&&j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,ja);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,j.uniform3fv(k.directionalLightDirection,b),j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray),
+j.uniformMatrix4fv(k.viewMatrix,!1,ja);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,ja),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,k){if(g.opacity!=0){var m,b=e(b,c,f,g,k).attributes;if(!g.morphTargets&&b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else{c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),
+j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,n=k.morphTargetForcedOrder,p=k.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=p[n[f]],f++;else{var n=[],o=-1,
+t=0,p=k.morphTargetInfluences,u,v=p.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&p[u]>o&&(t=u,o=p[t]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=o;n[t]=1;o=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=
 0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,
 0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,
 h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,
 h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,
 j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount,
 j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount,
 j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),N.data.vertices+=h.__webglFaceCount,N.data.faces+=h.__webglFaceCount/3,N.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),N.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),N.data.drawCalls++):k instanceof
 j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),N.data.vertices+=h.__webglFaceCount,N.data.faces+=h.__webglFaceCount/3,N.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),N.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),N.data.drawCalls++):k instanceof
 THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),N.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,
 THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),N.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,
-b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,k,m,n,p,t,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],k=c[u+3],n=c[u+4],t=c[u+5],m=c[u+6],p=c[u+7],o=c[u+8],f=(f+k+m)/3,h=(h+n+p)/3,g=(g+t+o)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}j.bufferData(j.ARRAY_BUFFER,b.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(e.attributes.normal);j.vertexAttribPointer(e.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,
-0,b.count);b.count=0}function h(b){if(K!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),K=b.doubleSided;if(da!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),da=b.flipSided}function k(b){aa!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),aa=b)}function m(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 e,b=0;b<6;b++)e=I[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function n(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=I[f].x*e.n14+I[f].y*e.n24+I[f].z*e.n34+I[f].w,b<=c)return!1;return!0}function p(b,e){b.list[b.count]=e;b.count+=1}function o(b){var e,
-c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?p(g,c):p(h,c)}function t(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?p(m,h):p(k,h))}else(h=e)&&(h.transparent?p(m,h):p(k,h))}function u(b,e){return e.z-b.z}function v(b){j.enable(j.POLYGON_OFFSET_FILL);
-j.polygonOffset(0.1,1);j.enable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(!1);j.colorMask(!1,!1,!1,!1);j.stencilFunc(j.ALWAYS,1,255);j.stencilOpSeparate(j.BACK,j.KEEP,j.INCR,j.KEEP);j.stencilOpSeparate(j.FRONT,j.KEEP,j.DECR,j.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],k,m,n,p,t,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(t=0;t<o;t++)f=b.__webglShadowVolumes[t].object,
-k=b.__webglShadowVolumes[t].buffer,m=f.materials[0],m.program||N.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,T!==m&&(j.useProgram(m),T=m,j.uniformMatrix4fv(n.projectionMatrix,!1,X),j.uniformMatrix4fv(n.viewMatrix,!1,Z),j.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),j.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer),j.vertexAttribPointer(p.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,
-k.__webglNormalBuffer),j.vertexAttribPointer(p.normal,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),j.cullFace(j.FRONT),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0),j.cullFace(j.BACK),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0)}j.disable(j.POLYGON_OFFSET_FILL);j.colorMask(!0,!0,!0,!0);j.stencilFunc(j.NOTEQUAL,0,255);j.stencilOp(j.KEEP,j.KEEP,j.KEEP);j.disable(j.DEPTH_TEST);$=-1;T=ea.program;j.useProgram(ea.program);j.uniformMatrix4fv(ea.projectionLocation,
-!1,X);j.uniform1f(ea.darknessLocation,ea.darkness);j.bindBuffer(j.ARRAY_BUFFER,ea.vertexBuffer);j.vertexAttribPointer(ea.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(ea.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(V)}function w(b,e){var c,f,h;c=_sprite.attributes;var g=_sprite.uniforms,
-k=fa/ka,m,n=[],p=ka*0.5,t=fa*0.5,o=!0;j.useProgram(_sprite.program);T=_sprite.program;$=-1;qa||(j.enableVertexAttribArray(_sprite.attributes.position),j.enableVertexAttribArray(_sprite.attributes.uv),qa=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,_sprite.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,
+b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,k,m,n,p,o,t,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],k=c[u+3],n=c[u+4],o=c[u+5],m=c[u+6],p=c[u+7],t=c[u+8],f=(f+k+m)/3,h=(h+n+p)/3,g=(g+o+t)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}j.bufferData(j.ARRAY_BUFFER,b.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(e.attributes.normal);j.vertexAttribPointer(e.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,
+0,b.count);b.count=0}function h(b){if(K!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),K=b.doubleSided;if($!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),$=b.flipSided}function k(b){W!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),W=b)}function m(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 e,b=0;b<6;b++)e=I[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function n(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=I[f].x*e.n14+I[f].y*e.n24+I[f].z*e.n34+I[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function p(b){var e,
+c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function t(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function u(b,e){return e.z-b.z}function v(b){j.enable(j.POLYGON_OFFSET_FILL);
+j.polygonOffset(0.1,1);j.enable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(!1);j.colorMask(!1,!1,!1,!1);j.stencilFunc(j.ALWAYS,1,255);j.stencilOpSeparate(j.BACK,j.KEEP,j.INCR,j.KEEP);j.stencilOpSeparate(j.FRONT,j.KEEP,j.DECR,j.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],k,m,n,p,o,t=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(o=0;o<t;o++)f=b.__webglShadowVolumes[o].object,
+k=b.__webglShadowVolumes[o].buffer,m=f.materials[0],m.program||N.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,ca!==m&&(j.useProgram(m),ca=m,j.uniformMatrix4fv(n.projectionMatrix,!1,X),j.uniformMatrix4fv(n.viewMatrix,!1,ja),j.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),j.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer),j.vertexAttribPointer(p.position,3,j.FLOAT,!1,0,0),
+j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer),j.vertexAttribPointer(p.normal,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),j.cullFace(j.FRONT),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0),j.cullFace(j.BACK),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0)}j.disable(j.POLYGON_OFFSET_FILL);j.colorMask(!0,!0,!0,!0);j.stencilFunc(j.NOTEQUAL,0,255);j.stencilOp(j.KEEP,j.KEEP,j.KEEP);j.disable(j.DEPTH_TEST);V=-1;ca=da.program;j.useProgram(da.program);
+j.uniformMatrix4fv(da.projectionLocation,!1,X);j.uniform1f(da.darknessLocation,da.darkness);j.bindBuffer(j.ARRAY_BUFFER,da.vertexBuffer);j.vertexAttribPointer(da.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(da.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.elementBuffer);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(Z)}function w(b,e){var c,f,h;
+c=Q.attributes;var g=Q.uniforms,k=ha/ea,m,n=[],p=ea*0.5,o=ha*0.5,t=!0;j.useProgram(Q.program);ca=Q.program;V=-1;oa||(j.enableVertexAttribArray(Q.attributes.position),j.enableVertexAttribArray(Q.attributes.uv),oa=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,Q.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,
 !1,X);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(j.uniform1i(g.useScreenCoordinates,1),j.uniform3f(g.screenPosition,
 !1,X);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(j.uniform1i(g.useScreenCoordinates,1),j.uniform3f(g.screenPosition,
-(h.position.x-p)/p,(t-h.position.y)/t,Math.max(0,Math.min(1,h.position.z)))):(j.uniform1i(g.useScreenCoordinates,0),j.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),j.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.affectedByDistance?1:fa),n[0]=m*k*h.scale.x,n[1]=m*h.scale.y,j.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),j.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),j.uniform2f(g.alignment,h.alignment.x,h.alignment.y),j.uniform1f(g.opacity,h.opacity),
-j.uniform1f(g.rotation,h.rotation),j.uniform2fv(g.scale,n),h.mergeWith3D&&!o?(j.enable(j.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(j.disable(j.DEPTH_TEST),o=!1),H(h.blending),O(h.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(V)}function A(b,e){var c,f,h=b.__webglLensFlares.length,g,k,m,n=new THREE.Vector3,p=fa/ka,t=ka*0.5,o=fa*0.5,u=16/fa,v=[u*p,u],w=[1,1,0],x=[1,1],A=P.uniforms;c=P.attributes;j.useProgram(P.program);T=P.program;$=-1;
-ua||(j.enableVertexAttribArray(P.attributes.vertex),j.enableVertexAttribArray(P.attributes.uv),ua=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.disable(j.CULL_FACE);j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<h;f++)if(c=
-b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),w[0]=n.x,w[1]=n.y,w[2]=n.z,x[0]=w[0]*t+t,x[1]=w[1]*o+o,P.hasVertexTexture||x[0]>0&&x[0]<ka&&x[1]>0&&x[1]<fa){j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,x[0]-8,x[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,v);j.uniform3fv(A.screenPosition,w);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);
+(h.position.x-p)/p,(o-h.position.y)/o,Math.max(0,Math.min(1,h.position.z)))):(j.uniform1i(g.useScreenCoordinates,0),j.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),j.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.affectedByDistance?1:ha),n[0]=m*k*h.scale.x,n[1]=m*h.scale.y,j.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),j.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),j.uniform2f(g.alignment,h.alignment.x,h.alignment.y),j.uniform1f(g.opacity,h.opacity),
+j.uniform1f(g.rotation,h.rotation),j.uniform2fv(g.scale,n),h.mergeWith3D&&!t?(j.enable(j.DEPTH_TEST),t=!0):!h.mergeWith3D&&t&&(j.disable(j.DEPTH_TEST),t=!1),H(h.blending),S(h.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(Z)}function A(b,e){var c,f,h=b.__webglLensFlares.length,g,k,m,n=new THREE.Vector3,p=ha/ea,o=ea*0.5,t=ha*0.5,u=16/ha,v=[u*p,u],w=[1,1,0],x=[1,1],A=P.uniforms;c=P.attributes;j.useProgram(P.program);ca=P.program;V=-1;
+ta||(j.enableVertexAttribArray(P.attributes.vertex),j.enableVertexAttribArray(P.attributes.uv),ta=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,P.elementBuffer);j.disable(j.CULL_FACE);j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<h;f++)if(c=
+b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),w[0]=n.x,w[1]=n.y,w[2]=n.z,x[0]=w[0]*o+o,x[1]=w[1]*t+t,P.hasVertexTexture||x[0]>0&&x[0]<ea&&x[1]>0&&x[1]<ha){j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,x[0]-8,x[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,v);j.uniform3fv(A.screenPosition,w);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);
 j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,x[0]-8,x[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(A.renderType,2);j.enable(j.BLEND);g=0;for(k=c.lensFlares.length;g<
 j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,x[0]-8,x[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=w[0];c.positionScreen.y=w[1];c.positionScreen.z=w[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(A.renderType,2);j.enable(j.BLEND);g=0;for(k=c.lensFlares.length;g<
-k;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/fa,v[0]=u*p,v[1]=u,j.uniform3fv(A.screenPosition,w),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),H(m.blending),O(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(V)}function B(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
-function x(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var k=g=void 0,m=void 0,n=void 0,p=void 0,p=h.__materials,k=0,m=p.length;k<m;k++)if(n=p[k],n.attributes)for(g in n.attributes)if(n.attributes[g].needsUpdate){g=!0;break a}g=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g)if(g=h,k=b,m=j.DYNAMIC_DRAW,g.__inittedArrays){var t=p=n=void 0,o=void 0,
-u=t=void 0,v=void 0,w=void 0,x=void 0,A=void 0,z=void 0,B=void 0,H=void 0,G=void 0,C=void 0,E=void 0,U=void 0,F=void 0,D=o=x=o=w=v=void 0,J=void 0,y=J=D=v=void 0,I=void 0,N=y=J=D=t=t=u=x=o=y=J=D=I=y=J=D=I=y=J=D=void 0,M=0,K=0,Q=0,na=0,P=0,S=0,O=0,aa=0,ja=0,L=0,R=0,J=D=0,T=g.__vertexArray,ea=g.__uvArray,da=g.__uv2Array,oa=g.__normalArray,V=g.__tangentArray,$=g.__colorArray,ca=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ia=g.__morphTargetsArrays,ga=g.__webglCustomAttributes,
-y=void 0,fa=g.__faceArray,ha=g.__lineArray,ka=g.__needsSmoothNormals,z=g.__vertexColorType,A=g.__uvType,B=g.__normalType,ma=k.geometry,qa=ma.__dirtyVertices,Ca=ma.__dirtyElements,ua=ma.__dirtyUvs,Aa=ma.__dirtyNormals,Xa=ma.__dirtyTangents,Ya=ma.__dirtyColors,Za=ma.__dirtyMorphTargets,Ha=ma.vertices,ab=g.faces,db=ma.faces,bb=ma.faceVertexUvs[0],cb=ma.faceVertexUvs[1],Ia=ma.skinVerticesA,Ja=ma.skinVerticesB,Ka=ma.skinIndices,Ba=ma.skinWeights,Fa=k instanceof THREE.ShadowVolume?ma.edgeFaces:void 0,za=
-ma.morphTargets;if(ga)for(N in ga)ga[N].offset=0,ga[N].offsetSrc=0;n=0;for(p=ab.length;n<p;n++)if(t=ab[n],o=db[t],bb&&(H=bb[t]),cb&&(G=cb[t]),t=o.vertexNormals,u=o.normal,v=o.vertexColors,w=o.color,x=o.vertexTangents,o instanceof THREE.Face3){if(qa)C=Ha[o.a].position,E=Ha[o.b].position,U=Ha[o.c].position,T[K]=C.x,T[K+1]=C.y,T[K+2]=C.z,T[K+3]=E.x,T[K+4]=E.y,T[K+5]=E.z,T[K+6]=U.x,T[K+7]=U.y,T[K+8]=U.z,K+=9;if(ga)for(N in ga)if(y=ga[N],y.__original.needsUpdate)D=y.offset,J=y.offsetSrc,y.size===1?(y.boundTo===
-void 0||y.boundTo==="vertices"?(y.array[D+0]=y.value[o.a],y.array[D+1]=y.value[o.b],y.array[D+2]=y.value[o.c]):y.boundTo==="faces"?(y.array[D+0]=y.value[J],y.array[D+1]=y.value[J],y.array[D+2]=y.value[J],y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[D+0]=y.value[J+0],y.array[D+1]=y.value[J+1],y.array[D+2]=y.value[J+2],y.offsetSrc+=3),y.offset+=3):(y.boundTo===void 0||y.boundTo==="vertices"?(C=y.value[o.a],E=y.value[o.b],U=y.value[o.c]):y.boundTo==="faces"?(C=y.value[J],E=y.value[J],U=y.value[J],
+k;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)w[0]=m.x,w[1]=m.y,w[2]=m.z,u=m.size*m.scale/ha,v[0]=u*p,v[1]=u,j.uniform3fv(A.screenPosition,w),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),H(m.blending),S(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(Z)}function B(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function x(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var k=g=void 0,m=void 0,n=void 0,p=void 0,p=h.__materials,k=0,m=p.length;k<m;k++)if(n=p[k],n.attributes)for(g in n.attributes)if(n.attributes[g].needsUpdate){g=!0;break a}g=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g)if(g=h,k=b,m=j.DYNAMIC_DRAW,g.__inittedArrays){var o=p=n=void 0,t=void 0,
+u=o=void 0,v=void 0,w=void 0,x=void 0,A=void 0,z=void 0,B=void 0,H=void 0,G=void 0,C=void 0,E=void 0,U=void 0,F=void 0,D=t=x=t=w=v=void 0,J=void 0,y=J=D=v=void 0,I=void 0,N=y=J=D=o=o=u=x=t=y=J=D=I=y=J=D=I=y=J=D=void 0,L=0,K=0,R=0,Q=0,la=0,P=0,O=0,S=0,W=0,M=0,ka=0,J=D=0,T=g.__vertexArray,ca=g.__uvArray,da=g.__uv2Array,$=g.__normalArray,ia=g.__tangentArray,Z=g.__colorArray,V=g.__skinVertexAArray,aa=g.__skinVertexBArray,X=g.__skinIndexArray,Y=g.__skinWeightArray,ja=g.__morphTargetsArrays,ga=g.__webglCustomAttributes,
+y=void 0,fa=g.__faceArray,ha=g.__lineArray,ma=g.__needsSmoothNormals,z=g.__vertexColorType,A=g.__uvType,B=g.__normalType,ea=k.geometry,xa=ea.__dirtyVertices,oa=ea.__dirtyElements,za=ea.__dirtyUvs,ta=ea.__dirtyNormals,Ba=ea.__dirtyTangents,Xa=ea.__dirtyColors,Ya=ea.__dirtyMorphTargets,Ha=ea.vertices,$a=g.faces,cb=ea.faces,ab=ea.faceVertexUvs[0],bb=ea.faceVertexUvs[1],Ia=ea.skinVerticesA,Ja=ea.skinVerticesB,Ka=ea.skinIndices,Ca=ea.skinWeights,Ga=k instanceof THREE.ShadowVolume?ea.edgeFaces:void 0,Aa=
+ea.morphTargets;if(ga)for(N in ga)ga[N].offset=0,ga[N].offsetSrc=0;n=0;for(p=$a.length;n<p;n++)if(o=$a[n],t=cb[o],ab&&(H=ab[o]),bb&&(G=bb[o]),o=t.vertexNormals,u=t.normal,v=t.vertexColors,w=t.color,x=t.vertexTangents,t instanceof THREE.Face3){if(xa)C=Ha[t.a].position,E=Ha[t.b].position,U=Ha[t.c].position,T[K]=C.x,T[K+1]=C.y,T[K+2]=C.z,T[K+3]=E.x,T[K+4]=E.y,T[K+5]=E.z,T[K+6]=U.x,T[K+7]=U.y,T[K+8]=U.z,K+=9;if(ga)for(N in ga)if(y=ga[N],y.__original.needsUpdate)D=y.offset,J=y.offsetSrc,y.size===1?(y.boundTo===
+void 0||y.boundTo==="vertices"?(y.array[D+0]=y.value[t.a],y.array[D+1]=y.value[t.b],y.array[D+2]=y.value[t.c]):y.boundTo==="faces"?(y.array[D+0]=y.value[J],y.array[D+1]=y.value[J],y.array[D+2]=y.value[J],y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[D+0]=y.value[J+0],y.array[D+1]=y.value[J+1],y.array[D+2]=y.value[J+2],y.offsetSrc+=3),y.offset+=3):(y.boundTo===void 0||y.boundTo==="vertices"?(C=y.value[t.a],E=y.value[t.b],U=y.value[t.c]):y.boundTo==="faces"?(C=y.value[J],E=y.value[J],U=y.value[J],
 y.offsetSrc++):y.boundTo==="faceVertices"&&(C=y.value[J+0],E=y.value[J+1],U=y.value[J+2],y.offsetSrc+=3),y.size===2?(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=E.x,y.array[D+3]=E.y,y.array[D+4]=U.x,y.array[D+5]=U.y,y.offset+=6):y.size===3?(y.type==="c"?(y.array[D+0]=C.r,y.array[D+1]=C.g,y.array[D+2]=C.b,y.array[D+3]=E.r,y.array[D+4]=E.g,y.array[D+5]=E.b,y.array[D+6]=U.r,y.array[D+7]=U.g,y.array[D+8]=U.b):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=C.z,y.array[D+3]=E.x,y.array[D+4]=E.y,y.array[D+
 y.offsetSrc++):y.boundTo==="faceVertices"&&(C=y.value[J+0],E=y.value[J+1],U=y.value[J+2],y.offsetSrc+=3),y.size===2?(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=E.x,y.array[D+3]=E.y,y.array[D+4]=U.x,y.array[D+5]=U.y,y.offset+=6):y.size===3?(y.type==="c"?(y.array[D+0]=C.r,y.array[D+1]=C.g,y.array[D+2]=C.b,y.array[D+3]=E.r,y.array[D+4]=E.g,y.array[D+5]=E.b,y.array[D+6]=U.r,y.array[D+7]=U.g,y.array[D+8]=U.b):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=C.z,y.array[D+3]=E.x,y.array[D+4]=E.y,y.array[D+
-5]=E.z,y.array[D+6]=U.x,y.array[D+7]=U.y,y.array[D+8]=U.z),y.offset+=9):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=C.z,y.array[D+3]=C.w,y.array[D+4]=E.x,y.array[D+5]=E.y,y.array[D+6]=E.z,y.array[D+7]=E.w,y.array[D+8]=U.x,y.array[D+9]=U.y,y.array[D+10]=U.z,y.array[D+11]=U.w,y.offset+=12));if(Za){D=0;for(J=za.length;D<J;D++)C=za[D].vertices[o.a].position,E=za[D].vertices[o.b].position,U=za[D].vertices[o.c].position,y=ia[D],y[R+0]=C.x,y[R+1]=C.y,y[R+2]=C.z,y[R+3]=E.x,y[R+4]=E.y,y[R+5]=E.z,y[R+6]=
-U.x,y[R+7]=U.y,y[R+8]=U.z;R+=9}if(Ba.length)D=Ba[o.a],J=Ba[o.b],y=Ba[o.c],Z[L]=D.x,Z[L+1]=D.y,Z[L+2]=D.z,Z[L+3]=D.w,Z[L+4]=J.x,Z[L+5]=J.y,Z[L+6]=J.z,Z[L+7]=J.w,Z[L+8]=y.x,Z[L+9]=y.y,Z[L+10]=y.z,Z[L+11]=y.w,D=Ka[o.a],J=Ka[o.b],y=Ka[o.c],Y[L]=D.x,Y[L+1]=D.y,Y[L+2]=D.z,Y[L+3]=D.w,Y[L+4]=J.x,Y[L+5]=J.y,Y[L+6]=J.z,Y[L+7]=J.w,Y[L+8]=y.x,Y[L+9]=y.y,Y[L+10]=y.z,Y[L+11]=y.w,D=Ia[o.a],J=Ia[o.b],y=Ia[o.c],ca[L]=D.x,ca[L+1]=D.y,ca[L+2]=D.z,ca[L+3]=1,ca[L+4]=J.x,ca[L+5]=J.y,ca[L+6]=J.z,ca[L+7]=1,ca[L+8]=y.x,ca[L+
-9]=y.y,ca[L+10]=y.z,ca[L+11]=1,D=Ja[o.a],J=Ja[o.b],y=Ja[o.c],X[L]=D.x,X[L+1]=D.y,X[L+2]=D.z,X[L+3]=1,X[L+4]=J.x,X[L+5]=J.y,X[L+6]=J.z,X[L+7]=1,X[L+8]=y.x,X[L+9]=y.y,X[L+10]=y.z,X[L+11]=1,L+=12;if(Ya&&z)v.length==3&&z==THREE.VertexColors?(o=v[0],D=v[1],J=v[2]):J=D=o=w,$[ja]=o.r,$[ja+1]=o.g,$[ja+2]=o.b,$[ja+3]=D.r,$[ja+4]=D.g,$[ja+5]=D.b,$[ja+6]=J.r,$[ja+7]=J.g,$[ja+8]=J.b,ja+=9;if(Xa&&ma.hasTangents)v=x[0],w=x[1],o=x[2],V[O]=v.x,V[O+1]=v.y,V[O+2]=v.z,V[O+3]=v.w,V[O+4]=w.x,V[O+5]=w.y,V[O+6]=w.z,V[O+
-7]=w.w,V[O+8]=o.x,V[O+9]=o.y,V[O+10]=o.z,V[O+11]=o.w,O+=12;if(Aa&&B)if(t.length==3&&ka)for(x=0;x<3;x++)u=t[x],oa[S]=u.x,oa[S+1]=u.y,oa[S+2]=u.z,S+=3;else for(x=0;x<3;x++)oa[S]=u.x,oa[S+1]=u.y,oa[S+2]=u.z,S+=3;if(ua&&H!==void 0&&A)for(x=0;x<3;x++)t=H[x],ea[Q]=t.u,ea[Q+1]=t.v,Q+=2;if(ua&&G!==void 0&&A)for(x=0;x<3;x++)t=G[x],da[na]=t.u,da[na+1]=t.v,na+=2;Ca&&(fa[P]=M,fa[P+1]=M+1,fa[P+2]=M+2,P+=3,ha[aa]=M,ha[aa+1]=M+1,ha[aa+2]=M,ha[aa+3]=M+2,ha[aa+4]=M+1,ha[aa+5]=M+2,aa+=6,M+=3)}else if(o instanceof THREE.Face4){if(qa)C=
-Ha[o.a].position,E=Ha[o.b].position,U=Ha[o.c].position,F=Ha[o.d].position,T[K]=C.x,T[K+1]=C.y,T[K+2]=C.z,T[K+3]=E.x,T[K+4]=E.y,T[K+5]=E.z,T[K+6]=U.x,T[K+7]=U.y,T[K+8]=U.z,T[K+9]=F.x,T[K+10]=F.y,T[K+11]=F.z,K+=12;if(ga)for(N in ga)if(y=ga[N],y.__original.needsUpdate)D=y.offset,J=y.offsetSrc,y.size===1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[D+0]=y.value[o.a],y.array[D+1]=y.value[o.b],y.array[D+2]=y.value[o.c],y.array[D+3]=y.value[o.d]):y.boundTo==="faces"?(y.array[D+0]=y.value[J],y.array[D+
-1]=y.value[J],y.array[D+2]=y.value[J],y.array[D+3]=y.value[J],y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[D+0]=y.value[J+0],y.array[D+1]=y.value[J+1],y.array[D+2]=y.value[J+2],y.array[D+3]=y.value[J+3],y.offsetSrc+=4),y.offset+=4):(y.boundTo===void 0||y.boundTo==="vertices"?(C=y.value[o.a],E=y.value[o.b],U=y.value[o.c],F=y.value[o.d]):y.boundTo==="faces"?(C=y.value[J],E=y.value[J],U=y.value[J],F=y.value[J],y.offsetSrc++):y.boundTo==="faceVertices"&&(C=y.value[J+0],E=y.value[J+1],U=y.value[J+
-2],F=y.value[J+3],y.offsetSrc+=4),y.size===2?(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=E.x,y.array[D+3]=E.y,y.array[D+4]=U.x,y.array[D+5]=U.y,y.array[D+6]=F.x,y.array[D+7]=F.y,y.offset+=8):y.size===3?(y.type==="c"?(y.array[D+0]=C.r,y.array[D+1]=C.g,y.array[D+2]=C.b,y.array[D+3]=E.r,y.array[D+4]=E.g,y.array[D+5]=E.b,y.array[D+6]=U.r,y.array[D+7]=U.g,y.array[D+8]=U.b,y.array[D+9]=F.r,y.array[D+10]=F.g,y.array[D+11]=F.b):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=C.z,y.array[D+3]=E.x,y.array[D+
-4]=E.y,y.array[D+5]=E.z,y.array[D+6]=U.x,y.array[D+7]=U.y,y.array[D+8]=U.z,y.array[D+9]=F.x,y.array[D+10]=F.y,y.array[D+11]=F.z),y.offset+=12):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=C.z,y.array[D+3]=C.w,y.array[D+4]=E.x,y.array[D+5]=E.y,y.array[D+6]=E.z,y.array[D+7]=E.w,y.array[D+8]=U.x,y.array[D+9]=U.y,y.array[D+10]=U.z,y.array[D+11]=U.w,y.array[D+12]=F.x,y.array[D+13]=F.y,y.array[D+14]=F.z,y.array[D+15]=F.w,y.offset+=16));if(Za){D=0;for(J=za.length;D<J;D++)C=za[D].vertices[o.a].position,
-E=za[D].vertices[o.b].position,U=za[D].vertices[o.c].position,F=za[D].vertices[o.d].position,y=ia[D],y[R+0]=C.x,y[R+1]=C.y,y[R+2]=C.z,y[R+3]=E.x,y[R+4]=E.y,y[R+5]=E.z,y[R+6]=U.x,y[R+7]=U.y,y[R+8]=U.z,y[R+9]=F.x,y[R+10]=F.y,y[R+11]=F.z;R+=12}if(Ba.length)D=Ba[o.a],J=Ba[o.b],y=Ba[o.c],I=Ba[o.d],Z[L]=D.x,Z[L+1]=D.y,Z[L+2]=D.z,Z[L+3]=D.w,Z[L+4]=J.x,Z[L+5]=J.y,Z[L+6]=J.z,Z[L+7]=J.w,Z[L+8]=y.x,Z[L+9]=y.y,Z[L+10]=y.z,Z[L+11]=y.w,Z[L+12]=I.x,Z[L+13]=I.y,Z[L+14]=I.z,Z[L+15]=I.w,D=Ka[o.a],J=Ka[o.b],y=Ka[o.c],
-I=Ka[o.d],Y[L]=D.x,Y[L+1]=D.y,Y[L+2]=D.z,Y[L+3]=D.w,Y[L+4]=J.x,Y[L+5]=J.y,Y[L+6]=J.z,Y[L+7]=J.w,Y[L+8]=y.x,Y[L+9]=y.y,Y[L+10]=y.z,Y[L+11]=y.w,Y[L+12]=I.x,Y[L+13]=I.y,Y[L+14]=I.z,Y[L+15]=I.w,D=Ia[o.a],J=Ia[o.b],y=Ia[o.c],I=Ia[o.d],ca[L]=D.x,ca[L+1]=D.y,ca[L+2]=D.z,ca[L+3]=1,ca[L+4]=J.x,ca[L+5]=J.y,ca[L+6]=J.z,ca[L+7]=1,ca[L+8]=y.x,ca[L+9]=y.y,ca[L+10]=y.z,ca[L+11]=1,ca[L+12]=I.x,ca[L+13]=I.y,ca[L+14]=I.z,ca[L+15]=1,D=Ja[o.a],J=Ja[o.b],y=Ja[o.c],o=Ja[o.d],X[L]=D.x,X[L+1]=D.y,X[L+2]=D.z,X[L+3]=1,X[L+
-4]=J.x,X[L+5]=J.y,X[L+6]=J.z,X[L+7]=1,X[L+8]=y.x,X[L+9]=y.y,X[L+10]=y.z,X[L+11]=1,X[L+12]=o.x,X[L+13]=o.y,X[L+14]=o.z,X[L+15]=1,L+=16;if(Ya&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],D=v[1],J=v[2],v=v[3]):v=J=D=o=w,$[ja]=o.r,$[ja+1]=o.g,$[ja+2]=o.b,$[ja+3]=D.r,$[ja+4]=D.g,$[ja+5]=D.b,$[ja+6]=J.r,$[ja+7]=J.g,$[ja+8]=J.b,$[ja+9]=v.r,$[ja+10]=v.g,$[ja+11]=v.b,ja+=12;if(Xa&&ma.hasTangents)v=x[0],w=x[1],o=x[2],x=x[3],V[O]=v.x,V[O+1]=v.y,V[O+2]=v.z,V[O+3]=v.w,V[O+4]=w.x,V[O+5]=w.y,V[O+6]=w.z,V[O+7]=
-w.w,V[O+8]=o.x,V[O+9]=o.y,V[O+10]=o.z,V[O+11]=o.w,V[O+12]=x.x,V[O+13]=x.y,V[O+14]=x.z,V[O+15]=x.w,O+=16;if(Aa&&B)if(t.length==4&&ka)for(x=0;x<4;x++)u=t[x],oa[S]=u.x,oa[S+1]=u.y,oa[S+2]=u.z,S+=3;else for(x=0;x<4;x++)oa[S]=u.x,oa[S+1]=u.y,oa[S+2]=u.z,S+=3;if(ua&&H!==void 0&&A)for(x=0;x<4;x++)t=H[x],ea[Q]=t.u,ea[Q+1]=t.v,Q+=2;if(ua&&G!==void 0&&A)for(x=0;x<4;x++)t=G[x],da[na]=t.u,da[na+1]=t.v,na+=2;Ca&&(fa[P]=M,fa[P+1]=M+1,fa[P+2]=M+3,fa[P+3]=M+1,fa[P+4]=M+2,fa[P+5]=M+3,P+=6,ha[aa]=M,ha[aa+1]=M+1,ha[aa+
-2]=M,ha[aa+3]=M+3,ha[aa+4]=M+1,ha[aa+5]=M+2,ha[aa+6]=M+2,ha[aa+7]=M+3,aa+=8,M+=4)}if(Fa){n=0;for(p=Fa.length;n<p;n++)fa[P]=Fa[n].a,fa[P+1]=Fa[n].b,fa[P+2]=Fa[n].c,fa[P+3]=Fa[n].a,fa[P+4]=Fa[n].c,fa[P+5]=Fa[n].d,P+=6}qa&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,T,m));if(ga)for(N in ga)y=ga[N],y.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,y.buffer),j.bufferData(j.ARRAY_BUFFER,y.array,m));if(Za){D=0;for(J=za.length;D<J;D++)j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[D]),
-j.bufferData(j.ARRAY_BUFFER,ia[D],m)}Ya&&ja>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));Aa&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,oa,m));Xa&&ma.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,V,m));ua&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m));ua&&na>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,
-da,m));Ca&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,fa,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ha,m));L>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ca,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Y,m),j.bindBuffer(j.ARRAY_BUFFER,
-g.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));k.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;var sa;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(e=h[f],e.attributes)for(sa in e.attributes)e.attributes[sa].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){sa=f;b=j.DYNAMIC_DRAW;p=sa.vertices;h=sa.colors;A=p.length;g=h.length;z=sa.__vertexArray;k=sa.__colorArray;B=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<A;m++)n=p[m].position,e=m*3,z[e]=n.x,z[e+1]=n.y,z[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);
-j.bufferData(j.ARRAY_BUFFER,z,b)}if(B){for(m=0;m<g;m++)color=h[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){sa=f;b=j.DYNAMIC_DRAW;p=sa.vertices;h=sa.colors;A=p.length;g=h.length;z=sa.__vertexArray;k=sa.__colorArray;B=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<A;m++)n=p[m].position,
-e=m*3,z[e]=n.x,z[e+1]=n.y,z[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,z,b)}if(B){for(m=0;m<g;m++)color=h[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}
-function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function z(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,h,j,k,m,n,o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],
-materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=j}function E(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(b){if(b!=$){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);
-j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}$=b}}function C(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,S(e.wrapS)),j.texParameteri(b,
-j.TEXTURE_WRAP_T,S(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,S(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,S(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_MAG_FILTER,Q(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function O(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texSubImage2D(j.TEXTURE_2D,0,0,
-0,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),C(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+e);j.bindTexture(j.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=
-j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,S(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,S(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,S(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,S(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,
+5]=E.z,y.array[D+6]=U.x,y.array[D+7]=U.y,y.array[D+8]=U.z),y.offset+=9):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=C.z,y.array[D+3]=C.w,y.array[D+4]=E.x,y.array[D+5]=E.y,y.array[D+6]=E.z,y.array[D+7]=E.w,y.array[D+8]=U.x,y.array[D+9]=U.y,y.array[D+10]=U.z,y.array[D+11]=U.w,y.offset+=12));if(Ya){D=0;for(J=Aa.length;D<J;D++)C=Aa[D].vertices[t.a].position,E=Aa[D].vertices[t.b].position,U=Aa[D].vertices[t.c].position,y=ja[D],y[ka+0]=C.x,y[ka+1]=C.y,y[ka+2]=C.z,y[ka+3]=E.x,y[ka+4]=E.y,y[ka+5]=E.z,
+y[ka+6]=U.x,y[ka+7]=U.y,y[ka+8]=U.z;ka+=9}if(Ca.length)D=Ca[t.a],J=Ca[t.b],y=Ca[t.c],Y[M]=D.x,Y[M+1]=D.y,Y[M+2]=D.z,Y[M+3]=D.w,Y[M+4]=J.x,Y[M+5]=J.y,Y[M+6]=J.z,Y[M+7]=J.w,Y[M+8]=y.x,Y[M+9]=y.y,Y[M+10]=y.z,Y[M+11]=y.w,D=Ka[t.a],J=Ka[t.b],y=Ka[t.c],X[M]=D.x,X[M+1]=D.y,X[M+2]=D.z,X[M+3]=D.w,X[M+4]=J.x,X[M+5]=J.y,X[M+6]=J.z,X[M+7]=J.w,X[M+8]=y.x,X[M+9]=y.y,X[M+10]=y.z,X[M+11]=y.w,D=Ia[t.a],J=Ia[t.b],y=Ia[t.c],V[M]=D.x,V[M+1]=D.y,V[M+2]=D.z,V[M+3]=1,V[M+4]=J.x,V[M+5]=J.y,V[M+6]=J.z,V[M+7]=1,V[M+8]=y.x,
+V[M+9]=y.y,V[M+10]=y.z,V[M+11]=1,D=Ja[t.a],J=Ja[t.b],y=Ja[t.c],aa[M]=D.x,aa[M+1]=D.y,aa[M+2]=D.z,aa[M+3]=1,aa[M+4]=J.x,aa[M+5]=J.y,aa[M+6]=J.z,aa[M+7]=1,aa[M+8]=y.x,aa[M+9]=y.y,aa[M+10]=y.z,aa[M+11]=1,M+=12;if(Xa&&z)v.length==3&&z==THREE.VertexColors?(t=v[0],D=v[1],J=v[2]):J=D=t=w,Z[W]=t.r,Z[W+1]=t.g,Z[W+2]=t.b,Z[W+3]=D.r,Z[W+4]=D.g,Z[W+5]=D.b,Z[W+6]=J.r,Z[W+7]=J.g,Z[W+8]=J.b,W+=9;if(Ba&&ea.hasTangents)v=x[0],w=x[1],t=x[2],ia[O]=v.x,ia[O+1]=v.y,ia[O+2]=v.z,ia[O+3]=v.w,ia[O+4]=w.x,ia[O+5]=w.y,ia[O+
+6]=w.z,ia[O+7]=w.w,ia[O+8]=t.x,ia[O+9]=t.y,ia[O+10]=t.z,ia[O+11]=t.w,O+=12;if(ta&&B)if(o.length==3&&ma)for(x=0;x<3;x++)u=o[x],$[P]=u.x,$[P+1]=u.y,$[P+2]=u.z,P+=3;else for(x=0;x<3;x++)$[P]=u.x,$[P+1]=u.y,$[P+2]=u.z,P+=3;if(za&&H!==void 0&&A)for(x=0;x<3;x++)o=H[x],ca[R]=o.u,ca[R+1]=o.v,R+=2;if(za&&G!==void 0&&A)for(x=0;x<3;x++)o=G[x],da[Q]=o.u,da[Q+1]=o.v,Q+=2;oa&&(fa[la]=L,fa[la+1]=L+1,fa[la+2]=L+2,la+=3,ha[S]=L,ha[S+1]=L+1,ha[S+2]=L,ha[S+3]=L+2,ha[S+4]=L+1,ha[S+5]=L+2,S+=6,L+=3)}else if(t instanceof
+THREE.Face4){if(xa)C=Ha[t.a].position,E=Ha[t.b].position,U=Ha[t.c].position,F=Ha[t.d].position,T[K]=C.x,T[K+1]=C.y,T[K+2]=C.z,T[K+3]=E.x,T[K+4]=E.y,T[K+5]=E.z,T[K+6]=U.x,T[K+7]=U.y,T[K+8]=U.z,T[K+9]=F.x,T[K+10]=F.y,T[K+11]=F.z,K+=12;if(ga)for(N in ga)if(y=ga[N],y.__original.needsUpdate)D=y.offset,J=y.offsetSrc,y.size===1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[D+0]=y.value[t.a],y.array[D+1]=y.value[t.b],y.array[D+2]=y.value[t.c],y.array[D+3]=y.value[t.d]):y.boundTo==="faces"?(y.array[D+
+0]=y.value[J],y.array[D+1]=y.value[J],y.array[D+2]=y.value[J],y.array[D+3]=y.value[J],y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[D+0]=y.value[J+0],y.array[D+1]=y.value[J+1],y.array[D+2]=y.value[J+2],y.array[D+3]=y.value[J+3],y.offsetSrc+=4),y.offset+=4):(y.boundTo===void 0||y.boundTo==="vertices"?(C=y.value[t.a],E=y.value[t.b],U=y.value[t.c],F=y.value[t.d]):y.boundTo==="faces"?(C=y.value[J],E=y.value[J],U=y.value[J],F=y.value[J],y.offsetSrc++):y.boundTo==="faceVertices"&&(C=y.value[J+0],
+E=y.value[J+1],U=y.value[J+2],F=y.value[J+3],y.offsetSrc+=4),y.size===2?(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=E.x,y.array[D+3]=E.y,y.array[D+4]=U.x,y.array[D+5]=U.y,y.array[D+6]=F.x,y.array[D+7]=F.y,y.offset+=8):y.size===3?(y.type==="c"?(y.array[D+0]=C.r,y.array[D+1]=C.g,y.array[D+2]=C.b,y.array[D+3]=E.r,y.array[D+4]=E.g,y.array[D+5]=E.b,y.array[D+6]=U.r,y.array[D+7]=U.g,y.array[D+8]=U.b,y.array[D+9]=F.r,y.array[D+10]=F.g,y.array[D+11]=F.b):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=
+C.z,y.array[D+3]=E.x,y.array[D+4]=E.y,y.array[D+5]=E.z,y.array[D+6]=U.x,y.array[D+7]=U.y,y.array[D+8]=U.z,y.array[D+9]=F.x,y.array[D+10]=F.y,y.array[D+11]=F.z),y.offset+=12):(y.array[D+0]=C.x,y.array[D+1]=C.y,y.array[D+2]=C.z,y.array[D+3]=C.w,y.array[D+4]=E.x,y.array[D+5]=E.y,y.array[D+6]=E.z,y.array[D+7]=E.w,y.array[D+8]=U.x,y.array[D+9]=U.y,y.array[D+10]=U.z,y.array[D+11]=U.w,y.array[D+12]=F.x,y.array[D+13]=F.y,y.array[D+14]=F.z,y.array[D+15]=F.w,y.offset+=16));if(Ya){D=0;for(J=Aa.length;D<J;D++)C=
+Aa[D].vertices[t.a].position,E=Aa[D].vertices[t.b].position,U=Aa[D].vertices[t.c].position,F=Aa[D].vertices[t.d].position,y=ja[D],y[ka+0]=C.x,y[ka+1]=C.y,y[ka+2]=C.z,y[ka+3]=E.x,y[ka+4]=E.y,y[ka+5]=E.z,y[ka+6]=U.x,y[ka+7]=U.y,y[ka+8]=U.z,y[ka+9]=F.x,y[ka+10]=F.y,y[ka+11]=F.z;ka+=12}if(Ca.length)D=Ca[t.a],J=Ca[t.b],y=Ca[t.c],I=Ca[t.d],Y[M]=D.x,Y[M+1]=D.y,Y[M+2]=D.z,Y[M+3]=D.w,Y[M+4]=J.x,Y[M+5]=J.y,Y[M+6]=J.z,Y[M+7]=J.w,Y[M+8]=y.x,Y[M+9]=y.y,Y[M+10]=y.z,Y[M+11]=y.w,Y[M+12]=I.x,Y[M+13]=I.y,Y[M+14]=I.z,
+Y[M+15]=I.w,D=Ka[t.a],J=Ka[t.b],y=Ka[t.c],I=Ka[t.d],X[M]=D.x,X[M+1]=D.y,X[M+2]=D.z,X[M+3]=D.w,X[M+4]=J.x,X[M+5]=J.y,X[M+6]=J.z,X[M+7]=J.w,X[M+8]=y.x,X[M+9]=y.y,X[M+10]=y.z,X[M+11]=y.w,X[M+12]=I.x,X[M+13]=I.y,X[M+14]=I.z,X[M+15]=I.w,D=Ia[t.a],J=Ia[t.b],y=Ia[t.c],I=Ia[t.d],V[M]=D.x,V[M+1]=D.y,V[M+2]=D.z,V[M+3]=1,V[M+4]=J.x,V[M+5]=J.y,V[M+6]=J.z,V[M+7]=1,V[M+8]=y.x,V[M+9]=y.y,V[M+10]=y.z,V[M+11]=1,V[M+12]=I.x,V[M+13]=I.y,V[M+14]=I.z,V[M+15]=1,D=Ja[t.a],J=Ja[t.b],y=Ja[t.c],t=Ja[t.d],aa[M]=D.x,aa[M+1]=
+D.y,aa[M+2]=D.z,aa[M+3]=1,aa[M+4]=J.x,aa[M+5]=J.y,aa[M+6]=J.z,aa[M+7]=1,aa[M+8]=y.x,aa[M+9]=y.y,aa[M+10]=y.z,aa[M+11]=1,aa[M+12]=t.x,aa[M+13]=t.y,aa[M+14]=t.z,aa[M+15]=1,M+=16;if(Xa&&z)v.length==4&&z==THREE.VertexColors?(t=v[0],D=v[1],J=v[2],v=v[3]):v=J=D=t=w,Z[W]=t.r,Z[W+1]=t.g,Z[W+2]=t.b,Z[W+3]=D.r,Z[W+4]=D.g,Z[W+5]=D.b,Z[W+6]=J.r,Z[W+7]=J.g,Z[W+8]=J.b,Z[W+9]=v.r,Z[W+10]=v.g,Z[W+11]=v.b,W+=12;if(Ba&&ea.hasTangents)v=x[0],w=x[1],t=x[2],x=x[3],ia[O]=v.x,ia[O+1]=v.y,ia[O+2]=v.z,ia[O+3]=v.w,ia[O+4]=
+w.x,ia[O+5]=w.y,ia[O+6]=w.z,ia[O+7]=w.w,ia[O+8]=t.x,ia[O+9]=t.y,ia[O+10]=t.z,ia[O+11]=t.w,ia[O+12]=x.x,ia[O+13]=x.y,ia[O+14]=x.z,ia[O+15]=x.w,O+=16;if(ta&&B)if(o.length==4&&ma)for(x=0;x<4;x++)u=o[x],$[P]=u.x,$[P+1]=u.y,$[P+2]=u.z,P+=3;else for(x=0;x<4;x++)$[P]=u.x,$[P+1]=u.y,$[P+2]=u.z,P+=3;if(za&&H!==void 0&&A)for(x=0;x<4;x++)o=H[x],ca[R]=o.u,ca[R+1]=o.v,R+=2;if(za&&G!==void 0&&A)for(x=0;x<4;x++)o=G[x],da[Q]=o.u,da[Q+1]=o.v,Q+=2;oa&&(fa[la]=L,fa[la+1]=L+1,fa[la+2]=L+3,fa[la+3]=L+1,fa[la+4]=L+2,fa[la+
+5]=L+3,la+=6,ha[S]=L,ha[S+1]=L+1,ha[S+2]=L,ha[S+3]=L+3,ha[S+4]=L+1,ha[S+5]=L+2,ha[S+6]=L+2,ha[S+7]=L+3,S+=8,L+=4)}if(Ga){n=0;for(p=Ga.length;n<p;n++)fa[la]=Ga[n].a,fa[la+1]=Ga[n].b,fa[la+2]=Ga[n].c,fa[la+3]=Ga[n].a,fa[la+4]=Ga[n].c,fa[la+5]=Ga[n].d,la+=6}xa&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,T,m));if(ga)for(N in ga)y=ga[N],y.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,y.buffer),j.bufferData(j.ARRAY_BUFFER,y.array,m));if(Ya){D=0;for(J=Aa.length;D<
+J;D++)j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[D]),j.bufferData(j.ARRAY_BUFFER,ja[D],m)}Xa&&W>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));ta&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));Ba&&ea.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,ia,m));za&&R>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));za&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,
+g.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,da,m));oa&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,fa,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ha,m));M>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,V,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,aa,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,
+X,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Y,m));k.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;var ra;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(e=h[f],e.attributes)for(ra in e.attributes)e.attributes[ra].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ra=f;b=j.DYNAMIC_DRAW;p=ra.vertices;h=ra.colors;A=p.length;g=h.length;z=ra.__vertexArray;k=ra.__colorArray;B=ra.__dirtyColors;if(ra.__dirtyVertices){for(m=0;m<A;m++)n=p[m].position,e=m*3,z[e]=n.x,z[e+1]=n.y,z[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,
+ra.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,z,b)}if(B){for(m=0;m<g;m++)color=h[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ra=f;b=j.DYNAMIC_DRAW;p=ra.vertices;h=ra.colors;A=p.length;g=h.length;z=ra.__vertexArray;k=ra.__colorArray;B=ra.__dirtyColors;if(ra.__dirtyVertices){for(m=
+0;m<A;m++)n=p[m].position,e=m*3,z[e]=n.x,z[e+1]=n.y,z[e+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,z,b)}if(B){for(m=0;m<g;m++)color=h[m],e=m*3,k[e]=color.r,k[e+1]=color.g,k[e+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,k,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=
+!1,f.__dirtyColors=!1}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function z(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,h,j,k,m,n,t={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,m=e(k),t[m]==void 0&&(t[m]={hash:m,counter:0}),n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]=
+{faces:[],materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(t[m].counter+=1,n=t[m].hash+"_"+t[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=j}function E(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(b){if(b!=V){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);
+j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}V=b}}function C(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,O(e.wrapS)),j.texParameteri(b,
+j.TEXTURE_WRAP_T,O(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,O(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,O(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_MAG_FILTER,R(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,R(e.minFilter)))}function S(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texSubImage2D(j.TEXTURE_2D,0,0,
+0,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),C(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+e);j.bindTexture(j.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=
+j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,O(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,O(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,O(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,O(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,O(b.format),b.width,b.height,0,O(b.format),O(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,
 b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,
 b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,
-j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=ka,b=fa);e!=ia&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(ca,ha,c,b),ia=e)}function F(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));
-j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
+j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=ea,b=ha);e!=ga&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(aa,ma,c,b),ga=e)}function F(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));
+j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function O(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
 case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
 case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
-case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var N=this,j,R=[],T=null,ia=null,V=!0,K=null,da=null,$=null,aa=null,ca=0,ha=0,ka=0,fa=0,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,X=new Float32Array(16),Z=new Float32Array(16),ga=new THREE.Vector4,U={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},J=b.canvas!==void 0?b.canvas:document.createElement("canvas"),na=b.stencil!==void 0?b.stencil:!0,ja=b.antialias!==void 0?b.antialias:!1,oa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ma=b.clearAlpha!==void 0?b.clearAlpha:0;
-this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=J;this.sortObjects=this.autoClear=!0;try{if(!(j=J.getContext("experimental-webgl",{antialias:ja,stencil:na})))throw"Error creating WebGL context.";}catch(Ca){console.error(Ca)}console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION));j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);
-j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(oa.r,oa.g,oa.b,ma);this.context=j;var Aa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(na){var ea={};ea.vertices=new Float32Array(12);ea.faces=new Uint16Array(6);ea.darkness=0.5;ea.vertices[0]=-20;ea.vertices[1]=-20;ea.vertices[2]=-1;ea.vertices[3]=20;ea.vertices[4]=-20;ea.vertices[5]=-1;ea.vertices[6]=20;ea.vertices[7]=20;ea.vertices[8]=
--1;ea.vertices[9]=-20;ea.vertices[10]=20;ea.vertices[11]=-1;ea.faces[0]=0;ea.faces[1]=1;ea.faces[2]=2;ea.faces[3]=0;ea.faces[4]=2;ea.faces[5]=3;ea.vertexBuffer=j.createBuffer();ea.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,ea.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,ea.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ea.faces,j.STATIC_DRAW);ea.program=j.createProgram();j.attachShader(ea.program,F("fragment",THREE.ShaderLib.shadowPost.fragmentShader));
-j.attachShader(ea.program,F("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(ea.program);ea.vertexLocation=j.getAttribLocation(ea.program,"position");ea.projectionLocation=j.getUniformLocation(ea.program,"projectionMatrix");ea.darknessLocation=j.getUniformLocation(ea.program,"darkness")}var P={};P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=
+case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var N=this,j,T=[],ca=null,ga=null,Z=!0,K=null,$=null,V=null,W=null,aa=0,ma=0,ea=0,ha=0,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,X=new Float32Array(16),ja=new Float32Array(16),fa=new THREE.Vector4,U={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},J=b.canvas!==void 0?b.canvas:document.createElement("canvas"),la=b.stencil!==void 0?b.stencil:!0,ka=b.antialias!==void 0?b.antialias:!1,ia=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),xa=b.clearAlpha!==void 0?b.clearAlpha:0;
+this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=J;this.sortObjects=this.autoClear=!0;try{if(!(j=J.getContext("experimental-webgl",{antialias:ka,stencil:la})))throw"Error creating WebGL context.";}catch(za){console.error(za)}console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION));j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);
+j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ia.r,ia.g,ia.b,xa);this.context=j;var Ba=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(la){var da={};da.vertices=new Float32Array(12);da.faces=new Uint16Array(6);da.darkness=0.5;da.vertices[0]=-20;da.vertices[1]=-20;da.vertices[2]=-1;da.vertices[3]=20;da.vertices[4]=-20;da.vertices[5]=-1;da.vertices[6]=20;da.vertices[7]=20;da.vertices[8]=
+-1;da.vertices[9]=-20;da.vertices[10]=20;da.vertices[11]=-1;da.faces[0]=0;da.faces[1]=1;da.faces[2]=2;da.faces[3]=0;da.faces[4]=2;da.faces[5]=3;da.vertexBuffer=j.createBuffer();da.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,da.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,da.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,da.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,da.faces,j.STATIC_DRAW);da.program=j.createProgram();j.attachShader(da.program,F("fragment",THREE.ShaderLib.shadowPost.fragmentShader));
+j.attachShader(da.program,F("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(da.program);da.vertexLocation=j.getAttribLocation(da.program,"position");da.projectionLocation=j.getUniformLocation(da.program,"projectionMatrix");da.darknessLocation=j.getUniformLocation(da.program,"darkness")}var P={};P.vertices=new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=
 1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=j.createBuffer();P.elementBuffer=j.createBuffer();P.tempTexture=j.createTexture();P.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,P.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
 1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=j.createBuffer();P.elementBuffer=j.createBuffer();P.tempTexture=j.createTexture();P.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,P.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,P.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
 P.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,P.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.texImage2D(j.TEXTURE_2D,
 P.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,P.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,P.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,P.occlusionTexture);j.texImage2D(j.TEXTURE_2D,
 0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(P.hasVertexTexture=!1,P.program=j.createProgram(),j.attachShader(P.program,F("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(P.program,
 0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(P.hasVertexTexture=!1,P.program=j.createProgram(),j.attachShader(P.program,F("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(P.program,
 F("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(P.hasVertexTexture=!0,P.program=j.createProgram(),j.attachShader(P.program,F("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(P.program,F("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(P.program);P.attributes={};P.uniforms={};P.attributes.vertex=j.getAttribLocation(P.program,"position");P.attributes.uv=j.getAttribLocation(P.program,"UV");P.uniforms.renderType=j.getUniformLocation(P.program,
 F("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(P.hasVertexTexture=!0,P.program=j.createProgram(),j.attachShader(P.program,F("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(P.program,F("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(P.program);P.attributes={};P.uniforms={};P.attributes.vertex=j.getAttribLocation(P.program,"position");P.attributes.uv=j.getAttribLocation(P.program,"UV");P.uniforms.renderType=j.getUniformLocation(P.program,
-"renderType");P.uniforms.map=j.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=j.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=j.getUniformLocation(P.program,"opacity");P.uniforms.scale=j.getUniformLocation(P.program,"scale");P.uniforms.rotation=j.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=j.getUniformLocation(P.program,"screenPosition");var ua=!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++]=1;_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++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;b=_sprite.vertices[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=
-j.createBuffer();_sprite.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,_sprite.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,_sprite.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,_sprite.faces,j.STATIC_DRAW);_sprite.program=j.createProgram();j.attachShader(_sprite.program,F("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(_sprite.program,F("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(_sprite.program);
-_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=j.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=j.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=j.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=j.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=j.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=j.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=
-j.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=j.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=j.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=j.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=j.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=j.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=
-j.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=j.getUniformLocation(_sprite.program,"projectionMatrix");var qa=!1;this.setSize=function(b,e){J.width=b;J.height=e;this.setViewport(0,0,J.width,J.height)};this.setViewport=function(b,e,c,f){ca=b;ha=e;ka=c;fa=f;j.viewport(ca,ha,ka,fa)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){V=
-b;j.depthMask(b)};this.setClearColorHex=function(b,e){oa.setHex(b);ma=e;j.clearColor(oa.r,oa.g,oa.b,ma)};this.setClearColor=function(b,e){oa.copy(b);ma=e;j.clearColor(oa.r,oa.g,oa.b,ma)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ea.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var g,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?
-k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,p;n=p=m=0;for(o=e.length;n<
-o;n++)h=e[n],h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&m++;m+p<=4?e=p:(e=Math.ceil(4*p/(m+p)),m=4-e);h={directional:e,point:m};p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var t;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
-maxDirLights:h.directional,maxPointLights:h.point,maxBones:p},u;h=[];k?h.push(k):(h.push(n),h.push(o));for(u in c)h.push(u),h.push(c[u]);k=h.join();u=0;for(h=R.length;u<h;u++)if(R[u].code==k){t=R[u].program;break a}u=j.createProgram();h=["#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");p=[Aa?"#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");
-j.attachShader(u,F("fragment",h+n));j.attachShader(u,F("vertex",p+o));j.linkProgram(u);j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");u.uniforms={};u.attributes={};var v;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)n.push(v);v=n;m=0;for(n=
-v.length;m<n;m++)o=v[m],u.uniforms[o]=j.getUniformLocation(u,o);n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)n.push("morphTarget"+v);for(t in e)n.push(t);t=n;v=0;for(e=t.length;v<e;v++)c=t[v],u.attributes[c]=j.getAttribLocation(u,c);R.push({program:u,code:k});t=u}b.program=t;t=b.program.attributes;t.position>=0&&j.enableVertexAttribArray(t.position);t.color>=0&&j.enableVertexAttribArray(t.color);t.normal>=
-0&&j.enableVertexAttribArray(t.normal);t.tangent>=0&&j.enableVertexAttribArray(t.tangent);b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(j.enableVertexAttribArray(t.skinVertexA),j.enableVertexAttribArray(t.skinVertexB),j.enableVertexAttribArray(t.skinIndex),j.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(g in b.attributes)t[g]!==void 0&&t[g]>=0&&j.enableVertexAttribArray(t[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;t.morphTarget0>=0&&(j.enableVertexAttribArray(t.morphTarget0),
-b.numSupportedMorphTargets++);t.morphTarget1>=0&&(j.enableVertexAttribArray(t.morphTarget1),b.numSupportedMorphTargets++);t.morphTarget2>=0&&(j.enableVertexAttribArray(t.morphTarget2),b.numSupportedMorphTargets++);t.morphTarget3>=0&&(j.enableVertexAttribArray(t.morphTarget3),b.numSupportedMorphTargets++);t.morphTarget4>=0&&(j.enableVertexAttribArray(t.morphTarget4),b.numSupportedMorphTargets++);t.morphTarget5>=0&&(j.enableVertexAttribArray(t.morphTarget5),b.numSupportedMorphTargets++);t.morphTarget6>=
-0&&(j.enableVertexAttribArray(t.morphTarget6),b.numSupportedMorphTargets++);t.morphTarget7>=0&&(j.enableVertexAttribArray(t.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,c,p,x){var z,J,C,E,U,G,F,I,K=b.lights,O=b.fog;N.data.vertices=0;N.data.faces=0;N.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Z);
-c.projectionMatrix.flattenToArray(X);Y.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Y);this.initWebGLObjects(b);M(p);(this.autoClear||x)&&this.clear();U=b.__webglObjects.length;for(x=0;x<U;x++)if(z=b.__webglObjects[x],F=z.object,F.visible)if(!(F instanceof THREE.Mesh)||n(F)){if(F.matrixWorld.flattenToArray(F._objectMatrixArray),B(F,c),t(z),z.render=!0,this.sortObjects)ga.copy(F.position),Y.multiplyVector3(ga),z.z=ga.z}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(u);
-G=b.__webglObjectsImmediate.length;for(x=0;x<G;x++)z=b.__webglObjectsImmediate[x],F=z.object,F.visible&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),B(F,c),o(z));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);H(b.overrideMaterial.blending);for(x=0;x<U;x++)if(z=b.__webglObjects[x],z.render)F=z.object,I=z.buffer,h(F),f(c,K,O,b.overrideMaterial,I,F);for(x=0;x<G;x++)z=b.__webglObjectsImmediate[x],F=z.object,F.visible&&(h(F),J=e(c,K,O,b.overrideMaterial,F),F.render(function(e){g(e,
+"renderType");P.uniforms.map=j.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=j.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=j.getUniformLocation(P.program,"opacity");P.uniforms.scale=j.getUniformLocation(P.program,"scale");P.uniforms.rotation=j.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=j.getUniformLocation(P.program,"screenPosition");var ta=!1,Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);b=0;Q.vertices[b++]=-1;Q.vertices[b++]=
+-1;Q.vertices[b++]=0;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=1;Q.vertices[b++]=0;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=0;b=Q.vertices[b++]=0;Q.faces[b++]=0;Q.faces[b++]=1;Q.faces[b++]=2;Q.faces[b++]=0;Q.faces[b++]=2;Q.faces[b++]=3;Q.vertexBuffer=j.createBuffer();Q.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,Q.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q.vertices,j.STATIC_DRAW);
+j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Q.faces,j.STATIC_DRAW);Q.program=j.createProgram();j.attachShader(Q.program,F("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(Q.program,F("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.position=j.getAttribLocation(Q.program,"position");Q.attributes.uv=j.getAttribLocation(Q.program,"uv");Q.uniforms.uvOffset=j.getUniformLocation(Q.program,
+"uvOffset");Q.uniforms.uvScale=j.getUniformLocation(Q.program,"uvScale");Q.uniforms.rotation=j.getUniformLocation(Q.program,"rotation");Q.uniforms.scale=j.getUniformLocation(Q.program,"scale");Q.uniforms.alignment=j.getUniformLocation(Q.program,"alignment");Q.uniforms.map=j.getUniformLocation(Q.program,"map");Q.uniforms.opacity=j.getUniformLocation(Q.program,"opacity");Q.uniforms.useScreenCoordinates=j.getUniformLocation(Q.program,"useScreenCoordinates");Q.uniforms.affectedByDistance=j.getUniformLocation(Q.program,
+"affectedByDistance");Q.uniforms.screenPosition=j.getUniformLocation(Q.program,"screenPosition");Q.uniforms.modelViewMatrix=j.getUniformLocation(Q.program,"modelViewMatrix");Q.uniforms.projectionMatrix=j.getUniformLocation(Q.program,"projectionMatrix");var oa=!1;this.setSize=function(b,e){J.width=b;J.height=e;this.setViewport(0,0,J.width,J.height)};this.setViewport=function(b,e,c,f){aa=b;ma=e;ea=c;ha=f;j.viewport(aa,ma,ea,ha)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=
+function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){Z=b;j.depthMask(b)};this.setClearColorHex=function(b,e){ia.setHex(b);xa=e;j.clearColor(ia.r,ia.g,ia.b,xa)};this.setClearColor=function(b,e){ia.copy(b);xa=e;j.clearColor(ia.r,ia.g,ia.b,xa)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){da.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,
+e,c,f){var g,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);
+b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,t,p;n=p=m=0;for(t=e.length;n<t;n++)h=e[n],h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&m++;m+p<=4?e=p:(e=Math.ceil(4*p/(m+p)),m=4-e);h={directional:e,point:m};p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var o;a:{n=b.fragmentShader;t=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,
+skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:p},u;h=[];k?h.push(k):(h.push(n),h.push(t));for(u in c)h.push(u),h.push(c[u]);k=h.join();u=0;for(h=T.length;u<h;u++)if(T[u].code==k){o=T[u].program;break a}u=j.createProgram();h=["#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");p=[Ba?"#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");
+j.attachShader(u,F("fragment",h+n));j.attachShader(u,F("vertex",p+t));j.linkProgram(u);j.getProgramParameter(u,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(u,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");u.uniforms={};u.attributes={};var v;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)n.push(v);v=n;m=0;for(n=
+v.length;m<n;m++)t=v[m],u.uniforms[t]=j.getUniformLocation(u,t);n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<c.maxMorphTargets;v++)n.push("morphTarget"+v);for(o in e)n.push(o);o=n;v=0;for(e=o.length;v<e;v++)c=o[v],u.attributes[c]=j.getAttribLocation(u,c);T.push({program:u,code:k});o=u}b.program=o;o=b.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=
+0&&j.enableVertexAttribArray(o.normal);o.tangent>=0&&j.enableVertexAttribArray(o.tangent);b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(g in b.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;o.morphTarget0>=0&&(j.enableVertexAttribArray(o.morphTarget0),
+b.numSupportedMorphTargets++);o.morphTarget1>=0&&(j.enableVertexAttribArray(o.morphTarget1),b.numSupportedMorphTargets++);o.morphTarget2>=0&&(j.enableVertexAttribArray(o.morphTarget2),b.numSupportedMorphTargets++);o.morphTarget3>=0&&(j.enableVertexAttribArray(o.morphTarget3),b.numSupportedMorphTargets++);o.morphTarget4>=0&&(j.enableVertexAttribArray(o.morphTarget4),b.numSupportedMorphTargets++);o.morphTarget5>=0&&(j.enableVertexAttribArray(o.morphTarget5),b.numSupportedMorphTargets++);o.morphTarget6>=
+0&&(j.enableVertexAttribArray(o.morphTarget6),b.numSupportedMorphTargets++);o.morphTarget7>=0&&(j.enableVertexAttribArray(o.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,c,o,x){var z,J,C,E,U,G,F,I,K=b.lights,O=b.fog;N.data.vertices=0;N.data.faces=0;N.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ja);
+c.projectionMatrix.flattenToArray(X);Y.multiply(c.projectionMatrix,c.matrixWorldInverse);m(Y);this.initWebGLObjects(b);L(o);(this.autoClear||x)&&this.clear();U=b.__webglObjects.length;for(x=0;x<U;x++)if(z=b.__webglObjects[x],F=z.object,F.visible)if(!(F instanceof THREE.Mesh)||n(F)){if(F.matrixWorld.flattenToArray(F._objectMatrixArray),B(F,c),t(z),z.render=!0,this.sortObjects)fa.copy(F.position),Y.multiplyVector3(fa),z.z=fa.z}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(u);
+G=b.__webglObjectsImmediate.length;for(x=0;x<G;x++)z=b.__webglObjectsImmediate[x],F=z.object,F.visible&&(F.matrixAutoUpdate&&F.matrixWorld.flattenToArray(F._objectMatrixArray),B(F,c),p(z));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);H(b.overrideMaterial.blending);for(x=0;x<U;x++)if(z=b.__webglObjects[x],z.render)F=z.object,I=z.buffer,h(F),f(c,K,O,b.overrideMaterial,I,F);for(x=0;x<G;x++)z=b.__webglObjectsImmediate[x],F=z.object,F.visible&&(h(F),J=e(c,K,O,b.overrideMaterial,F),F.render(function(e){g(e,
 J,b.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(x=0;x<U;x++)if(z=b.__webglObjects[x],z.render){F=z.object;I=z.buffer;C=z.opaque;h(F);for(z=0;z<C.count;z++)E=C.list[z],k(E.depthTest),f(c,K,O,E,I,F)}for(x=0;x<G;x++)if(z=b.__webglObjectsImmediate[x],F=z.object,F.visible){C=z.opaque;h(F);for(z=0;z<C.count;z++)E=C.list[z],k(E.depthTest),J=e(c,K,O,E,F),F.render(function(b){g(b,J,E.shading)})}for(x=0;x<U;x++)if(z=b.__webglObjects[x],z.render){F=z.object;I=z.buffer;C=z.transparent;h(F);
 J,b.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(x=0;x<U;x++)if(z=b.__webglObjects[x],z.render){F=z.object;I=z.buffer;C=z.opaque;h(F);for(z=0;z<C.count;z++)E=C.list[z],k(E.depthTest),f(c,K,O,E,I,F)}for(x=0;x<G;x++)if(z=b.__webglObjectsImmediate[x],F=z.object,F.visible){C=z.opaque;h(F);for(z=0;z<C.count;z++)E=C.list[z],k(E.depthTest),J=e(c,K,O,E,F),F.render(function(b){g(b,J,E.shading)})}for(x=0;x<U;x++)if(z=b.__webglObjects[x],z.render){F=z.object;I=z.buffer;C=z.transparent;h(F);
-for(z=0;z<C.count;z++)E=C.list[z],H(E.blending),k(E.depthTest),f(c,K,O,E,I,F)}for(x=0;x<G;x++)if(z=b.__webglObjectsImmediate[x],F=z.object,F.visible){C=z.transparent;h(F);for(z=0;z<C.count;z++)E=C.list[z],H(E.blending),k(E.depthTest),J=e(c,K,O,E,F),F.render(function(b){g(b,J,E.shading)})}}b.__webglSprites.length&&w(b,c);na&&b.__webglShadowVolumes.length&&b.lights.length&&v(b);b.__webglLensFlares.length&&A(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,
-p.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.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 e=b.__objectsAdded[0],c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=
+for(z=0;z<C.count;z++)E=C.list[z],H(E.blending),k(E.depthTest),f(c,K,O,E,I,F)}for(x=0;x<G;x++)if(z=b.__webglObjectsImmediate[x],F=z.object,F.visible){C=z.transparent;h(F);for(z=0;z<C.count;z++)E=C.list[z],H(E.blending),k(E.depthTest),J=e(c,K,O,E,F),F.render(function(b){g(b,J,E.shading)})}}b.__webglSprites.length&&w(b,c);la&&b.__webglShadowVolumes.length&&b.lights.length&&v(b);b.__webglLensFlares.length&&A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,
+o.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.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 e=b.__objectsAdded[0],c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=
 new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&z(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=
 new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&z(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=
-j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){var m=void 0,n=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(n=k.numMorphTargets;m<n;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=h,m=e,o=void 0,p=void 0,t=void 0,u=t=void 0,v=void 0,w=void 0,A=w=n=0,B=t=p=void 0,J=B=p=o=void 0,t=void 0,u=m.geometry,v=u.faces,B=k.faces,o=0,p=B.length;o<
-p;o++)t=B[o],t=v[t],t instanceof THREE.Face3?(n+=3,w+=1,A+=3):t instanceof THREE.Face4&&(n+=4,w+=2,A+=4);for(var o=k,p=m,C=B=v=void 0,U=void 0,C=void 0,t=[],v=0,B=p.materials.length;v<B;v++)if(C=p.materials[v],C instanceof THREE.MeshFaceMaterial){C=0;for(l=o.materials.length;C<l;C++)(U=o.materials[C])&&t.push(U)}else(U=C)&&t.push(U);o=t;k.__materials=o;a:{v=p=void 0;B=o.length;for(p=0;p<B;p++)if(v=o[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{B=v=void 0;t=o.length;
-for(v=0;v<t;v++)if(B=o[v],!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){B=B&&B.shading!=void 0&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}B=!1}a:{t=v=void 0;C=o.length;for(v=0;v<C;v++)if(t=o[v],t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(n*3);if(B)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(t)k.__colorArray=new Float32Array(n*3);if(p){if(u.faceUvs.length>
+j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){var m=void 0,n=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(n=k.numMorphTargets;m<n;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=h,m=e,o=void 0,t=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,A=w=n=0,B=p=t=void 0,J=B=t=o=void 0,p=void 0,u=m.geometry,v=u.faces,B=k.faces,o=0,t=B.length;o<
+t;o++)p=B[o],p=v[p],p instanceof THREE.Face3?(n+=3,w+=1,A+=3):p instanceof THREE.Face4&&(n+=4,w+=2,A+=4);for(var o=k,t=m,C=B=v=void 0,U=void 0,C=void 0,p=[],v=0,B=t.materials.length;v<B;v++)if(C=t.materials[v],C instanceof THREE.MeshFaceMaterial){C=0;for(l=o.materials.length;C<l;C++)(U=o.materials[C])&&p.push(U)}else(U=C)&&p.push(U);o=p;k.__materials=o;a:{v=t=void 0;B=o.length;for(t=0;t<B;t++)if(v=o[t],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{B=v=void 0;p=o.length;
+for(v=0;v<p;v++)if(B=o[v],!(B instanceof THREE.MeshBasicMaterial&&!B.envMap||B instanceof THREE.MeshDepthMaterial)){B=B&&B.shading!=void 0&&B.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}B=!1}a:{p=v=void 0;C=o.length;for(v=0;v<C;v++)if(p=o[v],p.vertexColors){p=p.vertexColors;break a}p=!1}k.__vertexArray=new Float32Array(n*3);if(B)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(p)k.__colorArray=new Float32Array(n*3);if(t){if(u.faceUvs.length>
 0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),k.__skinVertexBArray=new Float32Array(n*4),k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(A*2);
 0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),k.__skinVertexBArray=new Float32Array(n*4),k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(A*2);
-if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=B==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=B;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=A*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes)for(a in k.__webglCustomAttributes={},p.attributes){t=p.attributes[a];B={};for(J in t)B[J]=t[J];if(!B.__webglInitialized||
-B.createUniqueBuffers)B.__webglInitialized=!0,w=1,B.type==="v2"?w=2:B.type==="v3"?w=3:B.type==="v4"?w=4:B.type==="c"&&(w=3),B.size=w,B.array=new Float32Array(n*w),B.buffer=j.createBuffer(),B.buffer.belongsToAttribute=a,t.needsUpdate=!0,B.__original=t;k.__webglCustomAttributes[a]=B}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?E(c.__webglShadowVolumes,
+if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=B==THREE.SmoothShading;k.__uvType=t;k.__vertexColorType=p;k.__normalType=B;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=A*2;u=0;for(v=o.length;u<v;u++)if(t=o[u],t.attributes)for(a in k.__webglCustomAttributes={},t.attributes){p=t.attributes[a];B={};for(J in p)B[J]=p[J];if(!B.__webglInitialized||
+B.createUniqueBuffers)B.__webglInitialized=!0,w=1,B.type==="v2"?w=2:B.type==="v3"?w=3:B.type==="v4"?w=4:B.type==="c"&&(w=3),B.size=w,B.array=new Float32Array(n*w),B.buffer=j.createBuffer(),B.buffer.belongsToAttribute=a,p.needsUpdate=!0,B.__original=p;k.__webglCustomAttributes[a]=B}k.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?E(c.__webglShadowVolumes,
 h,e):E(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)E(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.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;E(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=
 h,e):E(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)E(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.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;E(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=
 g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.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;E(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=
 g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.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;E(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.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;E(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)e=b.__objectsRemoved[0],c=b,e instanceof THREE.ShadowVolume?G(c.__webglShadowVolumes,e):e instanceof
 new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;E(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)e=b.__objectsRemoved[0],c=b,e instanceof THREE.ShadowVolume?G(c.__webglShadowVolumes,e):e instanceof
 THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line?G(c.__webglObjects,e):e instanceof THREE.Sprite?G(c.__webglSprites,e):e instanceof THREE.LensFlare?G(c.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&G(c.__webglObjectsImmediate,e),b.__objectsRemoved.splice(0,1);e=0;for(c=b.__webglObjects.length;e<c;e++)x(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)x(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<
 THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line?G(c.__webglObjects,e):e instanceof THREE.Sprite?G(c.__webglSprites,e):e instanceof THREE.LensFlare?G(c.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&G(c.__webglObjectsImmediate,e),b.__objectsRemoved.splice(0,1);e=0;for(c=b.__webglObjects.length;e<c;e++)x(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)x(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<
-c;e++)x(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return Aa}};
+c;e++)x(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return Ba}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 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,c,e){e&&b.update(void 0,!1,c);var e=b.sounds,f,g=e.length;for(f=0;f<g;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
 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,c,e){e&&b.update(void 0,!1,c);var e=b.sounds,f,g=e.length;for(f=0;f<g;f++)b=e[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
@@ -345,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.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,h=Math.max(Math.max(e,f),g),k=Math.min(Math.min(e,f),g);if(k==h)k=e=0;else{var m=h-k,k=m/h,e=e==h?(f-g)/m:f==h?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=h;return c},
 THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,h=Math.max(Math.max(e,f),g),k=Math.min(Math.min(e,f),g);if(k==h)k=e=0;else{var m=h-k,k=m/h,e=e==h?(f-g)/m:f==h?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=h;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,k=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=k.length;o<t;o++){var u=new THREE.Vertex(k[o].position.clone());e&&c.matrix.multiplyVector3(u.position);h.push(u)}o=0;for(t=n.length;o<t;o++){var k=n[o],v,w,A=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?v=new THREE.Face3(k.a+f,k.b+f,k.c+f):
-k instanceof THREE.Face4&&(v=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));v.normal.copy(k.normal);e=0;for(h=A.length;e<h;e++)w=A[e],v.vertexNormals.push(w.clone());v.color.copy(k.color);e=0;for(h=u.length;e<h;e++)w=u[e],v.vertexColors.push(w.clone());v.materials=k.materials.slice();v.centroid.copy(k.centroid);m.push(v)}o=0;for(t=g.length;o<t;o++){f=g[o];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
+var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,k=g.vertices,m=b.faces,n=g.faces,o=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=k.length;p<t;p++){var u=new THREE.Vertex(k[p].position.clone());e&&c.matrix.multiplyVector3(u.position);h.push(u)}p=0;for(t=n.length;p<t;p++){var k=n[p],v,w,A=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?v=new THREE.Face3(k.a+f,k.b+f,k.c+f):
+k instanceof THREE.Face4&&(v=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));v.normal.copy(k.normal);e=0;for(h=A.length;e<h;e++)w=A[e],v.vertexNormals.push(w.clone());v.color.copy(k.color);e=0;for(h=u.length;e<h;e++)w=u[e],v.vertexColors.push(w.clone());v.materials=k.materials.slice();v.centroid.copy(k.centroid);m.push(v)}p=0;for(t=g.length;p<t;p++){f=g[p];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));o.push(m)}}};
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;e&&e(this)},g[c].src=b[c];return h}};
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;e&&e(this)},g[c].src=b[c];return h}};
-THREE.SceneUtils={addMesh:function(b,c,e,f,g,h,k,m,n,p){c=new THREE.Mesh(c,p);c.scale.x=c.scale.y=c.scale.z=e;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=k;c.rotation.y=m;c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,e){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new THREE.CubeGeometry(c,c,c,1,1,1,null,!0),e);b.addObject(c);
+THREE.SceneUtils={addMesh:function(b,c,e,f,g,h,k,m,n,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=e;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=k;c.rotation.y=m;c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,e){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new THREE.CubeGeometry(c,c,c,1,1,1,null,!0),e);b.addObject(c);
 return c},addPanoramaCube:function(b,c,e){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,f,!0),
 return c},addPanoramaCube:function(b,c,e){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,f,!0),
 new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,e){var f=c/2,c=new THREE.Plane(c,c),g=Math.PI,h=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));THREE.SceneUtils.addMesh(b,c,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));THREE.SceneUtils.addMesh(b,c,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));THREE.SceneUtils.addMesh(b,c,1,0,f,0,h,0,g,
 new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,e){var f=c/2,c=new THREE.Plane(c,c),g=Math.PI,h=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));THREE.SceneUtils.addMesh(b,c,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));THREE.SceneUtils.addMesh(b,c,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));THREE.SceneUtils.addMesh(b,c,1,0,f,0,h,0,g,
 new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}))},showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}))},showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
@@ -363,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}",
 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,e,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;e=Array(h);for(c=f=0;c<h;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<h;++c)e[c]/=f;return e}};
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;e=Array(h);for(c=f=0;c<h;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<h;++c)e[c]/=f;return e}};
 THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,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 e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
 THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,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 e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
-0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var p=b.hierarchy[e].keys[f].morphTargets[n];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
-{};for(p in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===p){o[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(o[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var o=b.hierarchy[e].keys[f].morphTargets[n];m[o]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var p=
+{};for(o in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===o){p[o]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(p[o]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=p}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));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 e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
 b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));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 e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
 2;return e}();THREE.Animation=function(b,c,e,f){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=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
 2;return e}();THREE.Animation=function(b,c,e,f){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=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!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 e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
 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 e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
 THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.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.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,k,m,n,p,o=this.data.JIT.hierarchy,t,u;this.currentTime+=b*this.timeScale;u=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,w=this.hierarchy.length;v<w;v++)if(b=this.hierarchy[v],n=b.animationCache,this.JITCompile&&o[v][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=o[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var A=0;A<3;A++){e=c[A];k=n.prevKey[e];m=n.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){k=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)k=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do k=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,k,m,n,o,p=this.data.JIT.hierarchy,t,u;this.currentTime+=b*this.timeScale;u=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,w=this.hierarchy.length;v<w;v++)if(b=this.hierarchy[v],n=b.animationCache,this.JITCompile&&p[v][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=p[v][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=p[v][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var A=0;A<3;A++){e=c[A];k=n.prevKey[e];m=n.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){k=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)k=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do k=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
 t)}n.prevKey[e]=k;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(m.time-k.time);g=k[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 t)}n.prevKey[e]=k;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(m.time-k.time);g=k[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",v,k.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
 this.getPrevKeyWith("pos",v,k.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
-"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)o[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,k,m,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;k=g*e;f[0]=this.interpolate(h[0],m[0],n[0],p[0],g,e,k);f[1]=this.interpolate(h[1],m[1],n[1],p[1],g,e,k);f[2]=this.interpolate(h[2],m[2],n[2],p[2],g,e,k);return f};
+"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&p[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)p[v][o]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,k,m,n,o;g=(b.length-1)*c;h=Math.floor(g);g-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];m=b[e[1]];n=b[e[2]];o=b[e[3]];e=g*g;k=g*e;f[0]=this.interpolate(h[0],m[0],n[0],o[0],g,e,k);f[1]=this.interpolate(h[1],m[1],n[1],o[1],g,e,k);f[2]=this.interpolate(h[2],m[2],n[2],o[2],g,e,k);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,g,h,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,g,h,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
 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=
 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=
@@ -409,65 +408,65 @@ 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!=
 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,
 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;
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,u=0,v=0,w=0,A=window.innerWidth/2,B=window.innerHeight/2;this.update=
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*u);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Matrix4,n=!1,o=1,p=0,t=0,u=0,v=0,w=0,A=window.innerWidth/2,B=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*t);this.translateY(b*u);n&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();k.copy(this.forward);h.set(0,1,0);g.cross(h,k).normalize();h.cross(k,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=k.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=k.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=k.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();k.copy(this.forward);h.set(0,1,0);g.cross(h,k).normalize();h.cross(k,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=k.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=k.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=k.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
 this.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){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
 this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){v=(b.clientX-A)/window.innerWidth;w=(b.clientY-B)/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:t=-1;break;
-case 40:case 83:o=-1;break;case 39:case 68:t=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:t=0;break;case 40:case 83:o=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:u=0;break;case 70:u=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+function(b){v=(b.clientX-A)/window.innerWidth;w=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
+case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:n=!0;o=1;break;case 69:n=!0;o=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:u=0;break;case 70:u=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 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||
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=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-
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2,p=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 e=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),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f};
 this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=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),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f};
 this.rotateCamera=function(){var b=Math.acos(h.dot(k)/h.length()/k.length());if(b){var c=(new THREE.Vector3).cross(h,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?h=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(h))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
 this.rotateCamera=function(){var b=Math.acos(h.dot(k)/h.length()/k.length());if(b){var c=(new THREE.Vector3).cross(h,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?h=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(h))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.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?p=o:p.addSelf(b.sub(o,p).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=p.clone().subSelf(o);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.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=p:o.addSelf(b.sub(p,o).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
 g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,c,e){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
 g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,c,e){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(b){e&&(h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),p=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===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(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
+c(this,function(b){e&&(h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),o=p=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(p=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
+b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(o=p=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=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.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
-THREE.CubeGeometry=function(b,c,e,f,g,h,k,m,n){function p(b,c,e,k,m,n,p,t){var u,v,w=f||1,A=g||1,N=m/2,j=n/2,R=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",A=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=h||1;var T=w+1,ia=A+1;m/=w;var V=n/A;for(v=0;v<ia;v++)for(n=0;n<T;n++){var K=new THREE.Vector3;K[b]=(n*m-N)*e;K[c]=(v*V-j)*k;K[u]=p;o.vertices.push(new THREE.Vertex(K))}for(v=0;v<A;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+T*
-v+R,n+T*(v+1)+R,n+1+T*(v+1)+R,n+1+T*v+R,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/A),new THREE.UV(n/w,(v+1)/A),new THREE.UV((n+1)/w,(v+1)/A),new THREE.UV((n+1)/w,v/A)])}THREE.Geometry.call(this);var o=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var A in n)this.sides[A]!=void 0&&(this.sides[A]=
-n[A]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var g=o.vertices[e],h=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(g.position.x==n.position.x&&
-g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=k;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)g=o.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.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,e,f,g,h){function k(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)k(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)k(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){k(0,0,-o-(h||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){k(0,0,o+
-(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));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,e,f,g,h,k,m,n){function o(b,c,e,k,m,n,o,t){var u,v,w=f||1,A=g||1,N=m/2,j=n/2,T=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",A=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=h||1;var ca=w+1,ga=A+1;m/=w;var Z=n/A;for(v=0;v<ga;v++)for(n=0;n<ca;n++){var K=new THREE.Vector3;K[b]=(n*m-N)*e;K[c]=(v*Z-j)*k;K[u]=o;p.vertices.push(new THREE.Vertex(K))}for(v=0;v<A;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+
+ca*v+T,n+ca*(v+1)+T,n+1+ca*(v+1)+T,n+1+ca*v+T,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/A),new THREE.UV(n/w,(v+1)/A),new THREE.UV((n+1)/w,(v+1)/A),new THREE.UV((n+1)/w,v/A)])}THREE.Geometry.call(this);var p=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var A in n)this.sides[A]!=void 0&&(this.sides[A]=
+n[A]);this.sides.px&&o("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&o("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&o("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&o("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&o("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var g=p.vertices[e],h=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(g.position.x==n.position.x&&
+g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=k;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)g=p.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(b,c,e,f,g,h){function k(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,o=Math.PI*2,p=f/2;for(n=0;n<b;n++)k(Math.sin(o*n/b)*c,Math.cos(o*n/b)*c,-p);for(n=0;n<b;n++)k(Math.sin(o*n/b)*e,Math.cos(o*n/b)*e,p);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){k(0,0,-p-(h||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){k(0,0,p+
+(g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],p=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/f));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,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=new THREE.Geometry,k;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,
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=new THREE.Geometry,k;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){k=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),p=f(h.faces[m].b,h.faces[m].c),o=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,o,k);e(h.faces[m].b,p,n,k);
-e(h.faces[m].c,o,p,k);e(n,p,o,k)}h.faces=k.faces}g.faces=h.faces;delete h;delete k;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);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){k=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),o=f(h.faces[m].b,h.faces[m].c),p=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,p,k);e(h.faces[m].b,o,n,k);
+e(h.faces[m].c,p,o,k);e(n,o,p,k)}h.faces=k.faces}g.faces=h.faces;delete h;delete k;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],h=[],k=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=k.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=h;n==0&&(h=f);
 THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],h=[],k=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=k.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=h;n==0&&(h=f);
 for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,h=b/2,k=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-k),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,h=b/2,k=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var o=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*o-k),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,h=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var t=2*f/h,u=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==k)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);p.push(o)}c.push(p)}for(var v,w,A,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){p=f==h-1;k=c[e][p?0:f+1];m=c[e][p?h-1:f];n=c[e-1][p?
-h-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);w=(f+1)/h;var t=f/h,o=new THREE.UV(1-w,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),B=new THREE.UV(1-w,v);e<c.length-1&&(v=this.vertices[k].position.clone(),w=this.vertices[m].position.clone(),A=this.vertices[n].position.clone(),v.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(k,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([o,u,t]));e>1&&(v=
-this.vertices[k].position.clone(),w=this.vertices[n].position.clone(),A=this.vertices[p].position.clone(),v.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([o,t,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,h=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),o=[],p=0;for(f=0;f<h;f++){var t=2*f/h,u=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==k)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);o.push(p)}c.push(o)}for(var v,w,A,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){o=f==h-1;k=c[e][o?0:f+1];m=c[e][o?h-1:f];n=c[e-1][o?
+h-1:f];o=c[e-1][o?0:f+1];u=e/(g-1);v=(e-1)/(g-1);w=(f+1)/h;var t=f/h,p=new THREE.UV(1-w,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),B=new THREE.UV(1-w,v);e<c.length-1&&(v=this.vertices[k].position.clone(),w=this.vertices[m].position.clone(),A=this.vertices[n].position.clone(),v.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(k,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([p,u,t]));e>1&&(v=
+this.vertices[k].position.clone(),w=this.vertices[n].position.clone(),A=this.vertices[o].position.clone(),v.normalize(),w.normalize(),A.normalize(),this.faces.push(new THREE.Face3(k,n,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([p,t,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 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 e(b,c,e){w.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e,f){w.faces.push(new THREE.Face4(b,c,e,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,k=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
-void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=k;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,u=m.faces,k=m.contour,v=m.bezel,w=this;w.vertices=[];w.faces=[];for(var A,n=h.length,B=u.length,o=v.length,m=0;m<n;m++)A=h[m],e(A.x,A.y,0);for(m=0;m<n;m++)A=h[m],e(A.x,A.y,g);if(t){for(m=0;m<o;m++)A=v[m],e(A.x,A.y,p);for(m=0;m<o;m++)A=v[m],e(A.x,A.y,g-p)}for(m=
-0;m<B;m++)g=u[m],w.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<B;m++)g=u[m],w.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var x;if(t)for(m=v.length;--m>0;){if(x){if(x.equals(k[m])){x=null;continue}}else x=k[m];p=n*2+m;u=p-1;f(p,u,u+o,p+o);for(t=0;t<n;t++)if(h[t].equals(k[m]))break;for(g=0;g<n;g++)if(h[g].equals(k[m-1]))break;f(t,g,u,p);f(p+o,u+o,g+n,t+n)}else for(m=k.length;--m>0;){if(x){if(x.equals(k[m])){x=null;continue}}else x=k[m];for(t=0;t<n;t++)if(h[t].equals(k[m]))break;for(g=
+THREE.TextGeometry.prototype.set=function(b,c){function e(b,c,e){w.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e,f){w.faces.push(new THREE.Face4(b,c,e,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,k=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",o=c.bezelThickness!==void 0?c.bezelThickness:10,p=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
+void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=k;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=p;var m=THREE.FontUtils.drawText(b),h=m.points,u=m.faces,k=m.contour,v=m.bezel,w=this;w.vertices=[];w.faces=[];for(var A,n=h.length,B=u.length,p=v.length,m=0;m<n;m++)A=h[m],e(A.x,A.y,0);for(m=0;m<n;m++)A=h[m],e(A.x,A.y,g);if(t){for(m=0;m<p;m++)A=v[m],e(A.x,A.y,o);for(m=0;m<p;m++)A=v[m],e(A.x,A.y,g-o)}for(m=
+0;m<B;m++)g=u[m],w.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<B;m++)g=u[m],w.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var x;if(t)for(m=v.length;--m>0;){if(x){if(x.equals(k[m])){x=null;continue}}else x=k[m];o=n*2+m;u=o-1;f(o,u,u+p,o+p);for(t=0;t<n;t++)if(h[t].equals(k[m]))break;for(g=0;g<n;g++)if(h[g].equals(k[m-1]))break;f(t,g,u,o);f(o+p,u+p,g+n,t+n)}else for(m=k.length;--m>0;){if(x){if(x.equals(k[m])){x=null;continue}}else x=k[m];for(t=0;t<n;t++)if(h[t].equals(k[m]))break;for(g=
 0;g<n;g++)if(h[g].equals(k[m-1]))break;f(t,g,g+n,t+n)}this.computeCentroids();this.computeFaceNormals()};
 0;g<n;g++)if(h[g].equals(k[m-1]))break;f(t,g,g+n,t+n)}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"),
 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:[]};for(var e,f,g,h,k,m=[],n=0;n<c.length;n++){k=c[n];h=[];for(e=0;e<k.length;e++)f=k[e],h.push(f.x+","+f.y);var p;e=h.slice(1).indexOf(h[0]);var o=this.Triangulate.area(k.slice(0,e+1))<0;f=[];for(e=-1;e<h.length;){p=e+1;e=h[p];e=h.slice(p+1).indexOf(e)+p;if(e<=p)break;var t=k.slice(p,e+1);o?this.Triangulate.area(t)<0?(p>0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}o&&m.push({shape:g,holes:f})}var u,v,w,
-A,B,x;h=[];for(k=0;k<m.length;k++){n=m[k];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];w=Number.POSITIVE_INFINITY;for(t=0;t<o.length;t++){B=o[t];for(e=0;e<g.length;e++)A=g[e],A=B.distanceTo(A),A<w&&(w=A,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:o.length-1,G=[];G.push(o[u]);G.push(g[v]);G.push(g[e]);w=this.Triangulate.area(G);var z=[];z.push(o[u]);z.push(o[t]);z.push(g[v]);B=this.Triangulate.area(z);A=v;x=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=o.length);u%=g.length;e=v-
-1>=0?v-1:g.length-1;t=u-1>=0?u-1:o.length-1;G=[];G.push(o[u]);G.push(g[v]);G.push(g[e]);G=this.Triangulate.area(G);z=[];z.push(o[u]);z.push(o[t]);z.push(g[v]);z=this.Triangulate.area(z);w+B>G+z&&(v=A,u=x,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=o.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:o.length-1);w=g.slice(0,v);B=g.slice(v);A=o.slice(u);x=o.slice(0,u);h.push(o[u]);h.push(g[v]);h.push(g[e]);h.push(o[u]);h.push(o[t]);h.push(g[v]);g=w.concat(A).concat(x).concat(B)}n.shape=g}u=[];v=[];
-for(k=p=0;k<m.length;k++){n=m[k];g=n.shape;u=u.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;v=v.concat(o);p+=g.length}var E;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){k=!1;for(g=0;g<u.length&&!k;g++)E=f*3+m,u[g].equals(h[E])&&(n.push(g),k=!0);k||(u.push(h[E]),n.push(u.length-1),console.log("not found"))}v.push(n)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,k=0;f=String(b).split("");
-for(var m=f.length,b=0;b<m;b++){var n=this.extractGlyphPoints(f[b],g,h,k);k+=n.offset;c.push(n.points);e=e.concat(n.points)}b=k/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];h=[];f=[];for(var k=[],m=new THREE.Vector2,p,b=e.length;--b>=0;){if(p){if(p.equals(e[b])){p=null;n=this.Triangulate.area(f)>0;k.push(n);h.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else p=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;f=0;for(var o;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),
-o=this.bezelSize/n.length(),k[f]?o+=1:o=1-o,o=n.multiplyScalar(o).addSelf(m),g.unshift(o),p?p.equals(e[b])&&(p=null,f++):p=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*
-c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f){var g=[],h,k,m,n,p,o,t,u,v,w,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));m=c.length;for(b=0;b<m;)switch(k=c[b++],k){case "m":k=c[b++]*e+f;n=c[b++]*e;g.push(new THREE.Vector2(k,n));break;case "l":k=c[b++]*e+f;n=c[b++]*e;g.push(new THREE.Vector2(k,n));break;case "q":k=c[b++]*e+f;n=c[b++]*e;t=
-c[b++]*e+f;u=c[b++]*e;if(h=g[g.length-1]){p=h.x;o=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var B=h/divisions,x=THREE.FontUtils.b2(B,p,t,k),B=THREE.FontUtils.b2(B,o,u,n);g.push(new THREE.Vector2(x,B))}}break;case "b":if(k=c[b++]*e+f,n=c[b++]*e,t=c[b++]*e+f,u=c[b++]*-e,v=c[b++]*e+f,w=c[b++]*-e,h=g[g.length-1]){p=h.x;o=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)B=h/divisions,x=THREE.FontUtils.b3(B,p,t,v,k),B=THREE.FontUtils.b3(B,o,u,w,n),g.push(new THREE.Vector2(x,B))}}}return{offset:A.ha*
+{points:b,faces:[]};for(var e,f,g,h,k,m=[],n=0;n<c.length;n++){k=c[n];h=[];for(e=0;e<k.length;e++)f=k[e],h.push(f.x+","+f.y);var o;e=h.slice(1).indexOf(h[0]);var p=this.Triangulate.area(k.slice(0,e+1))<0;f=[];for(e=-1;e<h.length;){o=e+1;e=h[o];e=h.slice(o+1).indexOf(e)+o;if(e<=o)break;var t=k.slice(o,e+1);p?this.Triangulate.area(t)<0?(o>0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}p&&m.push({shape:g,holes:f})}var u,v,w,
+A,B,x;h=[];for(k=0;k<m.length;k++){n=m[k];g=n.shape;f=n.holes;for(o=0;o<f.length;o++){p=f[o];w=Number.POSITIVE_INFINITY;for(t=0;t<p.length;t++){B=p[t];for(e=0;e<g.length;e++)A=g[e],A=B.distanceTo(A),A<w&&(w=A,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:p.length-1,G=[];G.push(p[u]);G.push(g[v]);G.push(g[e]);w=this.Triangulate.area(G);var z=[];z.push(p[u]);z.push(p[t]);z.push(g[v]);B=this.Triangulate.area(z);A=v;x=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=p.length);u%=g.length;e=v-
+1>=0?v-1:g.length-1;t=u-1>=0?u-1:p.length-1;G=[];G.push(p[u]);G.push(g[v]);G.push(g[e]);G=this.Triangulate.area(G);z=[];z.push(p[u]);z.push(p[t]);z.push(g[v]);z=this.Triangulate.area(z);w+B>G+z&&(v=A,u=x,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=p.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:p.length-1);w=g.slice(0,v);B=g.slice(v);A=p.slice(u);x=p.slice(0,u);h.push(p[u]);h.push(g[v]);h.push(g[e]);h.push(p[u]);h.push(p[t]);h.push(g[v]);g=w.concat(A).concat(x).concat(B)}n.shape=g}u=[];v=[];
+for(k=o=0;k<m.length;k++){n=m[k];g=n.shape;u=u.concat(g);p=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<p.length;f++)n=p[f],n[0]+=o,n[1]+=o,n[2]+=o;v=v.concat(p);o+=g.length}var E;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){k=!1;for(g=0;g<u.length&&!k;g++)E=f*3+m,u[g].equals(h[E])&&(n.push(g),k=!0);k||(u.push(h[E]),n.push(u.length-1),console.log("not found"))}v.push(n)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,k=0;f=String(b).split("");
+for(var m=f.length,b=0;b<m;b++){var n=this.extractGlyphPoints(f[b],g,h,k);k+=n.offset;c.push(n.points);e=e.concat(n.points)}b=k/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];h=[];f=[];for(var k=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;k.push(n);h.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;f=0;for(var p;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),
+p=this.bezelSize/n.length(),k[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*
+c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f){var g=[],h,k,m,n,o,p,t,u,v,w,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));m=c.length;for(b=0;b<m;)switch(k=c[b++],k){case "m":k=c[b++]*e+f;n=c[b++]*e;g.push(new THREE.Vector2(k,n));break;case "l":k=c[b++]*e+f;n=c[b++]*e;g.push(new THREE.Vector2(k,n));break;case "q":k=c[b++]*e+f;n=c[b++]*e;t=
+c[b++]*e+f;u=c[b++]*e;if(h=g[g.length-1]){o=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var B=h/divisions,x=THREE.FontUtils.b2(B,o,t,k),B=THREE.FontUtils.b2(B,p,u,n);g.push(new THREE.Vector2(x,B))}}break;case "b":if(k=c[b++]*e+f,n=c[b++]*e,t=c[b++]*e+f,u=c[b++]*-e,v=c[b++]*e+f,w=c[b++]*-e,h=g[g.length-1]){o=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)B=h/divisions,x=THREE.FontUtils.b3(B,o,t,v,k),B=THREE.FontUtils.b3(B,p,u,w,n),g.push(new THREE.Vector2(x,B))}}}return{offset:A.ha*
 e,points:g}}}};
 e,points:g}}}};
-(function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,k=0;k<c;h=k++)g+=b[h].x*b[k].y-b[k].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var h=[],k=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)k[p]=p;else for(p=0;p<g;p++)k[p]=g-1-p;var t=2*g;for(p=g-1;g>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return h}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var u;a:{u=b;var v=n,w=p,A=o,B=g,x=k,G=void 0,z=void 0,E=void 0,
-H=void 0,C=void 0,O=void 0,M=void 0,F=void 0,Q=void 0,z=u[x[v]].x,E=u[x[v]].y,H=u[x[w]].x,C=u[x[w]].y,O=u[x[A]].x,M=u[x[A]].y;if(1.0E-10>(H-z)*(M-E)-(C-E)*(O-z))u=!1;else{for(G=0;G<B;G++)if(!(G==v||G==w||G==A)){var F=u[x[G]].x,Q=u[x[G]].y,S=void 0,N=void 0,j=void 0,R=void 0,T=void 0,ia=void 0,V=void 0,K=void 0,da=void 0,$=void 0,aa=void 0,ca=void 0,S=j=T=void 0,S=O-H,N=M-C,j=z-O,R=E-M,T=H-z,ia=C-E,V=F-z,K=Q-E,da=F-H,$=Q-C,aa=F-O,ca=Q-M,S=S*$-N*da,T=T*K-ia*V,j=j*ca-R*aa;if(S>=0&&j>=0&&T>=0){u=!1;break a}}u=
-!0}}if(u){t=k[n];u=k[p];v=k[o];h.push(b[t]);h.push(b[u]);h.push(b[v]);m.push([k[n],k[p],k[o]]);n=p;for(o=p+1;o<g;n++,o++)k[n]=k[o];g--;t=2*g}}if(f)return m;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+(function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,k=0;k<c;h=k++)g+=b[h].x*b[k].y-b[k].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var h=[],k=[],m=[],n,o,p;if(c(b)>0)for(o=0;o<g;o++)k[o]=o;else for(o=0;o<g;o++)k[o]=g-1-o;var t=2*g;for(o=g-1;g>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return h}n=o;g<=n&&(n=0);o=n+1;g<=o&&(o=0);p=o+1;g<=p&&(p=0);var u;a:{u=b;var v=n,w=o,A=p,B=g,x=k,G=void 0,z=void 0,E=void 0,
+H=void 0,C=void 0,S=void 0,L=void 0,F=void 0,R=void 0,z=u[x[v]].x,E=u[x[v]].y,H=u[x[w]].x,C=u[x[w]].y,S=u[x[A]].x,L=u[x[A]].y;if(1.0E-10>(H-z)*(L-E)-(C-E)*(S-z))u=!1;else{for(G=0;G<B;G++)if(!(G==v||G==w||G==A)){var F=u[x[G]].x,R=u[x[G]].y,O=void 0,N=void 0,j=void 0,T=void 0,ca=void 0,ga=void 0,Z=void 0,K=void 0,$=void 0,V=void 0,W=void 0,aa=void 0,O=j=ca=void 0,O=S-H,N=L-C,j=z-S,T=E-L,ca=H-z,ga=C-E,Z=F-z,K=R-E,$=F-H,V=R-C,W=F-S,aa=R-L,O=O*V-N*$,ca=ca*K-ga*Z,j=j*aa-T*W;if(O>=0&&j>=0&&ca>=0){u=!1;break a}}u=
+!0}}if(u){t=k[n];u=k[o];v=k[p];h.push(b[t]);h.push(b[u]);h.push(b[v]);m.push([k[n],k[o],k[p]]);n=o;for(p=o+1;p<g;n++,p++)k[n]=k[p];g--;t=2*g}}if(f)return m;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
 THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
 1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,h,k));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[k][0],b[k][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,h,k));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[k][0],b[k][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(b,c,e,f,g,h,k){function m(b,c,e,f,g,h){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
 THREE.TorusKnotGeometry=function(b,c,e,f,g,h,k){function m(b,c,e,f,g,h){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,k=c/this.segmentsT*2*Math.PI,g=m(n,k,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,k,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(e,f);f.cross(h,e);h.normalize();f.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);g.x+=n*f.x+k*h.x;g.y+=n*f.y+k*h.y;g.z+=n*f.z+k*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
 this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,k=c/this.segmentsT*2*Math.PI,g=m(n,k,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,k,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(e,f);f.cross(h,e);h.normalize();f.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);g.x+=n*f.x+k*h.x;g.y+=n*f.y+k*h.y;g.z+=n*f.z+k*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][h],h=this.grid[b][h],k=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=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(g,e,f,h));this.faceVertexUvs[0].push([k,n,p,o])}this.computeCentroids();
+g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][h],h=this.grid[b][h],k=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,h));this.faceVertexUvs[0].push([k,n,o,p])}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(){}};
 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";
 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,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/
@@ -476,55 +475,55 @@ Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(t
 1)h.map.wrapS=THREE.RepeatWrapping;if(b.mapDiffuseRepeat[1]!=1)h.map.wrapT=THREE.RepeatWrapping}b.mapDiffuseOffset&&h.map.offset.set(b.mapDiffuseOffset[0],b.mapDiffuseOffset[1]);if(b.mapDiffuseWrap){k={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(k[b.mapDiffuseWrap[0]]!==void 0)h.map.wrapS=k[b.mapDiffuseWrap[0]];if(k[b.mapDiffuseWrap[1]]!==void 0)h.map.wrapT=k[b.mapDiffuseWrap[1]]}f(h.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse)k=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
 1)h.map.wrapS=THREE.RepeatWrapping;if(b.mapDiffuseRepeat[1]!=1)h.map.wrapT=THREE.RepeatWrapping}b.mapDiffuseOffset&&h.map.offset.set(b.mapDiffuseOffset[0],b.mapDiffuseOffset[1]);if(b.mapDiffuseWrap){k={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(k[b.mapDiffuseWrap[0]]!==void 0)h.map.wrapS=k[b.mapDiffuseWrap[0]];if(k[b.mapDiffuseWrap[1]]!==void 0)h.map.wrapT=k[b.mapDiffuseWrap[1]]}f(h.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse)k=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
 255<<8)+b.colorDiffuse[2]*255,h.color=k,h.opacity=b.transparency;else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLight&&c){k=document.createElement("canvas");h.lightMap=new THREE.Texture(k);h.lightMap.sourceFile=b.mapLight;if(b.mapLightmapRepeat)h.lightMap.repeat.set(b.mapLightRepeat[0],b.mapLightRepeat[1]),h.lightMap.wrapS=h.lightMap.wrapT=THREE.RepeatWrapping;b.mapLightmapOffset&&h.lightMap.offset.set(b.mapLightmapOffset[0],b.mapLightmapOffset[1]);f(h.lightMap,c+"/"+b.mapLightmap)}return new THREE[g](h)}};
 255<<8)+b.colorDiffuse[2]*255,h.color=k,h.opacity=b.transparency;else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLight&&c){k=document.createElement("canvas");h.lightMap=new THREE.Texture(k);h.lightMap.sourceFile=b.mapLight;if(b.mapLightmapRepeat)h.lightMap.repeat.set(b.mapLightRepeat[0],b.mapLightRepeat[1]),h.lightMap.wrapS=h.lightMap.wrapT=THREE.RepeatWrapping;b.mapLightmapOffset&&h.lightMap.offset.set(b.mapLightmapOffset[0],b.mapLightmapOffset[1]);f(h.lightMap,c+"/"+b.mapLightmap)}return new THREE[g](h)}};
 THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
 THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,n,p,o,t,u,v,w,A,B,x,G,z,E=b.faces;t=b.vertices;var H=b.normals,C=b.colors,O=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&O++;for(e=0;e<O;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(o=t.length;p<o;)u=new THREE.Vertex,u.position.x=t[p++]*c,u.position.y=
-t[p++]*c,u.position.z=t[p++]*c,f.vertices.push(u);p=0;for(o=E.length;p<o;){c=E[p++];t=c&1;n=c&2;e=c&4;g=c&8;v=c&16;u=c&32;A=c&64;c&=128;t?(B=new THREE.Face4,B.a=E[p++],B.b=E[p++],B.c=E[p++],B.d=E[p++],t=4):(B=new THREE.Face3,B.a=E[p++],B.b=E[p++],B.c=E[p++],t=3);if(n)n=E[p++],B.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<O;e++)x=b.uvs[e],w=E[p++],z=x[w*2],w=x[w*2+1],f.faceUvs[e][n]=new THREE.UV(z,w);if(g)for(e=0;e<O;e++){x=b.uvs[e];G=[];for(g=0;g<t;g++)w=E[p++],z=x[w*2],w=x[w*2+1],G[g]=
-new THREE.UV(z,w);f.faceVertexUvs[e][n]=G}if(v)v=E[p++]*3,g=new THREE.Vector3,g.x=H[v++],g.y=H[v++],g.z=H[v],B.normal=g;if(u)for(e=0;e<t;e++)v=E[p++]*3,g=new THREE.Vector3,g.x=H[v++],g.y=H[v++],g.z=H[v],B.vertexNormals.push(g);if(A)u=E[p++],u=new THREE.Color(C[u]),B.color=u;if(c)for(e=0;e<t;e++)u=E[p++],u=new THREE.Color(C[u]),B.vertexColors.push(u);f.faces.push(B)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
-n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,p,o,t,u,v,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(p=w.length;n<p;n+=3)o=w[n]*c,t=w[n+1]*
-c,u=w[n+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(o,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(o[c],o[c+1],o[c+2]),p.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,n,o,p,t,u,v,w,A,B,x,G,z,E=b.faces;t=b.vertices;var H=b.normals,C=b.colors,S=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&S++;for(e=0;e<S;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(p=t.length;o<p;)u=new THREE.Vertex,u.position.x=t[o++]*c,u.position.y=
+t[o++]*c,u.position.z=t[o++]*c,f.vertices.push(u);o=0;for(p=E.length;o<p;){c=E[o++];t=c&1;n=c&2;e=c&4;g=c&8;v=c&16;u=c&32;A=c&64;c&=128;t?(B=new THREE.Face4,B.a=E[o++],B.b=E[o++],B.c=E[o++],B.d=E[o++],t=4):(B=new THREE.Face3,B.a=E[o++],B.b=E[o++],B.c=E[o++],t=3);if(n)n=E[o++],B.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<S;e++)x=b.uvs[e],w=E[o++],z=x[w*2],w=x[w*2+1],f.faceUvs[e][n]=new THREE.UV(z,w);if(g)for(e=0;e<S;e++){x=b.uvs[e];G=[];for(g=0;g<t;g++)w=E[o++],z=x[w*2],w=x[w*2+1],G[g]=
+new THREE.UV(z,w);f.faceVertexUvs[e][n]=G}if(v)v=E[o++]*3,g=new THREE.Vector3,g.x=H[v++],g.y=H[v++],g.z=H[v],B.normal=g;if(u)for(e=0;e<t;e++)v=E[o++]*3,g=new THREE.Vector3,g.x=H[v++],g.y=H[v++],g.z=H[v],B.vertexNormals.push(g);if(A)u=E[o++],u=new THREE.Color(C[u]),B.color=u;if(c)for(e=0;e<t;e++)u=E[o++],u=new THREE.Color(C[u]),B.vertexColors.push(u);f.faces.push(B)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
+n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,o,p,t,u,v,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;n=0;for(o=w.length;n<o;n+=3)p=w[n]*c,t=w[n+1]*
+c,u=w[n+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(p,t,u)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];o=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(n=p.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(p[c],p[c+1],p[c+2]),o.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var k=new XMLHttpRequest,m=f+"/"+b,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",m,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
 c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var k=new XMLHttpRequest,m=f+"/"+b,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",m,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
-k.setRequestHeader("Content-Type","text/plain");k.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
-c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+O);c=n(b,c+M);THREE.BinaryLoader.prototype.f3(x,e,f,h,c)}function u(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+C);h=g(b,c+O);j=n(b,c+M);k=g(b,c+F);o=g(b,c+Q);c=g(b,c+S);THREE.BinaryLoader.prototype.f3n(x,E,e,f,h,j,k,o,c)}function v(c){var e,f,h,k;e=g(b,c);f=g(b,c+N);h=g(b,c+j);k=g(b,c+R);c=n(b,c+T);THREE.BinaryLoader.prototype.f4(x,e,f,h,k,c)}function w(c){var e,f,h,k,o,p,t,u;e=g(b,c);f=g(b,c+N);h=g(b,c+j);k=g(b,c+R);o=n(b,
-c+T);p=g(b,c+ia);t=g(b,c+V);u=g(b,c+K);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(x,E,e,f,h,k,o,p,t,u,c)}function A(c){var e,f;e=g(b,c);f=g(b,c+$);c=g(b,c+aa);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],H[e*2],H[e*2+1],H[f*2],H[f*2+1],H[c*2],H[c*2+1])}function B(c){var e,f,h;e=g(b,c);f=g(b,c+ca);h=g(b,c+ha);c=g(b,c+ka);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],H[e*2],H[e*2+1],H[f*2],H[f*2+1],H[h*2],H[h*2+1],H[c*2],H[c*2+1])}var x=this,G=0,z,E=[],H=[],C,O,M,F,Q,S,N,j,R,T,ia,V,K,
-da,$,aa,ca,ha,ka,fa,I,Y,X,Z,ga;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,f,c);z={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:g(b,G+16),nnormals:g(b,G+16+4),nuvs:g(b,G+16+8),ntri_flat:g(b,G+16+12),ntri_smooth:g(b,G+16+16),ntri_flat_uv:g(b,G+16+20),ntri_smooth_uv:g(b,
-G+16+24),nquad_flat:g(b,G+16+28),nquad_smooth:g(b,G+16+32),nquad_flat_uv:g(b,G+16+36),nquad_smooth_uv:g(b,G+16+40)};G+=z.header_bytes;C=z.vertex_index_bytes;O=z.vertex_index_bytes*2;M=z.vertex_index_bytes*3;F=z.vertex_index_bytes*3+z.material_index_bytes;Q=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;S=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;N=z.vertex_index_bytes;j=z.vertex_index_bytes*2;R=z.vertex_index_bytes*3;T=z.vertex_index_bytes*4;ia=z.vertex_index_bytes*
-4+z.material_index_bytes;V=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;K=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;da=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;$=z.uv_index_bytes;aa=z.uv_index_bytes*2;ca=z.uv_index_bytes;ha=z.uv_index_bytes*2;ka=z.uv_index_bytes*3;c=z.vertex_index_bytes*3+z.material_index_bytes;ga=z.vertex_index_bytes*4+z.material_index_bytes;fa=z.ntri_flat*c;I=z.ntri_smooth*(c+z.normal_index_bytes*3);Y=
-z.ntri_flat_uv*(c+z.uv_index_bytes*3);X=z.ntri_smooth_uv*(c+z.normal_index_bytes*3+z.uv_index_bytes*3);Z=z.nquad_flat*ga;c=z.nquad_smooth*(ga+z.normal_index_bytes*4);ga=z.nquad_flat_uv*(ga+z.uv_index_bytes*4);G+=function(c){for(var f,g,h,j=z.vertex_coordinate_bytes*3,m=c+z.nvertices*j;c<m;c+=j)f=e(b,c),g=e(b,c+z.vertex_coordinate_bytes),h=e(b,c+z.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,f,g,h);return z.nvertices*j}(G);G+=function(c){for(var e,f,g,h=z.normal_coordinate_bytes*3,j=
-c+z.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+z.normal_coordinate_bytes),g=p(b,c+z.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return z.nnormals*h}(G);G+=function(c){for(var f,g,h=z.uv_coordinate_bytes*2,j=c+z.nuvs*h;c<j;c+=h)f=e(b,c),g=e(b,c+z.uv_coordinate_bytes),H.push(f,g);return z.nuvs*h}(G);fa=G+fa;I=fa+I;Y=I+Y;X=Y+X;Z=X+Z;c=Z+c;ga=c+ga;(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=e+z.uv_index_bytes*3,g=b+z.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),A(c+e);return g-b})(I);
-(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=e+z.uv_index_bytes*3,g=b+z.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),A(c+e);return g-b})(Y);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=e+z.uv_index_bytes*4,g=b+z.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),B(c+e);return g-b})(c);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=e+z.uv_index_bytes*4,g=b+z.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),B(c+
-e);return g-b})(ga);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=b+z.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(G);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=b+z.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(fa);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=b+z.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(X);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*
-4,f=b+z.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(Z);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},f3n:function(b,c,e,f,g,h,k,m,n){var h=b.materials[h],p=c[m*3],
-o=c[m*3+1],m=c[m*3+2],t=c[n*3],u=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,u,n)],null,h))},f4n:function(b,c,e,f,g,h,k,m,n,p,o){var k=b.materials[k],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[p*3],w=c[p*3+1],p=c[p*3+2],A=c[o*3],B=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(v,w,p),new THREE.Vector3(A,B,o)],
-null,k))},uv3:function(b,c,e,f,g,h,k){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,k));b.push(m)},uv4:function(b,c,e,f,g,h,k,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,k));p.push(new THREE.UV(m,n));b.push(p)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in N.objects)if(!K.objects[v])if(G=N.objects[v],G.geometry!==void 0){if(C=K.geometries[G.geometry]){var b=!1;Q=[];for($=0;$<G.materials.length;$++)Q[$]=K.materials[G.materials[$]],b=Q[$]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();z=G.position;r=G.rotation;
-q=G.quaternion;s=G.scale;q=0;Q.length==0&&(Q[0]=new THREE.MeshFaceMaterial);Q.length>1&&(Q=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,Q);object.name=v;object.position.set(z[0],z[1],z[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;K.scene.addObject(object);K.objects[v]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
+k.setRequestHeader("Content-Type","text/plain");k.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=p(b,c),g=p(b,c+1),h=p(b,c+2),j=p(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function o(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,
+c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+S);c=n(b,c+L);THREE.BinaryLoader.prototype.f3(x,e,f,h,c)}function u(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+C);h=g(b,c+S);j=n(b,c+L);k=g(b,c+F);o=g(b,c+R);c=g(b,c+O);THREE.BinaryLoader.prototype.f3n(x,E,e,f,h,j,k,o,c)}function v(c){var e,f,h,k;e=g(b,c);f=g(b,c+N);h=g(b,c+j);k=g(b,c+T);c=n(b,c+ca);THREE.BinaryLoader.prototype.f4(x,e,f,h,k,c)}function w(c){var e,f,h,k,o,p,t,u;e=g(b,c);f=g(b,c+N);h=g(b,c+j);k=g(b,c+T);o=n(b,
+c+ca);p=g(b,c+ga);t=g(b,c+Z);u=g(b,c+K);c=g(b,c+$);THREE.BinaryLoader.prototype.f4n(x,E,e,f,h,k,o,p,t,u,c)}function A(c){var e,f;e=g(b,c);f=g(b,c+V);c=g(b,c+W);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],H[e*2],H[e*2+1],H[f*2],H[f*2+1],H[c*2],H[c*2+1])}function B(c){var e,f,h;e=g(b,c);f=g(b,c+aa);h=g(b,c+ma);c=g(b,c+ea);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],H[e*2],H[e*2+1],H[f*2],H[f*2+1],H[h*2],H[h*2+1],H[c*2],H[c*2+1])}var x=this,G=0,z,E=[],H=[],C,S,L,F,R,O,N,j,T,ca,ga,Z,K,
+$,V,W,aa,ma,ea,ha,I,Y,X,ja,fa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,f,c);z={signature:b.substr(G,8),header_bytes:p(b,G+8),vertex_coordinate_bytes:p(b,G+9),normal_coordinate_bytes:p(b,G+10),uv_coordinate_bytes:p(b,G+11),vertex_index_bytes:p(b,G+12),normal_index_bytes:p(b,G+13),uv_index_bytes:p(b,G+14),material_index_bytes:p(b,G+15),nvertices:g(b,G+16),nnormals:g(b,G+16+4),nuvs:g(b,G+16+8),ntri_flat:g(b,G+16+12),ntri_smooth:g(b,G+16+16),ntri_flat_uv:g(b,G+16+20),ntri_smooth_uv:g(b,
+G+16+24),nquad_flat:g(b,G+16+28),nquad_smooth:g(b,G+16+32),nquad_flat_uv:g(b,G+16+36),nquad_smooth_uv:g(b,G+16+40)};G+=z.header_bytes;C=z.vertex_index_bytes;S=z.vertex_index_bytes*2;L=z.vertex_index_bytes*3;F=z.vertex_index_bytes*3+z.material_index_bytes;R=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;O=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;N=z.vertex_index_bytes;j=z.vertex_index_bytes*2;T=z.vertex_index_bytes*3;ca=z.vertex_index_bytes*4;ga=z.vertex_index_bytes*
+4+z.material_index_bytes;Z=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;K=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;$=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;V=z.uv_index_bytes;W=z.uv_index_bytes*2;aa=z.uv_index_bytes;ma=z.uv_index_bytes*2;ea=z.uv_index_bytes*3;c=z.vertex_index_bytes*3+z.material_index_bytes;fa=z.vertex_index_bytes*4+z.material_index_bytes;ha=z.ntri_flat*c;I=z.ntri_smooth*(c+z.normal_index_bytes*3);Y=z.ntri_flat_uv*
+(c+z.uv_index_bytes*3);X=z.ntri_smooth_uv*(c+z.normal_index_bytes*3+z.uv_index_bytes*3);ja=z.nquad_flat*fa;c=z.nquad_smooth*(fa+z.normal_index_bytes*4);fa=z.nquad_flat_uv*(fa+z.uv_index_bytes*4);G+=function(c){for(var f,g,h,j=z.vertex_coordinate_bytes*3,m=c+z.nvertices*j;c<m;c+=j)f=e(b,c),g=e(b,c+z.vertex_coordinate_bytes),h=e(b,c+z.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,f,g,h);return z.nvertices*j}(G);G+=function(c){for(var e,f,g,h=z.normal_coordinate_bytes*3,j=c+z.nnormals*
+h;c<j;c+=h)e=o(b,c),f=o(b,c+z.normal_coordinate_bytes),g=o(b,c+z.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return z.nnormals*h}(G);G+=function(c){for(var f,g,h=z.uv_coordinate_bytes*2,j=c+z.nuvs*h;c<j;c+=h)f=e(b,c),g=e(b,c+z.uv_coordinate_bytes),H.push(f,g);return z.nuvs*h}(G);ha=G+ha;I=ha+I;Y=I+Y;X=Y+X;ja=X+ja;c=ja+c;fa=c+fa;(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=e+z.uv_index_bytes*3,g=b+z.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),A(c+e);return g-b})(I);(function(b){var c,
+e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=e+z.uv_index_bytes*3,g=b+z.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),A(c+e);return g-b})(Y);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=e+z.uv_index_bytes*4,g=b+z.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),B(c+e);return g-b})(c);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=e+z.uv_index_bytes*4,g=b+z.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),B(c+e);return g-b})(fa);
+(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=b+z.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(G);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=b+z.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(ha);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=b+z.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(X);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=b+z.nquad_smooth*
+e;for(c=b;c<f;c+=e)w(c);return f-b})(ja);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},f3n:function(b,c,e,f,g,h,k,m,n){var h=b.materials[h],o=c[m*3],p=c[m*3+1],m=c[m*3+2],
+t=c[n*3],u=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(t,u,n)],null,h))},f4n:function(b,c,e,f,g,h,k,m,n,o,p){var k=b.materials[k],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[o*3],w=c[o*3+1],o=c[o*3+2],A=c[p*3],B=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,u,n),new THREE.Vector3(v,w,o),new THREE.Vector3(A,B,p)],null,k))},uv3:function(b,
+c,e,f,g,h,k){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,k));b.push(m)},uv4:function(b,c,e,f,g,h,k,m,n){var o=[];o.push(new THREE.UV(c,e));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,k));o.push(new THREE.UV(m,n));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 e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in N.objects)if(!K.objects[v])if(G=N.objects[v],G.geometry!==void 0){if(C=K.geometries[G.geometry]){var b=!1;R=[];for(V=0;V<G.materials.length;V++)R[V]=K.materials[G.materials[V]],b=R[V]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();z=G.position;r=G.rotation;
+q=G.quaternion;s=G.scale;q=0;R.length==0&&(R[0]=new THREE.MeshFaceMaterial);R.length>1&&(R=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,R);object.name=v;object.position.set(z[0],z[1],z[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;K.scene.addObject(object);K.objects[v]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
 if(G.castsShadow)b=new THREE.ShadowVolume(C),K.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},K.triggers[object.name]=b)}}else z=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(z[0],z[1],z[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],
 if(G.castsShadow)b=new THREE.ShadowVolume(C),K.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},K.triggers[object.name]=b)}}else z=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(z[0],z[1],z[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,K.scene.addObject(object),K.objects[v]=object,K.empties[v]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},K.triggers[object.name]=b)}function n(b){return function(c){K.geometries[b]=c;m();R-=1;e.onLoadComplete();o()}}function p(b){return function(c){K.geometries[b]=c}}function o(){e.callbackProgress({totalModels:ia,totalTextures:V,loadedModels:ia-R,loadedTextures:V-T},K);e.onLoadProgress();R==0&&T==0&&c(K)}
-var t,u,v,w,A,B,x,G,z,E,H,C,O,M,F,Q,S,N,j,R,T,ia,V,K;N=b.data;F=new THREE.BinaryLoader;j=new THREE.JSONLoader;T=R=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in N.objects)if(G=N.objects[v],G.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(N.transform){b=N.transform.position;E=N.transform.rotation;var da=N.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);E&&K.scene.rotation.set(E[0],
-E[1],E[2]);da&&K.scene.scale.set(da[0],da[1],da[2]);(b||E||da)&&K.scene.updateMatrix()}b=function(){T-=1;o();e.onLoadComplete()};for(A in N.cameras){E=N.cameras[A];if(E.type=="perspective")O=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")O=new THREE.Camera,O.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);z=E.position;E=E.target;O.position.set(z[0],z[1],z[2]);O.target.position.set(E[0],E[1],E[2]);K.cameras[A]=O}for(w in N.lights)A=N.lights[w],
-O=A.color!==void 0?A.color:16777215,E=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(z=A.direction,S=new THREE.DirectionalLight(O,E),S.position.set(z[0],z[1],z[2]),S.position.normalize()):A.type=="point"?(z=A.position,d=A.distance,S=new THREE.PointLight(O,E,d),S.position.set(z[0],z[1],z[2])):A.type=="ambient"&&(S=new THREE.AmbientLight(O)),K.scene.addLight(S),K.lights[w]=S;for(B in N.fogs)w=N.fogs[B],w.type=="linear"?M=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(M=new THREE.FogExp2(0,
-w.density)),E=w.color,M.color.setRGB(E[0],E[1],E[2]),K.fogs[B]=M;if(K.cameras&&N.defaults.camera)K.currentCamera=K.cameras[N.defaults.camera];if(K.fogs&&N.defaults.fog)K.scene.fog=K.fogs[N.defaults.fog];E=N.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(E[0],E[1],E[2]);K.bgColorAlpha=N.defaults.bgalpha;for(t in N.geometries)if(B=N.geometries[t],B.type=="bin_mesh"||B.type=="ascii_mesh")R+=1,e.onLoadStart();ia=R;for(t in N.geometries)B=N.geometries[t],B.type=="cube"?(C=new THREE.CubeGeometry(B.width,
+s[1],s[2]),object.visible=G.visible!==void 0?G.visible:!1,K.scene.addObject(object),K.objects[v]=object,K.empties[v]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},K.triggers[object.name]=b)}function n(b){return function(c){K.geometries[b]=c;m();T-=1;e.onLoadComplete();p()}}function o(b){return function(c){K.geometries[b]=c}}function p(){e.callbackProgress({totalModels:ga,totalTextures:Z,loadedModels:ga-T,loadedTextures:Z-ca},K);e.onLoadProgress();T==0&&ca==0&&c(K)}
+var t,u,v,w,A,B,x,G,z,E,H,C,S,L,F,R,O,N,j,T,ca,ga,Z,K;N=b.data;F=new THREE.BinaryLoader;j=new THREE.JSONLoader;ca=T=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in N.objects)if(G=N.objects[v],G.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(N.transform){b=N.transform.position;E=N.transform.rotation;var $=N.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);E&&K.scene.rotation.set(E[0],
+E[1],E[2]);$&&K.scene.scale.set($[0],$[1],$[2]);(b||E||$)&&K.scene.updateMatrix()}b=function(){ca-=1;p();e.onLoadComplete()};for(A in N.cameras){E=N.cameras[A];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);z=E.position;E=E.target;S.position.set(z[0],z[1],z[2]);S.target.position.set(E[0],E[1],E[2]);K.cameras[A]=S}for(w in N.lights)A=N.lights[w],
+S=A.color!==void 0?A.color:16777215,E=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(z=A.direction,O=new THREE.DirectionalLight(S,E),O.position.set(z[0],z[1],z[2]),O.position.normalize()):A.type=="point"?(z=A.position,d=A.distance,O=new THREE.PointLight(S,E,d),O.position.set(z[0],z[1],z[2])):A.type=="ambient"&&(O=new THREE.AmbientLight(S)),K.scene.addLight(O),K.lights[w]=O;for(B in N.fogs)w=N.fogs[B],w.type=="linear"?L=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(L=new THREE.FogExp2(0,
+w.density)),E=w.color,L.color.setRGB(E[0],E[1],E[2]),K.fogs[B]=L;if(K.cameras&&N.defaults.camera)K.currentCamera=K.cameras[N.defaults.camera];if(K.fogs&&N.defaults.fog)K.scene.fog=K.fogs[N.defaults.fog];E=N.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(E[0],E[1],E[2]);K.bgColorAlpha=N.defaults.bgalpha;for(t in N.geometries)if(B=N.geometries[t],B.type=="bin_mesh"||B.type=="ascii_mesh")T+=1,e.onLoadStart();ga=T;for(t in N.geometries)B=N.geometries[t],B.type=="cube"?(C=new THREE.CubeGeometry(B.width,
 B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),K.geometries[t]=C):B.type=="plane"?(C=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),K.geometries[t]=C):B.type=="sphere"?(C=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),K.geometries[t]=C):B.type=="cylinder"?(C=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),K.geometries[t]=C):B.type=="torus"?(C=new THREE.TorusGeometry(B.radius,
 B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),K.geometries[t]=C):B.type=="plane"?(C=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),K.geometries[t]=C):B.type=="sphere"?(C=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),K.geometries[t]=C):B.type=="cylinder"?(C=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),K.geometries[t]=C):B.type=="torus"?(C=new THREE.TorusGeometry(B.radius,
-B.tube,B.segmentsR,B.segmentsT),K.geometries[t]=C):B.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(B.subdivisions),K.geometries[t]=C):B.type=="bin_mesh"?F.load({model:f(B.url,N.urlBaseType),callback:n(t)}):B.type=="ascii_mesh"?j.load({model:f(B.url,N.urlBaseType),callback:n(t)}):B.type=="embedded_mesh"&&(B=N.embeds[B.id])&&j.createModel(B,p(t),"");for(x in N.textures)if(t=N.textures[x],t.url instanceof Array){T+=t.url.length;for(F=0;F<t.url.length;F++)e.onLoadStart()}else T+=1,e.onLoadStart();
-V=T;for(x in N.textures){t=N.textures[x];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){F=[];for(var $=0;$<t.url.length;$++)F[$]=f(t.url[$],N.urlBaseType);F=THREE.ImageUtils.loadTextureCube(F,t.mapping,b)}else{F=THREE.ImageUtils.loadTexture(f(t.url,N.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)F.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)F.magFilter=THREE[t.magFilter];if(t.repeat){F.repeat.set(t.repeat[0],t.repeat[1]);
+B.tube,B.segmentsR,B.segmentsT),K.geometries[t]=C):B.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(B.subdivisions),K.geometries[t]=C):B.type=="bin_mesh"?F.load({model:f(B.url,N.urlBaseType),callback:n(t)}):B.type=="ascii_mesh"?j.load({model:f(B.url,N.urlBaseType),callback:n(t)}):B.type=="embedded_mesh"&&(B=N.embeds[B.id])&&j.createModel(B,o(t),"");for(x in N.textures)if(t=N.textures[x],t.url instanceof Array){ca+=t.url.length;for(F=0;F<t.url.length;F++)e.onLoadStart()}else ca+=1,e.onLoadStart();
+Z=ca;for(x in N.textures){t=N.textures[x];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){F=[];for(var V=0;V<t.url.length;V++)F[V]=f(t.url[V],N.urlBaseType);F=THREE.ImageUtils.loadTextureCube(F,t.mapping,b)}else{F=THREE.ImageUtils.loadTexture(f(t.url,N.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)F.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)F.magFilter=THREE[t.magFilter];if(t.repeat){F.repeat.set(t.repeat[0],t.repeat[1]);
 if(t.repeat[0]!=1)F.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)F.wrapT=THREE.RepeatWrapping}t.offset&&F.offset.set(t.offset[0],t.offset[1]);if(t.wrap){j={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(j[t.wrap[0]]!==void 0)F.wrapS=j[t.wrap[0]];if(j[t.wrap[1]]!==void 0)F.wrapT=j[t.wrap[1]]}}K.textures[x]=F}for(u in N.materials){x=N.materials[u];for(H in x.parameters)if(H=="envMap"||H=="map"||H=="lightMap")x.parameters[H]=K.textures[x.parameters[H]];else if(H=="shading")x.parameters[H]=
 if(t.repeat[0]!=1)F.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)F.wrapT=THREE.RepeatWrapping}t.offset&&F.offset.set(t.offset[0],t.offset[1]);if(t.wrap){j={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(j[t.wrap[0]]!==void 0)F.wrapS=j[t.wrap[0]];if(j[t.wrap[1]]!==void 0)F.wrapT=j[t.wrap[1]]}}K.textures[x]=F}for(u in N.materials){x=N.materials[u];for(H in x.parameters)if(H=="envMap"||H=="map"||H=="lightMap")x.parameters[H]=K.textures[x.parameters[H]];else if(H=="shading")x.parameters[H]=
 x.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")x.parameters[H]=THREE[x.parameters[H]]?THREE[x.parameters[H]]:THREE.NormalBlending;else if(H=="combine")x.parameters[H]=x.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H=="vertexColors")if(x.parameters[H]=="face")x.parameters[H]=THREE.FaceColors;else if(x.parameters[H])x.parameters[H]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=
 x.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")x.parameters[H]=THREE[x.parameters[H]]?THREE[x.parameters[H]]:THREE.NormalBlending;else if(H=="combine")x.parameters[H]=x.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H=="vertexColors")if(x.parameters[H]=="face")x.parameters[H]=THREE.FaceColors;else if(x.parameters[H])x.parameters[H]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=
-!0;if(x.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);F=x.parameters.color;j=x.parameters.specular;B=x.parameters.ambient;M=x.parameters.shininess;b.tNormal.texture=K.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)b.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map)b.tDiffuse.texture=x.parameters.map,b.enableDiffuse.value=!0;b.enableAO.value=!1;b.enableSpecular.value=!1;b.uDiffuseColor.value.setHex(F);b.uSpecularColor.value.setHex(j);
-b.uAmbientColor.value.setHex(B);b.uShininess.value=M;if(x.parameters.opacity)b.uOpacity.value=x.parameters.opacity;x=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0})}else x=new THREE[x.type](x.parameters);K.materials[u]=x}m();e.callbackSync(K)}}};
+!0;if(x.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);F=x.parameters.color;j=x.parameters.specular;B=x.parameters.ambient;L=x.parameters.shininess;b.tNormal.texture=K.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)b.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map)b.tDiffuse.texture=x.parameters.map,b.enableDiffuse.value=!0;b.enableAO.value=!1;b.enableSpecular.value=!1;b.uDiffuseColor.value.setHex(F);b.uSpecularColor.value.setHex(j);
+b.uAmbientColor.value.setHex(B);b.uShininess.value=L;if(x.parameters.opacity)b.uOpacity.value=x.parameters.opacity;x=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0})}else x=new THREE[x.type](x.parameters);K.materials[u]=x}m();e.callbackSync(K)}}};
 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=
 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,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,k,m,n,p,o,t){k=(k-o)/(t-o);o=this.normal_cache;c[h]=m+k*this.delta;c[h+1]=n;c[h+2]=p;g[h]=this.lerp(o[b],o[b+3],k);g[h+1]=this.lerp(o[b+1],o[b+4],k);g[h+2]=this.lerp(o[b+2],o[b+5],k)};this.VIntY=function(b,c,g,h,k,m,n,p,o,t){k=(k-o)/(t-o);o=this.normal_cache;c[h]=m;c[h+1]=n+k*this.delta;c[h+
-2]=p;c=b+this.yd*3;g[h]=this.lerp(o[b],o[c],k);g[h+1]=this.lerp(o[b+1],o[c+1],k);g[h+2]=this.lerp(o[b+2],o[c+2],k)};this.VIntZ=function(b,c,g,h,k,m,n,p,o,t){k=(k-o)/(t-o);o=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=p+k*this.delta;c=b+this.zd*3;g[h]=this.lerp(o[b],o[c],k);g[h+1]=this.lerp(o[b+1],o[c+1],k);g[h+2]=this.lerp(o[b+2],o[c+2],k)};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,g,h,k,m){var n=h+1,p=h+this.yd,o=h+this.zd,t=n+this.yd,u=n+this.zd,v=h+this.yd+this.zd,w=n+this.yd+this.zd,A=0,B=this.field[h],x=this.field[n],G=this.field[p],z=this.field[t],E=this.field[o],H=this.field[u],C=this.field[v],O=this.field[w];B<k&&(A|=1);x<k&&(A|=2);G<k&&(A|=8);z<k&&(A|=4);E<k&&(A|=16);H<k&&(A|=32);C<k&&(A|=128);O<k&&(A|=64);var M=THREE.edgeTable[A];if(M==0)return 0;var F=this.delta,
-Q=b+F,S=c+F,F=g+F;M&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,c,g,B,x));M&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,Q,c,g,x,z));M&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,b,S,g,G,z));M&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,c,g,B,G));M&16&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,12,k,b,c,F,E,H));M&32&&(this.compNorm(u),
-this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,15,k,Q,c,F,H,O));M&64&&(this.compNorm(v),this.compNorm(w),this.VIntX(v*3,this.vlist,this.nlist,18,k,b,S,F,C,O));M&128&&(this.compNorm(o),this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,21,k,b,c,F,E,C));M&256&&(this.compNorm(h),this.compNorm(o),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,c,g,B,E));M&512&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,27,k,Q,c,g,x,H));M&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
-3,this.vlist,this.nlist,30,k,Q,S,g,z,O));M&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,k,b,S,g,G,C));A<<=4;for(k=h=0;THREE.triTable[A+k]!=-1;)b=A+k,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),k+=3,h++;return h};this.posnormtriv=function(b,c,g,h,k,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
+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,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m+k*this.delta;c[h+1]=n;c[h+2]=o;g[h]=this.lerp(p[b],p[b+3],k);g[h+1]=this.lerp(p[b+1],p[b+4],k);g[h+2]=this.lerp(p[b+2],p[b+5],k)};this.VIntY=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m;c[h+1]=n+k*this.delta;c[h+
+2]=o;c=b+this.yd*3;g[h]=this.lerp(p[b],p[c],k);g[h+1]=this.lerp(p[b+1],p[c+1],k);g[h+2]=this.lerp(p[b+2],p[c+2],k)};this.VIntZ=function(b,c,g,h,k,m,n,o,p,t){k=(k-p)/(t-p);p=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=o+k*this.delta;c=b+this.zd*3;g[h]=this.lerp(p[b],p[c],k);g[h+1]=this.lerp(p[b+1],p[c+1],k);g[h+2]=this.lerp(p[b+2],p[c+2],k)};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,g,h,k,m){var n=h+1,o=h+this.yd,p=h+this.zd,t=n+this.yd,u=n+this.zd,v=h+this.yd+this.zd,w=n+this.yd+this.zd,A=0,B=this.field[h],x=this.field[n],G=this.field[o],z=this.field[t],E=this.field[p],H=this.field[u],C=this.field[v],S=this.field[w];B<k&&(A|=1);x<k&&(A|=2);G<k&&(A|=8);z<k&&(A|=4);E<k&&(A|=16);H<k&&(A|=32);C<k&&(A|=128);S<k&&(A|=64);var L=THREE.edgeTable[A];if(L==0)return 0;var F=this.delta,
+R=b+F,O=c+F,F=g+F;L&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,c,g,B,x));L&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,R,c,g,x,z));L&4&&(this.compNorm(o),this.compNorm(t),this.VIntX(o*3,this.vlist,this.nlist,6,k,b,O,g,G,z));L&8&&(this.compNorm(h),this.compNorm(o),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,c,g,B,G));L&16&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,12,k,b,c,F,E,H));L&32&&(this.compNorm(u),
+this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,15,k,R,c,F,H,S));L&64&&(this.compNorm(v),this.compNorm(w),this.VIntX(v*3,this.vlist,this.nlist,18,k,b,O,F,C,S));L&128&&(this.compNorm(p),this.compNorm(v),this.VIntY(p*3,this.vlist,this.nlist,21,k,b,c,F,E,C));L&256&&(this.compNorm(h),this.compNorm(p),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,c,g,B,E));L&512&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,27,k,R,c,g,x,H));L&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
+3,this.vlist,this.nlist,30,k,R,O,g,z,S));L&2048&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*3,this.vlist,this.nlist,33,k,b,O,g,G,C));A<<=4;for(k=h=0;THREE.triTable[A+k]!=-1;)b=A+k,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),k+=3,h++;return h};this.posnormtriv=function(b,c,g,h,k,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
 4]=b[h+1];this.positionArray[n+5]=b[h+2];this.positionArray[n+6]=b[k];this.positionArray[n+7]=b[k+1];this.positionArray[n+8]=b[k+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[k];this.normalArray[n+7]=c[k+1];this.normalArray[n+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
 4]=b[h+1];this.positionArray[n+5]=b[h+2];this.positionArray[n+6]=b[k];this.positionArray[n+7]=b[k+1];this.positionArray[n+8]=b[k+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[k];this.normalArray[n+7]=c[k+1];this.normalArray[n+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,h,k){var m=this.size*Math.sqrt(h/k),n=g*this.size,p=c*this.size,o=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(o-m);v<1&&(v=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
-1);for(var w,A,B,x,G,z;t<n;t++){o=this.size2*t;A=t/this.size-g;G=A*A;for(A=u;A<p;A++){B=o+this.size*A;w=A/this.size-c;z=w*w;for(w=v;w<m;w++)x=w/this.size-b,x=h/(1.0E-6+x*x+z+G)-k,x>0&&(this.field[B+w]+=x)}}};this.addPlaneX=function(b,c){var g,h,k,m,n,p=this.size,o=this.yd,t=this.zd,u=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(g=0;g<v;g++)if(h=g/p,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<p;h++){n=g+h*o;for(k=0;k<p;k++)u[t*k+n]+=m}};this.addPlaneY=function(b,c){var g,h,k,m,n,p,o=this.size,t=this.yd,u=
-this.zd,v=this.field,w=o*Math.sqrt(b/c);w>o&&(w=o);for(h=0;h<w;h++)if(g=h/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*t;for(g=0;g<o;g++){p=n+g;for(k=0;k<o;k++)v[u*k+p]+=m}}};this.addPlaneZ=function(b,c){var g,h,k,m,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(g=k/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*k;for(h=0;h<size;h++){p=n+h*yd;for(g=0;g<size;g++)field[p+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,h,k,m,n,p,o,t,u=this.size-2;for(k=1;k<u;k++){t=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<u;h++){o=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var k,m,n,p,o,t,u,v;for(k=0;k<h.count;k++)u=k*3,o=u+1,v=u+2,m=h.positionArray[u],
-n=h.positionArray[o],p=h.positionArray[v],t=new THREE.Vector3(m,n,p),m=h.normalArray[u],n=h.normalArray[o],p=h.normalArray[v],u=new THREE.Vector3(m,n,p),u.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),g.push(u);nfaces=h.count/3;for(k=0;k<nfaces;k++)u=(b+k)*3,o=u+1,v=u+2,t=g[u],m=g[o],n=g[v],u=new THREE.Face3(u,o,v,[t,m,n]),c.faces.push(u);b+=nfaces;h.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,g,h,k){var m=this.size*Math.sqrt(h/k),n=g*this.size,o=c*this.size,p=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);m=Math.floor(p+m);m>this.size-1&&(m=this.size-
+1);for(var w,A,B,x,G,z;t<n;t++){p=this.size2*t;A=t/this.size-g;G=A*A;for(A=u;A<o;A++){B=p+this.size*A;w=A/this.size-c;z=w*w;for(w=v;w<m;w++)x=w/this.size-b,x=h/(1.0E-6+x*x+z+G)-k,x>0&&(this.field[B+w]+=x)}}};this.addPlaneX=function(b,c){var g,h,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(h=g/o,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<o;h++){n=g+h*p;for(k=0;k<o;k++)u[t*k+n]+=m}};this.addPlaneY=function(b,c){var g,h,k,m,n,o,p=this.size,t=this.yd,u=
+this.zd,v=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(h=0;h<w;h++)if(g=h/p,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*t;for(g=0;g<p;g++){o=n+g;for(k=0;k<p;k++)v[u*k+o]+=m}}};this.addPlaneZ=function(b,c){var g,h,k,m,n,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(g=k/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*k;for(h=0;h<size;h++){o=n+h*yd;for(g=0;g<size;g++)field[o+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,h,k,m,n,o,p,t,u=this.size-2;for(k=1;k<u;k++){t=this.size2*k;o=(k-this.halfsize)/this.halfsize;for(h=1;h<u;h++){p=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(m,n,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var k,m,n,o,p,t,u,v;for(k=0;k<h.count;k++)u=k*3,p=u+1,v=u+2,m=h.positionArray[u],
+n=h.positionArray[p],o=h.positionArray[v],t=new THREE.Vector3(m,n,o),m=h.normalArray[u],n=h.normalArray[p],o=h.normalArray[v],u=new THREE.Vector3(m,n,o),u.normalize(),p=new THREE.Vertex(t),c.vertices.push(p),g.push(u);nfaces=h.count/3;for(k=0;k<nfaces;k++)u=(b+k)*3,p=u+1,v=u+2,t=g[u],m=g[p],n=g[v],u=new THREE.Face3(u,p,v,[t,m,n]),c.faces.push(u);b+=nfaces;h.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,
 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,
 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]);
 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]);
@@ -556,19 +555,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,e,f,g,h=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,h=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
 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.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 e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var k=c.mesh.geometry.faces[h],m=c.mesh.geometry.vertices[k.a].position,n=c.mesh.geometry.vertices[k.b].position,p=c.mesh.geometry.vertices[k.c].position,o=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,m,n,p,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-k instanceof THREE.Face4&&(k=this.rayTriangle(e,m,n,o,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,n,p,o,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var k=c.mesh.geometry.faces[h],m=c.mesh.geometry.vertices[k.a].position,n=c.mesh.geometry.vertices[k.b].position,o=c.mesh.geometry.vertices[k.c].position,p=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,m,n,o,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+k instanceof THREE.Face4&&(k=this.rayTriangle(e,m,n,p,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,n,o,p,f,this.collisionNormal),k<f&&(f=k,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
 THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,h){var k=THREE.CollisionSystem.__v1,m=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(e,c);m.sub(f,e);h.cross(k,m);m=h.dot(b.direction);if(!(m<0))return Number.MAX_VALUE;k=h.dot(c)-h.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=m*g))return Number.MAX_VALUE;k/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(k);m.addSelf(b.origin);Math.abs(h.x)>Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=m.y-c.y,h=e.y-c.y,
 THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,h){var k=THREE.CollisionSystem.__v1,m=THREE.CollisionSystem.__v2;h.set(0,0,0);k.sub(e,c);m.sub(f,e);h.cross(k,m);m=h.dot(b.direction);if(!(m<0))return Number.MAX_VALUE;k=h.dot(c)-h.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=m*g))return Number.MAX_VALUE;k/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(k);m.addSelf(b.origin);Math.abs(h.x)>Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=m.y-c.y,h=e.y-c.y,
 g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=h*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k};
 g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=h*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,h=0,k=0,m=0,n=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,k=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
-p=!1,m=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);h>f&&(p=2,f=h);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,h=0,k=0,m=0,n=0,o=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,o=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,o=!1,k=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,o=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
+o=!1,m=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,o=!1,n=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,o=!1,n=1);if(o)return-1;o=0;g>f&&(o=1,f=g);h>f&&(o=2,f=h);switch(o){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
 f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
 f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.Camera(53,1,1,1E4);n.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:k},mapRight:{type:"t",value:1,
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},k=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.Camera(53,1,1,1E4);n.position.z=2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:k},mapRight:{type:"t",value:1,
-texture:m}},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 p=
-new THREE.Scene;p.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);k.width=b;k.height=f;m.width=b;m.height=f};this.render=function(b,e){g.projectionMatrix=e.projectionMatrix;g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(-10);h.projectionMatrix=e.projectionMatrix;h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(10);f.call(c,b,g,k,!0);f.call(c,b,h,m,!0);f.call(c,p,n)}};
+texture:m}},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,f){e.call(c,b,f);k.width=b;k.height=f;m.width=b;m.height=f};this.render=function(b,e){g.projectionMatrix=e.projectionMatrix;g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(-10);h.projectionMatrix=e.projectionMatrix;h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(10);f.call(c,b,g,k,!0);f.call(c,b,h,m,!0);f.call(c,o,n)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,h,k=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;h=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,h,k=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;h=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
 k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);m.projectionMatrix=k.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,h);f.call(c,b,k);this.setViewport(g,0,g,h);f.call(c,b,m,!1)}};
 k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);m.projectionMatrix=k.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,h);f.call(c,b,k);this.setViewport(g,0,g,h);f.call(c,b,m,!1)}};

+ 98 - 98
build/custom/ThreeWebGL.js

@@ -14,20 +14,20 @@ THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;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())},
 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,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};
 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),
 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),
-g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+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 g,i,h,j,o,k,n,t,r,q,y=b.geometry,
-B=y.vertices,D=[],f=0;for(g=y.faces.length;f<g;f++)if(i=y.faces[f],r=this.origin.clone(),q=this.direction.clone(),k=b.matrixWorld,h=k.multiplyVector3(B[i.a].position.clone()),j=k.multiplyVector3(B[i.b].position.clone()),o=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()),t=q.dot(n),b.doubleSided||(b.flipSided?t>0:t<0))if(n=n.dot((new THREE.Vector3).sub(h,r))/t,r=r.addSelf(q.multiplyScalar(n)),
+g=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-d*d),h=(h*f-d*e)*g,b=(b*e-d*f)*g;return h>0&&b>0&&h+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 g,i,h,j,o,k,n,t,r,q,C=b.geometry,
+y=C.vertices,D=[],f=0;for(g=C.faces.length;f<g;f++)if(i=C.faces[f],r=this.origin.clone(),q=this.direction.clone(),k=b.matrixWorld,h=k.multiplyVector3(y[i.a].position.clone()),j=k.multiplyVector3(y[i.b].position.clone()),o=k.multiplyVector3(y[i.c].position.clone()),k=i instanceof THREE.Face4?k.multiplyVector3(y[i.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),t=q.dot(n),b.doubleSided||(b.flipSided?t>0:t<0))if(n=n.dot((new THREE.Vector3).sub(h,r))/t,r=r.addSelf(q.multiplyScalar(n)),
 i instanceof THREE.Face3)e(r,h,j,o)&&(i={distance:this.origin.distanceTo(r),point:r,face:i,object:b},D.push(i));else if(i instanceof THREE.Face4&&(e(r,h,j,k)||e(r,j,o,k)))i={distance:this.origin.distanceTo(r),point:r,face:i,object:b},D.push(i);return D}else return[]}};
 i instanceof THREE.Face3)e(r,h,j,o)&&(i={distance:this.origin.distanceTo(r),point:r,face:i,object:b},D.push(i));else if(i instanceof THREE.Face4&&(e(r,h,j,k)||e(r,j,o,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;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,n,t){j=!1;d=h;e=i;f=n;g=t;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points=
 THREE.Rectangle=function(){function b(){i=f-d;h=g-e}var d,e,f,g,i,h,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return h};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,i,n,t){j=!1;d=h;e=i;f=n;g=t;b()};this.addPoint=function(h,i){j?(j=!1,d=h,e=i,f=h,g=i):(d=d<h?d:h,e=e<i?e:i,f=f>h?f:h,g=g>i?g:i);b()};this.add3Points=
 function(h,i,n,t,r,q){j?(j=!1,d=h<n?h<r?h:r:n<r?n:r,e=i<t?i<q?i:q:t<q?t:q,f=h>n?h>r?h:r:n>r?n:r,g=i>t?i>q?i:q:t>q?t:q):(d=h<n?h<r?h<d?h:d:r<d?r:d:n<r?n<d?n:d:r<d?r:d,e=i<t?i<q?i<e?i:e:q<e?q:e:t<q?t<e?t:e:q<e?q:e,f=h>n?h>r?h>f?h:f:r>f?r:f:n>r?n>f?n:f:r>f?r:f,g=i>t?i>q?i>g?i:g:q>g?q:g:t>q?t>g?t:g:q>g?q:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
 function(h,i,n,t,r,q){j?(j=!1,d=h<n?h<r?h:r:n<r?n:r,e=i<t?i<q?i:q:t<q?t:q,f=h>n?h>r?h:r:n>r?n:r,g=i>t?i>q?i:q:t>q?t:q):(d=h<n?h<r?h<d?h:d:r<d?r:d:n<r?n<d?n:d:r<d?r:d,e=i<t?i<q?i<e?i:e:q<e?q:e:t<q?t<e?t:e:q<e?q:e,f=h>n?h>r?h>f?h:f:r>f?r:f:n>r?n>f?n:f:r>f?r:f,g=i>t?i>q?i>g?i:g:q>g?q:g:t>q?t>g?t:g:q>g?q:g);b()};this.addRectangle=function(h){j?(j=!1,d=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(d=d<h.getLeft()?d:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
 h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]};
 h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){d-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){d=d>h.getLeft()?d:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(d,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;g=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,g,i,h,j,o,k,n,t,r,q,y,B){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,o||0,k||0,n||1,t||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,g,i,h,j,o,k,n,t,r,q,y,B){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=o;this.n32=k;this.n33=n;this.n34=t;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,g,i,h,j,o,k,n,t,r,q,C,y){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,o||0,k||0,n||1,t||0,r||0,q||0,C||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,o,k,n,t,r,q,C,y){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=h;this.n24=j;this.n31=o;this.n32=k;this.n33=n;this.n34=t;this.n41=r;this.n42=q;this.n43=C;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1,
 g=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());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=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)*g;b.y=(this.n21*d+this.n22*e+this.n23*
 g=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());g.cross(i,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=i.x;this.n21=f.y;this.n22=g.y;this.n23=i.y;this.n31=f.z;this.n32=g.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,g=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)*g;b.y=(this.n21*d+this.n22*e+this.n23*
 f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;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();
 f+this.n24)*g;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*g;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,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,k=b.n24,n=b.n31,t=b.n32,r=b.n33,q=b.n34,y=b.n41,B=b.n42,D=b.n43,A=b.n44,O=d.n11,ia=d.n12,T=d.n13,E=d.n14,v=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*v+g*Q;this.n12=e*ia+f*ca+g*$;this.n13=e*T+f*M+g*aa;this.n14=e*E+f*C+g*c+i;this.n21=h*O+j*v+o*Q;this.n22=h*ia+j*ca+o*$;this.n23=h*T+j*M+o*aa;this.n24=h*E+j*C+o*c+k;this.n31=n*O+t*v+r*Q;this.n32=n*ia+t*ca+r*$;this.n33=n*T+t*M+r*aa;this.n34=n*E+t*C+r*c+q;this.n41=y*O+B*v+D*Q;this.n42=y*ia+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,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,k=b.n24,n=b.n31,t=b.n32,r=b.n33,q=b.n34,C=b.n41,y=b.n42,D=b.n43,A=b.n44,O=d.n11,ia=d.n12,T=d.n13,E=d.n14,z=d.n21,ca=d.n22,
+L=d.n23,F=d.n24,Q=d.n31,$=d.n32,aa=d.n33,c=d.n34;this.n11=e*O+f*z+g*Q;this.n12=e*ia+f*ca+g*$;this.n13=e*T+f*L+g*aa;this.n14=e*E+f*F+g*c+i;this.n21=h*O+j*z+o*Q;this.n22=h*ia+j*ca+o*$;this.n23=h*T+j*L+o*aa;this.n24=h*E+j*F+o*c+k;this.n31=n*O+t*z+r*Q;this.n32=n*ia+t*ca+r*$;this.n33=n*T+t*L+r*aa;this.n34=n*E+t*F+r*c+q;this.n41=C*O+y*z+D*Q;this.n42=C*ia+y*ca+D*$;this.n43=C*T+y*L+D*aa;this.n44=C*E+y*F+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},
 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,g=this.n21,i=this.n22,h=this.n23,j=this.n24,o=this.n31,k=this.n32,n=this.n33,t=this.n34,r=this.n41,q=this.n42,y=this.n43,B=this.n44;return f*h*k*r-e*j*k*r-f*i*n*r+d*j*n*r+e*i*t*r-d*h*t*r-f*h*o*q+e*j*o*q+f*g*n*q-b*j*n*q-e*g*t*q+b*h*t*q+f*i*o*y-d*j*o*y-f*g*k*y+b*j*k*y+d*g*t*y-b*i*t*y-e*i*o*B+d*h*o*B+e*g*k*B-b*h*k*B-d*g*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,g=this.n21,i=this.n22,h=this.n23,j=this.n24,o=this.n31,k=this.n32,n=this.n33,t=this.n34,r=this.n41,q=this.n42,C=this.n43,y=this.n44;return f*h*k*r-e*j*k*r-f*i*n*r+d*j*n*r+e*i*t*r-d*h*t*r-f*h*o*q+e*j*o*q+f*g*n*q-b*j*n*q-e*g*t*q+b*h*t*q+f*i*o*C-d*j*o*C-f*g*k*C+b*j*k*C+d*g*t*C-b*i*t*C-e*i*o*y+d*h*o*y+e*g*k*y-b*h*k*y-d*g*n*y+b*i*n*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=
 b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;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;
 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;
 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},
 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,o=g*i,k=g*h;this.set(o*i+e,o*h-f*j,o*j+f*h,0,o*h+f*j,k*h+e,k*j-f*i,0,o*j-f*h
 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),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=
 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),g=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f),h=b*e,j=d*e;this.n11=g*i;this.n12=-g*f;this.n13=e;this.n21=j*i+b*f;this.n22=-j*f+b*i;this.n23=-d*g;this.n31=-h*i+d*f;this.n32=h*f+d*i;this.n33=
 b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,o=d*h;d*=j;var k=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(k+f);this.n12=o-g;this.n13=d+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;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*g;return this},setRotationFromQuaternion:function(b){var d=b.x,e=b.y,f=b.z,g=b.w,i=d+d,h=e+e,j=f+f,b=d*i,o=d*h;d*=j;var k=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(k+f);this.n12=o-g;this.n13=d+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;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,g=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*g;this.n23=b.n23*g;this.n33=b.n33*g}};
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var e=1/d.x,f=1/d.y,g=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*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,k=b.n24,n=b.n31,t=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=o*q*B-k*r*B+k*t*D-j*q*D-o*t*A+j*r*A;d.n12=i*r*B-g*q*B-i*t*D+f*q*D+g*t*A-f*r*A;d.n13=g*k*B-i*o*B+i*j*D-f*k*D-g*j*A+f*o*A;d.n14=i*o*t-g*k*t-i*j*r+f*k*r+g*j*q-f*o*q;d.n21=k*r*y-o*q*y-k*n*D+h*q*D+o*n*A-h*r*A;d.n22=g*q*y-i*r*y+i*n*D-e*q*D-g*n*A+e*r*A;d.n23=i*o*y-g*k*y-i*h*D+e*k*D+g*h*A-e*o*A;d.n24=
-g*k*n-i*o*n+i*h*r-e*k*r-g*h*q+e*o*q;d.n31=j*q*y-k*t*y+k*n*B-h*q*B-j*n*A+h*t*A;d.n32=i*t*y-f*q*y-i*n*B+e*q*B+f*n*A-e*t*A;d.n33=g*k*y-i*j*y+i*h*B-e*k*B-f*h*A+e*j*A;d.n34=i*j*n-f*k*n-i*h*t+e*k*t+f*h*q-e*j*q;d.n41=o*t*y-j*r*y-o*n*B+h*r*B+j*n*D-h*t*D;d.n42=f*r*y-g*t*y+g*n*B-e*r*B-f*n*D+e*t*D;d.n43=g*j*y-f*o*y-g*h*B+e*o*B+f*h*D-e*j*D;d.n44=f*o*n-g*j*n+g*h*t-e*o*t-f*h*r+e*j*r;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,g=b.n13,i=b.n14,h=b.n21,j=b.n22,o=b.n23,k=b.n24,n=b.n31,t=b.n32,r=b.n33,q=b.n34,C=b.n41,y=b.n42,D=b.n43,A=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=o*q*y-k*r*y+k*t*D-j*q*D-o*t*A+j*r*A;d.n12=i*r*y-g*q*y-i*t*D+f*q*D+g*t*A-f*r*A;d.n13=g*k*y-i*o*y+i*j*D-f*k*D-g*j*A+f*o*A;d.n14=i*o*t-g*k*t-i*j*r+f*k*r+g*j*q-f*o*q;d.n21=k*r*C-o*q*C-k*n*D+h*q*D+o*n*A-h*r*A;d.n22=g*q*C-i*r*C+i*n*D-e*q*D-g*n*A+e*r*A;d.n23=i*o*C-g*k*C-i*h*D+e*k*D+g*h*A-e*o*A;d.n24=
+g*k*n-i*o*n+i*h*r-e*k*r-g*h*q+e*o*q;d.n31=j*q*C-k*t*C+k*n*y-h*q*y-j*n*A+h*t*A;d.n32=i*t*C-f*q*C-i*n*y+e*q*y+f*n*A-e*t*A;d.n33=g*k*C-i*j*C+i*h*y-e*k*y-f*h*A+e*j*A;d.n34=i*j*n-f*k*n-i*h*t+e*k*t+f*h*q-e*j*q;d.n41=o*t*C-j*r*C-o*n*y+h*r*y+j*n*D-h*t*D;d.n42=f*r*C-g*t*C+g*n*y-e*r*y-f*n*D+e*t*D;d.n43=g*j*C-f*o*C-g*h*y+e*o*y+f*h*D-e*j*D;d.n44=f*o*n-g*j*n+g*h*t-e*o*t-f*h*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,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,o=-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,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*k;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*o;e[6]=b*k;e[7]=b*n;e[8]=b*t;return d};
 THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,o=-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,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*k;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*i;e[3]=b*h;e[4]=b*j;e[5]=b*o;e[6]=b*k;e[7]=b*n;e[8]=b*t;return d};
 THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)};
 THREE.Matrix4.makeFrustum=function(b,d,e,f,g,i){var h;h=new THREE.Matrix4;h.n11=2*g/(d-b);h.n12=0;h.n13=(d+b)/(d-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(i+g)/(i-g);h.n34=-2*i*g/(i-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,d,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,e,f)};
 THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,o,k;h=new THREE.Matrix4;j=d-b;o=e-f;k=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((i+g)/k);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Matrix4.makeOrtho=function(b,d,e,f,g,i){var h,j,o,k;h=new THREE.Matrix4;j=d-b;o=e-f;k=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/k;h.n34=-((i+g)/k);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};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,g,i,h,j=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;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],h=this.vertices[i.c],j.sub(h.position,e.position),o.sub(d.position,e.position),j.crossSelf(o);j.isZero()||
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var d,e,f,g,i,h,j=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;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],h=this.vertices[i.c],j.sub(h.position,e.position),o.sub(d.position,e.position),j.crossSelf(o);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=
 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]),
 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,g,i){j=b.vertices[c].position;o=b.vertices[d].position;k=b.vertices[e].position;n=h[f];t=h[g];r=h[i];q=o.x-j.x;y=k.x-j.x;B=o.y-j.y;D=k.y-j.y;A=o.z-j.z;O=k.z-j.z;ia=t.u-n.u;T=r.u-n.u;E=t.v-n.v;v=r.v-n.v;ca=1/(ia*v-T*E);$.set((v*q-E*
-y)*ca,(v*B-E*D)*ca,(v*A-E*O)*ca);aa.set((ia*y-T*q)*ca,(ia*D-T*B)*ca,(ia*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,g,i,h,j,o,k,n,t,r,q,y,B,D,A,O,ia,T,E,v,ca,M,C=[],Q=[],$=new THREE.Vector3,aa=new THREE.Vector3,c=new THREE.Vector3,ua=new THREE.Vector3,na=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],h=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 Ca=["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++)na.copy(i.vertexNormals[f]),g=i[Ca[f]],M=C[g],c.copy(M),c.subSelf(na.multiplyScalar(na.dot(M))).normalize(),ua.cross(i.vertexNormals[f],M),g=ua.dot(Q[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(c.x,c.y,c.z,g)}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,g,i){j=b.vertices[c].position;o=b.vertices[d].position;k=b.vertices[e].position;n=h[f];t=h[g];r=h[i];q=o.x-j.x;C=k.x-j.x;y=o.y-j.y;D=k.y-j.y;A=o.z-j.z;O=k.z-j.z;ia=t.u-n.u;T=r.u-n.u;E=t.v-n.v;z=r.v-n.v;ca=1/(ia*z-T*E);$.set((z*q-E*
+C)*ca,(z*y-E*D)*ca,(z*A-E*O)*ca);aa.set((ia*C-T*q)*ca,(ia*D-T*y)*ca,(ia*O-T*A)*ca);F[c].addSelf($);F[d].addSelf($);F[e].addSelf($);Q[c].addSelf(aa);Q[d].addSelf(aa);Q[e].addSelf(aa)}var d,e,f,g,i,h,j,o,k,n,t,r,q,C,y,D,A,O,ia,T,E,z,ca,L,F=[],Q=[],$=new THREE.Vector3,aa=new THREE.Vector3,c=new THREE.Vector3,ua=new THREE.Vector3,na=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)F[d]=new THREE.Vector3,Q[d]=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++)i=this.faces[d],h=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 Ca=["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++)na.copy(i.vertexNormals[f]),g=i[Ca[f]],L=F[g],c.copy(L),c.subSelf(na.multiplyScalar(na.dot(L))).normalize(),ua.cross(i.vertexNormals[f],L),g=ua.dot(Q[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(c.x,c.y,c.z,g)}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;
 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]===
 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,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];i=h.vertexIndices[1];
 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,g,i,h,j={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.a,h.c),d(j,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),d(j,g,e),g=b(h.a,h.b),d(j,g,e),g=b(h.a,h.d),d(j,g,e),g=b(h.b,h.c),d(j,g,e),g=b(h.c,h.d),d(j,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];i=h.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,
 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()};
 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=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,g,i,h,j,o,k,n,t,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=[];g=0;var A=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],A.push(g),g+=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],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(o="a",n=A[g]+0):e.b===h?(o="b",n=A[g]+1):e.c===h?(o="c",n=A[g]+2):e.d===h&&(o="d",n=A[g]+3),e.a===j?(o+="a",t=A[g]+0):e.b===j?(o+="b",t=A[g]+1):e.c===j?(o+="c",t=A[g]+2):e.d===j&&(o+="d",t=A[g]+3),f.a===h?(k="a",r=A[i]+0):f.b===h?(k="b",r=A[i]+1):f.c===h?(k="c",r=A[i]+2):f.d===h&&(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),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>t&&(e=n,n=t,t=e):n<t&&(e=n,n=t,t=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,t,r,q),e.normal.set(1,0,0),D.push(e);this.geometry=y}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,o,k,n,t,r,q,C=new THREE.Geometry;C.vertices=this.geometry.vertices;f=C.faces=this.geometry.faces;var y=C.egdes=this.geometry.edges,D=C.edgeFaces=[];g=0;var A=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],A.push(g),g+=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=y.length;b<d;b++)j=y[b],e=j.faces[0],f=j.faces[1],g=j.faceIndices[0],i=j.faceIndices[1],h=j.vertexIndices[0],j=j.vertexIndices[1],e.a===h?(o="a",n=A[g]+0):e.b===h?(o="b",n=A[g]+1):e.c===h?(o="c",n=A[g]+2):e.d===h&&(o="d",n=A[g]+3),e.a===j?(o+="a",t=A[g]+0):e.b===j?(o+="b",t=A[g]+1):e.c===j?(o+="c",t=A[g]+2):e.d===j&&(o+="d",t=A[g]+3),f.a===h?(k="a",r=A[i]+0):f.b===h?(k="b",r=A[i]+1):f.c===h?(k="c",r=A[i]+2):f.d===h&&(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),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>t&&(e=n,n=t,t=e):n<t&&(e=n,n=t,t=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,t,r,q),e.normal.set(1,0,0),D.push(e);this.geometry=C}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,g=b.faces,b=b.vertices,i=g.length,h,j,o,k,n,t=["a","b","c","d"];for(o=0;o<i;o++){j=d.length;h=g[o];h 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(h.normal);e.push(j);
 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,g=b.faces,b=b.vertices,i=g.length,h,j,o,k,n,t=["a","b","c","d"];for(o=0;o<i;o++){j=d.length;h=g[o];h 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(h.normal);e.push(j);
 for(j=0;j<k;j++)n=b[h[t[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],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))}};
 for(j=0;j<k;j++)n=b[h[t[j]]],d.push(new THREE.Vertex(n.position.clone()))}for(i=0;i<g.length-1;i++){b=e[i];for(h=i+1;h<g.length;h++)j=e[h],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,g,i,h,j,o,k,n,t,r,q,y,B,D=0,A=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(y=0;y<f;y++){i=d[A[y]];j=b[i];for(B=0;B<g;B++)if(h=e[A[B]],o=b[h],Math.abs(j.position.x-o.position.x)<1.0E-4&&Math.abs(j.position.y-o.position.y)<1.0E-4&&Math.abs(j.position.z-o.position.z)<1.0E-4&&(D++,D===1&&(k=j,n=o,t=i,r=h,q=A[y]),D===2))return q+=A[y],q==="ad"||q==="ac"?{faces:[d,e],vertices:[k,n,o,j],indices:[t,r,
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,e){var f,g,i,h,j,o,k,n,t,r,q,C,y,D=0,A=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(C=0;C<f;C++){i=d[A[C]];j=b[i];for(y=0;y<g;y++)if(h=e[A[y]],o=b[h],Math.abs(j.position.x-o.position.x)<1.0E-4&&Math.abs(j.position.y-o.position.y)<1.0E-4&&Math.abs(j.position.z-o.position.z)<1.0E-4&&(D++,D===1&&(k=j,n=o,t=i,r=h,q=A[C]),D===2))return q+=A[C],q==="ad"||q==="ac"?{faces:[d,e],vertices:[k,n,o,j],indices:[t,r,
 h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[k,j,o,n],indices:[t,i,h,r],vertexTypes:[1,1,2,2],extrudable:!0}}};
 h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[k,j,o,n],indices:[t,i,h,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;
 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;
 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.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.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.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=o[j]=o[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,g=d.z+d.w,h=-b.z+b.w,i=-d.z+d.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?c=Math.max(c,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var f,g,i=[],h,j,o=[],k,n,t=[],r,q=[],y,B,D=[],A,O,ia=[],T=new THREE.Vector4,E=new THREE.Vector4,
-v=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){v.multiply(d.projectionMatrix,d.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,d){v.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));v.multiplyVector3(b);return b};this.projectObjects=function(b,e,c){var e=[],h,j,k;g=0;
-j=b.objects;b=0;for(h=j.length;b<h;b++){k=j[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh){a:{o=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)),t=0;t<6;t++)if(o=M[t].x*n.n14+M[t].y*n.n24+M[t].z*n.n34+M[t].w,o<=r){o=!1;break a}o=!0}o=!o}if(!o)o=i[g]=i[g]||new THREE.RenderableObject,g++,f=o,T.copy(k.position),v.multiplyVector3(T),f.object=k,f.z=T.z,e.push(f)}c&&e.sort(d);return e};this.projectScene=function(f,g,c){var i=
-[],T=g.near,Ca=g.far,ja,la,P,R,H,I,S,L,N,F,ka,ma,sa,ra,qa,oa,ta;O=B=r=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);v.multiply(g.projectionMatrix,g.matrixWorldInverse);M[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);M[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);M[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);M[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);M[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);M[5].set(v.n41+v.n31,v.n42+
-v.n32,v.n43+v.n33,v.n44+v.n34);for(ja=0;ja<6;ja++)N=M[ja],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,g,!0);f=0;for(ja=N.length;f<ja;f++)if(F=N[f].object,F.visible)if(ka=F.matrixWorld,ma=F.matrixRotationWorld,sa=F.materials,ra=F.overdraw,j=0,F instanceof THREE.Mesh){qa=F.geometry;R=qa.vertices;oa=qa.faces;qa=qa.faceVertexUvs;la=0;for(P=R.length;la<P;la++)h=b(),h.positionWorld.copy(R[la].position),ka.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
-v.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>T&&h.positionScreen.z<Ca;R=0;for(la=oa.length;R<la;R++){P=oa[R];if(P instanceof THREE.Face3)if(H=o[P.a],I=o[P.b],S=o[P.c],H.visible&&I.visible&&S.visible&&(F.doubleSided||F.flipSided!=(S.positionScreen.x-H.positionScreen.x)*(I.positionScreen.y-H.positionScreen.y)-(S.positionScreen.y-H.positionScreen.y)*(I.positionScreen.x-H.positionScreen.x)<0))L=t[n]=t[n]||
-new THREE.RenderableFace3,n++,k=L,k.v1.copy(H),k.v2.copy(I),k.v3.copy(S);else continue;else if(P instanceof THREE.Face4)if(H=o[P.a],I=o[P.b],S=o[P.c],L=o[P.d],H.visible&&I.visible&&S.visible&&L.visible&&(F.doubleSided||F.flipSided!=((L.positionScreen.x-H.positionScreen.x)*(I.positionScreen.y-H.positionScreen.y)-(L.positionScreen.y-H.positionScreen.y)*(I.positionScreen.x-H.positionScreen.x)<0||(I.positionScreen.x-S.positionScreen.x)*(L.positionScreen.y-S.positionScreen.y)-(I.positionScreen.y-S.positionScreen.y)*
-(L.positionScreen.x-S.positionScreen.x)<0)))ta=q[r]=q[r]||new THREE.RenderableFace4,r++,k=ta,k.v1.copy(H),k.v2.copy(I),k.v3.copy(S),k.v4.copy(L);else continue;k.normalWorld.copy(P.normal);ma.multiplyVector3(k.normalWorld);k.centroidWorld.copy(P.centroid);ka.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);v.multiplyVector3(k.centroidScreen);S=P.vertexNormals;H=0;for(I=S.length;H<I;H++)L=k.vertexNormalsWorld[H],L.copy(S[H]),ma.multiplyVector3(L);H=0;for(I=qa.length;H<I;H++)if(ta=
-qa[H][R]){S=0;for(L=ta.length;S<L;S++)k.uvs[H][S]=ta[S]}k.meshMaterials=sa;k.faceMaterials=P.materials;k.overdraw=ra;k.z=k.centroidScreen.z;i.push(k)}}else if(F instanceof THREE.Line){ca.multiply(v,ka);R=F.geometry.vertices;H=b();H.positionScreen.copy(R[0].position);ca.multiplyVector4(H.positionScreen);la=1;for(P=R.length;la<P;la++)if(H=b(),H.positionScreen.copy(R[la].position),ca.multiplyVector4(H.positionScreen),I=o[j-2],C.copy(H.positionScreen),Q.copy(I.positionScreen),e(C,Q))C.multiplyScalar(1/
-C.w),Q.multiplyScalar(1/Q.w),ka=D[B]=D[B]||new THREE.RenderableLine,B++,y=ka,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),v.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))ka=ia[O]=ia[O]||new THREE.RenderableParticle,O++,A=ka,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+g.projectionMatrix.n11)/
-(E.w+g.projectionMatrix.n14)),A.scale.y=F.scale.y*Math.abs(A.y-(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),A.materials=F.materials,i.push(A);c&&i.sort(d);return i}};
+THREE.Projector=function(){function b(){var b=o[j]=o[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,g=d.z+d.w,h=-b.z+b.w,i=-d.z+d.w;return f>=0&&g>=0&&h>=0&&i>=0?!0:f<0&&g<0||h<0&&i<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(e=Math.min(e,f/(f-g))),h<0?c=Math.max(c,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<c?!1:(b.lerpSelf(d,c),d.lerpSelf(b,1-e),!0))}var f,g,i=[],h,j,o=[],k,n,t=[],r,q=[],C,y,D=[],A,O,ia=[],T=new THREE.Vector4,E=new THREE.Vector4,
+z=new THREE.Matrix4,ca=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,d){z.multiply(d.projectionMatrix,d.matrixWorldInverse);z.multiplyVector3(b);return b};this.unprojectVector=function(b,d){z.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));z.multiplyVector3(b);return b};this.projectObjects=function(b,e,c){var e=[],h,j,k;g=0;
+j=b.objects;b=0;for(h=j.length;b<h;b++){k=j[b];var o;if(!(o=!k.visible))if(o=k instanceof THREE.Mesh){a:{o=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)),t=0;t<6;t++)if(o=L[t].x*n.n14+L[t].y*n.n24+L[t].z*n.n34+L[t].w,o<=r){o=!1;break a}o=!0}o=!o}if(!o)o=i[g]=i[g]||new THREE.RenderableObject,g++,f=o,T.copy(k.position),z.multiplyVector3(T),f.object=k,f.z=T.z,e.push(f)}c&&e.sort(d);return e};this.projectScene=function(f,g,c){var i=
+[],T=g.near,Ca=g.far,ja,la,P,R,J,I,S,M,N,G,ka,ma,sa,ra,qa,oa,ta;O=y=r=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);z.multiply(g.projectionMatrix,g.matrixWorldInverse);L[0].set(z.n41-z.n11,z.n42-z.n12,z.n43-z.n13,z.n44-z.n14);L[1].set(z.n41+z.n11,z.n42+z.n12,z.n43+z.n13,z.n44+z.n14);L[2].set(z.n41+z.n21,z.n42+z.n22,z.n43+z.n23,z.n44+z.n24);L[3].set(z.n41-z.n21,z.n42-z.n22,z.n43-z.n23,z.n44-z.n24);L[4].set(z.n41-z.n31,z.n42-z.n32,z.n43-z.n33,z.n44-z.n34);L[5].set(z.n41+z.n31,z.n42+
+z.n32,z.n43+z.n33,z.n44+z.n34);for(ja=0;ja<6;ja++)N=L[ja],N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z));N=this.projectObjects(f,g,!0);f=0;for(ja=N.length;f<ja;f++)if(G=N[f].object,G.visible)if(ka=G.matrixWorld,ma=G.matrixRotationWorld,sa=G.materials,ra=G.overdraw,j=0,G instanceof THREE.Mesh){qa=G.geometry;R=qa.vertices;oa=qa.faces;qa=qa.faceVertexUvs;la=0;for(P=R.length;la<P;la++)h=b(),h.positionWorld.copy(R[la].position),ka.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
+z.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>T&&h.positionScreen.z<Ca;R=0;for(la=oa.length;R<la;R++){P=oa[R];if(P instanceof THREE.Face3)if(J=o[P.a],I=o[P.b],S=o[P.c],J.visible&&I.visible&&S.visible&&(G.doubleSided||G.flipSided!=(S.positionScreen.x-J.positionScreen.x)*(I.positionScreen.y-J.positionScreen.y)-(S.positionScreen.y-J.positionScreen.y)*(I.positionScreen.x-J.positionScreen.x)<0))M=t[n]=t[n]||
+new THREE.RenderableFace3,n++,k=M,k.v1.copy(J),k.v2.copy(I),k.v3.copy(S);else continue;else if(P instanceof THREE.Face4)if(J=o[P.a],I=o[P.b],S=o[P.c],M=o[P.d],J.visible&&I.visible&&S.visible&&M.visible&&(G.doubleSided||G.flipSided!=((M.positionScreen.x-J.positionScreen.x)*(I.positionScreen.y-J.positionScreen.y)-(M.positionScreen.y-J.positionScreen.y)*(I.positionScreen.x-J.positionScreen.x)<0||(I.positionScreen.x-S.positionScreen.x)*(M.positionScreen.y-S.positionScreen.y)-(I.positionScreen.y-S.positionScreen.y)*
+(M.positionScreen.x-S.positionScreen.x)<0)))ta=q[r]=q[r]||new THREE.RenderableFace4,r++,k=ta,k.v1.copy(J),k.v2.copy(I),k.v3.copy(S),k.v4.copy(M);else continue;k.normalWorld.copy(P.normal);ma.multiplyVector3(k.normalWorld);k.centroidWorld.copy(P.centroid);ka.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);z.multiplyVector3(k.centroidScreen);S=P.vertexNormals;J=0;for(I=S.length;J<I;J++)M=k.vertexNormalsWorld[J],M.copy(S[J]),ma.multiplyVector3(M);J=0;for(I=qa.length;J<I;J++)if(ta=
+qa[J][R]){S=0;for(M=ta.length;S<M;S++)k.uvs[J][S]=ta[S]}k.meshMaterials=sa;k.faceMaterials=P.materials;k.overdraw=ra;k.z=k.centroidScreen.z;i.push(k)}}else if(G instanceof THREE.Line){ca.multiply(z,ka);R=G.geometry.vertices;J=b();J.positionScreen.copy(R[0].position);ca.multiplyVector4(J.positionScreen);la=1;for(P=R.length;la<P;la++)if(J=b(),J.positionScreen.copy(R[la].position),ca.multiplyVector4(J.positionScreen),I=o[j-2],F.copy(J.positionScreen),Q.copy(I.positionScreen),e(F,Q))F.multiplyScalar(1/
+F.w),Q.multiplyScalar(1/Q.w),ka=D[y]=D[y]||new THREE.RenderableLine,y++,C=ka,C.v1.positionScreen.copy(F),C.v2.positionScreen.copy(Q),C.z=Math.max(F.z,Q.z),C.materials=G.materials,i.push(C)}else if(G instanceof THREE.Particle&&(E.set(G.matrixWorld.n14,G.matrixWorld.n24,G.matrixWorld.n34,1),z.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))ka=ia[O]=ia[O]||new THREE.RenderableParticle,O++,A=ka,A.x=E.x/E.w,A.y=E.y/E.w,A.z=E.z,A.rotation=G.rotation.z,A.scale.x=G.scale.x*Math.abs(A.x-(E.x+g.projectionMatrix.n11)/
+(E.w+g.projectionMatrix.n14)),A.scale.y=G.scale.y*Math.abs(A.y-(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),A.materials=G.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,g=e.length;for(f=0;f<g;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.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,g=e.length;for(f=0;f<g;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",
 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_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,114 +183,114 @@ 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,
 "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.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.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,g,h,i=b.vertices,j=i.length,k=b.colors,o=k.length,p=b.__vertexArray,G=b.__colorArray,wa=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){ka.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,ra.copy(g),ka.multiplyVector3(ra),wa[f]=[ra.z,f];wa.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[wa[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=k[wa[f][1]],G[h]=color.r,G[h+
-1]=color.g,G[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(r)for(f=0;f<o;f++)color=k[f],h=f*3,G[h]=color.r,G[h+1]=color.g,G[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,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,g){f.program||aa.initMaterial(f,d,e,g);var h=f.program,i=h.uniforms,j=f.uniforms;h!=na&&
+THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,k=b.colors,o=k.length,p=b.__vertexArray,H=b.__colorArray,wa=b.__sortArray,n=b.__dirtyVertices,r=b.__dirtyColors;if(e.sortParticles){ka.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,ra.copy(g),ka.multiplyVector3(ra),wa[f]=[ra.z,f];wa.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[wa[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=k[wa[f][1]],H[h]=color.r,H[h+
+1]=color.g,H[h+2]=color.b}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(r)for(f=0;f<o;f++)color=k[f],h=f*3,H[h]=color.r,H[h+1]=color.g,H[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,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,g){f.program||aa.initMaterial(f,d,e,g);var h=f.program,i=h.uniforms,j=f.uniforms;h!=na&&
 (c.useProgram(h),na=h);c.uniformMatrix4fv(i.projectionMatrix,!1,ma);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||
 (c.useProgram(h),na=h);c.uniformMatrix4fv(i.projectionMatrix,!1,ma);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,o,p=0,G=0,wa=0,n,r,t,q,x=qa,y=x.directional.colors,A=x.directional.positions,B=x.point.colors,J=x.point.positions,K=x.point.distances,u=0,s=0,e=o=q=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,r=o.position,t=o.intensity,q=o.distance,o instanceof THREE.AmbientLight)p+=n.r,G+=n.g,wa+=n.b;else if(o instanceof THREE.DirectionalLight)q=u*3,y[q]=n.r*t,y[q+1]=n.g*t,y[q+2]=n.b*t,A[q]=r.x,A[q+1]=r.y,A[q+2]=r.z,u+=1;else if(o instanceof THREE.PointLight)o=s*3,B[o]=n.r*t,B[o+1]=n.g*t,B[o+2]=
-n.b*t,J[o]=r.x,J[o+1]=r.y,J[o+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;x.point.length=s;x.directional.length=u;x.ambient[0]=p;x.ambient[1]=G;x.ambient[2]=wa;e=qa;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,o,p=0,H=0,wa=0,n,r,t,q,v=qa,w=v.directional.colors,C=v.directional.positions,A=v.point.colors,y=v.point.positions,K=v.point.distances,u=0,s=0,e=o=q=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,r=o.position,t=o.intensity,q=o.distance,o instanceof THREE.AmbientLight)p+=n.r,H+=n.g,wa+=n.b;else if(o instanceof THREE.DirectionalLight)q=u*3,w[q]=n.r*t,w[q+1]=n.g*t,w[q+2]=n.b*t,C[q]=r.x,C[q+1]=r.y,C[q+2]=r.z,u+=1;else if(o instanceof THREE.PointLight)o=s*3,A[o]=n.r*t,A[o+1]=n.g*t,A[o+2]=
+n.b*t,y[o]=r.x,y[o+1]=r.y,y[o+2]=r.z,K[s]=q,s+=1;for(e=u*3;e<w.length;e++)w[e]=0;for(e=s*3;e<A.length;e++)A[e]=0;v.point.length=s;v.directional.length=u;v.ambient[0]=p;v.ambient[1]=H;v.ambient[2]=wa;e=qa;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
 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=oa.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=
 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=oa.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=h.uniforms[z])if(k=j[z],p=k.type,e=k.value,p=="i")c.uniform1i(G,e);else if(p=="f")c.uniform1f(G,e);else if(p=="fv1")c.uniform1fv(G,e);else if(p=="fv")c.uniform3fv(G,e);else if(p=="v2")c.uniform2f(G,e.x,e.y);else if(p=="v3")c.uniform3f(G,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(G,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(G,e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(G,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(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[p])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[p]);k.__webglInit=!0}v(c.TEXTURE_CUBE_MAP,
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var B in j)if(H=h.uniforms[B])if(k=j[B],p=k.type,e=k.value,p=="i")c.uniform1i(H,e);else if(p=="f")c.uniform1f(H,e);else if(p=="fv1")c.uniform1fv(H,e);else if(p=="fv")c.uniform3fv(H,e);else if(p=="v2")c.uniform2f(H,e.x,e.y);else if(p=="v3")c.uniform3f(H,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(H,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(H,e.r,e.g,e.b);else if(p=="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(p=0;p<6;++p)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[p])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;++p)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[p]);k.__webglInit=!0}z(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,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._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||
 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,g._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,g._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,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,sa);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,
 f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,sa);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,g._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,sa);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,sa),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,d,f,g,h,i){if(g.opacity!=0){var j,b=e(b,d,f,g,i).attributes;if(!g.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]),
 !1,g._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,sa);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,sa),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,d,f,g,h,i){if(g.opacity!=0){var j,b=e(b,d,f,g,i).attributes;if(!g.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else{d=g.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[i.morphTargetBase]),
 c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=o[k[f]],f++;else{var k=[],n=-1,
 c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k[f]]),c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[f]=o[k[f]],f++;else{var k=[],n=-1,
-p=0,o=i.morphTargetInfluences,G,wa=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(G=0;G<wa;G++)!k[G]&&o[G]>n&&(p=G,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(j in h.__webglCustomAttributes)b[j]>=
+p=0,o=i.morphTargetInfluences,H,wa=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(H=0;H<wa;H++)!k[H]&&o[H]>n&&(p=H,n=o[p]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=n;k[p]=1;n=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(g.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(j in h.__webglCustomAttributes)b[j]>=
 0&&(d=h.__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,h.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,
 0&&(d=h.__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,h.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,
 h.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,
 h.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,
 c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,
 c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(g.wireframe?(c.lineWidth(g.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.drawElements(c.LINES,h.__webglLineCount,
 c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),aa.data.vertices+=h.__webglFaceCount,aa.data.faces+=h.__webglFaceCount/3,aa.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),c.drawArrays(i,0,h.__webglLineCount),aa.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),aa.data.drawCalls++):i instanceof
 c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),aa.data.vertices+=h.__webglFaceCount,aa.data.faces+=h.__webglFaceCount/3,aa.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(g.linewidth),c.drawArrays(i,0,h.__webglLineCount),aa.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),aa.data.drawCalls++):i instanceof
 THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),aa.data.drawCalls++)}}function g(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,
 THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),aa.data.drawCalls++)}}function g(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,h,g,i,j,k,o,p,G,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],h=e[n+1],g=e[n+2],i=e[n+3],k=e[n+4],p=e[n+5],j=e[n+6],o=e[n+7],G=e[n+8],f=(f+i+j)/3,h=(h+k+o)/3,g=(g+p+G)/3,e[n]=f,e[n+1]=h,e[n+2]=g,e[n+3]=f,e[n+4]=h,e[n+5]=g,e[n+6]=f,e[n+7]=h,e[n+8]=g}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(la!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),la=b.doubleSided;if(P!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),P=b.flipSided}function h(b){H!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),H=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 o(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,
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,g,i,j,k,o,p,H,n,r=b.count*3;for(n=0;n<r;n+=9)e=b.normalArray,f=e[n],h=e[n+1],g=e[n+2],i=e[n+3],k=e[n+4],p=e[n+5],j=e[n+6],o=e[n+7],H=e[n+8],f=(f+i+j)/3,h=(h+k+o)/3,g=(g+p+H)/3,e[n]=f,e[n+1]=h,e[n+2]=g,e[n+3]=f,e[n+4]=h,e[n+5]=g,e[n+6]=f,e[n+7]=h,e[n+8]=g}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(la!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),la=b.doubleSided;if(P!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),P=b.flipSided}function h(b){J!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),J=b)}function j(b){G[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);G[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);G[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);G[3].set(b.n41-b.n21,b.n42-
+b.n22,b.n43-b.n23,b.n44-b.n24);G[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);G[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=G[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function o(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=G[e].x*c.n14+G[e].y*c.n24+G[e].z*c.n34+G[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,h=b.transparent;h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?k(h,d):k(f,d)}function t(b){var c,d,e,f,h=b.object,g=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=g.materials.length;c<d;c++)(f=g.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);
 d,e=b.object,f=b.opaque,h=b.transparent;h.count=0;b=f.count=0;for(c=e.materials.length;b<c;b++)d=e.materials[b],d.transparent?k(h,d):k(f,d)}function t(b){var c,d,e,f,h=b.object,g=b.buffer,i=b.opaque,j=b.transparent;j.count=0;b=i.count=0;for(e=h.materials.length;b<e;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=g.materials.length;c<d;c++)(f=g.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,h=b.lights,g=[],i,j,k,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,
 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,h=b.lights,g=[],i,j,k,o,p,n=b.__webglShadowVolumes.length;for(d=0;d<e;d++)if(f=b.lights[d],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(p=0;p<n;p++)f=b.__webglShadowVolumes[p].object,
 i=b.__webglShadowVolumes[p].buffer,j=f.materials[0],j.program||aa.initMaterial(j,h,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,na!==j&&(c.useProgram(j),na=j,c.uniformMatrix4fv(k.projectionMatrix,!1,ma),c.uniformMatrix4fv(k.viewMatrix,!1,sa),c.uniform3fv(k.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,
 i=b.__webglShadowVolumes[p].buffer,j=f.materials[0],j.program||aa.initMaterial(j,h,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,na!==j&&(c.useProgram(j),na=j,c.uniformMatrix4fv(k.projectionMatrix,!1,ma),c.uniformMatrix4fv(k.viewMatrix,!1,sa),c.uniform3fv(k.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),c.uniformMatrix4fv(k.objectMatrix,!1,f._objectMatrixArray),c.bindBuffer(c.ARRAY_BUFFER,i.__webglVertexBuffer),c.vertexAttribPointer(o.position,3,c.FLOAT,!1,0,
 0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(o.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;na=u.program;c.useProgram(u.program);
 0),c.bindBuffer(c.ARRAY_BUFFER,i.__webglNormalBuffer),c.vertexAttribPointer(o.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;na=u.program;c.useProgram(u.program);
-c.uniformMatrix4fv(u.projectionLocation,!1,ma);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(ja)}function y(b,d){var e,f,h;e=_sprite.attributes;
-var g=_sprite.uniforms,i=N/L,j,k=[],o=L*0.5,p=N*0.5,n=!0;c.useProgram(_sprite.program);na=_sprite.program;R=-1;Ea||(c.enableVertexAttribArray(_sprite.attributes.position),c.enableVertexAttribArray(_sprite.attributes.uv),Ea=!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(g.projectionMatrix,
-!1,ma);c.activeTexture(c.TEXTURE0);c.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(c.uniform1i(g.useScreenCoordinates,1),c.uniform3f(g.screenPosition,
-(h.position.x-o)/o,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(c.uniform1i(g.useScreenCoordinates,0),c.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),c.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),j=h.map.image.width/(h.affectedByDistance?1:N),k[0]=j*i*h.scale.x,k[1]=j*h.scale.y,c.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),c.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),c.uniform2f(g.alignment,h.alignment.x,h.alignment.y),c.uniform1f(g.opacity,h.opacity),
-c.uniform1f(g.rotation,h.rotation),c.uniform2fv(g.scale,k),h.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!h.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),E(h.blending),ca(h.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ja)}function B(b,d){var e,f,h=b.__webglLensFlares.length,g,i,j,k=new THREE.Vector3,o=N/L,p=L*0.5,n=N*0.5,r=16/N,t=[r*o,r],q=[1,1,0],v=[1,1],y=x.uniforms;e=x.attributes;c.useProgram(x.program);na=x.program;R=-1;Fa||
-(c.enableVertexAttribArray(x.attributes.vertex),c.enableVertexAttribArray(x.attributes.uv),Fa=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,x.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,x.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,x.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<h;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,v[0]=q[0]*p+p,v[1]=q[1]*n+n,x.hasVertexTexture||v[0]>0&&v[0]<L&&v[1]>0&&v[1]<N){c.bindTexture(c.TEXTURE_2D,x.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,v[0]-8,v[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,t);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,x.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,v[0]-8,v[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,x.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);g=0;for(i=e.lensFlares.length;g<
-i;g++)if(j=e.lensFlares[g],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,t[0]=r*o,t[1]=r,c.uniform3fv(y.screenPosition,q),c.uniform2fv(y.scale,t),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(ja)}function D(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+c.uniformMatrix4fv(u.projectionLocation,!1,ma);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(ja)}function C(b,d){var e,f,h;e=w.attributes;
+var g=w.uniforms,i=N/M,j,k=[],o=M*0.5,p=N*0.5,n=!0;c.useProgram(w.program);na=w.program;R=-1;Ea||(c.enableVertexAttribArray(w.attributes.position),c.enableVertexAttribArray(w.attributes.uv),Ea=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,w.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,w.elementBuffer);c.uniformMatrix4fv(g.projectionMatrix,!1,ma);c.activeTexture(c.TEXTURE0);
+c.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(r);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(c.uniform1i(g.useScreenCoordinates,1),c.uniform3f(g.screenPosition,(h.position.x-
+o)/o,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):(c.uniform1i(g.useScreenCoordinates,0),c.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),c.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),j=h.map.image.width/(h.affectedByDistance?1:N),k[0]=j*i*h.scale.x,k[1]=j*h.scale.y,c.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),c.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),c.uniform2f(g.alignment,h.alignment.x,h.alignment.y),c.uniform1f(g.opacity,h.opacity),c.uniform1f(g.rotation,
+h.rotation),c.uniform2fv(g.scale,k),h.mergeWith3D&&!n?(c.enable(c.DEPTH_TEST),n=!0):!h.mergeWith3D&&n&&(c.disable(c.DEPTH_TEST),n=!1),E(h.blending),ca(h.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ja)}function y(b,d){var e,f,h=b.__webglLensFlares.length,g,i,j,k=new THREE.Vector3,o=N/M,p=M*0.5,n=N*0.5,r=16/N,t=[r*o,r],q=[1,1,0],w=[1,1],z=v.uniforms;e=v.attributes;c.useProgram(v.program);na=v.program;R=-1;Fa||(c.enableVertexAttribArray(v.attributes.vertex),
+c.enableVertexAttribArray(v.attributes.uv),Fa=!0);c.uniform1i(z.occlusionMap,0);c.uniform1i(z.map,1);c.bindBuffer(c.ARRAY_BUFFER,v.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,v.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,v.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<h;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,w[0]=q[0]*p+p,w[1]=q[1]*n+n,v.hasVertexTexture||w[0]>0&&w[0]<M&&w[1]>0&&w[1]<N){c.bindTexture(c.TEXTURE_2D,v.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,w[0]-8,w[1]-8,16,16,0);c.uniform1i(z.renderType,0);c.uniform2fv(z.scale,t);c.uniform3fv(z.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,v.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,w[0]-8,w[1]-8,16,16,0);c.uniform1i(z.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,v.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(z.renderType,2);c.enable(c.BLEND);g=0;for(i=e.lensFlares.length;g<i;g++)if(j=e.lensFlares[g],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,t[0]=r*o,t[1]=r,c.uniform3fv(z.screenPosition,q),c.uniform2fv(z.scale,t),c.uniform1f(z.rotation,j.rotation),c.uniform1f(z.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(ja)}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,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var i=g=void 0,j=void 0,k=void 0,o=void 0,o=h.__materials,i=0,j=o.length;i<j;i++)if(k=o[i],k.attributes)for(g in k.attributes)if(k.attributes[g].needsUpdate){g=!0;break a}g=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g)if(g=h,i=b,j=c.DYNAMIC_DRAW,g.__inittedArrays){var n=o=k=void 0,p=void 0,
 function A(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){h=f.geometryGroups[e];a:{for(var i=g=void 0,j=void 0,k=void 0,o=void 0,o=h.__materials,i=0,j=o.length;i<j;i++)if(k=o[i],k.attributes)for(g in k.attributes)if(k.attributes[g].needsUpdate){g=!0;break a}g=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g)if(g=h,i=b,j=c.DYNAMIC_DRAW,g.__inittedArrays){var n=o=k=void 0,p=void 0,
-G=n=void 0,r=void 0,t=void 0,q=void 0,x=void 0,v=void 0,y=void 0,A=void 0,B=void 0,u=void 0,J=void 0,K=void 0,D=void 0,s=p=q=p=t=r=void 0,z=void 0,m=z=s=r=void 0,F=void 0,H=m=z=s=n=n=G=q=p=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,I=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,ia=g.__needsSmoothNormals,v=g.__vertexColorType,x=g.__uvType,y=g.__normalType,ga=i.geometry,ka=ga.__dirtyVertices,la=ga.__dirtyElements,ja=ga.__dirtyUvs,na=ga.__dirtyNormals,oa=ga.__dirtyTangents,pa=ga.__dirtyColors,qa=ga.__dirtyMorphTargets,ma=ga.vertices,ra=g.faces,ta=ga.faces,sa=ga.faceVertexUvs[0],ua=ga.faceVertexUvs[1],za=ga.skinVerticesA,Aa=ga.skinVerticesB,Ba=ga.skinIndices,xa=ga.skinWeights,ya=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0,va=
-ga.morphTargets;if(Q)for(H in Q)Q[H].offset=0,Q[H].offsetSrc=0;k=0;for(o=ra.length;k<o;k++)if(n=ra[k],p=ta[n],sa&&(A=sa[n]),ua&&(B=ua[n]),n=p.vertexNormals,G=p.normal,r=p.vertexColors,t=p.color,q=p.vertexTangents,p instanceof THREE.Face3){if(ka)u=ma[p.a].position,J=ma[p.b].position,K=ma[p.c].position,I[C]=u.x,I[C+1]=u.y,I[C+2]=u.z,I[C+3]=J.x,I[C+4]=J.y,I[C+5]=J.z,I[C+6]=K.x,I[C+7]=K.y,I[C+8]=K.z,C+=9;if(Q)for(H in Q)if(m=Q[H],m.__original.needsUpdate)s=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===
-void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.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[p.a],J=m.value[p.b],K=m.value[p.c]):m.boundTo==="faces"?(u=m.value[z],J=m.value[z],K=m.value[z],
-m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[z+0],J=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]=J.x,m.array[s+3]=J.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]=J.r,m.array[s+4]=J.g,m.array[s+5]=J.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]=J.x,m.array[s+4]=J.y,m.array[s+
-5]=J.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]=J.x,m.array[s+5]=J.y,m.array[s+6]=J.z,m.array[s+7]=J.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(qa){s=0;for(z=va.length;s<z;s++)u=va[s].vertices[p.a].position,J=va[s].vertices[p.b].position,K=va[s].vertices[p.c].position,m=ca[s],m[ea+0]=u.x,m[ea+1]=u.y,m[ea+2]=u.z,m[ea+3]=J.x,m[ea+4]=J.y,m[ea+5]=J.z,
-m[ea+6]=K.x,m[ea+7]=K.y,m[ea+8]=K.z;ea+=9}if(xa.length)s=xa[p.a],z=xa[p.b],m=xa[p.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=Ba[p.a],z=Ba[p.b],m=Ba[p.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=za[p.a],z=za[p.b],m=za[p.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=Aa[p.a],z=Aa[p.b],m=Aa[p.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(pa&&v)r.length==3&&v==THREE.VertexColors?(p=r[0],s=r[1],z=r[2]):z=s=p=t,fa[da]=p.r,fa[da+1]=p.g,fa[da+2]=p.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(oa&&ga.hasTangents)r=q[0],t=q[1],p=q[2],V[U]=r.x,V[U+1]=r.y,V[U+2]=r.z,V[U+3]=r.w,V[U+4]=t.x,V[U+5]=t.y,V[U+
-6]=t.z,V[U+7]=t.w,V[U+8]=p.x,V[U+9]=p.y,V[U+10]=p.z,V[U+11]=p.w,U+=12;if(na&&y)if(n.length==3&&ia)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(ja&&A!==void 0&&x)for(q=0;q<3;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ja&&B!==void 0&&x)for(q=0;q<3;q++)n=B[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;la&&(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(p instanceof THREE.Face4){if(ka)u=
-ma[p.a].position,J=ma[p.b].position,K=ma[p.c].position,D=ma[p.d].position,I[C]=u.x,I[C+1]=u.y,I[C+2]=u.z,I[C+3]=J.x,I[C+4]=J.y,I[C+5]=J.z,I[C+6]=K.x,I[C+7]=K.y,I[C+8]=K.z,I[C+9]=D.x,I[C+10]=D.y,I[C+11]=D.z,C+=12;if(Q)for(H in Q)if(m=Q[H],m.__original.needsUpdate)s=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c],m.array[s+3]=m.value[p.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[p.a],J=m.value[p.b],K=m.value[p.c],D=m.value[p.d]):m.boundTo==="faces"?(u=m.value[z],J=m.value[z],K=m.value[z],D=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&(u=m.value[z+0],J=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]=J.x,m.array[s+3]=J.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]=J.r,m.array[s+4]=J.g,m.array[s+5]=J.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]=J.x,m.array[s+
-4]=J.y,m.array[s+5]=J.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]=J.x,m.array[s+5]=J.y,m.array[s+6]=J.z,m.array[s+7]=J.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(qa){s=0;for(z=va.length;s<z;s++)u=va[s].vertices[p.a].position,
-J=va[s].vertices[p.b].position,K=va[s].vertices[p.c].position,D=va[s].vertices[p.d].position,m=ca[s],m[ea+0]=u.x,m[ea+1]=u.y,m[ea+2]=u.z,m[ea+3]=J.x,m[ea+4]=J.y,m[ea+5]=J.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(xa.length)s=xa[p.a],z=xa[p.b],m=xa[p.c],F=xa[p.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=Ba[p.a],z=Ba[p.b],
-m=Ba[p.c],F=Ba[p.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=za[p.a],z=za[p.b],m=za[p.c],F=za[p.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=Aa[p.a],z=Aa[p.b],m=Aa[p.c],p=Aa[p.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]=p.x,X[w+13]=p.y,X[w+14]=p.z,X[w+15]=1,w+=16;if(pa&&v)r.length==4&&v==THREE.VertexColors?(p=r[0],s=r[1],z=r[2],r=r[3]):r=z=s=p=t,fa[da]=p.r,fa[da+1]=p.g,fa[da+2]=p.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(oa&&ga.hasTangents)r=q[0],t=q[1],p=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]=t.x,V[U+5]=t.y,V[U+6]=t.z,V[U+
-7]=t.w,V[U+8]=p.x,V[U+9]=p.y,V[U+10]=p.z,V[U+11]=p.w,V[U+12]=q.x,V[U+13]=q.y,V[U+14]=q.z,V[U+15]=q.w,U+=16;if(na&&y)if(n.length==4&&ia)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(ja&&A!==void 0&&x)for(q=0;q<4;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ja&&B!==void 0&&x)for(q=0;q<4;q++)n=B[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;la&&(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(ya){k=0;for(o=ya.length;k<o;k++)O[M]=ya[k].a,O[M+1]=ya[k].b,O[M+2]=ya[k].c,O[M+3]=ya[k].a,O[M+4]=ya[k].c,O[M+5]=ya[k].d,M+=6}ka&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,I,j));if(Q)for(H in Q)m=Q[H],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(qa){s=0;for(z=va.length;s<z;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,
+H=n=void 0,r=void 0,t=void 0,q=void 0,w=void 0,v=void 0,z=void 0,A=void 0,C=void 0,y=void 0,u=void 0,K=void 0,D=void 0,s=p=q=p=t=r=void 0,B=void 0,m=B=s=r=void 0,G=void 0,J=m=B=s=n=n=H=q=p=m=B=s=G=m=B=s=G=m=B=s=void 0,E=0,F=0,S=0,T=0,L=0,M=0,U=0,N=0,da=0,x=0,ea=0,B=s=0,I=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,ia=g.__needsSmoothNormals,v=g.__vertexColorType,w=g.__uvType,z=g.__normalType,ga=i.geometry,ka=ga.__dirtyVertices,la=ga.__dirtyElements,ja=ga.__dirtyUvs,na=ga.__dirtyNormals,oa=ga.__dirtyTangents,pa=ga.__dirtyColors,qa=ga.__dirtyMorphTargets,ma=ga.vertices,ra=g.faces,ta=ga.faces,sa=ga.faceVertexUvs[0],ua=ga.faceVertexUvs[1],za=ga.skinVerticesA,Aa=ga.skinVerticesB,Ba=ga.skinIndices,xa=ga.skinWeights,ya=i instanceof THREE.ShadowVolume?ga.edgeFaces:void 0,va=
+ga.morphTargets;if(Q)for(J in Q)Q[J].offset=0,Q[J].offsetSrc=0;k=0;for(o=ra.length;k<o;k++)if(n=ra[k],p=ta[n],sa&&(A=sa[n]),ua&&(C=ua[n]),n=p.vertexNormals,H=p.normal,r=p.vertexColors,t=p.color,q=p.vertexTangents,p instanceof THREE.Face3){if(ka)y=ma[p.a].position,u=ma[p.b].position,K=ma[p.c].position,I[F]=y.x,I[F+1]=y.y,I[F+2]=y.z,I[F+3]=u.x,I[F+4]=u.y,I[F+5]=u.z,I[F+6]=K.x,I[F+7]=K.y,I[F+8]=K.z,F+=9;if(Q)for(J in Q)if(m=Q[J],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===
+void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c]):m.boundTo==="faces"?(m.array[s+0]=m.value[B],m.array[s+1]=m.value[B],m.array[s+2]=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[B+0],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(y=m.value[p.a],u=m.value[p.b],K=m.value[p.c]):m.boundTo==="faces"?(y=m.value[B],u=m.value[B],K=m.value[B],
+m.offsetSrc++):m.boundTo==="faceVertices"&&(y=m.value[B+0],u=m.value[B+1],K=m.value[B+2],m.offsetSrc+=3),m.size===2?(m.array[s+0]=y.x,m.array[s+1]=y.y,m.array[s+2]=u.x,m.array[s+3]=u.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]=y.r,m.array[s+1]=y.g,m.array[s+2]=y.b,m.array[s+3]=u.r,m.array[s+4]=u.g,m.array[s+5]=u.b,m.array[s+6]=K.r,m.array[s+7]=K.g,m.array[s+8]=K.b):(m.array[s+0]=y.x,m.array[s+1]=y.y,m.array[s+2]=y.z,m.array[s+3]=u.x,m.array[s+4]=u.y,m.array[s+
+5]=u.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]=y.x,m.array[s+1]=y.y,m.array[s+2]=y.z,m.array[s+3]=y.w,m.array[s+4]=u.x,m.array[s+5]=u.y,m.array[s+6]=u.z,m.array[s+7]=u.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(qa){s=0;for(B=va.length;s<B;s++)y=va[s].vertices[p.a].position,u=va[s].vertices[p.b].position,K=va[s].vertices[p.c].position,m=ca[s],m[ea+0]=y.x,m[ea+1]=y.y,m[ea+2]=y.z,m[ea+3]=u.x,m[ea+4]=u.y,m[ea+5]=u.z,
+m[ea+6]=K.x,m[ea+7]=K.y,m[ea+8]=K.z;ea+=9}if(xa.length)s=xa[p.a],B=xa[p.b],m=xa[p.c],Z[x]=s.x,Z[x+1]=s.y,Z[x+2]=s.z,Z[x+3]=s.w,Z[x+4]=B.x,Z[x+5]=B.y,Z[x+6]=B.z,Z[x+7]=B.w,Z[x+8]=m.x,Z[x+9]=m.y,Z[x+10]=m.z,Z[x+11]=m.w,s=Ba[p.a],B=Ba[p.b],m=Ba[p.c],Y[x]=s.x,Y[x+1]=s.y,Y[x+2]=s.z,Y[x+3]=s.w,Y[x+4]=B.x,Y[x+5]=B.y,Y[x+6]=B.z,Y[x+7]=B.w,Y[x+8]=m.x,Y[x+9]=m.y,Y[x+10]=m.z,Y[x+11]=m.w,s=za[p.a],B=za[p.b],m=za[p.c],W[x]=s.x,W[x+1]=s.y,W[x+2]=s.z,W[x+3]=1,W[x+4]=B.x,W[x+5]=B.y,W[x+6]=B.z,W[x+7]=1,W[x+8]=m.x,
+W[x+9]=m.y,W[x+10]=m.z,W[x+11]=1,s=Aa[p.a],B=Aa[p.b],m=Aa[p.c],X[x]=s.x,X[x+1]=s.y,X[x+2]=s.z,X[x+3]=1,X[x+4]=B.x,X[x+5]=B.y,X[x+6]=B.z,X[x+7]=1,X[x+8]=m.x,X[x+9]=m.y,X[x+10]=m.z,X[x+11]=1,x+=12;if(pa&&v)r.length==3&&v==THREE.VertexColors?(p=r[0],s=r[1],B=r[2]):B=s=p=t,fa[da]=p.r,fa[da+1]=p.g,fa[da+2]=p.b,fa[da+3]=s.r,fa[da+4]=s.g,fa[da+5]=s.b,fa[da+6]=B.r,fa[da+7]=B.g,fa[da+8]=B.b,da+=9;if(oa&&ga.hasTangents)r=q[0],t=q[1],p=q[2],V[U]=r.x,V[U+1]=r.y,V[U+2]=r.z,V[U+3]=r.w,V[U+4]=t.x,V[U+5]=t.y,V[U+
+6]=t.z,V[U+7]=t.w,V[U+8]=p.x,V[U+9]=p.y,V[U+10]=p.z,V[U+11]=p.w,U+=12;if(na&&z)if(n.length==3&&ia)for(q=0;q<3;q++)H=n[q],P[M]=H.x,P[M+1]=H.y,P[M+2]=H.z,M+=3;else for(q=0;q<3;q++)P[M]=H.x,P[M+1]=H.y,P[M+2]=H.z,M+=3;if(ja&&A!==void 0&&w)for(q=0;q<3;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ja&&C!==void 0&&w)for(q=0;q<3;q++)n=C[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;la&&(O[L]=E,O[L+1]=E+1,O[L+2]=E+2,L+=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(p instanceof THREE.Face4){if(ka)y=
+ma[p.a].position,u=ma[p.b].position,K=ma[p.c].position,D=ma[p.d].position,I[F]=y.x,I[F+1]=y.y,I[F+2]=y.z,I[F+3]=u.x,I[F+4]=u.y,I[F+5]=u.z,I[F+6]=K.x,I[F+7]=K.y,I[F+8]=K.z,I[F+9]=D.x,I[F+10]=D.y,I[F+11]=D.z,F+=12;if(Q)for(J in Q)if(m=Q[J],m.__original.needsUpdate)s=m.offset,B=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[p.a],m.array[s+1]=m.value[p.b],m.array[s+2]=m.value[p.c],m.array[s+3]=m.value[p.d]):m.boundTo==="faces"?(m.array[s+0]=m.value[B],m.array[s+
+1]=m.value[B],m.array[s+2]=m.value[B],m.array[s+3]=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[B+0],m.array[s+1]=m.value[B+1],m.array[s+2]=m.value[B+2],m.array[s+3]=m.value[B+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(y=m.value[p.a],u=m.value[p.b],K=m.value[p.c],D=m.value[p.d]):m.boundTo==="faces"?(y=m.value[B],u=m.value[B],K=m.value[B],D=m.value[B],m.offsetSrc++):m.boundTo==="faceVertices"&&(y=m.value[B+0],u=m.value[B+1],K=m.value[B+
+2],D=m.value[B+3],m.offsetSrc+=4),m.size===2?(m.array[s+0]=y.x,m.array[s+1]=y.y,m.array[s+2]=u.x,m.array[s+3]=u.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]=y.r,m.array[s+1]=y.g,m.array[s+2]=y.b,m.array[s+3]=u.r,m.array[s+4]=u.g,m.array[s+5]=u.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]=y.x,m.array[s+1]=y.y,m.array[s+2]=y.z,m.array[s+3]=u.x,m.array[s+
+4]=u.y,m.array[s+5]=u.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]=y.x,m.array[s+1]=y.y,m.array[s+2]=y.z,m.array[s+3]=y.w,m.array[s+4]=u.x,m.array[s+5]=u.y,m.array[s+6]=u.z,m.array[s+7]=u.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(qa){s=0;for(B=va.length;s<B;s++)y=va[s].vertices[p.a].position,
+u=va[s].vertices[p.b].position,K=va[s].vertices[p.c].position,D=va[s].vertices[p.d].position,m=ca[s],m[ea+0]=y.x,m[ea+1]=y.y,m[ea+2]=y.z,m[ea+3]=u.x,m[ea+4]=u.y,m[ea+5]=u.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(xa.length)s=xa[p.a],B=xa[p.b],m=xa[p.c],G=xa[p.d],Z[x]=s.x,Z[x+1]=s.y,Z[x+2]=s.z,Z[x+3]=s.w,Z[x+4]=B.x,Z[x+5]=B.y,Z[x+6]=B.z,Z[x+7]=B.w,Z[x+8]=m.x,Z[x+9]=m.y,Z[x+10]=m.z,Z[x+11]=m.w,Z[x+12]=G.x,Z[x+13]=G.y,Z[x+14]=G.z,Z[x+15]=G.w,s=Ba[p.a],B=Ba[p.b],
+m=Ba[p.c],G=Ba[p.d],Y[x]=s.x,Y[x+1]=s.y,Y[x+2]=s.z,Y[x+3]=s.w,Y[x+4]=B.x,Y[x+5]=B.y,Y[x+6]=B.z,Y[x+7]=B.w,Y[x+8]=m.x,Y[x+9]=m.y,Y[x+10]=m.z,Y[x+11]=m.w,Y[x+12]=G.x,Y[x+13]=G.y,Y[x+14]=G.z,Y[x+15]=G.w,s=za[p.a],B=za[p.b],m=za[p.c],G=za[p.d],W[x]=s.x,W[x+1]=s.y,W[x+2]=s.z,W[x+3]=1,W[x+4]=B.x,W[x+5]=B.y,W[x+6]=B.z,W[x+7]=1,W[x+8]=m.x,W[x+9]=m.y,W[x+10]=m.z,W[x+11]=1,W[x+12]=G.x,W[x+13]=G.y,W[x+14]=G.z,W[x+15]=1,s=Aa[p.a],B=Aa[p.b],m=Aa[p.c],p=Aa[p.d],X[x]=s.x,X[x+1]=s.y,X[x+2]=s.z,X[x+3]=1,X[x+4]=B.x,
+X[x+5]=B.y,X[x+6]=B.z,X[x+7]=1,X[x+8]=m.x,X[x+9]=m.y,X[x+10]=m.z,X[x+11]=1,X[x+12]=p.x,X[x+13]=p.y,X[x+14]=p.z,X[x+15]=1,x+=16;if(pa&&v)r.length==4&&v==THREE.VertexColors?(p=r[0],s=r[1],B=r[2],r=r[3]):r=B=s=p=t,fa[da]=p.r,fa[da+1]=p.g,fa[da+2]=p.b,fa[da+3]=s.r,fa[da+4]=s.g,fa[da+5]=s.b,fa[da+6]=B.r,fa[da+7]=B.g,fa[da+8]=B.b,fa[da+9]=r.r,fa[da+10]=r.g,fa[da+11]=r.b,da+=12;if(oa&&ga.hasTangents)r=q[0],t=q[1],p=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]=t.x,V[U+5]=t.y,V[U+6]=t.z,V[U+
+7]=t.w,V[U+8]=p.x,V[U+9]=p.y,V[U+10]=p.z,V[U+11]=p.w,V[U+12]=q.x,V[U+13]=q.y,V[U+14]=q.z,V[U+15]=q.w,U+=16;if(na&&z)if(n.length==4&&ia)for(q=0;q<4;q++)H=n[q],P[M]=H.x,P[M+1]=H.y,P[M+2]=H.z,M+=3;else for(q=0;q<4;q++)P[M]=H.x,P[M+1]=H.y,P[M+2]=H.z,M+=3;if(ja&&A!==void 0&&w)for(q=0;q<4;q++)n=A[q],$[S]=n.u,$[S+1]=n.v,S+=2;if(ja&&C!==void 0&&w)for(q=0;q<4;q++)n=C[q],aa[T]=n.u,aa[T+1]=n.v,T+=2;la&&(O[L]=E,O[L+1]=E+1,O[L+2]=E+3,O[L+3]=E+1,O[L+4]=E+2,O[L+5]=E+3,L+=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(ya){k=0;for(o=ya.length;k<o;k++)O[L]=ya[k].a,O[L+1]=ya[k].b,O[L+2]=ya[k].c,O[L+3]=ya[k].a,O[L+4]=ya[k].c,O[L+5]=ya[k].d,L+=6}ka&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,I,j));if(Q)for(J in Q)m=Q[J],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(qa){s=0;for(B=va.length;s<B;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,
 ca[s],j)}pa&&da>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,fa,j));na&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,P,j));oa&&ga.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,j));ja&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ja&&T>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));la&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
 ca[s],j)}pa&&da>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,fa,j));na&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,P,j));oa&&ga.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,j));ja&&S>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ja&&T>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));la&&(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,
+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));x>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;var ha;h=h.__materials;f=0;for(b=
 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;var ha;h=h.__materials;f=0;for(b=
-h.length;f<b;f++)if(e=h[f],e.attributes)for(ha in e.attributes)e.attributes[ha].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ha=f;b=c.DYNAMIC_DRAW;o=ha.vertices;h=ha.colors;x=o.length;g=h.length;v=ha.__vertexArray;i=ha.__colorArray;y=ha.__dirtyColors;if(ha.__dirtyVertices){for(j=0;j<x;j++)k=o[j].position,e=j*3,v[e]=k.x,v[e+1]=k.y,v[e+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,ha.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<
-g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ha.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ha=f;b=c.DYNAMIC_DRAW;o=ha.vertices;h=ha.colors;x=o.length;g=h.length;v=ha.__vertexArray;i=ha.__colorArray;y=ha.__dirtyColors;if(ha.__dirtyVertices){for(j=0;j<x;j++)k=o[j].position,e=j*3,v[e]=k.x,v[e+1]=k.y,v[e+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,
-ha.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ha.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}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 e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,
+h.length;f<b;f++)if(e=h[f],e.attributes)for(ha in e.attributes)e.attributes[ha].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ha=f;b=c.DYNAMIC_DRAW;o=ha.vertices;h=ha.colors;w=o.length;g=h.length;v=ha.__vertexArray;i=ha.__colorArray;z=ha.__dirtyColors;if(ha.__dirtyVertices){for(j=0;j<w;j++)k=o[j].position,e=j*3,v[e]=k.x,v[e+1]=k.y,v[e+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,ha.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(z){for(j=0;j<
+g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ha.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ha=f;b=c.DYNAMIC_DRAW;o=ha.vertices;h=ha.colors;w=o.length;g=h.length;v=ha.__vertexArray;i=ha.__colorArray;z=ha.__dirtyColors;if(ha.__dirtyVertices){for(j=0;j<w;j++)k=o[j].position,e=j*3,v[e]=k.x,v[e+1]=k.y,v[e+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,
+ha.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(z){for(j=0;j<g;j++)color=h[j],e=j*3,i[e]=color.r,i[e+1]=color.g,i[e+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ha.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}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 e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,
 1)}function ia(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}var e,d,f,g,h,i,j,k,p={},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],i=h.materials,j=c(i),p[j]==void 0&&(p[j]={hash:j,counter:0}),k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,
 1)}function ia(b){function c(b){var f=[];e=0;for(d=b.length;e<d;e++)b[e]==void 0?f.push("undefined"):f.push(b[e].id);return f.join("_")}var e,d,f,g,h,i,j,k,p={},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],i=h.materials,j=c(i),p[j]==void 0&&(p[j]={hash:j,counter:0}),k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,
 b.geometryGroups[k].vertices+h>65535&&(p[j].counter+=1,k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function T(b,c,e){b.push({buffer:c,object:e,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);
 b.geometryGroups[k].vertices+h>65535&&(p[j].counter+=1,k=p[j].hash+"_"+p[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=h}function T(b,c,e){b.push({buffer:c,object:e,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,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}R=b}}function v(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,$(e.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,$(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,$(e.magFilter)),
+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 z(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,$(e.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,$(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,$(e.magFilter)),
 c.texParameteri(b,c.TEXTURE_MIN_FILTER,$(e.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(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function ca(b,e){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,
 c.texParameteri(b,c.TEXTURE_MIN_FILTER,$(e.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(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function ca(b,e){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),v(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+e);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();
+b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),z(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+e);c.bindTexture(c.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=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.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.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 e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,d=L,b=N);e!=Ca&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(I,S,d,b),Ca=e)}function C(b,e){var d;b=="fragment"?d=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(d=c.createShader(c.VERTEX_SHADER));c.shaderSource(d,e);c.compileShader(d);if(!c.getShaderParameter(d,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(d)),
+c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,d=M,b=N);e!=Ca&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(I,S,d,b),Ca=e)}function F(b,e){var d;b=="fragment"?d=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(d=c.createShader(c.VERTEX_SHADER));c.shaderSource(d,e);c.compileShader(d);if(!c.getShaderParameter(d,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(d)),
 console.error(e),null;return d}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;
 console.error(e),null;return d}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.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,ua=[],na=null,Ca=null,ja=!0,la=null,P=null,R=null,H=null,I=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],ka=new THREE.Matrix4,ma=new Float32Array(16),sa=new Float32Array(16),ra=new THREE.Vector4,qa={ambient:[0,0,0],directional:{length:0,
+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,ua=[],na=null,Ca=null,ja=!0,la=null,P=null,R=null,J=null,I=0,S=0,M=0,N=0,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,ma=new Float32Array(16),sa=new Float32Array(16),ra=new THREE.Vector4,qa={ambient:[0,0,0],directional:{length:0,
 colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},oa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ta=b.stencil!==void 0?b.stencil:!0,Ha=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Da=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.sortObjects=this.autoClear=!0;try{if(!(c=oa.getContext("experimental-webgl",
 colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},oa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ta=b.stencil!==void 0?b.stencil:!0,Ha=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Da=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.sortObjects=this.autoClear=!0;try{if(!(c=oa.getContext("experimental-webgl",
 {antialias:Ha,stencil:ta})))throw"Error creating WebGL context.";}catch(Ia){console.error(Ia)}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);
 {antialias:Ha,stencil:ta})))throw"Error creating WebGL context.";}catch(Ia){console.error(Ia)}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(pa.r,pa.g,pa.b,Da);this.context=c;var Ga=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ta){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();
 c.clearColor(pa.r,pa.g,pa.b,Da);this.context=c;var Ga=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ta){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 x={};x.vertices=new Float32Array(16);x.faces=new Uint16Array(6);b=0;x.vertices[b++]=-1;x.vertices[b++]=-1;x.vertices[b++]=0;x.vertices[b++]=0;x.vertices[b++]=1;x.vertices[b++]=-1;x.vertices[b++]=1;x.vertices[b++]=0;x.vertices[b++]=1;x.vertices[b++]=1;x.vertices[b++]=1;x.vertices[b++]=1;x.vertices[b++]=-1;x.vertices[b++]=1;x.vertices[b++]=0;x.vertices[b++]=
-1;b=0;x.faces[b++]=0;x.faces[b++]=1;x.faces[b++]=2;x.faces[b++]=0;x.faces[b++]=2;x.faces[b++]=3;x.vertexBuffer=c.createBuffer();x.elementBuffer=c.createBuffer();x.tempTexture=c.createTexture();x.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,x.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,x.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,x.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,x.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,x.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?(x.hasVertexTexture=!1,x.program=c.createProgram(),c.attachShader(x.program,C("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(x.program,C("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(x.hasVertexTexture=!0,x.program=c.createProgram(),c.attachShader(x.program,C("fragment",
-THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(x.program,C("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(x.program);x.attributes={};x.uniforms={};x.attributes.vertex=c.getAttribLocation(x.program,"position");x.attributes.uv=c.getAttribLocation(x.program,"UV");x.uniforms.renderType=c.getUniformLocation(x.program,"renderType");x.uniforms.map=c.getUniformLocation(x.program,"map");x.uniforms.occlusionMap=c.getUniformLocation(x.program,"occlusionMap");
-x.uniforms.opacity=c.getUniformLocation(x.program,"opacity");x.uniforms.scale=c.getUniformLocation(x.program,"scale");x.uniforms.rotation=c.getUniformLocation(x.program,"rotation");x.uniforms.screenPosition=c.getUniformLocation(x.program,"screenPosition");var Fa=!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++]=1;_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++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;b=_sprite.vertices[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,"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 Ea=!1;this.setSize=function(b,c){oa.width=b;oa.height=c;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(b,e,d,f){I=b;S=e;L=d;N=f;c.viewport(I,S,L,N)};this.setScissor=function(b,e,d,f){c.scissor(b,e,d,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ja=b;c.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);Da=e;c.clearColor(pa.r,pa.g,pa.b,Da)};this.setClearColor=function(b,e){pa.copy(b);
-Da=e;c.clearColor(pa.r,pa.g,pa.b,Da)};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,e,d,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,o,p;k=p=j=0;for(o=e.length;k<o;k++)h=e[k],h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&j++;j+p<=4?e=p:(e=Math.ceil(4*p/(j+p)),j=4-e);h={directional:e,point:j};
-p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var n;a:{k=b.fragmentShader;o=b.vertexShader;var j=b.uniforms,e=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:p},q;h=[];i?h.push(i):(h.push(k),h.push(o));for(q in d)h.push(q),h.push(d[q]);i=h.join();
-q=0;for(h=ua.length;q<h;q++)if(ua[q].code==i){n=ua[q].program;break a}q=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-p=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.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",p+o));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=
+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,F("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(u.program,F("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 v={};v.vertices=new Float32Array(16);v.faces=new Uint16Array(6);b=0;v.vertices[b++]=-1;v.vertices[b++]=-1;v.vertices[b++]=0;v.vertices[b++]=0;v.vertices[b++]=1;v.vertices[b++]=-1;v.vertices[b++]=1;v.vertices[b++]=0;v.vertices[b++]=1;v.vertices[b++]=1;v.vertices[b++]=1;v.vertices[b++]=1;v.vertices[b++]=-1;v.vertices[b++]=1;v.vertices[b++]=0;v.vertices[b++]=
+1;b=0;v.faces[b++]=0;v.faces[b++]=1;v.faces[b++]=2;v.faces[b++]=0;v.faces[b++]=2;v.faces[b++]=3;v.vertexBuffer=c.createBuffer();v.elementBuffer=c.createBuffer();v.tempTexture=c.createTexture();v.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,v.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,v.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,v.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,v.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?(v.hasVertexTexture=!1,v.program=c.createProgram(),c.attachShader(v.program,F("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(v.program,F("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(v.hasVertexTexture=!0,v.program=c.createProgram(),c.attachShader(v.program,F("fragment",
+THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(v.program,F("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(v.program);v.attributes={};v.uniforms={};v.attributes.vertex=c.getAttribLocation(v.program,"position");v.attributes.uv=c.getAttribLocation(v.program,"UV");v.uniforms.renderType=c.getUniformLocation(v.program,"renderType");v.uniforms.map=c.getUniformLocation(v.program,"map");v.uniforms.occlusionMap=c.getUniformLocation(v.program,"occlusionMap");
+v.uniforms.opacity=c.getUniformLocation(v.program,"opacity");v.uniforms.scale=c.getUniformLocation(v.program,"scale");v.uniforms.rotation=c.getUniformLocation(v.program,"rotation");v.uniforms.screenPosition=c.getUniformLocation(v.program,"screenPosition");var Fa=!1,w={};w.vertices=new Float32Array(16);w.faces=new Uint16Array(6);b=0;w.vertices[b++]=-1;w.vertices[b++]=-1;w.vertices[b++]=0;w.vertices[b++]=1;w.vertices[b++]=1;w.vertices[b++]=-1;w.vertices[b++]=1;w.vertices[b++]=1;w.vertices[b++]=1;w.vertices[b++]=
+1;w.vertices[b++]=1;w.vertices[b++]=0;w.vertices[b++]=-1;w.vertices[b++]=1;w.vertices[b++]=0;b=w.vertices[b++]=0;w.faces[b++]=0;w.faces[b++]=1;w.faces[b++]=2;w.faces[b++]=0;w.faces[b++]=2;w.faces[b++]=3;w.vertexBuffer=c.createBuffer();w.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,w.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,w.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,w.faces,c.STATIC_DRAW);w.program=c.createProgram();
+c.attachShader(w.program,F("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(w.program,F("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(w.program);w.attributes={};w.uniforms={};w.attributes.position=c.getAttribLocation(w.program,"position");w.attributes.uv=c.getAttribLocation(w.program,"uv");w.uniforms.uvOffset=c.getUniformLocation(w.program,"uvOffset");w.uniforms.uvScale=c.getUniformLocation(w.program,"uvScale");w.uniforms.rotation=c.getUniformLocation(w.program,"rotation");
+w.uniforms.scale=c.getUniformLocation(w.program,"scale");w.uniforms.alignment=c.getUniformLocation(w.program,"alignment");w.uniforms.map=c.getUniformLocation(w.program,"map");w.uniforms.opacity=c.getUniformLocation(w.program,"opacity");w.uniforms.useScreenCoordinates=c.getUniformLocation(w.program,"useScreenCoordinates");w.uniforms.affectedByDistance=c.getUniformLocation(w.program,"affectedByDistance");w.uniforms.screenPosition=c.getUniformLocation(w.program,"screenPosition");w.uniforms.modelViewMatrix=
+c.getUniformLocation(w.program,"modelViewMatrix");w.uniforms.projectionMatrix=c.getUniformLocation(w.program,"projectionMatrix");var Ea=!1;this.setSize=function(b,c){oa.width=b;oa.height=c;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(b,e,d,f){I=b;S=e;M=d;N=f;c.viewport(I,S,M,N)};this.setScissor=function(b,e,d,f){c.scissor(b,e,d,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ja=b;c.depthMask(b)};
+this.setClearColorHex=function(b,e){pa.setHex(b);Da=e;c.clearColor(pa.r,pa.g,pa.b,Da)};this.setClearColor=function(b,e){pa.copy(b);Da=e;c.clearColor(pa.r,pa.g,pa.b,Da)};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,e,d,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,o,p;k=p=j=0;for(o=e.length;k<o;k++)h=e[k],h instanceof
+THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&j++;j+p<=4?e=p:(e=Math.ceil(4*p/(j+p)),j=4-e);h={directional:e,point:j};p=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)p=f.bones.length;var n;a:{k=b.fragmentShader;o=b.vertexShader;var j=b.uniforms,e=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,
+maxPointLights:h.point,maxBones:p},q;h=[];i?h.push(i):(h.push(k),h.push(o));for(q in d)h.push(q),h.push(d[q]);i=h.join();q=0;for(h=ua.length;q<h;q++)if(ua[q].code==i){n=ua[q].program;break a}q=c.createProgram();h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":
+"",d.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");p=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.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,F("fragment",h+k));c.attachShader(q,F("vertex",p+o));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++)o=r[j],q.uniforms[o]=c.getUniformLocation(q,o);k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<d.maxMorphTargets;r++)k.push("morphTarget"+r);for(n in e)k.push(n);n=k;r=0;for(e=n.length;r<e;r++)d=n[r],q.attributes[d]=c.getAttribLocation(q,d);ua.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>=
 r.length;j<k;j++)o=r[j],q.uniforms[o]=c.getUniformLocation(q,o);k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(r=0;r<d.maxMorphTargets;r++)k.push("morphTarget"+r);for(n in e)k.push(n);n=k;r=0;for(e=n.length;r<e;r++)d=n[r],q.attributes[d]=c.getAttribLocation(q,d);ua.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),
 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>=
 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,v){var u,x,A,C,F,I,p,G,H=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(sa);d.projectionMatrix.flattenToArray(ma);ka.multiply(d.projectionMatrix,d.matrixWorldInverse);j(ka);this.initWebGLObjects(b);M(k);(this.autoClear||v)&&this.clear();F=b.__webglObjects.length;for(v=0;v<F;v++)if(u=b.__webglObjects[v],p=u.object,p.visible)if(!(p instanceof THREE.Mesh)||o(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),t(u),u.render=!0,this.sortObjects)ra.copy(p.position),ka.multiplyVector3(ra),u.z=ra.z}else u.render=!1;else u.render=
-!1;this.sortObjects&&b.__webglObjects.sort(r);I=b.__webglObjectsImmediate.length;for(v=0;v<I;v++)u=b.__webglObjectsImmediate[v],p=u.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),n(u));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);E(b.overrideMaterial.blending);for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render)p=u.object,G=u.buffer,i(p),f(d,H,L,b.overrideMaterial,G,p);for(v=0;v<I;v++)u=b.__webglObjectsImmediate[v],p=u.object,p.visible&&(i(p),
-x=e(d,H,L,b.overrideMaterial,p),p.render(function(c){g(c,x,b.overrideMaterial.shading)}))}else{E(THREE.NormalBlending);for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render){p=u.object;G=u.buffer;A=u.opaque;i(p);for(u=0;u<A.count;u++)C=A.list[u],h(C.depthTest),f(d,H,L,C,G,p)}for(v=0;v<I;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){A=u.opaque;i(p);for(u=0;u<A.count;u++)C=A.list[u],h(C.depthTest),x=e(d,H,L,C,p),p.render(function(b){g(b,x,C.shading)})}for(v=0;v<F;v++)if(u=b.__webglObjects[v],
-u.render){p=u.object;G=u.buffer;A=u.transparent;i(p);for(u=0;u<A.count;u++)C=A.list[u],E(C.blending),h(C.depthTest),f(d,H,L,C,G,p)}for(v=0;v<I;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){A=u.transparent;i(p);for(u=0;u<A.count;u++)C=A.list[u],E(C.blending),h(C.depthTest),x=e(d,H,L,C,p),p.render(function(b){g(b,x,C.shading)})}}b.__webglSprites.length&&y(b,d);ta&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&B(b,d);k&&k.minFilter!==THREE.NearestFilter&&
+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,v){var u,w,z,A,F,G,p,H,I=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(sa);d.projectionMatrix.flattenToArray(ma);ka.multiply(d.projectionMatrix,d.matrixWorldInverse);j(ka);this.initWebGLObjects(b);L(k);(this.autoClear||v)&&this.clear();F=b.__webglObjects.length;for(v=0;v<F;v++)if(u=b.__webglObjects[v],p=u.object,p.visible)if(!(p instanceof THREE.Mesh)||o(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),t(u),u.render=!0,this.sortObjects)ra.copy(p.position),ka.multiplyVector3(ra),u.z=ra.z}else u.render=!1;else u.render=
+!1;this.sortObjects&&b.__webglObjects.sort(r);G=b.__webglObjectsImmediate.length;for(v=0;v<G;v++)u=b.__webglObjectsImmediate[v],p=u.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),D(p,d),n(u));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);E(b.overrideMaterial.blending);for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render)p=u.object,H=u.buffer,i(p),f(d,I,J,b.overrideMaterial,H,p);for(v=0;v<G;v++)u=b.__webglObjectsImmediate[v],p=u.object,p.visible&&(i(p),
+w=e(d,I,J,b.overrideMaterial,p),p.render(function(c){g(c,w,b.overrideMaterial.shading)}))}else{E(THREE.NormalBlending);for(v=0;v<F;v++)if(u=b.__webglObjects[v],u.render){p=u.object;H=u.buffer;z=u.opaque;i(p);for(u=0;u<z.count;u++)A=z.list[u],h(A.depthTest),f(d,I,J,A,H,p)}for(v=0;v<G;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){z=u.opaque;i(p);for(u=0;u<z.count;u++)A=z.list[u],h(A.depthTest),w=e(d,I,J,A,p),p.render(function(b){g(b,w,A.shading)})}for(v=0;v<F;v++)if(u=b.__webglObjects[v],
+u.render){p=u.object;H=u.buffer;z=u.transparent;i(p);for(u=0;u<z.count;u++)A=z.list[u],E(A.blending),h(A.depthTest),f(d,I,J,A,H,p)}for(v=0;v<G;v++)if(u=b.__webglObjectsImmediate[v],p=u.object,p.visible){z=u.transparent;i(p);for(u=0;u<z.count;u++)A=z.list[u],E(A.blending),h(A.depthTest),w=e(d,I,J,A,p),p.render(function(b){g(b,w,A.shading)})}}b.__webglSprites.length&&C(b,d);ta&&b.__webglShadowVolumes.length&&b.lights.length&&q(b);b.__webglLensFlares.length&&y(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),
 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&&ia(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=
 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&&ia(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,p=void 0,o=void 0,q=o=void 0,r=void 0,u=void 0,
 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,p=void 0,o=void 0,q=o=void 0,r=void 0,u=void 0,
-v=u=k=0,t=o=p=void 0,x=t=p=n=void 0,o=void 0,q=j.geometry,r=q.faces,t=i.faces,n=0,p=t.length;n<p;n++)o=t[n],o=r[o],o instanceof THREE.Face3?(k+=3,u+=1,v+=3):o instanceof THREE.Face4&&(k+=4,u+=2,v+=4);for(var n=i,p=j,y=t=r=void 0,B=void 0,y=void 0,o=[],r=0,t=p.materials.length;r<t;r++)if(y=p.materials[r],y instanceof THREE.MeshFaceMaterial){y=0;for(l=n.materials.length;y<l;y++)(B=n.materials[y])&&o.push(B)}else(B=y)&&o.push(B);n=o;i.__materials=n;a:{r=p=void 0;t=n.length;for(p=0;p<t;p++)if(r=n[p],
-r.map||r.lightMap||r instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{t=r=void 0;o=n.length;for(r=0;r<o;r++)if(t=n[r],!(t instanceof THREE.MeshBasicMaterial&&!t.envMap||t instanceof THREE.MeshDepthMaterial)){t=t&&t.shading!=void 0&&t.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}t=!1}a:{o=r=void 0;y=n.length;for(r=0;r<y;r++)if(o=n[r],o.vertexColors){o=o.vertexColors;break a}o=!1}i.__vertexArray=new Float32Array(k*3);if(t)i.__normalArray=new Float32Array(k*3);
+v=u=k=0,t=o=p=void 0,y=t=p=n=void 0,o=void 0,q=j.geometry,r=q.faces,t=i.faces,n=0,p=t.length;n<p;n++)o=t[n],o=r[o],o instanceof THREE.Face3?(k+=3,u+=1,v+=3):o instanceof THREE.Face4&&(k+=4,u+=2,v+=4);for(var n=i,p=j,w=t=r=void 0,z=void 0,w=void 0,o=[],r=0,t=p.materials.length;r<t;r++)if(w=p.materials[r],w instanceof THREE.MeshFaceMaterial){w=0;for(l=n.materials.length;w<l;w++)(z=n.materials[w])&&o.push(z)}else(z=w)&&o.push(z);n=o;i.__materials=n;a:{r=p=void 0;t=n.length;for(p=0;p<t;p++)if(r=n[p],
+r.map||r.lightMap||r instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{t=r=void 0;o=n.length;for(r=0;r<o;r++)if(t=n[r],!(t instanceof THREE.MeshBasicMaterial&&!t.envMap||t instanceof THREE.MeshDepthMaterial)){t=t&&t.shading!=void 0&&t.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}t=!1}a:{o=r=void 0;w=n.length;for(r=0;r<w;r++)if(o=n[r],o.vertexColors){o=o.vertexColors;break a}o=!1}i.__vertexArray=new Float32Array(k*3);if(t)i.__normalArray=new Float32Array(k*3);
 if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(o)i.__colorArray=new Float32Array(k*3);if(p){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);
 if(q.hasTangents)i.__tangentArray=new Float32Array(k*4);if(o)i.__colorArray=new Float32Array(k*3);if(p){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(u*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=t==THREE.SmoothShading;i.__uvType=p;i.__vertexColorType=o;i.__normalType=t;i.__webglFaceCount=u*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(p=n[q],p.attributes)for(a in i.__webglCustomAttributes=
 i.__faceArray=new Uint16Array(u*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=t==THREE.SmoothShading;i.__uvType=p;i.__vertexColorType=o;i.__normalType=t;i.__webglFaceCount=u*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(p=n[q],p.attributes)for(a in i.__webglCustomAttributes=
-{},p.attributes){o=p.attributes[a];t={};for(x in o)t[x]=o[x];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,u=1,t.type==="v2"?u=2:t.type==="v3"?u=3:t.type==="v4"?u=4:t.type==="c"&&(u=3),t.size=u,t.array=new Float32Array(k*u),t.buffer=c.createBuffer(),t.buffer.belongsToAttribute=a,o.needsUpdate=!0,t.__original=o;i.__webglCustomAttributes[a]=t}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=
+{},p.attributes){o=p.attributes[a];t={};for(y in o)t[y]=o[y];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,u=1,t.type==="v2"?u=2:t.type==="v3"?u=3:t.type==="v4"?u=4:t.type==="c"&&(u=3),t.size=u,t.array=new Float32Array(k*u),t.buffer=c.createBuffer(),t.buffer.belongsToAttribute=a,o.needsUpdate=!0,t.__original=o;i.__webglCustomAttributes[a]=t}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,
 !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(),
 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],
 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],

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -270,7 +270,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	// prepare sprites
 	// prepare sprites
 	
 	
-	_sprite = {};
+	var _sprite = {};
 
 
 	_sprite.vertices = new Float32Array( 8 + 8 );
 	_sprite.vertices = new Float32Array( 8 + 8 );
 	_sprite.faces    = new Uint16Array( 6 );
 	_sprite.faces    = new Uint16Array( 6 );