Pārlūkot izejas kodu

Added handling of custom attributes for ParticleSystems.

alteredq 14 gadi atpakaļ
vecāks
revīzija
2014fb8b7f

+ 328 - 324
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r42 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,k,h,m,o;if(e==0)f=g=k=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),o=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=o;g=e;k=b;break;case 2:f=b;g=e;k=c;break;case 3:f=b;g=o;k=e;break;case 4:f=c;g=b;k=e;break;case 5:f=e;g=b;k=o;break;case 6:case 0:f=e,g=c,k=b}this.setRGB(f,
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,k,h,m,n;if(e==0)f=g=k=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=n;g=e;k=b;break;case 2:f=b;g=e;k=c;break;case 3:f=b;g=n;k=e;break;case 4:f=c;g=b;k=e;break;case 5:f=e;g=b;k=n;break;case 6:case 0:f=e,g=c,k=b}this.setRGB(f,
 g,k)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
 THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
 (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
@@ -14,35 +14,35 @@ 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())},
 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,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.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,k,h,m,o,p,n,t,u,v,w=b.geometry,
-C=w.vertices,z=[],f=0;for(g=w.faces.length;f<g;f++)if(k=w.faces[f],u=this.origin.clone(),v=this.direction.clone(),p=b.matrixWorld,h=p.multiplyVector3(C[k.a].position.clone()),m=p.multiplyVector3(C[k.b].position.clone()),o=p.multiplyVector3(C[k.c].position.clone()),p=k instanceof THREE.Face4?p.multiplyVector3(C[k.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),t=v.dot(n),b.doubleSided||(b.flipSided?t>0:t<0))if(n=n.dot((new THREE.Vector3).sub(h,u))/t,u=u.addSelf(v.multiplyScalar(n)),
-k instanceof THREE.Face3)e(u,h,m,o)&&(k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},z.push(k));else if(k instanceof THREE.Face4&&(e(u,h,m,p)||e(u,m,o,p)))k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},z.push(k);return z}else return[]}};
-THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return h};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,n,t){m=!1;c=h;e=k;f=n;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,n,t,u,v){m?(m=!1,c=h<n?h<u?h:u:n<u?n:u,e=k<t?k<v?k:v:t<v?t:v,f=h>n?h>u?h:u:n>u?n:u,g=k>t?k>v?k:v:t>v?t:v):(c=h<n?h<u?h<c?h:c:u<c?u:c:n<u?n<c?n: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>n?h>u?h>f?h:f:u>f?u:f:n>u?n>f?n: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,k,h,m,n,p,o,t,u,v,x=b.geometry,
+B=x.vertices,A=[],f=0;for(g=x.faces.length;f<g;f++)if(k=x.faces[f],u=this.origin.clone(),v=this.direction.clone(),p=b.matrixWorld,h=p.multiplyVector3(B[k.a].position.clone()),m=p.multiplyVector3(B[k.b].position.clone()),n=p.multiplyVector3(B[k.c].position.clone()),p=k instanceof THREE.Face4?p.multiplyVector3(B[k.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),t=v.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(h,u))/t,u=u.addSelf(v.multiplyScalar(o)),
+k instanceof THREE.Face3)e(u,h,m,n)&&(k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},A.push(k));else if(k instanceof THREE.Face4&&(e(u,h,m,p)||e(u,m,n,p)))k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},A.push(k);return A}else return[]}};
+THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return h};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>
 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,k,h,m,o,p,n,t,u,v,w,C){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,o||0,p||0,n||1,t||0,u||0,v||0,w||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,o,p,n,t,u,v,w,C){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=o;this.n32=p;this.n33=n;this.n34=t;this.n41=u;this.n42=v;this.n43=w;this.n44=C;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,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,k,h,m,n,p,o,t,u,v,x,B){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,n||0,p||0,o||1,t||0,u||0,v||0,x||0,B||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,n,p,o,t,u,v,x,B){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=u;this.n42=v;this.n43=x;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,c,e){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());g.cross(k,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=k.x;this.n21=f.y;this.n22=g.y;this.n23=k.y;this.n31=f.z;this.n32=g.z;this.n33=k.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();
-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,k=b.n14,h=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,C=b.n42,z=b.n43,y=b.n44,G=c.n11,x=c.n12,B=c.n13,F=c.n14,D=c.n21,P=c.n22,
-I=c.n23,L=c.n24,K=c.n31,U=c.n32,H=c.n33,fa=c.n34,j=c.n41,da=c.n42,V=c.n43,$=c.n44;this.n11=e*G+f*D+g*K+k*j;this.n12=e*x+f*P+g*U+k*da;this.n13=e*B+f*I+g*H+k*V;this.n14=e*F+f*L+g*fa+k*$;this.n21=h*G+m*D+o*K+p*j;this.n22=h*x+m*P+o*U+p*da;this.n23=h*B+m*I+o*H+p*V;this.n24=h*F+m*L+o*fa+p*$;this.n31=n*G+t*D+u*K+v*j;this.n32=n*x+t*P+u*U+v*da;this.n33=n*B+t*I+u*H+v*V;this.n34=n*F+t*L+u*fa+v*$;this.n41=w*G+C*D+z*K+y*j;this.n42=w*x+C*P+z*U+y*da;this.n43=w*B+C*I+z*H+y*V;this.n44=w*F+C*L+z*fa+y*$;return this},
-multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;
-this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,k=this.n22,h=this.n23,m=this.n24,o=this.n31,p=this.n32,n=this.n33,t=this.n34,u=this.n41,v=this.n42,w=this.n43,C=this.n44;return f*h*p*u-e*m*p*u-f*k*n*u+c*m*n*u+e*k*t*u-c*h*t*u-f*h*o*v+e*m*o*v+f*g*n*v-b*m*n*v-e*g*t*v+b*h*t*v+f*k*o*w-c*m*o*w-f*g*p*w+b*m*p*w+c*g*t*w-b*k*t*w-e*k*o*C+c*h*o*C+e*g*p*C-b*h*p*C-c*g*n*C+b*k*n*C},transpose:function(){var b;
-b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;
-b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
-b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,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,k=b.x,h=b.y,m=b.z,o=g*k,p=g*h;this.set(o*k+e,o*h-f*m,o*m+f*h,0,o*h+f*m,p*h+e,p*m-f*k,0,o*m-f*h,p*m+f*k,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,c){var e=b.x,f=b.y,g=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var o=h*m,p=h*g,n=f*m,t=f*g;
-this.n11=o+t*e;this.n12=n*e-p;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=p*e-n;this.n32=t+o*e;this.n33=k*h;break;case "ZXY":o=h*m;p=h*g;n=f*m;t=f*g;this.n11=o-t*e;this.n12=-k*g;this.n13=n+p*e;this.n21=p+n*e;this.n22=k*m;this.n23=t-o*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":o=k*m;p=k*g;n=e*m;t=e*g;this.n11=h*m;this.n12=n*f-p;this.n13=o*f+t;this.n21=h*g;this.n22=t*f+o;this.n23=p*f-n;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":o=k*h;p=k*f;n=e*h;t=e*f;this.n11=
-h*m;this.n12=t-o*g;this.n13=n*g+p;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+n;this.n33=o-t*g;break;case "XZY":o=k*h;p=k*f;n=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=o*g+t;this.n22=k*m;this.n23=p*g-n;this.n31=n*g-p;this.n32=e*m;this.n33=t*g+o;break;default:o=k*m,p=k*g,n=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=p+n*f,this.n22=o-t*f,this.n23=-e*h,this.n31=t-o*f,this.n32=n+p*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c=
-b.x,e=b.y,f=b.z,g=b.w,k=c+c,h=e+e,m=f+f,b=c*k,o=c*h;c*=m;var p=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(p+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;this.n32=e+k;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=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,k=b.n14,h=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,u=b.n33,v=b.n34,w=b.n41,C=b.n42,z=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*v*C-p*u*C+p*t*z-m*v*z-o*t*y+m*u*y;c.n12=k*u*C-g*v*C-k*t*z+f*v*z+g*t*y-f*u*y;c.n13=g*p*C-k*o*C+k*m*z-f*p*z-g*m*y+f*o*y;c.n14=k*o*t-g*p*t-k*m*u+f*p*u+g*m*v-f*o*v;c.n21=p*u*w-o*v*w-p*n*z+h*v*z+o*n*y-h*u*y;c.n22=g*v*w-k*u*w+k*n*z-e*v*z-g*n*y+e*u*y;c.n23=k*o*w-g*p*w-k*h*z+e*p*z+g*h*y-e*o*y;c.n24=
-g*p*n-k*o*n+k*h*u-e*p*u-g*h*v+e*o*v;c.n31=m*v*w-p*t*w+p*n*C-h*v*C-m*n*y+h*t*y;c.n32=k*t*w-f*v*w-k*n*C+e*v*C+f*n*y-e*t*y;c.n33=g*p*w-k*m*w+k*h*C-e*p*C-f*h*y+e*m*y;c.n34=k*m*n-f*p*n-k*h*t+e*p*t+f*h*v-e*m*v;c.n41=o*t*w-m*u*w-o*n*C+h*u*C+m*n*z-h*t*z;c.n42=f*u*w-g*t*w+g*n*C-e*u*C-f*n*z+e*t*z;c.n43=g*m*w-f*o*w-g*h*C+e*o*C+f*h*z-e*m*z;c.n44=f*o*n-g*m*n+g*h*t-e*o*t-f*h*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,k=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,p=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*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*k;e[3]=b*h;e[4]=b*m;e[5]=b*o;e[6]=b*p;e[7]=b*n;e[8]=b*t;return c};
+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,k=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,B=b.n42,A=b.n43,y=b.n44,F=c.n11,w=c.n12,H=c.n13,E=c.n14,D=c.n21,S=c.n22,
+J=c.n23,G=c.n24,U=c.n31,W=c.n32,M=c.n33,X=c.n34,T=c.n41,R=c.n42,j=c.n43,fa=c.n44;this.n11=e*F+f*D+g*U+k*T;this.n12=e*w+f*S+g*W+k*R;this.n13=e*H+f*J+g*M+k*j;this.n14=e*E+f*G+g*X+k*fa;this.n21=h*F+m*D+n*U+p*T;this.n22=h*w+m*S+n*W+p*R;this.n23=h*H+m*J+n*M+p*j;this.n24=h*E+m*G+n*X+p*fa;this.n31=o*F+t*D+u*U+v*T;this.n32=o*w+t*S+u*W+v*R;this.n33=o*H+t*J+u*M+v*j;this.n34=o*E+t*G+u*X+v*fa;this.n41=x*F+B*D+A*U+y*T;this.n42=x*w+B*S+A*W+y*R;this.n43=x*H+B*J+A*M+y*j;this.n44=x*E+B*G+A*X+y*fa;return this},multiplyToArray:function(b,
+c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
+b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,k=this.n22,h=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,u=this.n41,v=this.n42,x=this.n43,B=this.n44;return f*h*p*u-e*m*p*u-f*k*o*u+c*m*o*u+e*k*t*u-c*h*t*u-f*h*n*v+e*m*n*v+f*g*o*v-b*m*o*v-e*g*t*v+b*h*t*v+f*k*n*x-c*m*n*x-f*g*p*x+b*m*p*x+c*g*t*x-b*k*t*x-e*k*n*B+c*h*n*B+e*g*p*B-b*h*p*B-c*g*o*B+b*k*o*B},transpose:function(){var b;b=this.n21;this.n21=
+this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
+this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=
+this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,
+c,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,k=b.x,h=b.y,m=b.z,n=g*k,p=g*h;this.set(n*k+e,n*h-f*m,n*m+f*h,0,n*h+f*m,p*h+e,p*m-f*k,0,n*m-f*h,p*m+f*k,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,c){var e=b.x,f=b.y,g=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=h*m,p=h*g,o=f*m,t=f*g;this.n11=n+t*e;this.n12=
+o*e-p;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=p*e-o;this.n32=t+n*e;this.n33=k*h;break;case "ZXY":n=h*m;p=h*g;o=f*m;t=f*g;this.n11=n-t*e;this.n12=-k*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=k*m;this.n23=t-n*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":n=k*m;p=k*g;o=e*m;t=e*g;this.n11=h*m;this.n12=o*f-p;this.n13=n*f+t;this.n21=h*g;this.n22=t*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":n=k*h;p=k*f;o=e*h;t=e*f;this.n11=h*m;this.n12=t-n*g;this.n13=
+o*g+p;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-t*g;break;case "XZY":n=k*h;p=k*f;o=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=n*g+t;this.n22=k*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=t*g+n;break;default:n=k*m,p=k*g,o=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=p+o*f,this.n22=n-t*f,this.n23=-e*h,this.n31=t-n*f,this.n32=o+p*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,k=c+c,
+h=e+e,m=f+f,b=c*k,n=c*h;c*=m;var p=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+h;this.n21=n+g;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;this.n32=e+k;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=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,k=b.n14,h=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,B=b.n42,A=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*v*B-p*u*B+p*t*A-m*v*A-n*t*y+m*u*y;c.n12=k*u*B-g*v*B-k*t*A+f*v*A+g*t*y-f*u*y;c.n13=g*p*B-k*n*B+k*m*A-f*p*A-g*m*y+f*n*y;c.n14=k*n*t-g*p*t-k*m*u+f*p*u+g*m*v-f*n*v;c.n21=p*u*x-n*v*x-p*o*A+h*v*A+n*o*y-h*u*y;c.n22=g*v*x-k*u*x+k*o*A-e*v*A-g*o*y+e*u*y;c.n23=k*n*x-g*p*x-k*h*A+e*p*A+g*h*y-e*n*y;c.n24=
+g*p*o-k*n*o+k*h*u-e*p*u-g*h*v+e*n*v;c.n31=m*v*x-p*t*x+p*o*B-h*v*B-m*o*y+h*t*y;c.n32=k*t*x-f*v*x-k*o*B+e*v*B+f*o*y-e*t*y;c.n33=g*p*x-k*m*x+k*h*B-e*p*B-f*h*y+e*m*y;c.n34=k*m*o-f*p*o-k*h*t+e*p*t+f*h*v-e*m*v;c.n41=n*t*x-m*u*x-n*o*B+h*u*B+m*o*A-h*t*A;c.n42=f*u*x-g*t*x+g*o*B-e*u*B-f*o*A+e*t*A;c.n43=g*m*x-f*n*x-g*h*B+e*n*B+f*h*A-e*m*A;c.n44=f*n*o-g*m*o+g*h*t-e*n*t-f*h*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,k=b.n32*b.n21-b.n31*b.n22,h=-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*h+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*k;e[3]=b*h;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*t;return c};
 THREE.Matrix4.makeFrustum=function(b,c,e,f,g,k){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-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=-(k+g)/(k-g);h.n34=-2*k*g/(k-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};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,k){var h,m,o,p;h=new THREE.Matrix4;m=c-b;o=e-f;p=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((k+g)/p);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,c,e,f,g,k){var h,m,n,p;h=new THREE.Matrix4;m=c-b;n=e-f;p=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((e+f)/n);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((k+g)/p);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.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.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
 this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._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)===
@@ -51,27 +51,27 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};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),k=Math.cos(e),e=Math.sin(e),h=b*c,m=f*g;this.w=h*k-m*e;this.x=h*e+m*k;this.y=f*c*k+b*g*e;this.z=b*g*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
 f;this.z=b.z*f;this.w=Math.cos(e);return this},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,k=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*k+e*m-f*h;this.y=e*b+g*h+f*k-c*m;this.z=f*b+g*m+c*h-e*k;this.w=g*b-c*k-e*h-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,k=this.x,h=this.y,m=this.z,o=this.w,p=o*e+h*g-m*f,n=
-o*f+m*e-k*g,t=o*g+k*f-h*e,e=-k*e-h*f-m*g;c.x=p*o+e*-k+n*-m-t*-h;c.y=n*o+e*-h+t*-k-p*-m;c.z=t*o+e*-m+p*-h-n*-k;return c}};
+multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,k=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*k+e*m-f*h;this.y=e*b+g*h+f*k-c*m;this.z=f*b+g*m+c*h-e*k;this.w=g*b-c*k-e*h-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,k=this.x,h=this.y,m=this.z,n=this.w,p=n*e+h*g-m*f,o=
+n*f+m*e-k*g,t=n*g+k*f-h*e,e=-k*e-h*f-m*g;c.x=p*n+e*-k+o*-m-t*-h;c.y=o*n+e*-h+t*-k-p*-m;c.z=t*n+e*-m+p*-h-o*-k;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 k=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<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)*k)/h;f=Math.sin(f*k)/h;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,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,g,k,h){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=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,k,h,m=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){k=this.faces[f];if(b&&k.vertexNormals.length){m.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)m.addSelf(k.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],h=this.vertices[k.c],m.sub(h.position,e.position),o.sub(c.position,e.position),m.crossSelf(o);m.isZero()||
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,k,h,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){k=this.faces[f];if(b&&k.vertexNormals.length){m.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)m.addSelf(k.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],h=this.vertices[k.c],m.sub(h.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
 m.normalize();k.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]),
-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,j,f,g,k){m=b.vertices[e].position;o=b.vertices[c].position;p=b.vertices[j].position;n=h[f];t=h[g];u=h[k];v=o.x-m.x;w=p.x-m.x;C=o.y-m.y;z=p.y-m.y;y=o.z-m.z;G=p.z-m.z;x=t.u-n.u;B=u.u-n.u;F=t.v-n.v;D=u.v-n.v;P=1/(x*D-B*F);U.set((D*v-F*w)*
-P,(D*C-F*z)*P,(D*y-F*G)*P);H.set((x*w-B*v)*P,(x*z-B*C)*P,(x*G-B*y)*P);L[e].addSelf(U);L[c].addSelf(U);L[j].addSelf(U);K[e].addSelf(H);K[c].addSelf(H);K[j].addSelf(H)}var c,e,f,g,k,h,m,o,p,n,t,u,v,w,C,z,y,G,x,B,F,D,P,I,L=[],K=[],U=new THREE.Vector3,H=new THREE.Vector3,fa=new THREE.Vector3,j=new THREE.Vector3,da=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)L[c]=new THREE.Vector3,K[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],h=this.faceVertexUvs[0][c],k instanceof
-THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)da.copy(k.vertexNormals[f]),g=k[V[f]],I=L[g],fa.copy(I),fa.subSelf(da.multiplyScalar(da.dot(I))).normalize(),j.cross(k.vertexNormals[f],I),g=j.dot(K[g]),g=g<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(fa.x,fa.y,fa.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,k){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=h[j];t=h[g];u=h[k];v=n.x-m.x;x=p.x-m.x;B=n.y-m.y;A=p.y-m.y;y=n.z-m.z;F=p.z-m.z;w=t.u-o.u;H=u.u-o.u;E=t.v-o.v;D=u.v-o.v;S=1/(w*D-H*E);W.set((D*v-E*x)*
+S,(D*B-E*A)*S,(D*y-E*F)*S);M.set((w*x-H*v)*S,(w*A-H*B)*S,(w*F-H*y)*S);G[e].addSelf(W);G[c].addSelf(W);G[f].addSelf(W);U[e].addSelf(M);U[c].addSelf(M);U[f].addSelf(M)}var c,e,f,g,k,h,m,n,p,o,t,u,v,x,B,A,y,F,w,H,E,D,S,J,G=[],U=[],W=new THREE.Vector3,M=new THREE.Vector3,X=new THREE.Vector3,T=new THREE.Vector3,R=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)G[c]=new THREE.Vector3,U[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],h=this.faceVertexUvs[0][c],k instanceof
+THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var j=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)R.copy(k.vertexNormals[f]),g=k[j[f]],J=G[g],X.copy(J),X.subSelf(R.multiplyScalar(R.dot(J))).normalize(),T.cross(k.vertexNormals[f],J),g=T.dot(U[g]),g=g<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.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;
 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,k,h,m={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.a,h.c),c(m,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(m,g,e),g=b(h.a,h.b),c(m,g,e),g=b(h.a,h.d),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.c,h.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];k=h.vertexIndices[1];
 h.faceIndices=m[b(g,k)].array;for(g=0;g<h.faceIndices.length;g++)k=h.faceIndices[g],h.faces.push(this.faces[k])}}};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,k,h,m,o,p,n,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;k=Math.floor(g);h=g-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;p=this.points[e[0]];n=this.points[e[1]];
-t=this.points[e[2]];u=this.points[e[3]];m=h*h;o=h*m;f.x=c(p.x,n.x,t.x,u.x,h,m,o);f.y=c(p.y,n.y,t.y,u.y,h,m,o);f.z=c(p.z,n.z,t.z,u.z,h,m,o);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=[],o=new THREE.Vector3,p=this.getLength();m.push(o.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(o.copy(position).clone());
-m.push(o.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.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,k,h,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;k=Math.floor(g);h=g-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;p=this.points[e[0]];o=this.points[e[1]];
+t=this.points[e[2]];u=this.points[e[3]];m=h*h;n=h*m;f.x=c(p.x,o.x,t.x,u.x,h,m,n);f.y=c(p.y,o.y,t.y,u.y,h,m,n);f.z=c(p.z,o.z,t.z,u.z,h,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());
+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.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.setViewOffset=function(b,c,e,f,g,k){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=k;this.updateProjectionMatrix()};
@@ -123,13 +123,13 @@ THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THR
 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()};
 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,k,h,m,o,p,n,t,u,v,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var C=w.egdes=this.geometry.edges,z=w.edgeFaces=[];g=0;var y=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],y.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=C.length;b<c;b++)m=C[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],k=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(o="a",n=y[g]+0):e.b===h?(o="b",n=y[g]+1):e.c===h?(o="c",n=y[g]+2):e.d===h&&(o="d",n=y[g]+3),e.a===m?(o+="a",t=y[g]+0):e.b===m?(o+="b",t=y[g]+1):e.c===m?(o+="c",t=y[g]+2):e.d===m&&(o+="d",t=y[g]+3),f.a===h?(p="a",u=y[k]+0):f.b===h?(p="b",u=y[k]+1):f.c===h?(p="c",u=y[k]+2):f.d===h&&(p="d",u=y[k]+3),f.a===m?(p+="a",v=y[k]+0):f.b===m?(p+="b",v=y[k]+
-1):f.c===m?(p+="c",v=y[k]+2):f.d===m&&(p+="d",v=y[k]+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),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(n,t,u,v),e.normal.set(1,0,0),z.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,k=g.length,h,m,o,p,n,t=["a","b","c","d"];for(o=0;o<k;o++){m=c.length;h=g[o];h 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(h.normal);e.push(m);
-for(m=0;m<p;m++)n=b[h[t[m]]],c.push(new THREE.Vertex(n.position.clone()))}for(k=0;k<g.length-1;k++){b=e[k];for(h=k+1;h<g.length;h++)m=e[h],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,k,h,m,o,p,n,t,u,v,w,C,z=0,y=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){k=c[y[w]];m=b[k];for(C=0;C<g;C++)if(h=e[y[C]],o=b[h],Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4&&(z++,z===1&&(p=m,n=o,t=k,u=h,v=y[w]),z===2))return v+=y[w],v==="ad"||v==="ac"?{faces:[c,e],vertices:[p,n,o,m],indices:[t,u,
-h,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,o,n],indices:[t,k,h,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,k,h,m,n,p,o,t,u,v,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var B=x.egdes=this.geometry.edges,A=x.edgeFaces=[];g=0;var y=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],y.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=B.length;b<c;b++)m=B[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],k=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(n="a",o=y[g]+0):e.b===h?(n="b",o=y[g]+1):e.c===h?(n="c",o=y[g]+2):e.d===h&&(n="d",o=y[g]+3),e.a===m?(n+="a",t=y[g]+0):e.b===m?(n+="b",t=y[g]+1):e.c===m?(n+="c",t=y[g]+2):e.d===m&&(n+="d",t=y[g]+3),f.a===h?(p="a",u=y[k]+0):f.b===h?(p="b",u=y[k]+1):f.c===h?(p="c",u=y[k]+2):f.d===h&&(p="d",u=y[k]+3),f.a===m?(p+="a",v=y[k]+0):f.b===m?(p+="b",v=y[k]+
+1):f.c===m?(p+="c",v=y[k]+2):f.d===m&&(p+="d",v=y[k]+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),A.push(e);this.geometry=x}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,k=g.length,h,m,n,p,o,t=["a","b","c","d"];for(n=0;n<k;n++){m=c.length;h=g[n];h 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(h.normal);e.push(m);
+for(m=0;m<p;m++)o=b[h[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(k=0;k<g.length-1;k++){b=e[k];for(h=k+1;h<g.length;h++)m=e[h],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,k,h,m,n,p,o,t,u,v,x,B,A=0,y=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){k=c[y[x]];m=b[k];for(B=0;B<g;B++)if(h=e[y[B]],n=b[h],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&&(A++,A===1&&(p=m,o=n,t=k,u=h,v=y[x]),A===2))return v+=y[x],v==="ad"||v==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,u,
+h,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[t,k,h,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;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
@@ -138,56 +138,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.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.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.Projector=function(){function b(){var b=o[m]=o[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,k=[],h,m,o=[],p,n,t=[],u,v=[],w,C,z=[],y,G,x=[],B=new THREE.Vector4,F=new THREE.Vector4,
-D=new THREE.Matrix4,P=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(b,e){D.multiply(e.projectionMatrix,e.matrixWorldInverse);D.multiplyVector3(b);return b};this.unprojectVector=function(b,e){D.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));D.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],j,m,o;g=0;m=
-b.objects;b=0;for(j=m.length;b<j;b++){o=m[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var n=o.matrixWorld,t=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),u=0;u<6;u++)if(p=I[u].x*n.n14+I[u].y*n.n24+I[u].z*n.n34+I[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=k[g]=k[g]||new THREE.RenderableObject,g++,f=p,B.copy(o.position),D.multiplyVector3(B),f.object=o,f.z=B.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,k){var j=[],
-B=g.near,V=g.far,$,O,ea,Y,T,ca,ha,na,ia,J,ga,X,W,ja,Z,N,ka;G=C=u=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);D.multiply(g.projectionMatrix,g.matrixWorldInverse);I[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);I[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);I[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);I[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);I[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);I[5].set(D.n41+D.n31,D.n42+D.n32,
-D.n43+D.n33,D.n44+D.n34);for($=0;$<6;$++)ia=I[$],ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z));ia=this.projectObjects(f,g,!0);f=0;for($=ia.length;f<$;f++)if(J=ia[f].object,J.visible)if(ga=J.matrixWorld,X=J.matrixRotationWorld,W=J.materials,ja=J.overdraw,m=0,J instanceof THREE.Mesh){Z=J.geometry;Y=Z.vertices;N=Z.faces;Z=Z.faceVertexUvs;O=0;for(ea=Y.length;O<ea;O++)h=b(),h.positionWorld.copy(Y[O].position),ga.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),
-h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>B&&h.positionScreen.z<V;Y=0;for(O=N.length;Y<O;Y++){ea=N[Y];if(ea instanceof THREE.Face3)if(T=o[ea.a],ca=o[ea.b],ha=o[ea.c],T.visible&&ca.visible&&ha.visible&&(J.doubleSided||J.flipSided!=(ha.positionScreen.x-T.positionScreen.x)*(ca.positionScreen.y-T.positionScreen.y)-(ha.positionScreen.y-T.positionScreen.y)*(ca.positionScreen.x-T.positionScreen.x)<0))na=t[n]=t[n]||new THREE.RenderableFace3,
-n++,p=na,p.v1.copy(T),p.v2.copy(ca),p.v3.copy(ha);else continue;else if(ea instanceof THREE.Face4)if(T=o[ea.a],ca=o[ea.b],ha=o[ea.c],na=o[ea.d],T.visible&&ca.visible&&ha.visible&&na.visible&&(J.doubleSided||J.flipSided!=((na.positionScreen.x-T.positionScreen.x)*(ca.positionScreen.y-T.positionScreen.y)-(na.positionScreen.y-T.positionScreen.y)*(ca.positionScreen.x-T.positionScreen.x)<0||(ca.positionScreen.x-ha.positionScreen.x)*(na.positionScreen.y-ha.positionScreen.y)-(ca.positionScreen.y-ha.positionScreen.y)*
-(na.positionScreen.x-ha.positionScreen.x)<0)))ka=v[u]=v[u]||new THREE.RenderableFace4,u++,p=ka,p.v1.copy(T),p.v2.copy(ca),p.v3.copy(ha),p.v4.copy(na);else continue;p.normalWorld.copy(ea.normal);X.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ea.centroid);ga.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);D.multiplyVector3(p.centroidScreen);ha=ea.vertexNormals;T=0;for(ca=ha.length;T<ca;T++)na=p.vertexNormalsWorld[T],na.copy(ha[T]),X.multiplyVector3(na);T=0;for(ca=Z.length;T<
-ca;T++)if(ka=Z[T][Y]){ha=0;for(na=ka.length;ha<na;ha++)p.uvs[T][ha]=ka[ha]}p.meshMaterials=W;p.faceMaterials=ea.materials;p.overdraw=ja;p.z=p.centroidScreen.z;j.push(p)}}else if(J instanceof THREE.Line){P.multiply(D,ga);Y=J.geometry.vertices;T=b();T.positionScreen.copy(Y[0].position);P.multiplyVector4(T.positionScreen);O=1;for(ea=Y.length;O<ea;O++)if(T=b(),T.positionScreen.copy(Y[O].position),P.multiplyVector4(T.positionScreen),ca=o[m-2],L.copy(T.positionScreen),K.copy(ca.positionScreen),e(L,K))L.multiplyScalar(1/
-L.w),K.multiplyScalar(1/K.w),ga=z[C]=z[C]||new THREE.RenderableLine,C++,w=ga,w.v1.positionScreen.copy(L),w.v2.positionScreen.copy(K),w.z=Math.max(L.z,K.z),w.materials=J.materials,j.push(w)}else if(J instanceof THREE.Particle&&(F.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),D.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ga=x[G]=x[G]||new THREE.RenderableParticle,G++,y=ga,y.x=F.x/F.w,y.y=F.y/F.w,y.z=F.z,y.rotation=J.rotation.z,y.scale.x=J.scale.x*Math.abs(y.x-(F.x+g.projectionMatrix.n11)/
-(F.w+g.projectionMatrix.n14)),y.scale.y=J.scale.y*Math.abs(y.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),y.materials=J.materials,j.push(y);k&&j.sort(c);return j}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var o,p,n,t,u,v,w,C;b=c.projectScene(e,f);o=0;for(p=b.length;o<p;o++)if(u=b[o],u instanceof THREE.RenderableParticle){w=u.x*g+g;C=u.y*k+k;n=0;for(t=u.material.length;n<t;n++)if(v=u.material[n],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=w+"px",v.style.top=C+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(y!=b)w.globalAlpha=y=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(x!=b.hex)x=b.hex,w.strokeStyle="#"+k(x.toString(16))}function g(b){if(B!=b.hex)B=b.hex,w.fillStyle="#"+k(B.toString(16))}function k(b){for(;b.length<6;)b="0"+b;return b}
-var h=this,m=null,o=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,t,u,v,w=p.getContext("2d"),C=new THREE.Color(0),z=0,y=1,G=0,x=null,B=null,F=null,D=null,P=null,I,L,K,U,H=new THREE.RenderableVertex,fa=new THREE.RenderableVertex,j,da,V,$,O,ea,Y,T,ca,ha,na,ia,J=new THREE.Color(0),ga=new THREE.Color(0),X=new THREE.Color(0),W=new THREE.Color(0),ja=new THREE.Color(0),Z,N,ka,la,ta,va,Ba,ya,ua,za,wa=new THREE.Rectangle,qa=new THREE.Rectangle,S=new THREE.Rectangle,
-Q=!1,oa=new THREE.Color,R=new THREE.Color,Ca=new THREE.Color,aa=new THREE.Color,pa=new THREE.Vector3,Pa,Qa,Wa,xa,Ra,Sa,b=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;Qa=Pa.getContext("2d");Qa.fillStyle="rgba(0,0,0,1)";Qa.fillRect(0,0,2,2);Wa=Qa.getImageData(0,0,2,2);xa=Wa.data;Ra=document.createElement("canvas");Ra.width=Ra.height=b;Sa=Ra.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){n=b;t=e;u=n/2;v=t/2;p.width=n;p.height=t;wa.set(-u,-v,u,v);y=1;G=0;P=D=F=B=x=null};this.setClearColor=function(b,e){C=b;z=e};this.setClearColorHex=function(b,e){C.setHex(b);z=e};this.clear=function(){w.setTransform(1,0,0,-1,u,v);if(!qa.isEmpty())qa.inflate(1),qa.minSelf(wa),C.hex==0&&z==0?w.clearRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight()):(e(THREE.NormalBlending),c(1),w.fillStyle="rgba("+Math.floor(C.r*255)+","+Math.floor(C.g*255)+","+Math.floor(C.b*
-255)+","+z+")",w.fillRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight())),qa.empty()};this.render=function(b,k){function p(b){var e,c,f,g=b.lights;R.setRGB(0,0,0);Ca.setRGB(0,0,0);aa.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(R.r+=f.r,R.g+=f.g,R.b+=f.b):c instanceof THREE.DirectionalLight?(Ca.r+=f.r,Ca.g+=f.g,Ca.b+=f.b):c instanceof THREE.PointLight&&(aa.r+=f.r,aa.g+=f.g,aa.b+=f.b)}function n(b,e,c,f){var g,j,h,k,m=b.lights,b=0;for(g=m.length;b<g;b++)j=
-m[b],h=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):j instanceof THREE.PointLight&&(k=c.dot(pa.sub(j.position,e).normalize()),k<=0||(k*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),k!=0&&(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,o,p,n,aa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)p=h.map.image,n=p.width>>1,aa=p.height>>1,h=j.scale.x*
-u,o=j.scale.y*v,k=h*n,m=o*aa,S.set(b.x-k,b.y-m,b.x+k,b.y+m),wa.instersects(S)&&(w.save(),w.translate(b.x,b.y),w.rotate(-j.rotation),w.scale(h,-o),w.translate(-n,-aa),w.drawImage(p,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,S.set(b.x-k,b.y-m,b.x+k,b.y+m),wa.instersects(S)&&(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 y(b,g,j,h){c(h.opacity);e(h.blending);w.beginPath();
-w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(g.positionScreen.x,g.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(F!=b)w.lineWidth=F=b;b=h.linecap;if(D!=b)w.lineCap=D=b;b=h.linejoin;if(P!=b)w.lineJoin=P=b;f(h.color);w.stroke();S.inflate(h.linewidth*2)}}function z(b,f,g,m,o,p,aa,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);j=b.positionScreen.x;da=b.positionScreen.y;V=f.positionScreen.x;$=f.positionScreen.y;O=g.positionScreen.x;
-ea=g.positionScreen.y;C(j,da,V,$,O,ea);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(la=aa.uvs[0],Ea(j,da,V,$,O,ea,t.map.image,la[m].u,la[m].v,la[o].u,la[o].v,la[p].u,la[p].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,pa.copy(aa.vertexNormalsWorld[0]),ta=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,va=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(aa.vertexNormalsWorld[1]),Ba=(pa.x*b.n11+
-pa.y*b.n12+pa.z*b.n13)*0.5+0.5,ya=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(aa.vertexNormalsWorld[2]),ua=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,za=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,Ea(j,da,V,$,O,ea,t.envMap.image,ta,va,Ba,ya,ua,za)}else t.wireframe?B(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(la=aa.uvs[0],Ea(j,da,V,$,O,ea,t.map.image,
-la[m].u,la[m].v,la[o].u,la[o].v,la[p].u,la[p].v)),e(THREE.SubtractiveBlending)),Q?!t.wireframe&&t.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==3?(ga.r=X.r=W.r=R.r,ga.g=X.g=W.g=R.g,ga.b=X.b=W.b=R.b,n(u,aa.v1.positionWorld,aa.vertexNormalsWorld[0],ga),n(u,aa.v2.positionWorld,aa.vertexNormalsWorld[1],X),n(u,aa.v3.positionWorld,aa.vertexNormalsWorld[2],W),ja.r=(X.r+W.r)*0.5,ja.g=(X.g+W.g)*0.5,ja.b=(X.b+W.b)*0.5,ka=Ta(ga,X,W,ja),Ea(j,da,V,$,O,ea,ka,0,0,1,0,0,1)):(oa.r=R.r,oa.g=R.g,oa.b=
-R.b,n(u,aa.centroidWorld,aa.normalWorld,oa),J.r=Math.max(0,Math.min(t.color.r*oa.r,1)),J.g=Math.max(0,Math.min(t.color.g*oa.g,1)),J.b=Math.max(0,Math.min(t.color.b*oa.b,1)),J.updateHex(),t.wireframe?B(J,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(J)):t.wireframe?B(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(t.color);else if(t instanceof THREE.MeshDepthMaterial)Z=k.near,N=k.far,ga.r=ga.g=ga.b=1-Ja(b.positionScreen.z,Z,N),X.r=X.g=X.b=1-Ja(f.positionScreen.z,
-Z,N),W.r=W.g=W.b=1-Ja(g.positionScreen.z,Z,N),ja.r=(X.r+W.r)*0.5,ja.g=(X.g+W.g)*0.5,ja.b=(X.b+W.b)*0.5,ka=Ta(ga,X,W,ja),Ea(j,da,V,$,O,ea,ka,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)J.r=Na(aa.normalWorld.x),J.g=Na(aa.normalWorld.y),J.b=Na(aa.normalWorld.z),J.updateHex(),t.wireframe?B(J,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ga(J)}function x(b,f,g,m,o,p,t,aa,u){h.data.vertices+=4;h.data.faces++;c(aa.opacity);e(aa.blending);if(aa.map||aa.envMap)z(b,f,m,0,1,3,t,
-aa,u),z(o,g,p,1,2,3,t,aa,u);else if(j=b.positionScreen.x,da=b.positionScreen.y,V=f.positionScreen.x,$=f.positionScreen.y,O=g.positionScreen.x,ea=g.positionScreen.y,Y=m.positionScreen.x,T=m.positionScreen.y,ca=o.positionScreen.x,ha=o.positionScreen.y,na=p.positionScreen.x,ia=p.positionScreen.y,aa instanceof THREE.MeshBasicMaterial)G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color);else if(aa instanceof THREE.MeshLambertMaterial)Q?
-!aa.wireframe&&aa.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ga.r=X.r=W.r=ja.r=R.r,ga.g=X.g=W.g=ja.g=R.g,ga.b=X.b=W.b=ja.b=R.b,n(u,t.v1.positionWorld,t.vertexNormalsWorld[0],ga),n(u,t.v2.positionWorld,t.vertexNormalsWorld[1],X),n(u,t.v4.positionWorld,t.vertexNormalsWorld[3],W),n(u,t.v3.positionWorld,t.vertexNormalsWorld[2],ja),ka=Ta(ga,X,W,ja),C(j,da,V,$,Y,T),Ea(j,da,V,$,Y,T,ka,0,0,1,0,0,1),C(ca,ha,O,ea,na,ia),Ea(ca,ha,O,ea,na,ia,ka,1,0,1,1,0,1)):(oa.r=R.r,oa.g=R.g,oa.b=R.b,n(u,
-t.centroidWorld,t.normalWorld,oa),J.r=Math.max(0,Math.min(aa.color.r*oa.r,1)),J.g=Math.max(0,Math.min(aa.color.g*oa.g,1)),J.b=Math.max(0,Math.min(aa.color.b*oa.b,1)),J.updateHex(),G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(J,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(J)):(G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color));else if(aa instanceof THREE.MeshNormalMaterial)J.r=Na(t.normalWorld.x),J.g=Na(t.normalWorld.y),
-J.b=Na(t.normalWorld.z),J.updateHex(),G(j,da,V,$,O,ea,Y,T),aa.wireframe?B(J,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(J);else if(aa instanceof THREE.MeshDepthMaterial)Z=k.near,N=k.far,ga.r=ga.g=ga.b=1-Ja(b.positionScreen.z,Z,N),X.r=X.g=X.b=1-Ja(f.positionScreen.z,Z,N),W.r=W.g=W.b=1-Ja(m.positionScreen.z,Z,N),ja.r=ja.g=ja.b=1-Ja(g.positionScreen.z,Z,N),ka=Ta(ga,X,W,ja),C(j,da,V,$,Y,T),Ea(j,da,V,$,Y,T,ka,0,0,1,0,0,1),C(ca,ha,O,ea,na,ia),Ea(ca,ha,O,ea,na,ia,ka,1,0,1,1,0,1)}function C(b,
-e,c,f,g,j){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,j);w.lineTo(b,e);w.closePath()}function G(b,e,c,f,g,j,h,k){w.beginPath();w.moveTo(b,e);w.lineTo(c,f);w.lineTo(g,j);w.lineTo(h,k);w.lineTo(b,e);w.closePath()}function B(b,e,c,g){if(F!=e)w.lineWidth=F=e;if(D!=c)w.lineCap=D=c;if(P!=g)w.lineJoin=P=g;f(b);w.stroke();S.inflate(e*2)}function Ga(b){g(b);w.fill()}function Ea(b,e,c,f,g,j,h,k,m,o,p,t,aa){var n,u;n=h.width-1;u=h.height-1;k*=n;m*=u;o*=n;p*=u;t*=n;aa*=u;c-=b;f-=e;g-=b;j-=e;o-=k;p-=
-m;t-=k;aa-=m;n=o*aa-t*p;n!=0&&(u=1/n,n=(aa*c-p*g)*u,p=(aa*f-p*j)*u,c=(o*g-t*c)*u,f=(o*j-t*f)*u,b=b-n*k-c*m,e=e-p*k-f*m,w.save(),w.transform(n,p,c,f,b,e),w.clip(),w.drawImage(h,0,0),w.restore())}function Ta(b,e,c,f){var g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=j<0?0:j>255?255:j;xa[2]=b<0?0:b>255?255:b;xa[4]=h<0?0:h>255?255:h;xa[5]=k<0?0:k>255?
-255:k;xa[6]=e<0?0:e>255?255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=o<0?0:o>255?255:o;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=t<0?0:t>255?255:t;xa[14]=f<0?0:f>255?255:f;Qa.putImageData(Wa,0,0);Sa.drawImage(Pa,0,0);return Ra}function Ja(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function E(b,e){var c=e.x-b.x,f=e.y-b.y,g=1/Math.sqrt(c*c+f*f);c*=g;f*=g;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ua,A,ma,Aa,Ha,Oa,Va,ra;this.autoClear?this.clear():w.setTransform(1,
-0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,k,this.sortElements);(Q=b.lights.length>0)&&p(b);Ua=0;for(A=m.length;Ua<A;Ua++){ma=m[Ua];S.empty();if(ma instanceof THREE.RenderableParticle){I=ma;I.x*=u;I.y*=v;Aa=0;for(Ha=ma.materials.length;Aa<Ha;)ra=ma.materials[Aa++],ra.opacity!=0&&t(I,ma,ra,b)}else if(ma instanceof THREE.RenderableLine){if(I=ma.v1,L=ma.v2,I.positionScreen.x*=u,I.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,S.addPoint(I.positionScreen.x,I.positionScreen.y),
-S.addPoint(L.positionScreen.x,L.positionScreen.y),wa.instersects(S)){Aa=0;for(Ha=ma.materials.length;Aa<Ha;)ra=ma.materials[Aa++],ra.opacity!=0&&y(I,L,ma,ra,b)}}else if(ma instanceof THREE.RenderableFace3){if(I=ma.v1,L=ma.v2,K=ma.v3,I.positionScreen.x*=u,I.positionScreen.y*=v,L.positionScreen.x*=u,L.positionScreen.y*=v,K.positionScreen.x*=u,K.positionScreen.y*=v,ma.overdraw&&(E(I.positionScreen,L.positionScreen),E(L.positionScreen,K.positionScreen),E(K.positionScreen,I.positionScreen)),S.add3Points(I.positionScreen.x,
-I.positionScreen.y,L.positionScreen.x,L.positionScreen.y,K.positionScreen.x,K.positionScreen.y),wa.instersects(S)){Aa=0;for(Ha=ma.meshMaterials.length;Aa<Ha;)if(ra=ma.meshMaterials[Aa++],ra instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(ra=ma.faceMaterials[Oa++])&&ra.opacity!=0&&z(I,L,K,0,1,2,ma,ra,b)}else ra.opacity!=0&&z(I,L,K,0,1,2,ma,ra,b)}}else if(ma instanceof THREE.RenderableFace4&&(I=ma.v1,L=ma.v2,K=ma.v3,U=ma.v4,I.positionScreen.x*=u,I.positionScreen.y*=v,
-L.positionScreen.x*=u,L.positionScreen.y*=v,K.positionScreen.x*=u,K.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,H.positionScreen.copy(L.positionScreen),fa.positionScreen.copy(U.positionScreen),ma.overdraw&&(E(I.positionScreen,L.positionScreen),E(L.positionScreen,U.positionScreen),E(U.positionScreen,I.positionScreen),E(K.positionScreen,H.positionScreen),E(K.positionScreen,fa.positionScreen)),S.addPoint(I.positionScreen.x,I.positionScreen.y),S.addPoint(L.positionScreen.x,L.positionScreen.y),
-S.addPoint(K.positionScreen.x,K.positionScreen.y),S.addPoint(U.positionScreen.x,U.positionScreen.y),wa.instersects(S))){Aa=0;for(Ha=ma.meshMaterials.length;Aa<Ha;)if(ra=ma.meshMaterials[Aa++],ra instanceof THREE.MeshFaceMaterial){Oa=0;for(Va=ma.faceMaterials.length;Oa<Va;)(ra=ma.faceMaterials[Oa++])&&ra.opacity!=0&&x(I,L,K,U,H,fa,ma,ra,b)}else ra.opacity!=0&&x(I,L,K,U,H,fa,ma,ra,b)}qa.addRectangle(S)}w.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(U.sub(j.position,e.centroidWorld),U.normalize(),h=e.normalWorld.dot(U)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,m,o,t,n){h.data.vertices+=3;h.data.faces++;j=f(da++);j.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?F.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?B?(D.r=P.r,D.g=P.g,D.b=P.b,b(n,o,D),F.r=Math.max(0,Math.min(t.color.r*D.r,1)),F.g=Math.max(0,Math.min(t.color.g*D.g,1)),F.b=Math.max(0,Math.min(t.color.b*D.b,1)),F.updateHex()):F.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-
-o.z*t.__farMinusNear),F.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&F.setRGB(g(o.normalWorld.x),g(o.normalWorld.y),g(o.normalWorld.z));t.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(F.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):j.setAttribute("style","fill: #"+k(F.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(j)}function e(e,c,m,o,
-t,n,u){h.data.vertices+=4;h.data.faces++;j=f(da++);j.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?B?(D.r=P.r,D.g=P.g,D.b=P.b,b(u,t,D),F.r=Math.max(0,Math.min(n.color.r*D.r,1)),F.g=Math.max(0,Math.min(n.color.g*D.g,1)),F.b=Math.max(0,Math.min(n.color.b*
-D.b,1)),F.updateHex()):F.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-t.z*n.__farMinusNear),F.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(g(t.normalWorld.x),g(t.normalWorld.y),g(t.normalWorld.z));n.wireframe?j.setAttribute("style","fill: none; stroke: #"+k(F.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):j.setAttribute("style",
-"fill: #"+k(F.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(j)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),$==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,o=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,t,u,v,w,C,z,y,G=new THREE.Rectangle,x=new THREE.Rectangle,B=
-!1,F=new THREE.Color(16777215),D=new THREE.Color(16777215),P=new THREE.Color(0),I=new THREE.Color(0),L=new THREE.Color(0),K,U=new THREE.Vector3,H=[],fa=[],j,da,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":$=1;break;case "low":$=0}};this.setSize=function(b,e){n=b;t=e;u=n/2;v=t/2;p.setAttribute("viewBox",-u+" "+-v+" "+n+" "+t);p.setAttribute("width",n);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,n,F,D,K,J,H;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,f,this.sortElements);V=da=0;if(B=b.lights.length>0){J=b.lights;P.setRGB(0,0,0);I.setRGB(0,0,0);L.setRGB(0,0,0);g=0;for(t=J.length;g<t;g++)n=J[g],F=n.color,n instanceof THREE.AmbientLight?(P.r+=F.r,P.g+=F.g,P.b+=F.b):n instanceof THREE.DirectionalLight?(I.r+=F.r,I.g+=F.g,I.b+=F.b):n instanceof
-THREE.PointLight&&(L.r+=F.r,L.g+=F.g,L.b+=F.b)}g=0;for(t=m.length;g<t;g++)if(J=m[g],x.empty(),J instanceof THREE.RenderableParticle){w=J;w.x*=u;w.y*=-v;n=0;for(F=J.materials.length;n<F;)n++}else if(J instanceof THREE.RenderableLine){if(w=J.v1,C=J.v2,w.positionScreen.x*=u,w.positionScreen.y*=-v,C.positionScreen.x*=u,C.positionScreen.y*=-v,x.addPoint(w.positionScreen.x,w.positionScreen.y),x.addPoint(C.positionScreen.x,C.positionScreen.y),G.instersects(x)){n=0;for(F=J.materials.length;n<F;)if((H=J.materials[n++])&&
-H.opacity!=0){D=w;K=C;var U=V++;fa[U]==null&&(fa[U]=document.createElementNS("http://www.w3.org/2000/svg","line"),$==0&&fa[U].setAttribute("shape-rendering","crispEdges"));j=fa[U];j.setAttribute("x1",D.positionScreen.x);j.setAttribute("y1",D.positionScreen.y);j.setAttribute("x2",K.positionScreen.x);j.setAttribute("y2",K.positionScreen.y);H instanceof THREE.LineBasicMaterial&&(j.setAttribute("style","fill: none; stroke: ##"+k(H.color.hex.toString(16))+"; stroke-width: "+H.linewidth+"; stroke-opacity: "+
-H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin),p.appendChild(j))}}}else if(J instanceof THREE.RenderableFace3){if(w=J.v1,C=J.v2,z=J.v3,w.positionScreen.x*=u,w.positionScreen.y*=-v,C.positionScreen.x*=u,C.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,x.addPoint(w.positionScreen.x,w.positionScreen.y),x.addPoint(C.positionScreen.x,C.positionScreen.y),x.addPoint(z.positionScreen.x,z.positionScreen.y),G.instersects(x)){n=0;for(F=J.meshMaterials.length;n<
-F;)if(H=J.meshMaterials[n++],H instanceof THREE.MeshFaceMaterial){D=0;for(K=J.faceMaterials.length;D<K;)(H=J.faceMaterials[D++])&&H.opacity!=0&&c(w,C,z,J,H,b)}else H&&H.opacity!=0&&c(w,C,z,J,H,b)}}else if(J instanceof THREE.RenderableFace4&&(w=J.v1,C=J.v2,z=J.v3,y=J.v4,w.positionScreen.x*=u,w.positionScreen.y*=-v,C.positionScreen.x*=u,C.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,x.addPoint(w.positionScreen.x,w.positionScreen.y),x.addPoint(C.positionScreen.x,
-C.positionScreen.y),x.addPoint(z.positionScreen.x,z.positionScreen.y),x.addPoint(y.positionScreen.x,y.positionScreen.y),G.instersects(x))){n=0;for(F=J.meshMaterials.length;n<F;)if(H=J.meshMaterials[n++],H instanceof THREE.MeshFaceMaterial){D=0;for(K=J.faceMaterials.length;D<K;)(H=J.faceMaterials[D++])&&H.opacity!=0&&e(w,C,z,y,J,H,b)}else H&&H.opacity!=0&&e(w,C,z,y,J,H,b)}}};
+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,j=e.z+e.w,h=-b.z+b.w,k=-e.z+e.w;return g>=0&&j>=0&&h>=0&&k>=0?!0:g<0&&j<0||h<0&&k<0?!1:(g<0?c=Math.max(c,g/(g-j)):j<0&&(f=Math.min(f,g/(g-j))),h<0?c=Math.max(c,h/(h-k)):k<0&&(f=Math.min(f,h/(h-k))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,k=[],h,m,n=[],p,o,t=[],u,v=[],x,B,A=[],y,F,w=[],H=new THREE.Vector4,E=new THREE.Vector4,
+D=new THREE.Matrix4,S=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,U=new THREE.Vector4;this.projectVector=function(b,e){D.multiply(e.projectionMatrix,e.matrixWorldInverse);D.multiplyVector3(b);return b};this.unprojectVector=function(b,e){D.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));D.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,n,j;g=0;n=
+b.objects;b=0;for(m=n.length;b<m;b++){j=n[b];var p;if(!(p=!j.visible))if(p=j instanceof THREE.Mesh){a:{p=void 0;for(var o=j.matrixWorld,t=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),u=0;u<6;u++)if(p=J[u].x*o.n14+J[u].y*o.n24+J[u].z*o.n34+J[u].w,p<=t){p=!1;break a}p=!0}p=!p}if(!p)p=k[g]=k[g]||new THREE.RenderableObject,g++,f=p,H.copy(j.position),D.multiplyVector3(H),f.object=j,f.z=H.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,k){var H=[],
+R=g.near,j=g.far,fa,P,da,ca,Y,ea,ga,la,pa,N,ia,Z,ma,$,I,V,oa;F=B=u=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);D.multiply(g.projectionMatrix,g.matrixWorldInverse);J[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);J[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);J[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);J[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);J[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);J[5].set(D.n41+D.n31,D.n42+
+D.n32,D.n43+D.n33,D.n44+D.n34);for(fa=0;fa<6;fa++)pa=J[fa],pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z));pa=this.projectObjects(f,g,!0);f=0;for(fa=pa.length;f<fa;f++)if(N=pa[f].object,N.visible)if(ia=N.matrixWorld,Z=N.matrixRotationWorld,ma=N.materials,$=N.overdraw,m=0,N instanceof THREE.Mesh){I=N.geometry;ca=I.vertices;V=I.faces;I=I.faceVertexUvs;P=0;for(da=ca.length;P<da;P++)h=b(),h.positionWorld.copy(ca[P].position),ia.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
+D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>R&&h.positionScreen.z<j;ca=0;for(P=V.length;ca<P;ca++){da=V[ca];if(da instanceof THREE.Face3)if(Y=n[da.a],ea=n[da.b],ga=n[da.c],Y.visible&&ea.visible&&ga.visible&&(N.doubleSided||N.flipSided!=(ga.positionScreen.x-Y.positionScreen.x)*(ea.positionScreen.y-Y.positionScreen.y)-(ga.positionScreen.y-Y.positionScreen.y)*(ea.positionScreen.x-Y.positionScreen.x)<0))la=
+t[o]=t[o]||new THREE.RenderableFace3,o++,p=la,p.v1.copy(Y),p.v2.copy(ea),p.v3.copy(ga);else continue;else if(da instanceof THREE.Face4)if(Y=n[da.a],ea=n[da.b],ga=n[da.c],la=n[da.d],Y.visible&&ea.visible&&ga.visible&&la.visible&&(N.doubleSided||N.flipSided!=((la.positionScreen.x-Y.positionScreen.x)*(ea.positionScreen.y-Y.positionScreen.y)-(la.positionScreen.y-Y.positionScreen.y)*(ea.positionScreen.x-Y.positionScreen.x)<0||(ea.positionScreen.x-ga.positionScreen.x)*(la.positionScreen.y-ga.positionScreen.y)-
+(ea.positionScreen.y-ga.positionScreen.y)*(la.positionScreen.x-ga.positionScreen.x)<0)))oa=v[u]=v[u]||new THREE.RenderableFace4,u++,p=oa,p.v1.copy(Y),p.v2.copy(ea),p.v3.copy(ga),p.v4.copy(la);else continue;p.normalWorld.copy(da.normal);Z.multiplyVector3(p.normalWorld);p.centroidWorld.copy(da.centroid);ia.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);D.multiplyVector3(p.centroidScreen);ga=da.vertexNormals;Y=0;for(ea=ga.length;Y<ea;Y++)la=p.vertexNormalsWorld[Y],la.copy(ga[Y]),
+Z.multiplyVector3(la);Y=0;for(ea=I.length;Y<ea;Y++)if(oa=I[Y][ca]){ga=0;for(la=oa.length;ga<la;ga++)p.uvs[Y][ga]=oa[ga]}p.meshMaterials=ma;p.faceMaterials=da.materials;p.overdraw=$;p.z=p.centroidScreen.z;H.push(p)}}else if(N instanceof THREE.Line){S.multiply(D,ia);ca=N.geometry.vertices;Y=b();Y.positionScreen.copy(ca[0].position);S.multiplyVector4(Y.positionScreen);P=1;for(da=ca.length;P<da;P++)if(Y=b(),Y.positionScreen.copy(ca[P].position),S.multiplyVector4(Y.positionScreen),ea=n[m-2],G.copy(Y.positionScreen),
+U.copy(ea.positionScreen),e(G,U))G.multiplyScalar(1/G.w),U.multiplyScalar(1/U.w),ia=A[B]=A[B]||new THREE.RenderableLine,B++,x=ia,x.v1.positionScreen.copy(G),x.v2.positionScreen.copy(U),x.z=Math.max(G.z,U.z),x.materials=N.materials,H.push(x)}else if(N instanceof THREE.Particle&&(E.set(N.matrixWorld.n14,N.matrixWorld.n24,N.matrixWorld.n34,1),D.multiplyVector4(E),E.z/=E.w,E.z>0&&E.z<1))ia=w[F]=w[F]||new THREE.RenderableParticle,F++,y=ia,y.x=E.x/E.w,y.y=E.y/E.w,y.z=E.z,y.rotation=N.rotation.z,y.scale.x=
+N.scale.x*Math.abs(y.x-(E.x+g.projectionMatrix.n11)/(E.w+g.projectionMatrix.n14)),y.scale.y=N.scale.y*Math.abs(y.y-(E.y+g.projectionMatrix.n22)/(E.w+g.projectionMatrix.n24)),y.materials=N.materials,H.push(y);k&&H.sort(c);return H}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var n,p,o,t,u,v,x,B;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(u=b[n],u instanceof THREE.RenderableParticle){x=u.x*g+g;B=u.y*k+k;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=x+"px",v.style.top=B+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)x.globalAlpha=y=b}function e(b){if(F!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}F=b}}function f(b){if(w!=b.hex)w=b.hex,x.strokeStyle="#"+k(w.toString(16))}function g(b){if(H!=b.hex)H=b.hex,x.fillStyle="#"+k(H.toString(16))}function k(b){for(;b.length<6;)b="0"+b;return b}
+var h=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,t,u,v,x=p.getContext("2d"),B=new THREE.Color(0),A=0,y=1,F=0,w=null,H=null,E=null,D=null,S=null,J,G,U,W,M=new THREE.RenderableVertex,X=new THREE.RenderableVertex,T,R,j,fa,P,da,ca,Y,ea,ga,la,pa,N=new THREE.Color(0),ia=new THREE.Color(0),Z=new THREE.Color(0),ma=new THREE.Color(0),$=new THREE.Color(0),I,V,oa,ha,na,wa,Aa,va,ya,Ma,qa=new THREE.Rectangle,sa=new THREE.Rectangle,ra=new THREE.Rectangle,
+Ba=!1,aa=new THREE.Color,L=new THREE.Color,ua=new THREE.Color,Q=new THREE.Color,ka=new THREE.Vector3,ja,Pa,Va,xa,Qa,Ra,b=16;ja=document.createElement("canvas");ja.width=ja.height=2;Pa=ja.getContext("2d");Pa.fillStyle="rgba(0,0,0,1)";Pa.fillRect(0,0,2,2);Va=Pa.getImageData(0,0,2,2);xa=Va.data;Qa=document.createElement("canvas");Qa.width=Qa.height=b;Ra=Qa.getContext("2d");Ra.translate(-b/2,-b/2);Ra.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;qa.set(-u,-v,u,v);y=1;F=0;S=D=E=H=w=null};this.setClearColor=function(b,e){B=b;A=e};this.setClearColorHex=function(b,e){B.setHex(b);A=e};this.clear=function(){x.setTransform(1,0,0,-1,u,v);if(!sa.isEmpty())sa.inflate(1),sa.minSelf(qa),B.hex==0&&A==0?x.clearRect(sa.getX(),sa.getY(),sa.getWidth(),sa.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*
+255)+","+A+")",x.fillRect(sa.getX(),sa.getY(),sa.getWidth(),sa.getHeight())),sa.empty()};this.render=function(b,k){function p(b){var e,c,f,g=b.lights;L.setRGB(0,0,0);ua.setRGB(0,0,0);Q.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(L.r+=f.r,L.g+=f.g,L.b+=f.b):c instanceof THREE.DirectionalLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):c instanceof THREE.PointLight&&(Q.r+=f.r,Q.g+=f.g,Q.b+=f.b)}function o(b,e,c,f){var g,j,h,k,m=b.lights,b=0;for(g=m.length;b<g;b++)j=
+m[b],h=j.color,j instanceof THREE.DirectionalLight?(k=c.dot(j.position),k<=0||(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)):j instanceof THREE.PointLight&&(k=c.dot(ka.sub(j.position,e).normalize()),k<=0||(k*=j.distance==0?1:1-Math.min(e.distanceTo(j.position)/j.distance,1),k!=0&&(k*=j.intensity,f.r+=h.r*k,f.g+=h.g*k,f.b+=h.b*k)))}function t(b,j,h){c(h.opacity);e(h.blending);var k,m,p,n,o,ja;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)n=h.map.image,o=n.width>>1,ja=n.height>>1,h=j.scale.x*
+u,p=j.scale.y*v,k=h*o,m=p*ja,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),qa.instersects(ra)&&(x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(h,-p),x.translate(-o,-ja),x.drawImage(n,0,0),x.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=j.scale.x*u,m=j.scale.y*v,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),qa.instersects(ra)&&(f(h.color),g(h.color),x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(k,m),h.program(x),x.restore()))}function y(b,g,j,h){c(h.opacity);e(h.blending);x.beginPath();
+x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(g.positionScreen.x,g.positionScreen.y);x.closePath();if(h instanceof THREE.LineBasicMaterial){b=h.linewidth;if(E!=b)x.lineWidth=E=b;b=h.linecap;if(D!=b)x.lineCap=D=b;b=h.linejoin;if(S!=b)x.lineJoin=S=b;f(h.color);x.stroke();ra.inflate(h.linewidth*2)}}function A(b,f,g,m,p,n,ja,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);T=b.positionScreen.x;R=b.positionScreen.y;j=f.positionScreen.x;fa=f.positionScreen.y;P=g.positionScreen.x;
+da=g.positionScreen.y;B(T,R,j,fa,P,da);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,R,j,fa,P,da,t.map.image,ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,ka.copy(ja.vertexNormalsWorld[0]),na=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,wa=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[1]),Aa=(ka.x*b.n11+
+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,va=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,ka.copy(ja.vertexNormalsWorld[2]),ya=(ka.x*b.n11+ka.y*b.n12+ka.z*b.n13)*0.5+0.5,Ma=-(ka.x*b.n21+ka.y*b.n22+ka.z*b.n23)*0.5+0.5,Ca(T,R,j,fa,P,da,t.envMap.image,na,wa,Aa,va,ya,Ma)}else t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ha=ja.uvs[0],Ca(T,R,j,fa,P,da,t.map.image,
+ha[m].u,ha[m].v,ha[p].u,ha[p].v,ha[n].u,ha[n].v)),e(THREE.SubtractiveBlending)),Ba?!t.wireframe&&t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==3?(ia.r=Z.r=ma.r=L.r,ia.g=Z.g=ma.g=L.g,ia.b=Z.b=ma.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],ma),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,1)):(aa.r=L.r,aa.g=L.g,
+aa.b=L.b,o(u,ja.centroidWorld,ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=Z.g=Z.b=1-Ia(f.positionScreen.z,
+I,V),ma.r=ma.g=ma.b=1-Ia(g.positionScreen.z,I,V),$.r=(Z.r+ma.r)*0.5,$.g=(Z.g+ma.g)*0.5,$.b=(Z.b+ma.b)*0.5,oa=Sa(ia,Z,ma,$),Ca(T,R,j,fa,P,da,oa,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),N.b=Na(ja.normalWorld.z),N.updateHex(),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)}function w(b,f,g,m,p,n,ja,t,u){h.data.vertices+=4;h.data.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,m,0,1,3,ja,
+t,u),A(p,g,n,1,2,3,ja,t,u);else if(T=b.positionScreen.x,R=b.positionScreen.y,j=f.positionScreen.x,fa=f.positionScreen.y,P=g.positionScreen.x,da=g.positionScreen.y,ca=m.positionScreen.x,Y=m.positionScreen.y,ea=p.positionScreen.x,ga=p.positionScreen.y,la=n.positionScreen.x,pa=n.positionScreen.y,t instanceof THREE.MeshBasicMaterial)F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color);else if(t instanceof THREE.MeshLambertMaterial)Ba?!t.wireframe&&
+t.shading==THREE.SmoothShading&&ja.vertexNormalsWorld.length==4?(ia.r=Z.r=ma.r=$.r=L.r,ia.g=Z.g=ma.g=$.g=L.g,ia.b=Z.b=ma.b=$.b=L.b,o(u,ja.v1.positionWorld,ja.vertexNormalsWorld[0],ia),o(u,ja.v2.positionWorld,ja.vertexNormalsWorld[1],Z),o(u,ja.v4.positionWorld,ja.vertexNormalsWorld[3],ma),o(u,ja.v3.positionWorld,ja.vertexNormalsWorld[2],$),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)):(aa.r=L.r,aa.g=L.g,aa.b=L.b,o(u,ja.centroidWorld,
+ja.normalWorld,aa),N.r=Math.max(0,Math.min(t.color.r*aa.r,1)),N.g=Math.max(0,Math.min(t.color.g*aa.g,1)),N.b=Math.max(0,Math.min(t.color.b*aa.b,1)),N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N)):(F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(t.color));else if(t instanceof THREE.MeshNormalMaterial)N.r=Na(ja.normalWorld.x),N.g=Na(ja.normalWorld.y),N.b=Na(ja.normalWorld.z),
+N.updateHex(),F(T,R,j,fa,P,da,ca,Y),t.wireframe?H(N,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ea(N);else if(t instanceof THREE.MeshDepthMaterial)I=k.near,V=k.far,ia.r=ia.g=ia.b=1-Ia(b.positionScreen.z,I,V),Z.r=Z.g=Z.b=1-Ia(f.positionScreen.z,I,V),ma.r=ma.g=ma.b=1-Ia(m.positionScreen.z,I,V),$.r=$.g=$.b=1-Ia(g.positionScreen.z,I,V),oa=Sa(ia,Z,ma,$),B(T,R,j,fa,ca,Y),Ca(T,R,j,fa,ca,Y,oa,0,0,1,0,0,1),B(ea,ga,P,da,la,pa),Ca(ea,ga,P,da,la,pa,oa,1,0,1,1,0,1)}function B(b,e,c,f,g,j){x.beginPath();
+x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(b,e);x.closePath()}function F(b,e,c,f,g,j,h,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,j);x.lineTo(h,k);x.lineTo(b,e);x.closePath()}function H(b,e,c,g){if(E!=e)x.lineWidth=E=e;if(D!=c)x.lineCap=D=c;if(S!=g)x.lineJoin=S=g;f(b);x.stroke();ra.inflate(e*2)}function Ea(b){g(b);x.fill()}function Ca(b,e,c,f,g,j,h,k,m,t,p,n,ja){var o,u;o=h.width-1;u=h.height-1;k*=o;m*=u;t*=o;p*=u;n*=o;ja*=u;c-=b;f-=e;g-=b;j-=e;t-=k;p-=m;n-=k;ja-=m;o=t*ja-n*p;
+o!=0&&(u=1/o,o=(ja*c-p*g)*u,p=(ja*f-p*j)*u,c=(t*g-n*c)*u,f=(t*j-n*f)*u,b=b-o*k-c*m,e=e-p*k-f*m,x.save(),x.transform(o,p,c,f,b,e),x.clip(),x.drawImage(h,0,0),x.restore())}function Sa(b,e,c,f){var g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),n=~~(f.g*255),f=~~(f.b*255);xa[0]=g<0?0:g>255?255:g;xa[1]=j<0?0:j>255?255:j;xa[2]=b<0?0:b>255?255:b;xa[4]=h<0?0:h>255?255:h;xa[5]=k<0?0:k>255?255:k;xa[6]=e<0?0:e>255?
+255:e;xa[8]=m<0?0:m>255?255:m;xa[9]=t<0?0:t>255?255:t;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=n<0?0:n>255?255:n;xa[14]=f<0?0:f>255?255:f;Pa.putImageData(Va,0,0);Ra.drawImage(ja,0,0);return Qa}function Ia(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Na(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Fa(b,e){var c=e.x-b.x,f=e.y-b.y,g=1/Math.sqrt(c*c+f*f);c*=g;f*=g;e.x+=c;e.y+=f;b.x-=c;b.y-=f}var Ta,C,K,z,Ga,Oa,Ua,ta;this.autoClear?this.clear():x.setTransform(1,0,0,-1,u,v);h.data.vertices=
+0;h.data.faces=0;m=n.projectScene(b,k,this.sortElements);(Ba=b.lights.length>0)&&p(b);Ta=0;for(C=m.length;Ta<C;Ta++){K=m[Ta];ra.empty();if(K instanceof THREE.RenderableParticle){J=K;J.x*=u;J.y*=v;z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&t(J,K,ta,b)}else if(K instanceof THREE.RenderableLine){if(J=K.v1,G=K.v2,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,ra.addPoint(J.positionScreen.x,J.positionScreen.y),ra.addPoint(G.positionScreen.x,
+G.positionScreen.y),qa.instersects(ra)){z=0;for(Ga=K.materials.length;z<Ga;)ta=K.materials[z++],ta.opacity!=0&&y(J,G,K,ta,b)}}else if(K instanceof THREE.RenderableFace3){if(J=K.v1,G=K.v2,U=K.v3,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=v,U.positionScreen.x*=u,U.positionScreen.y*=v,K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,U.positionScreen),Fa(U.positionScreen,J.positionScreen)),ra.add3Points(J.positionScreen.x,J.positionScreen.y,
+G.positionScreen.x,G.positionScreen.y,U.positionScreen.x,U.positionScreen.y),qa.instersects(ra)){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}else ta.opacity!=0&&A(J,G,U,0,1,2,K,ta,b)}}else if(K instanceof THREE.RenderableFace4&&(J=K.v1,G=K.v2,U=K.v3,W=K.v4,J.positionScreen.x*=u,J.positionScreen.y*=v,G.positionScreen.x*=u,G.positionScreen.y*=
+v,U.positionScreen.x*=u,U.positionScreen.y*=v,W.positionScreen.x*=u,W.positionScreen.y*=v,M.positionScreen.copy(G.positionScreen),X.positionScreen.copy(W.positionScreen),K.overdraw&&(Fa(J.positionScreen,G.positionScreen),Fa(G.positionScreen,W.positionScreen),Fa(W.positionScreen,J.positionScreen),Fa(U.positionScreen,M.positionScreen),Fa(U.positionScreen,X.positionScreen)),ra.addPoint(J.positionScreen.x,J.positionScreen.y),ra.addPoint(G.positionScreen.x,G.positionScreen.y),ra.addPoint(U.positionScreen.x,
+U.positionScreen.y),ra.addPoint(W.positionScreen.x,W.positionScreen.y),qa.instersects(ra))){z=0;for(Ga=K.meshMaterials.length;z<Ga;)if(ta=K.meshMaterials[z++],ta instanceof THREE.MeshFaceMaterial){Oa=0;for(Ua=K.faceMaterials.length;Oa<Ua;)(ta=K.faceMaterials[Oa++])&&ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}else ta.opacity!=0&&w(J,G,U,W,M,X,K,ta,b)}sa.addRectangle(ra)}x.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(W.sub(j.position,e.centroidWorld),W.normalize(),h=e.normalWorld.dot(W)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,j,m,t,n){h.data.vertices+=3;h.data.faces++;T=f(R++);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");t instanceof THREE.MeshBasicMaterial?E.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?H?(D.r=S.r,D.g=S.g,D.b=S.b,b(n,m,D),E.r=Math.max(0,Math.min(t.color.r*D.r,1)),E.g=Math.max(0,Math.min(t.color.g*D.g,1)),E.b=Math.max(0,Math.min(t.color.b*D.b,1)),E.updateHex()):E.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(U=1-t.__2near/(t.__farPlusNear-
+m.z*t.__farMinusNear),E.setRGB(U,U,U)):t instanceof THREE.MeshNormalMaterial&&E.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));t.wireframe?T.setAttribute("style","fill: none; stroke: #"+k(E.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):T.setAttribute("style","fill: #"+k(E.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(T)}function e(e,c,j,m,
+t,n,o){h.data.vertices+=4;h.data.faces++;T=f(R++);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");n instanceof THREE.MeshBasicMaterial?E.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?H?(D.r=S.r,D.g=S.g,D.b=S.b,b(o,t,D),E.r=Math.max(0,Math.min(n.color.r*D.r,1)),E.g=Math.max(0,Math.min(n.color.g*D.g,1)),E.b=Math.max(0,Math.min(n.color.b*
+D.b,1)),E.updateHex()):E.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(U=1-n.__2near/(n.__farPlusNear-t.z*n.__farMinusNear),E.setRGB(U,U,U)):n instanceof THREE.MeshNormalMaterial&&E.setRGB(g(t.normalWorld.x),g(t.normalWorld.y),g(t.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: #"+k(E.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style",
+"fill: #"+k(E.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(T)}function f(b){M[b]==null&&(M[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),fa==0&&M[b].setAttribute("shape-rendering","crispEdges"));return M[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,v,x,B,A,y,F=new THREE.Rectangle,w=new THREE.Rectangle,
+H=!1,E=new THREE.Color(16777215),D=new THREE.Color(16777215),S=new THREE.Color(0),J=new THREE.Color(0),G=new THREE.Color(0),U,W=new THREE.Vector3,M=[],X=[],T,R,j,fa=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":fa=1;break;case "low":fa=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);F.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,E,D,U,N,M;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=n.projectScene(b,f,this.sortElements);j=R=0;if(H=b.lights.length>0){N=b.lights;S.setRGB(0,0,0);J.setRGB(0,0,0);G.setRGB(0,0,0);g=0;for(t=N.length;g<t;g++)o=N[g],E=o.color,o instanceof THREE.AmbientLight?(S.r+=E.r,S.g+=E.g,S.b+=E.b):o instanceof THREE.DirectionalLight?(J.r+=E.r,J.g+=E.g,J.b+=E.b):o instanceof
+THREE.PointLight&&(G.r+=E.r,G.g+=E.g,G.b+=E.b)}g=0;for(t=m.length;g<t;g++)if(N=m[g],w.empty(),N instanceof THREE.RenderableParticle){x=N;x.x*=u;x.y*=-v;o=0;for(E=N.materials.length;o<E;)o++}else if(N instanceof THREE.RenderableLine){if(x=N.v1,B=N.v2,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,w.addPoint(x.positionScreen.x,x.positionScreen.y),w.addPoint(B.positionScreen.x,B.positionScreen.y),F.instersects(w)){o=0;for(E=N.materials.length;o<E;)if((M=N.materials[o++])&&
+M.opacity!=0){D=x;U=B;var W=j++;X[W]==null&&(X[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),fa==0&&X[W].setAttribute("shape-rendering","crispEdges"));T=X[W];T.setAttribute("x1",D.positionScreen.x);T.setAttribute("y1",D.positionScreen.y);T.setAttribute("x2",U.positionScreen.x);T.setAttribute("y2",U.positionScreen.y);M instanceof THREE.LineBasicMaterial&&(T.setAttribute("style","fill: none; stroke: ##"+k(M.color.hex.toString(16))+"; stroke-width: "+M.linewidth+"; stroke-opacity: "+
+M.opacity+"; stroke-linecap: "+M.linecap+"; stroke-linejoin: "+M.linejoin),p.appendChild(T))}}}else if(N instanceof THREE.RenderableFace3){if(x=N.v1,B=N.v2,A=N.v3,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,w.addPoint(x.positionScreen.x,x.positionScreen.y),w.addPoint(B.positionScreen.x,B.positionScreen.y),w.addPoint(A.positionScreen.x,A.positionScreen.y),F.instersects(w)){o=0;for(E=N.meshMaterials.length;o<
+E;)if(M=N.meshMaterials[o++],M instanceof THREE.MeshFaceMaterial){D=0;for(U=N.faceMaterials.length;D<U;)(M=N.faceMaterials[D++])&&M.opacity!=0&&c(x,B,A,N,M,b)}else M&&M.opacity!=0&&c(x,B,A,N,M,b)}}else if(N instanceof THREE.RenderableFace4&&(x=N.v1,B=N.v2,A=N.v3,y=N.v4,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,A.positionScreen.x*=u,A.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,w.addPoint(x.positionScreen.x,x.positionScreen.y),w.addPoint(B.positionScreen.x,
+B.positionScreen.y),w.addPoint(A.positionScreen.x,A.positionScreen.y),w.addPoint(y.positionScreen.x,y.positionScreen.y),F.instersects(w))){o=0;for(E=N.meshMaterials.length;o<E;)if(M=N.meshMaterials[o++],M instanceof THREE.MeshFaceMaterial){D=0;for(U=N.faceMaterials.length;D<U;)(M=N.faceMaterials[D++])&&M.opacity!=0&&e(x,B,A,y,N,M,b)}else M&&M.opacity!=0&&e(x,B,A,y,N,M,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -218,120 +218,124 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderC
 THREE.ShaderChunk.morphtarget_pars_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.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,t=b.colors,o=t.length,p=b.__vertexArray,n=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors;if(c.sortParticles){Z.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=k[f].position,la.copy(g),Z.multiplyVector3(la),u[f]=[la.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,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;for(f=0;f<o;f++)h=f*3,color=t[u[f][1]],n[h]=color.r,n[h+1]=color.g,
-n[h+2]=color.b}else{if(v)for(f=0;f<m;f++)g=k[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(w)for(f=0;f<o;f++)color=t[f],h=f*3,n[h]=color.r,n[h+1]=color.g,n[h+2]=color.b}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,p,e);if(w||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,n,e)}function e(b,e,c,f,g){f.program||fa.initMaterial(f,e,c,g);var h=f.program,k=h.uniforms,m=f.uniforms;h!=V&&(j.useProgram(h),
-V=h);j.uniformMatrix4fv(k.projectionMatrix,!1,N);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 t,
-o,p=0,n=0,u=0,v,w,y,z,x=ta,C=x.directional.colors,G=x.directional.positions,F=x.point.colors,D=x.point.positions,Z=x.point.distances,B=0,E=0,c=o=z=0;for(t=e.length;c<t;c++)if(o=e[c],v=o.color,w=o.position,y=o.intensity,z=o.distance,o instanceof THREE.AmbientLight)p+=v.r,n+=v.g,u+=v.b;else if(o instanceof THREE.DirectionalLight)z=B*3,C[z]=v.r*y,C[z+1]=v.g*y,C[z+2]=v.b*y,G[z]=w.x,G[z+1]=w.y,G[z+2]=w.z,B+=1;else if(o instanceof THREE.PointLight)o=E*3,F[o]=v.r*y,F[o+1]=v.g*y,F[o+2]=v.b*y,D[o]=w.x,D[o+
-1]=w.y,D[o+2]=w.z,Z[E]=z,E+=1;for(c=B*3;c<C.length;c++)C[c]=0;for(c=E*3;c<F.length;c++)F[c]=0;x.point.length=E;x.directional.length=B;x.ambient[0]=p;x.ambient[1]=n;x.ambient[2]=u;c=ta;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;
-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=va.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 L in m)if(n=h.uniforms[L])if(t=m[L],p=t.type,c=t.value,p=="i")j.uniform1i(n,c);else if(p=="f")j.uniform1f(n,c);else if(p=="fv1")j.uniform1fv(n,c);else if(p=="fv")j.uniform3fv(n,c);else if(p=="v2")j.uniform2f(n,c.x,c.y);else if(p=="v3")j.uniform3f(n,c.x,c.y,c.z);else if(p=="v4")j.uniform4f(n,c.x,c.y,c.z,c.w);else if(p=="c")j.uniform3f(n,c.r,c.g,c.b);else if(p=="t"&&(j.uniform1i(n,c),t=t.texture))if(t.image instanceof Array&&t.image.length==
-6){if(t.image.length==6){if(t.needsUpdate){if(t.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);for(p=0;p<6;++p)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,j.RGBA,j.UNSIGNED_BYTE,t.image[p])}else{t.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);for(p=0;p<6;++p)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,t.image[p]);t.__webglInit=!0}P(j.TEXTURE_CUBE_MAP,t,t.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,
-null);t.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}}else I(t,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,ka);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,ka);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,ka),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,t=k.morphTargetForcedOrder,p=k.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<t.length;)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=p[t[f]],f++;else{var t=[],o=-1,
-n=0,p=k.morphTargetInfluences,u,v=p.length,f=0;for(k.morphTargetBase!==-1&&(t[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!t[u]&&p[u]>o&&(n=u,o=p[n]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=o;t[n]=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,
-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.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),fa.data.vertices+=h.__webglFaceCount,fa.data.faces+=h.__webglFaceCount/3,fa.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),fa.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),fa.data.drawCalls++):k instanceof
-THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),fa.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,g,h,k,m,t,p,o,n,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],h=c[u+2],k=c[u+3],t=c[u+4],o=c[u+5],m=c[u+6],p=c[u+7],n=c[u+8],f=(f+k+m)/3,g=(g+t+p)/3,h=(h+o+n)/3,c[u]=f,c[u+1]=g,c[u+2]=h,c[u+3]=f,c[u+4]=g,c[u+5]=h,c[u+6]=f,c[u+7]=g,c[u+8]=h}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 k(b){if(ea!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ea=b.doubleSided;if(Y!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),Y=b.flipSided}function h(b){ca!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ca=b)}function m(b,e,c){ha!=b&&(b?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ha=b);if(b&&(na!=e||ia!=c))j.polygonOffset(e,c),na=e,ia=c}function o(b){ja[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,
-b.n44-b.n14);ja[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ja[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ja[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ja[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ja[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=ja[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(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=ja[f].x*e.n14+ja[f].y*e.n24+ja[f].z*e.n34+ja[f].w,b<=c)return!1;return!0}function n(b,e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?n(h,c):n(g,c)}function u(b){var e,c,f,g,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=
-j.materials.length;e<c;e++)(g=j.materials[e])&&(g.transparent?n(m,g):n(k,g))}else(g=e)&&(g.transparent?n(m,g):n(k,g))}function v(b,e){return e.z-b.z}function w(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,g=b.lights,h=[],k,m,t,p,o,n=b.__webglShadowVolumes.length;
-for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(o=0;o<n;o++)f=b.__webglShadowVolumes[o].object,k=b.__webglShadowVolumes[o].buffer,m=f.materials[0],m.program||fa.initMaterial(m,g,void 0,f),m=m.program,t=m.uniforms,p=m.attributes,V!==m&&(j.useProgram(m),V=m,j.uniformMatrix4fv(t.projectionMatrix,!1,N),j.uniformMatrix4fv(t.viewMatrix,!1,ka),j.uniform3fv(t.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),
-j.uniformMatrix4fv(t.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);ca=T=-1;V=S.program;j.useProgram(S.program);j.uniformMatrix4fv(S.projectionLocation,!1,N);j.uniform1f(S.darknessLocation,S.darkness);j.bindBuffer(j.ARRAY_BUFFER,S.vertexBuffer);j.vertexAttribPointer(S.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(S.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,S.elementBuffer);
-j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(O)}function C(b,e){var c,f,g;c=R.attributes;var h=R.uniforms,k=W/X,m,t=[],o=X*0.5,p=W*0.5,n=!0;j.useProgram(R.program);V=R.program;ca=T=-1;Ca||(j.enableVertexAttribArray(R.attributes.position),j.enableVertexAttribArray(R.attributes.uv),Ca=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,R.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,R.elementBuffer);j.uniformMatrix4fv(h.projectionMatrix,!1,N);j.activeTexture(j.TEXTURE0);j.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],
-g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(j.uniform1i(h.useScreenCoordinates,1),j.uniform3f(h.screenPosition,(g.position.x-o)/o,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(j.uniform1i(h.useScreenCoordinates,0),j.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),j.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.scaleByViewport?W:1),t[0]=m*k*g.scale.x,t[1]=m*g.scale.y,j.uniform2f(h.uvScale,g.uvScale.x,
-g.uvScale.y),j.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),j.uniform2f(h.alignment,g.alignment.x,g.alignment.y),j.uniform1f(h.opacity,g.opacity),j.uniform1f(h.rotation,g.rotation),j.uniform2fv(h.scale,t),g.mergeWith3D&&!n?(j.enable(j.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(j.disable(j.DEPTH_TEST),n=!1),D(g.blending),I(g.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(O)}function z(b,e){var c,f,g=b.__webglLensFlares.length,h,k,m,t=
-new THREE.Vector3,o=W/X,p=X*0.5,n=W*0.5,u=16/W,v=[u*o,u],w=[1,1,0],y=[1,1],z=Q.uniforms;c=Q.attributes;j.useProgram(Q.program);V=Q.program;ca=T=-1;oa||(j.enableVertexAttribArray(Q.attributes.vertex),j.enableVertexAttribArray(Q.attributes.uv),oa=!0);j.uniform1i(z.occlusionMap,0);j.uniform1i(z.map,1);j.bindBuffer(j.ARRAY_BUFFER,Q.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,Q.elementBuffer);j.disable(j.CULL_FACE);
-j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,Q.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<g;f++)if(c=b.__webglLensFlares[f].object,t.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(t),e.projectionMatrix.multiplyVector3(t),w[0]=t.x,w[1]=t.y,w[2]=t.z,y[0]=w[0]*p+p,y[1]=w[1]*n+n,Q.hasVertexTexture||y[0]>0&&y[0]<X&&y[1]>0&&y[1]<W){j.bindTexture(j.TEXTURE_2D,Q.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,y[0]-
-8,y[1]-8,16,16,0);j.uniform1i(z.renderType,0);j.uniform2fv(z.scale,v);j.uniform3fv(z.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,Q.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,y[0]-8,y[1]-8,16,16,0);j.uniform1i(z.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,Q.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(z.renderType,2);j.enable(j.BLEND);h=0;for(k=c.lensFlares.length;h<k;h++)if(m=c.lensFlares[h],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/W,v[0]=u*o,v[1]=u,j.uniform3fv(z.screenPosition,w),j.uniform2fv(z.scale,v),j.uniform1f(z.rotation,m.rotation),j.uniform1f(z.opacity,m.opacity),D(m.blending),I(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);
-j.depthMask(O)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function G(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups){g=f.geometryGroups[e];a:{for(var k=h=void 0,m=void 0,t=void 0,o=void 0,o=g.__materials,k=0,m=o.length;k<m;k++)if(t=o[k],t.attributes)for(h in t.attributes)if(t.attributes[h].needsUpdate){h=!0;
-break a}h=!1}if(f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h)if(h=g,k=b,m=j.DYNAMIC_DRAW,h.__inittedArrays){var p=o=t=void 0,n=void 0,u=p=void 0,v=void 0,w=void 0,y=void 0,z=void 0,x=void 0,C=void 0,G=void 0,F=void 0,D=void 0,B=void 0,Z=void 0,L=void 0,E=n=y=n=w=v=void 0,N=void 0,A=N=E=v=void 0,I=void 0,H=A=N=E=p=p=u=y=n=A=N=E=I=A=N=E=I=A=N=E=void 0,K=0,J=0,O=0,R=0,ka=0,Q=0,P=0,la=0,T=0,M=0,S=0,N=E=0,U=h.__vertexArray,
-da=h.__uvArray,fa=h.__uv2Array,ea=h.__normalArray,V=h.__tangentArray,$=h.__colorArray,W=h.__skinVertexAArray,X=h.__skinVertexBArray,Y=h.__skinIndexArray,ca=h.__skinWeightArray,ja=h.__morphTargetsArrays,ta=h.__webglCustomAttributes,A=void 0,ga=h.__faceArray,ha=h.__lineArray,na=h.__needsSmoothNormals,x=h.__vertexColorType,z=h.__uvType,C=h.__normalType,ia=k.geometry,va=ia.__dirtyVertices,ua=ia.__dirtyElements,oa=ia.__dirtyUvs,qa=ia.__dirtyNormals,Ba=ia.__dirtyTangents,wa=ia.__dirtyColors,za=ia.__dirtyMorphTargets,
-ya=ia.vertices,Ca=h.faces,Za=ia.faces,Xa=ia.faceVertexUvs[0],Ya=ia.faceVertexUvs[1],Ka=ia.skinVerticesA,La=ia.skinVerticesB,Ma=ia.skinIndices,Fa=ia.skinWeights,Ia=k instanceof THREE.ShadowVolume?ia.edgeFaces:void 0,Da=ia.morphTargets;if(ta)for(H in ta)ta[H].offset=0,ta[H].offsetSrc=0;t=0;for(o=Ca.length;t<o;t++)if(p=Ca[t],n=Za[p],Xa&&(G=Xa[p]),Ya&&(F=Ya[p]),p=n.vertexNormals,u=n.normal,v=n.vertexColors,w=n.color,y=n.vertexTangents,n instanceof THREE.Face3){if(va)D=ya[n.a].position,B=ya[n.b].position,
-Z=ya[n.c].position,U[J]=D.x,U[J+1]=D.y,U[J+2]=D.z,U[J+3]=B.x,U[J+4]=B.y,U[J+5]=B.z,U[J+6]=Z.x,U[J+7]=Z.y,U[J+8]=Z.z,J+=9;if(ta)for(H in ta)if(A=ta[H],A.__original.needsUpdate)E=A.offset,N=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E+0]=A.value[n.a],A.array[E+1]=A.value[n.b],A.array[E+2]=A.value[n.c]):A.boundTo==="faces"?(A.array[E+0]=A.value[N],A.array[E+1]=A.value[N],A.array[E+2]=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E+0]=A.value[N+0],A.array[E+
-1]=A.value[N+1],A.array[E+2]=A.value[N+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(D=A.value[n.a],B=A.value[n.b],Z=A.value[n.c]):A.boundTo==="faces"?(D=A.value[N],B=A.value[N],Z=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(D=A.value[N+0],B=A.value[N+1],Z=A.value[N+2],A.offsetSrc+=3),A.size===2?(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=B.x,A.array[E+3]=B.y,A.array[E+4]=Z.x,A.array[E+5]=Z.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[E+0]=D.r,A.array[E+
-1]=D.g,A.array[E+2]=D.b,A.array[E+3]=B.r,A.array[E+4]=B.g,A.array[E+5]=B.b,A.array[E+6]=Z.r,A.array[E+7]=Z.g,A.array[E+8]=Z.b):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=B.x,A.array[E+4]=B.y,A.array[E+5]=B.z,A.array[E+6]=Z.x,A.array[E+7]=Z.y,A.array[E+8]=Z.z),A.offset+=9):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=B.x,A.array[E+5]=B.y,A.array[E+6]=B.z,A.array[E+7]=B.w,A.array[E+8]=Z.x,A.array[E+9]=Z.y,A.array[E+10]=Z.z,A.array[E+11]=Z.w,
-A.offset+=12));if(za){E=0;for(N=Da.length;E<N;E++)D=Da[E].vertices[n.a].position,B=Da[E].vertices[n.b].position,Z=Da[E].vertices[n.c].position,A=ja[E],A[S+0]=D.x,A[S+1]=D.y,A[S+2]=D.z,A[S+3]=B.x,A[S+4]=B.y,A[S+5]=B.z,A[S+6]=Z.x,A[S+7]=Z.y,A[S+8]=Z.z;S+=9}if(Fa.length)E=Fa[n.a],N=Fa[n.b],A=Fa[n.c],ca[M]=E.x,ca[M+1]=E.y,ca[M+2]=E.z,ca[M+3]=E.w,ca[M+4]=N.x,ca[M+5]=N.y,ca[M+6]=N.z,ca[M+7]=N.w,ca[M+8]=A.x,ca[M+9]=A.y,ca[M+10]=A.z,ca[M+11]=A.w,E=Ma[n.a],N=Ma[n.b],A=Ma[n.c],Y[M]=E.x,Y[M+1]=E.y,Y[M+2]=E.z,
-Y[M+3]=E.w,Y[M+4]=N.x,Y[M+5]=N.y,Y[M+6]=N.z,Y[M+7]=N.w,Y[M+8]=A.x,Y[M+9]=A.y,Y[M+10]=A.z,Y[M+11]=A.w,E=Ka[n.a],N=Ka[n.b],A=Ka[n.c],W[M]=E.x,W[M+1]=E.y,W[M+2]=E.z,W[M+3]=1,W[M+4]=N.x,W[M+5]=N.y,W[M+6]=N.z,W[M+7]=1,W[M+8]=A.x,W[M+9]=A.y,W[M+10]=A.z,W[M+11]=1,E=La[n.a],N=La[n.b],A=La[n.c],X[M]=E.x,X[M+1]=E.y,X[M+2]=E.z,X[M+3]=1,X[M+4]=N.x,X[M+5]=N.y,X[M+6]=N.z,X[M+7]=1,X[M+8]=A.x,X[M+9]=A.y,X[M+10]=A.z,X[M+11]=1,M+=12;if(wa&&x)v.length==3&&x==THREE.VertexColors?(n=v[0],E=v[1],N=v[2]):N=E=n=w,$[T]=n.r,
-$[T+1]=n.g,$[T+2]=n.b,$[T+3]=E.r,$[T+4]=E.g,$[T+5]=E.b,$[T+6]=N.r,$[T+7]=N.g,$[T+8]=N.b,T+=9;if(Ba&&ia.hasTangents)v=y[0],w=y[1],n=y[2],V[P]=v.x,V[P+1]=v.y,V[P+2]=v.z,V[P+3]=v.w,V[P+4]=w.x,V[P+5]=w.y,V[P+6]=w.z,V[P+7]=w.w,V[P+8]=n.x,V[P+9]=n.y,V[P+10]=n.z,V[P+11]=n.w,P+=12;if(qa&&C)if(p.length==3&&na)for(y=0;y<3;y++)u=p[y],ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;else for(y=0;y<3;y++)ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;if(oa&&G!==void 0&&z)for(y=0;y<3;y++)p=G[y],da[O]=p.u,da[O+1]=p.v,O+=2;if(oa&&
-F!==void 0&&z)for(y=0;y<3;y++)p=F[y],fa[R]=p.u,fa[R+1]=p.v,R+=2;ua&&(ga[ka]=K,ga[ka+1]=K+1,ga[ka+2]=K+2,ka+=3,ha[la]=K,ha[la+1]=K+1,ha[la+2]=K,ha[la+3]=K+2,ha[la+4]=K+1,ha[la+5]=K+2,la+=6,K+=3)}else if(n instanceof THREE.Face4){if(va)D=ya[n.a].position,B=ya[n.b].position,Z=ya[n.c].position,L=ya[n.d].position,U[J]=D.x,U[J+1]=D.y,U[J+2]=D.z,U[J+3]=B.x,U[J+4]=B.y,U[J+5]=B.z,U[J+6]=Z.x,U[J+7]=Z.y,U[J+8]=Z.z,U[J+9]=L.x,U[J+10]=L.y,U[J+11]=L.z,J+=12;if(ta)for(H in ta)if(A=ta[H],A.__original.needsUpdate)E=
-A.offset,N=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E+0]=A.value[n.a],A.array[E+1]=A.value[n.b],A.array[E+2]=A.value[n.c],A.array[E+3]=A.value[n.d]):A.boundTo==="faces"?(A.array[E+0]=A.value[N],A.array[E+1]=A.value[N],A.array[E+2]=A.value[N],A.array[E+3]=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E+0]=A.value[N+0],A.array[E+1]=A.value[N+1],A.array[E+2]=A.value[N+2],A.array[E+3]=A.value[N+3],A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo===
-"vertices"?(D=A.value[n.a],B=A.value[n.b],Z=A.value[n.c],L=A.value[n.d]):A.boundTo==="faces"?(D=A.value[N],B=A.value[N],Z=A.value[N],L=A.value[N],A.offsetSrc++):A.boundTo==="faceVertices"&&(D=A.value[N+0],B=A.value[N+1],Z=A.value[N+2],L=A.value[N+3],A.offsetSrc+=4),A.size===2?(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=B.x,A.array[E+3]=B.y,A.array[E+4]=Z.x,A.array[E+5]=Z.y,A.array[E+6]=L.x,A.array[E+7]=L.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[E+0]=D.r,A.array[E+1]=D.g,A.array[E+2]=D.b,
-A.array[E+3]=B.r,A.array[E+4]=B.g,A.array[E+5]=B.b,A.array[E+6]=Z.r,A.array[E+7]=Z.g,A.array[E+8]=Z.b,A.array[E+9]=L.r,A.array[E+10]=L.g,A.array[E+11]=L.b):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=B.x,A.array[E+4]=B.y,A.array[E+5]=B.z,A.array[E+6]=Z.x,A.array[E+7]=Z.y,A.array[E+8]=Z.z,A.array[E+9]=L.x,A.array[E+10]=L.y,A.array[E+11]=L.z),A.offset+=12):(A.array[E+0]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=B.x,A.array[E+5]=B.y,A.array[E+6]=B.z,A.array[E+
-7]=B.w,A.array[E+8]=Z.x,A.array[E+9]=Z.y,A.array[E+10]=Z.z,A.array[E+11]=Z.w,A.array[E+12]=L.x,A.array[E+13]=L.y,A.array[E+14]=L.z,A.array[E+15]=L.w,A.offset+=16));if(za){E=0;for(N=Da.length;E<N;E++)D=Da[E].vertices[n.a].position,B=Da[E].vertices[n.b].position,Z=Da[E].vertices[n.c].position,L=Da[E].vertices[n.d].position,A=ja[E],A[S+0]=D.x,A[S+1]=D.y,A[S+2]=D.z,A[S+3]=B.x,A[S+4]=B.y,A[S+5]=B.z,A[S+6]=Z.x,A[S+7]=Z.y,A[S+8]=Z.z,A[S+9]=L.x,A[S+10]=L.y,A[S+11]=L.z;S+=12}if(Fa.length)E=Fa[n.a],N=Fa[n.b],
-A=Fa[n.c],I=Fa[n.d],ca[M]=E.x,ca[M+1]=E.y,ca[M+2]=E.z,ca[M+3]=E.w,ca[M+4]=N.x,ca[M+5]=N.y,ca[M+6]=N.z,ca[M+7]=N.w,ca[M+8]=A.x,ca[M+9]=A.y,ca[M+10]=A.z,ca[M+11]=A.w,ca[M+12]=I.x,ca[M+13]=I.y,ca[M+14]=I.z,ca[M+15]=I.w,E=Ma[n.a],N=Ma[n.b],A=Ma[n.c],I=Ma[n.d],Y[M]=E.x,Y[M+1]=E.y,Y[M+2]=E.z,Y[M+3]=E.w,Y[M+4]=N.x,Y[M+5]=N.y,Y[M+6]=N.z,Y[M+7]=N.w,Y[M+8]=A.x,Y[M+9]=A.y,Y[M+10]=A.z,Y[M+11]=A.w,Y[M+12]=I.x,Y[M+13]=I.y,Y[M+14]=I.z,Y[M+15]=I.w,E=Ka[n.a],N=Ka[n.b],A=Ka[n.c],I=Ka[n.d],W[M]=E.x,W[M+1]=E.y,W[M+2]=
-E.z,W[M+3]=1,W[M+4]=N.x,W[M+5]=N.y,W[M+6]=N.z,W[M+7]=1,W[M+8]=A.x,W[M+9]=A.y,W[M+10]=A.z,W[M+11]=1,W[M+12]=I.x,W[M+13]=I.y,W[M+14]=I.z,W[M+15]=1,E=La[n.a],N=La[n.b],A=La[n.c],n=La[n.d],X[M]=E.x,X[M+1]=E.y,X[M+2]=E.z,X[M+3]=1,X[M+4]=N.x,X[M+5]=N.y,X[M+6]=N.z,X[M+7]=1,X[M+8]=A.x,X[M+9]=A.y,X[M+10]=A.z,X[M+11]=1,X[M+12]=n.x,X[M+13]=n.y,X[M+14]=n.z,X[M+15]=1,M+=16;if(wa&&x)v.length==4&&x==THREE.VertexColors?(n=v[0],E=v[1],N=v[2],v=v[3]):v=N=E=n=w,$[T]=n.r,$[T+1]=n.g,$[T+2]=n.b,$[T+3]=E.r,$[T+4]=E.g,$[T+
-5]=E.b,$[T+6]=N.r,$[T+7]=N.g,$[T+8]=N.b,$[T+9]=v.r,$[T+10]=v.g,$[T+11]=v.b,T+=12;if(Ba&&ia.hasTangents)v=y[0],w=y[1],n=y[2],y=y[3],V[P]=v.x,V[P+1]=v.y,V[P+2]=v.z,V[P+3]=v.w,V[P+4]=w.x,V[P+5]=w.y,V[P+6]=w.z,V[P+7]=w.w,V[P+8]=n.x,V[P+9]=n.y,V[P+10]=n.z,V[P+11]=n.w,V[P+12]=y.x,V[P+13]=y.y,V[P+14]=y.z,V[P+15]=y.w,P+=16;if(qa&&C)if(p.length==4&&na)for(y=0;y<4;y++)u=p[y],ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;else for(y=0;y<4;y++)ea[Q]=u.x,ea[Q+1]=u.y,ea[Q+2]=u.z,Q+=3;if(oa&&G!==void 0&&z)for(y=0;y<4;y++)p=
-G[y],da[O]=p.u,da[O+1]=p.v,O+=2;if(oa&&F!==void 0&&z)for(y=0;y<4;y++)p=F[y],fa[R]=p.u,fa[R+1]=p.v,R+=2;ua&&(ga[ka]=K,ga[ka+1]=K+1,ga[ka+2]=K+3,ga[ka+3]=K+1,ga[ka+4]=K+2,ga[ka+5]=K+3,ka+=6,ha[la]=K,ha[la+1]=K+1,ha[la+2]=K,ha[la+3]=K+3,ha[la+4]=K+1,ha[la+5]=K+2,ha[la+6]=K+2,ha[la+7]=K+3,la+=8,K+=4)}if(Ia){t=0;for(o=Ia.length;t<o;t++)ga[ka]=Ia[t].a,ga[ka+1]=Ia[t].b,ga[ka+2]=Ia[t].c,ga[ka+3]=Ia[t].a,ga[ka+4]=Ia[t].c,ga[ka+5]=Ia[t].d,ka+=6}va&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
-U,m));if(ta)for(H in ta)A=ta[H],A.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,A.buffer),j.bufferData(j.ARRAY_BUFFER,A.array,m));if(za){E=0;for(N=Da.length;E<N;E++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]),j.bufferData(j.ARRAY_BUFFER,ja[E],m)}wa&&T>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));qa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m));Ba&&ia.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,
-h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,V,m));oa&&O>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));oa&&R>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,fa,m));ua&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ha,m));M>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),
-j.bufferData(j.ARRAY_BUFFER,W,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Y,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,
-delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var sa;g=g.__materials;f=0;for(b=g.length;f<b;f++)if(e=g[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;o=sa.vertices;
-g=sa.colors;z=o.length;h=g.length;x=sa.__vertexArray;k=sa.__colorArray;C=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<z;m++)t=o[m].position,e=m*3,x[e]=t.x,x[e+1]=t.y,x[e+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,x,b)}if(C){for(m=0;m<h;m++)color=g[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;o=sa.vertices;g=sa.colors;z=o.length;h=g.length;x=sa.__vertexArray;k=sa.__colorArray;C=sa.__dirtyColors;if(sa.__dirtyVertices){for(m=0;m<z;m++)t=o[m].position,e=m*3,x[e]=t.x,x[e+1]=t.y,x[e+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,sa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,x,b)}if(C){for(m=0;m<h;m++)color=g[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 x(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function B(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 F(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function D(b){if(b!=T){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)}T=b}}function P(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,H(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,H(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,H(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,H(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,U(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,U(e.minFilter)))}function I(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,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),P(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,H(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,H(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,
-H(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,H(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,H(b.format),b.width,b.height,0,H(b.format),H(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,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=X,b=W);e!=$&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(J,ga,c,b),$=e)}function K(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 U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}
-function H(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.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 fa=this,j,da=[],V=null,$=null,O=!0,ea=null,Y=null,T=null,ca=null,ha=null,na=null,ia=null,J=0,ga=0,X=0,W=0,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Matrix4,N=new Float32Array(16),ka=new Float32Array(16),la=new THREE.Vector4,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-Ba=b.stencil!==void 0?b.stencil:!0,ya=b.antialias!==void 0?b.antialias:!1,ua=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),za=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(j=va.getContext("experimental-webgl",{antialias:ya,stencil:Ba})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+
-" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(wa){console.error(wa)}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(ua.r,ua.g,ua.b,za);this.context=j;var qa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Ba){var S={};S.vertices=new Float32Array(12);S.faces=
-new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=j.createBuffer();S.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,S.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,S.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
-S.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S.faces,j.STATIC_DRAW);S.program=j.createProgram();j.attachShader(S.program,K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(S.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(S.program);S.vertexLocation=j.getAttribLocation(S.program,"position");S.projectionLocation=j.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=j.getUniformLocation(S.program,"darkness")}var 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++]=0;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++]=1;Q.vertices[b++]=1;Q.vertices[b++]=-1;Q.vertices[b++]=1;Q.vertices[b++]=0;Q.vertices[b++]=1;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();
-Q.tempTexture=j.createTexture();Q.occlusionTexture=j.createTexture();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);j.bindTexture(j.TEXTURE_2D,Q.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,Q.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?(Q.hasVertexTexture=!1,Q.program=j.createProgram(),j.attachShader(Q.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(Q.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=j.createProgram(),j.attachShader(Q.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(Q.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(Q.program);Q.attributes={};Q.uniforms={};
-Q.attributes.vertex=j.getAttribLocation(Q.program,"position");Q.attributes.uv=j.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=j.getUniformLocation(Q.program,"renderType");Q.uniforms.map=j.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=j.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=j.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=j.getUniformLocation(Q.program,"scale");Q.uniforms.rotation=j.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=
-j.getUniformLocation(Q.program,"screenPosition");var oa=!1,R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);b=0;R.vertices[b++]=-1;R.vertices[b++]=-1;R.vertices[b++]=0;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=-1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=1;R.vertices[b++]=0;R.vertices[b++]=-1;R.vertices[b++]=1;R.vertices[b++]=0;b=R.vertices[b++]=0;R.faces[b++]=0;R.faces[b++]=1;R.faces[b++]=2;R.faces[b++]=0;R.faces[b++]=2;R.faces[b++]=
-3;R.vertexBuffer=j.createBuffer();R.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,R.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,R.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,R.faces,j.STATIC_DRAW);R.program=j.createProgram();j.attachShader(R.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(R.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(R.program);R.attributes={};R.uniforms=
-{};R.attributes.position=j.getAttribLocation(R.program,"position");R.attributes.uv=j.getAttribLocation(R.program,"uv");R.uniforms.uvOffset=j.getUniformLocation(R.program,"uvOffset");R.uniforms.uvScale=j.getUniformLocation(R.program,"uvScale");R.uniforms.rotation=j.getUniformLocation(R.program,"rotation");R.uniforms.scale=j.getUniformLocation(R.program,"scale");R.uniforms.alignment=j.getUniformLocation(R.program,"alignment");R.uniforms.map=j.getUniformLocation(R.program,"map");R.uniforms.opacity=j.getUniformLocation(R.program,
-"opacity");R.uniforms.useScreenCoordinates=j.getUniformLocation(R.program,"useScreenCoordinates");R.uniforms.affectedByDistance=j.getUniformLocation(R.program,"affectedByDistance");R.uniforms.screenPosition=j.getUniformLocation(R.program,"screenPosition");R.uniforms.modelViewMatrix=j.getUniformLocation(R.program,"modelViewMatrix");R.uniforms.projectionMatrix=j.getUniformLocation(R.program,"projectionMatrix");var Ca=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,
-va.height)};this.setViewport=function(b,e,c,f){J=b;ga=e;X=c;W=f;j.viewport(J,ga,X,W)};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){O=b;j.depthMask(b)};this.setClearColorHex=function(b,e){ua.setHex(b);za=e;j.clearColor(ua.r,ua.g,ua.b,za)};this.setClearColor=function(b,e){ua.copy(b);za=e;j.clearColor(ua.r,ua.g,ua.b,za)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|
-j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){S.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=da.length;u<h;u++)if(da[u].code==k){o=da[u].program;break a}u=
-j.createProgram();h=[qa?"#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");
-p=["#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");j.attachShader(u,K("fragment",p+n));j.attachShader(u,K("vertex",h+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);da.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,n,x){var B,G,F,I,K,J,H,P,O=b.lights,T=b.fog;fa.data.vertices=0;fa.data.faces=0;fa.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ka);c.projectionMatrix.flattenToArray(N);Z.multiply(c.projectionMatrix,
-c.matrixWorldInverse);o(Z);this.initWebGLObjects(b);L(n);(this.autoClear||x)&&this.clear();K=b.__webglObjects.length;for(x=0;x<K;x++)if(B=b.__webglObjects[x],H=B.object,H.visible)if(!(H instanceof THREE.Mesh)||p(H)){if(H.matrixWorld.flattenToArray(H._objectMatrixArray),y(H,c),u(B),B.render=!0,this.sortObjects)B.object.renderDepth?B.z=B.object.renderDepth:(la.copy(H.position),Z.multiplyVector3(la),B.z=la.z)}else B.render=!1;else B.render=!1;this.sortObjects&&b.__webglObjects.sort(v);J=b.__webglObjectsImmediate.length;
-for(x=0;x<J;x++)B=b.__webglObjectsImmediate[x],H=B.object,H.visible&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),y(H,c),t(B));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);D(b.overrideMaterial.blending);for(x=0;x<K;x++)if(B=b.__webglObjects[x],B.render)H=B.object,P=B.buffer,k(H),f(c,O,T,b.overrideMaterial,P,H);for(x=0;x<J;x++)B=b.__webglObjectsImmediate[x],H=B.object,H.visible&&(k(H),G=e(c,O,T,b.overrideMaterial,H),H.render(function(e){g(e,G,b.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);
-for(x=0;x<K;x++)if(B=b.__webglObjects[x],B.render){H=B.object;P=B.buffer;F=B.opaque;k(H);for(B=0;B<F.count;B++)I=F.list[B],h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,O,T,I,P,H)}for(x=0;x<J;x++)if(B=b.__webglObjectsImmediate[x],H=B.object,H.visible){F=B.opaque;k(H);for(B=0;B<F.count;B++)I=F.list[B],h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,O,T,I,H),H.render(function(b){g(b,G,I.shading)})}for(x=0;x<K;x++)if(B=b.__webglObjects[x],
-B.render){H=B.object;P=B.buffer;F=B.transparent;k(H);for(B=0;B<F.count;B++)I=F.list[B],D(I.blending),h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),f(c,O,T,I,P,H)}for(x=0;x<J;x++)if(B=b.__webglObjectsImmediate[x],H=B.object,H.visible){F=B.transparent;k(H);for(B=0;B<F.count;B++)I=F.list[B],D(I.blending),h(I.depthTest),m(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),G=e(c,O,T,I,H),H.render(function(b){g(b,G,I.shading)})}}b.__webglSprites.length&&C(b,c);Ba&&
-b.__webglShadowVolumes.length&&b.lights.length&&w(b);b.__webglLensFlares.length&&z(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,n.__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&&B(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var k=h;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,h,k=b.vertices,m=k.length,t=b.colors,n=t.length,p=b.__vertexArray,o=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,x=b.__dirtyColors,y=b.__webglCustomAttributes,A,w;if(y)for(A in y)y[A].offset=0;if(c.sortParticles){oa.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=k[f].position,wa.copy(g),oa.multiplyVector3(wa),u[f]=[wa.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,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;
+for(f=0;f<n;f++)h=f*3,color=t[u[f][1]],o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(y)for(A in y){f=y[A];t=f.value.length;for(h=0;h<t;h++){index=u[h][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[index];f.size===2?(f.array[n]=w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=
+w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)g=k[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(x)for(f=0;f<n;f++)color=t[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(y)for(A in y)if(f=y[A],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")w=f.value[h];f.size===2?(f.array[n]=
+w.x,f.array[n+1]=w.y):f.size===3?f.type==="c"?(f.array[n]=w.r,f.array[n+1]=w.g,f.array[n+2]=w.b):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z):(f.array[n]=w.x,f.array[n+1]=w.y,f.array[n+2]=w.z,f.array[n+3]=w.w)}f.offset+=f.size}}}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,p,e);if(x||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,o,e);if(y)for(A in y)if(f=y[A],f.__original.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
+f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||R.initMaterial(f,e,c,g);var h=f.program,k=h.uniforms,m=f.uniforms;h!=P&&(j.useProgram(h),P=h);j.uniformMatrix4fv(k.projectionMatrix,!1,ha);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,t,p=0,o=0,u=0,v,x,y,A,w=Aa,B=w.directional.colors,F=w.directional.positions,E=w.point.colors,D=w.point.positions,I=w.point.distances,H=0,C=0,c=t=A=0;for(n=e.length;c<n;c++)if(t=e[c],v=t.color,x=t.position,y=t.intensity,A=t.distance,t instanceof THREE.AmbientLight)p+=v.r,o+=v.g,u+=v.b;else if(t instanceof THREE.DirectionalLight)A=
+H*3,B[A]=v.r*y,B[A+1]=v.g*y,B[A+2]=v.b*y,F[A]=x.x,F[A+1]=x.y,F[A+2]=x.z,H+=1;else if(t instanceof THREE.PointLight)t=C*3,E[t]=v.r*y,E[t+1]=v.g*y,E[t+2]=v.b*y,D[t]=x.x,D[t+1]=x.y,D[t+2]=x.z,I[C]=A,C+=1;for(c=H*3;c<B.length;c++)B[c]=0;for(c=C*3;c<E.length;c++)E[c]=0;w.point.length=C;w.directional.length=H;w.ambient[0]=p;w.ambient[1]=o;w.ambient[2]=u;c=Aa;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;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=va.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 K in m)if(o=h.uniforms[K])if(n=m[K],p=n.type,c=n.value,p=="i")j.uniform1i(o,c);else if(p=="f")j.uniform1f(o,c);else if(p=="fv1")j.uniform1fv(o,c);else if(p=="fv")j.uniform3fv(o,c);else if(p=="v2")j.uniform2f(o,c.x,c.y);else if(p=="v3")j.uniform3f(o,
+c.x,c.y,c.z);else if(p=="v4")j.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")j.uniform3f(o,c.r,c.g,c.b);else if(p=="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(p=0;p<6;++p)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,j.RGBA,j.UNSIGNED_BYTE,n.image[p])}else{n.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,
+n.image.__webglTextureCube);for(p=0;p<6;++p)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[p]);n.__webglInit=!0}G(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 U(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,na);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,na);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,na),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,t=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]=t[n[f]],f++;else{var n=[],p=-1,o=0,t=k.morphTargetInfluences,u,v=t.length,f=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!n[u]&&t[u]>p&&(o=u,p=t[o]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=
+p;n[o]=1;p=-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,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.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),R.data.vertices+=h.__webglFaceCount,R.data.faces+=h.__webglFaceCount/3,R.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),R.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),R.data.drawCalls++):k instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),R.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,g,h,k,m,n,t,p,o,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],h=c[u+2],k=c[u+3],n=c[u+4],p=c[u+5],m=c[u+6],t=c[u+7],o=c[u+8],f=(f+k+m)/3,g=(g+n+t)/3,h=(h+p+o)/3,c[u]=
+f,c[u+1]=g,c[u+2]=h,c[u+3]=f,c[u+4]=g,c[u+5]=h,c[u+6]=f,c[u+7]=g,c[u+8]=h}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 k(b){if(Y!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Y=b.doubleSided;if(ea!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ea=b.flipSided}function h(b){la!=b&&(b?
+j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),la=b)}function m(b,e,c){pa!=b&&(b?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),pa=b);if(b&&(N!=e||ia!=c))j.polygonOffset(e,c),N=e,ia=c}function n(b){V[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);V[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);V[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);V[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);V[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
+V[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=V[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(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=V[f].x*e.n14+V[f].y*e.n24+V[f].z*e.n34+V[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(e=f.materials.length;b<
+e;b++)c=f.materials[b],c.transparent?o(h,c):o(g,c)}function u(b){var e,c,f,g,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(g=j.materials[e])&&(g.transparent?o(m,g):o(k,g))}else(g=e)&&(g.transparent?o(m,g):o(k,g))}function v(b,e){return e.z-b.z}function x(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,g=b.lights,h=[],k,m,n,t,p,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){h[0]=-f.position.x;h[1]=-f.position.y;h[2]=-f.position.z;for(p=0;p<o;p++)f=b.__webglShadowVolumes[p].object,k=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||
+R.initMaterial(m,g,void 0,f),m=m.program,n=m.uniforms,t=m.attributes,P!==m&&(j.useProgram(m),P=m,j.uniformMatrix4fv(n.projectionMatrix,!1,ha),j.uniformMatrix4fv(n.viewMatrix,!1,na),j.uniform3fv(n.directionalLightDirection,h)),f.matrixWorld.flattenToArray(f._objectMatrixArray),j.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer),j.vertexAttribPointer(t.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer),j.vertexAttribPointer(t.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);la=ga=-1;P=aa.program;j.useProgram(aa.program);j.uniformMatrix4fv(aa.projectionLocation,!1,ha);j.uniform1f(aa.darknessLocation,
+aa.darkness);j.bindBuffer(j.ARRAY_BUFFER,aa.vertexBuffer);j.vertexAttribPointer(aa.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(aa.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,aa.elementBuffer);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(ca)}function B(b,e){var c,f,g;c=Q.attributes;var h=Q.uniforms,k=I/$,m,n=[],t=$*0.5,p=I*0.5,o=!0;j.useProgram(Q.program);
+P=Q.program;la=ga=-1;ka||(j.enableVertexAttribArray(Q.attributes.position),j.enableVertexAttribArray(Q.attributes.uv),ka=!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(h.projectionMatrix,!1,ha);j.activeTexture(j.TEXTURE0);j.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<
+f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(j.uniform1i(h.useScreenCoordinates,1),j.uniform3f(h.screenPosition,(g.position.x-t)/t,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):
+(j.uniform1i(h.useScreenCoordinates,0),j.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),j.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.scaleByViewport?I:1),n[0]=m*k*g.scale.x,n[1]=m*g.scale.y,j.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),j.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),j.uniform2f(h.alignment,g.alignment.x,g.alignment.y),j.uniform1f(h.opacity,g.opacity),j.uniform1f(h.rotation,g.rotation),j.uniform2fv(h.scale,n),g.mergeWith3D&&
+!o?(j.enable(j.DEPTH_TEST),o=!0):!g.mergeWith3D&&o&&(j.disable(j.DEPTH_TEST),o=!1),J(g.blending),U(g.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ca)}function A(b,e){var c,f,g=b.__webglLensFlares.length,h,k,m,n=new THREE.Vector3,t=I/$,p=$*0.5,o=I*0.5,u=16/I,v=[u*t,u],x=[1,1,0],y=[1,1],A=L.uniforms;c=L.attributes;j.useProgram(L.program);P=L.program;la=ga=-1;ua||(j.enableVertexAttribArray(L.attributes.vertex),j.enableVertexAttribArray(L.attributes.uv),
+ua=!0);j.uniform1i(A.occlusionMap,0);j.uniform1i(A.map,1);j.bindBuffer(j.ARRAY_BUFFER,L.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,L.elementBuffer);j.disable(j.CULL_FACE);j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,L.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<g;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),x[0]=n.x,x[1]=n.y,x[2]=n.z,y[0]=x[0]*p+p,y[1]=x[1]*o+o,L.hasVertexTexture||y[0]>0&&y[0]<$&&y[1]>0&&y[1]<I){j.bindTexture(j.TEXTURE_2D,L.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,y[0]-8,y[1]-8,16,16,0);j.uniform1i(A.renderType,0);j.uniform2fv(A.scale,v);j.uniform3fv(A.screenPosition,x);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,L.occlusionTexture);
+j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,y[0]-8,y[1]-8,16,16,0);j.uniform1i(A.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,L.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(A.renderType,2);j.enable(j.BLEND);h=0;for(k=c.lensFlares.length;h<k;h++)if(m=c.lensFlares[h],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,
+x[2]=m.z,u=m.size*m.scale/I,v[0]=u*t,v[1]=u,j.uniform3fv(A.screenPosition,x),j.uniform2fv(A.scale,v),j.uniform1f(A.rotation,m.rotation),j.uniform1f(A.opacity,m.opacity),J(m.blending),U(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ca)}function y(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function F(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function w(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function H(b){var e,f,g,h;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(g=f.geometryGroups[e],h=F(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||
+f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||h){h=g;var k=b,m=j.DYNAMIC_DRAW;if(h.__inittedArrays){var n=void 0,t=void 0,p=void 0,o=void 0,u=p=void 0,v=void 0,x=void 0,y=void 0,A=void 0,B=void 0,E=void 0,D=void 0,H=void 0,I=void 0,V=void 0,J=void 0,G=void 0,C=o=y=o=x=v=void 0,K=void 0,z=K=C=v=void 0,M=void 0,P=z=K=C=p=p=u=y=o=z=K=C=M=z=K=C=M=z=K=C=void 0,L=0,N=0,U=0,oa=0,S=0,Q=0,ha=0,T=0,Y=0,O=0,R=0,K=C=0,W=h.__vertexArray,aa=h.__uvArray,fa=h.__uv2Array,da=h.__normalArray,X=h.__tangentArray,
+ca=h.__colorArray,na=h.__skinVertexAArray,ea=h.__skinVertexBArray,Z=h.__skinIndexArray,$=h.__skinWeightArray,ma=h.__morphTargetsArrays,ia=h.__webglCustomAttributes,z=void 0,ga=h.__faceArray,la=h.__lineArray,pa=h.__needsSmoothNormals,B=h.__vertexColorType,A=h.__uvType,E=h.__normalType,ka=k.geometry,wa=ka.__dirtyVertices,ra=ka.__dirtyElements,qa=ka.__dirtyUvs,sa=ka.__dirtyNormals,Aa=ka.__dirtyTangents,va=ka.__dirtyColors,ya=ka.__dirtyMorphTargets,ua=ka.vertices,Ba=h.faces,Ma=ka.faces,Wa=ka.faceVertexUvs[0],
+Xa=ka.faceVertexUvs[1],Ja=ka.skinVerticesA,Ka=ka.skinVerticesB,La=ka.skinIndices,Da=ka.skinWeights,Ha=k instanceof THREE.ShadowVolume?ka.edgeFaces:void 0,za=ka.morphTargets;if(ia)for(P in ia)ia[P].offset=0,ia[P].offsetSrc=0;n=0;for(t=Ba.length;n<t;n++)if(p=Ba[n],o=Ma[p],Wa&&(D=Wa[p]),Xa&&(H=Xa[p]),p=o.vertexNormals,u=o.normal,v=o.vertexColors,x=o.color,y=o.vertexTangents,o instanceof THREE.Face3){if(wa)I=ua[o.a].position,V=ua[o.b].position,J=ua[o.c].position,W[N]=I.x,W[N+1]=I.y,W[N+2]=I.z,W[N+3]=
+V.x,W[N+4]=V.y,W[N+5]=V.z,W[N+6]=J.x,W[N+7]=J.y,W[N+8]=J.z,N+=9;if(ia)for(P in ia)if(z=ia[P],z.__original.needsUpdate)C=z.offset,K=z.offsetSrc,z.size===1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[C+0]=z.value[o.a],z.array[C+1]=z.value[o.b],z.array[C+2]=z.value[o.c]):z.boundTo==="faces"?(z.array[C+0]=z.value[K],z.array[C+1]=z.value[K],z.array[C+2]=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[C+0]=z.value[K+0],z.array[C+1]=z.value[K+1],z.array[C+2]=z.value[K+2],z.offsetSrc+=
+3),z.offset+=3):(z.boundTo===void 0||z.boundTo==="vertices"?(I=z.value[o.a],V=z.value[o.b],J=z.value[o.c]):z.boundTo==="faces"?(I=z.value[K],V=z.value[K],J=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(I=z.value[K+0],V=z.value[K+1],J=z.value[K+2],z.offsetSrc+=3),z.size===2?(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=V.x,z.array[C+3]=V.y,z.array[C+4]=J.x,z.array[C+5]=J.y,z.offset+=6):z.size===3?(z.type==="c"?(z.array[C+0]=I.r,z.array[C+1]=I.g,z.array[C+2]=I.b,z.array[C+3]=V.r,z.array[C+
+4]=V.g,z.array[C+5]=V.b,z.array[C+6]=J.r,z.array[C+7]=J.g,z.array[C+8]=J.b):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=V.x,z.array[C+4]=V.y,z.array[C+5]=V.z,z.array[C+6]=J.x,z.array[C+7]=J.y,z.array[C+8]=J.z),z.offset+=9):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=I.w,z.array[C+4]=V.x,z.array[C+5]=V.y,z.array[C+6]=V.z,z.array[C+7]=V.w,z.array[C+8]=J.x,z.array[C+9]=J.y,z.array[C+10]=J.z,z.array[C+11]=J.w,z.offset+=12));if(ya){C=0;for(K=za.length;C<K;C++)I=
+za[C].vertices[o.a].position,V=za[C].vertices[o.b].position,J=za[C].vertices[o.c].position,z=ma[C],z[R+0]=I.x,z[R+1]=I.y,z[R+2]=I.z,z[R+3]=V.x,z[R+4]=V.y,z[R+5]=V.z,z[R+6]=J.x,z[R+7]=J.y,z[R+8]=J.z;R+=9}if(Da.length)C=Da[o.a],K=Da[o.b],z=Da[o.c],$[O]=C.x,$[O+1]=C.y,$[O+2]=C.z,$[O+3]=C.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=z.x,$[O+9]=z.y,$[O+10]=z.z,$[O+11]=z.w,C=La[o.a],K=La[o.b],z=La[o.c],Z[O]=C.x,Z[O+1]=C.y,Z[O+2]=C.z,Z[O+3]=C.w,Z[O+4]=K.x,Z[O+5]=K.y,Z[O+6]=K.z,Z[O+7]=K.w,Z[O+8]=
+z.x,Z[O+9]=z.y,Z[O+10]=z.z,Z[O+11]=z.w,C=Ja[o.a],K=Ja[o.b],z=Ja[o.c],na[O]=C.x,na[O+1]=C.y,na[O+2]=C.z,na[O+3]=1,na[O+4]=K.x,na[O+5]=K.y,na[O+6]=K.z,na[O+7]=1,na[O+8]=z.x,na[O+9]=z.y,na[O+10]=z.z,na[O+11]=1,C=Ka[o.a],K=Ka[o.b],z=Ka[o.c],ea[O]=C.x,ea[O+1]=C.y,ea[O+2]=C.z,ea[O+3]=1,ea[O+4]=K.x,ea[O+5]=K.y,ea[O+6]=K.z,ea[O+7]=1,ea[O+8]=z.x,ea[O+9]=z.y,ea[O+10]=z.z,ea[O+11]=1,O+=12;if(va&&B)v.length==3&&B==THREE.VertexColors?(o=v[0],C=v[1],K=v[2]):K=C=o=x,ca[Y]=o.r,ca[Y+1]=o.g,ca[Y+2]=o.b,ca[Y+3]=C.r,
+ca[Y+4]=C.g,ca[Y+5]=C.b,ca[Y+6]=K.r,ca[Y+7]=K.g,ca[Y+8]=K.b,Y+=9;if(Aa&&ka.hasTangents)v=y[0],x=y[1],o=y[2],X[ha]=v.x,X[ha+1]=v.y,X[ha+2]=v.z,X[ha+3]=v.w,X[ha+4]=x.x,X[ha+5]=x.y,X[ha+6]=x.z,X[ha+7]=x.w,X[ha+8]=o.x,X[ha+9]=o.y,X[ha+10]=o.z,X[ha+11]=o.w,ha+=12;if(sa&&E)if(p.length==3&&pa)for(y=0;y<3;y++)u=p[y],da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;else for(y=0;y<3;y++)da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;if(qa&&D!==void 0&&A)for(y=0;y<3;y++)p=D[y],aa[U]=p.u,aa[U+1]=p.v,U+=2;if(qa&&H!==void 0&&A)for(y=
+0;y<3;y++)p=H[y],fa[oa]=p.u,fa[oa+1]=p.v,oa+=2;ra&&(ga[S]=L,ga[S+1]=L+1,ga[S+2]=L+2,S+=3,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+2,la[T+4]=L+1,la[T+5]=L+2,T+=6,L+=3)}else if(o instanceof THREE.Face4){if(wa)I=ua[o.a].position,V=ua[o.b].position,J=ua[o.c].position,G=ua[o.d].position,W[N]=I.x,W[N+1]=I.y,W[N+2]=I.z,W[N+3]=V.x,W[N+4]=V.y,W[N+5]=V.z,W[N+6]=J.x,W[N+7]=J.y,W[N+8]=J.z,W[N+9]=G.x,W[N+10]=G.y,W[N+11]=G.z,N+=12;if(ia)for(P in ia)if(z=ia[P],z.__original.needsUpdate)C=z.offset,K=z.offsetSrc,z.size===
+1?(z.boundTo===void 0||z.boundTo==="vertices"?(z.array[C+0]=z.value[o.a],z.array[C+1]=z.value[o.b],z.array[C+2]=z.value[o.c],z.array[C+3]=z.value[o.d]):z.boundTo==="faces"?(z.array[C+0]=z.value[K],z.array[C+1]=z.value[K],z.array[C+2]=z.value[K],z.array[C+3]=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(z.array[C+0]=z.value[K+0],z.array[C+1]=z.value[K+1],z.array[C+2]=z.value[K+2],z.array[C+3]=z.value[K+3],z.offsetSrc+=4),z.offset+=4):(z.boundTo===void 0||z.boundTo==="vertices"?(I=z.value[o.a],
+V=z.value[o.b],J=z.value[o.c],G=z.value[o.d]):z.boundTo==="faces"?(I=z.value[K],V=z.value[K],J=z.value[K],G=z.value[K],z.offsetSrc++):z.boundTo==="faceVertices"&&(I=z.value[K+0],V=z.value[K+1],J=z.value[K+2],G=z.value[K+3],z.offsetSrc+=4),z.size===2?(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=V.x,z.array[C+3]=V.y,z.array[C+4]=J.x,z.array[C+5]=J.y,z.array[C+6]=G.x,z.array[C+7]=G.y,z.offset+=8):z.size===3?(z.type==="c"?(z.array[C+0]=I.r,z.array[C+1]=I.g,z.array[C+2]=I.b,z.array[C+3]=V.r,z.array[C+
+4]=V.g,z.array[C+5]=V.b,z.array[C+6]=J.r,z.array[C+7]=J.g,z.array[C+8]=J.b,z.array[C+9]=G.r,z.array[C+10]=G.g,z.array[C+11]=G.b):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=V.x,z.array[C+4]=V.y,z.array[C+5]=V.z,z.array[C+6]=J.x,z.array[C+7]=J.y,z.array[C+8]=J.z,z.array[C+9]=G.x,z.array[C+10]=G.y,z.array[C+11]=G.z),z.offset+=12):(z.array[C+0]=I.x,z.array[C+1]=I.y,z.array[C+2]=I.z,z.array[C+3]=I.w,z.array[C+4]=V.x,z.array[C+5]=V.y,z.array[C+6]=V.z,z.array[C+7]=V.w,z.array[C+8]=
+J.x,z.array[C+9]=J.y,z.array[C+10]=J.z,z.array[C+11]=J.w,z.array[C+12]=G.x,z.array[C+13]=G.y,z.array[C+14]=G.z,z.array[C+15]=G.w,z.offset+=16));if(ya){C=0;for(K=za.length;C<K;C++)I=za[C].vertices[o.a].position,V=za[C].vertices[o.b].position,J=za[C].vertices[o.c].position,G=za[C].vertices[o.d].position,z=ma[C],z[R+0]=I.x,z[R+1]=I.y,z[R+2]=I.z,z[R+3]=V.x,z[R+4]=V.y,z[R+5]=V.z,z[R+6]=J.x,z[R+7]=J.y,z[R+8]=J.z,z[R+9]=G.x,z[R+10]=G.y,z[R+11]=G.z;R+=12}if(Da.length)C=Da[o.a],K=Da[o.b],z=Da[o.c],M=Da[o.d],
+$[O]=C.x,$[O+1]=C.y,$[O+2]=C.z,$[O+3]=C.w,$[O+4]=K.x,$[O+5]=K.y,$[O+6]=K.z,$[O+7]=K.w,$[O+8]=z.x,$[O+9]=z.y,$[O+10]=z.z,$[O+11]=z.w,$[O+12]=M.x,$[O+13]=M.y,$[O+14]=M.z,$[O+15]=M.w,C=La[o.a],K=La[o.b],z=La[o.c],M=La[o.d],Z[O]=C.x,Z[O+1]=C.y,Z[O+2]=C.z,Z[O+3]=C.w,Z[O+4]=K.x,Z[O+5]=K.y,Z[O+6]=K.z,Z[O+7]=K.w,Z[O+8]=z.x,Z[O+9]=z.y,Z[O+10]=z.z,Z[O+11]=z.w,Z[O+12]=M.x,Z[O+13]=M.y,Z[O+14]=M.z,Z[O+15]=M.w,C=Ja[o.a],K=Ja[o.b],z=Ja[o.c],M=Ja[o.d],na[O]=C.x,na[O+1]=C.y,na[O+2]=C.z,na[O+3]=1,na[O+4]=K.x,na[O+
+5]=K.y,na[O+6]=K.z,na[O+7]=1,na[O+8]=z.x,na[O+9]=z.y,na[O+10]=z.z,na[O+11]=1,na[O+12]=M.x,na[O+13]=M.y,na[O+14]=M.z,na[O+15]=1,C=Ka[o.a],K=Ka[o.b],z=Ka[o.c],o=Ka[o.d],ea[O]=C.x,ea[O+1]=C.y,ea[O+2]=C.z,ea[O+3]=1,ea[O+4]=K.x,ea[O+5]=K.y,ea[O+6]=K.z,ea[O+7]=1,ea[O+8]=z.x,ea[O+9]=z.y,ea[O+10]=z.z,ea[O+11]=1,ea[O+12]=o.x,ea[O+13]=o.y,ea[O+14]=o.z,ea[O+15]=1,O+=16;if(va&&B)v.length==4&&B==THREE.VertexColors?(o=v[0],C=v[1],K=v[2],v=v[3]):v=K=C=o=x,ca[Y]=o.r,ca[Y+1]=o.g,ca[Y+2]=o.b,ca[Y+3]=C.r,ca[Y+4]=C.g,
+ca[Y+5]=C.b,ca[Y+6]=K.r,ca[Y+7]=K.g,ca[Y+8]=K.b,ca[Y+9]=v.r,ca[Y+10]=v.g,ca[Y+11]=v.b,Y+=12;if(Aa&&ka.hasTangents)v=y[0],x=y[1],o=y[2],y=y[3],X[ha]=v.x,X[ha+1]=v.y,X[ha+2]=v.z,X[ha+3]=v.w,X[ha+4]=x.x,X[ha+5]=x.y,X[ha+6]=x.z,X[ha+7]=x.w,X[ha+8]=o.x,X[ha+9]=o.y,X[ha+10]=o.z,X[ha+11]=o.w,X[ha+12]=y.x,X[ha+13]=y.y,X[ha+14]=y.z,X[ha+15]=y.w,ha+=16;if(sa&&E)if(p.length==4&&pa)for(y=0;y<4;y++)u=p[y],da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;else for(y=0;y<4;y++)da[Q]=u.x,da[Q+1]=u.y,da[Q+2]=u.z,Q+=3;if(qa&&
+D!==void 0&&A)for(y=0;y<4;y++)p=D[y],aa[U]=p.u,aa[U+1]=p.v,U+=2;if(qa&&H!==void 0&&A)for(y=0;y<4;y++)p=H[y],fa[oa]=p.u,fa[oa+1]=p.v,oa+=2;ra&&(ga[S]=L,ga[S+1]=L+1,ga[S+2]=L+3,ga[S+3]=L+1,ga[S+4]=L+2,ga[S+5]=L+3,S+=6,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+3,la[T+4]=L+1,la[T+5]=L+2,la[T+6]=L+2,la[T+7]=L+3,T+=8,L+=4)}if(Ha){n=0;for(t=Ha.length;n<t;n++)ga[S]=Ha[n].a,ga[S+1]=Ha[n].b,ga[S+2]=Ha[n].c,ga[S+3]=Ha[n].a,ga[S+4]=Ha[n].c,ga[S+5]=Ha[n].d,S+=6}wa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),
+j.bufferData(j.ARRAY_BUFFER,W,m));if(ia)for(P in ia)z=ia[P],z.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,m));if(ya){C=0;for(K=za.length;C<K;C++)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[C]),j.bufferData(j.ARRAY_BUFFER,ma[C],m)}va&&Y>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));sa&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,da,m));Aa&&ka.hasTangents&&
+(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,X,m));qa&&U>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,aa,m));qa&&oa>0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,fa,m));ra&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,la,m));O>0&&(j.bindBuffer(j.ARRAY_BUFFER,
+h.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,na,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$,m));k.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,
+delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;w(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;B=A.length;k=h.length;E=b.__vertexArray;m=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(n=
+0;n<B;n++)t=A[n].position,g=n*3,E[g]=t.x,E[g+1]=t.y,E[g+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,E,e)}if(D){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;A=b.vertices;h=b.colors;B=A.length;k=h.length;
+E=b.__vertexArray;m=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<B;n++)t=A[n].position,g=n*3,E[g]=t.x,E[g+1]=t.y,E[g+2]=t.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,E,e)}if(D){for(n=0;n<k;n++)color=h[n],g=n*3,m[g]=color.r,m[g+1]=color.g,m[g+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,h=F(f),(f.__dirtyVertices||
+f.__dirtyColors||b.sortParticles||h)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,w(f)}function E(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function D(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={},t=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:t}),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:t})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=j}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],
+count:0}})}function J(b){if(b!=ga){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)}ga=b}}function G(b,e,c){(c.width&
+c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,T(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,T(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,T(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,T(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,X(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,X(e.minFilter)))}function U(b,e){if(b.needsUpdate)b.__webglInit?
+(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,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),G(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 W(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,T(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,T(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,T(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,T(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,T(b.format),
+b.width,b.height,0,T(b.format),T(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,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=$,b=I);e!=da&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(Z,ma,c,b),da=e)}function M(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 X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function T(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.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 R=this,j,fa=[],P=null,da=null,ca=!0,Y=null,ea=null,ga=null,la=null,pa=null,N=null,ia=null,Z=0,ma=0,$=0,I=0,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ha=new Float32Array(16),na=new Float32Array(16),wa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ya=b.stencil!==void 0?b.stencil:!0,Ma=b.antialias!==void 0?b.antialias:!1,qa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),sa=b.clearAlpha!==
+void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;try{if(!(j=va.getContext("experimental-webgl",{antialias:Ma,stencil:ya})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(ra){console.error(ra)}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(qa.r,qa.g,qa.b,sa);this.context=j;var Ba=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(ya){var aa={};aa.vertices=new Float32Array(12);aa.faces=new Uint16Array(6);aa.darkness=0.5;aa.vertices[0]=-20;aa.vertices[1]=-20;aa.vertices[2]=-1;aa.vertices[3]=20;aa.vertices[4]=-20;aa.vertices[5]=-1;aa.vertices[6]=20;
+aa.vertices[7]=20;aa.vertices[8]=-1;aa.vertices[9]=-20;aa.vertices[10]=20;aa.vertices[11]=-1;aa.faces[0]=0;aa.faces[1]=1;aa.faces[2]=2;aa.faces[3]=0;aa.faces[4]=2;aa.faces[5]=3;aa.vertexBuffer=j.createBuffer();aa.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,aa.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,aa.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,aa.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,aa.faces,j.STATIC_DRAW);aa.program=j.createProgram();j.attachShader(aa.program,
+M("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(aa.program,M("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(aa.program);aa.vertexLocation=j.getAttribLocation(aa.program,"position");aa.projectionLocation=j.getUniformLocation(aa.program,"projectionMatrix");aa.darknessLocation=j.getUniformLocation(aa.program,"darkness")}var L={};L.vertices=new Float32Array(16);L.faces=new Uint16Array(6);b=0;L.vertices[b++]=-1;L.vertices[b++]=-1;L.vertices[b++]=0;L.vertices[b++]=
+0;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=1;L.vertices[b++]=-1;L.vertices[b++]=1;L.vertices[b++]=0;L.vertices[b++]=1;b=0;L.faces[b++]=0;L.faces[b++]=1;L.faces[b++]=2;L.faces[b++]=0;L.faces[b++]=2;L.faces[b++]=3;L.vertexBuffer=j.createBuffer();L.elementBuffer=j.createBuffer();L.tempTexture=j.createTexture();L.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,L.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,
+L.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,L.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,L.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,L.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,
+L.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?(L.hasVertexTexture=!1,L.program=j.createProgram(),j.attachShader(L.program,M("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),
+j.attachShader(L.program,M("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(L.hasVertexTexture=!0,L.program=j.createProgram(),j.attachShader(L.program,M("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(L.program,M("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(L.program);L.attributes={};L.uniforms={};L.attributes.vertex=j.getAttribLocation(L.program,"position");L.attributes.uv=j.getAttribLocation(L.program,"UV");L.uniforms.renderType=
+j.getUniformLocation(L.program,"renderType");L.uniforms.map=j.getUniformLocation(L.program,"map");L.uniforms.occlusionMap=j.getUniformLocation(L.program,"occlusionMap");L.uniforms.opacity=j.getUniformLocation(L.program,"opacity");L.uniforms.scale=j.getUniformLocation(L.program,"scale");L.uniforms.rotation=j.getUniformLocation(L.program,"rotation");L.uniforms.screenPosition=j.getUniformLocation(L.program,"screenPosition");var ua=!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,M("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(Q.program,M("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 ka=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){Z=b;ma=e;$=c;I=f;j.viewport(Z,ma,$,I)};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){ca=b;j.depthMask(b)};this.setClearColorHex=function(b,e){qa.setHex(b);sa=e;j.clearColor(qa.r,qa.g,qa.b,sa)};this.setClearColor=function(b,e){qa.copy(b);sa=e;j.clearColor(qa.r,qa.g,qa.b,sa)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){aa.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,t;n=t=m=0;for(o=e.length;n<o;n++)h=e[n],h instanceof THREE.DirectionalLight&&t++,h instanceof THREE.PointLight&&m++;m+t<=4?e=t:(e=Math.ceil(4*t/(m+t)),m=4-e);h={directional:e,point:m};t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;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:t},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=fa.length;u<h;u++)if(fa[u].code==k){p=fa[u].program;break a}u=j.createProgram();h=[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");
+t=["#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");j.attachShader(u,M("fragment",t+n));j.attachShader(u,M("vertex",h+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(p in e)n.push(p);p=n;v=0;for(e=p.length;v<e;v++)c=p[v],u.attributes[c]=j.getAttribLocation(u,c);fa.push({program:u,code:k});p=u}b.program=p;p=b.program.attributes;p.position>=0&&j.enableVertexAttribArray(p.position);p.color>=0&&j.enableVertexAttribArray(p.color);p.normal>=0&&j.enableVertexAttribArray(p.normal);p.tangent>=0&&j.enableVertexAttribArray(p.tangent);
+b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(j.enableVertexAttribArray(p.skinVertexA),j.enableVertexAttribArray(p.skinVertexB),j.enableVertexAttribArray(p.skinIndex),j.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&j.enableVertexAttribArray(p[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(j.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(j.enableVertexAttribArray(p.morphTarget1),
+b.numSupportedMorphTargets++);p.morphTarget2>=0&&(j.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(j.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(j.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(j.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(j.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
+0&&(j.enableVertexAttribArray(p.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,w){var I,E,F,D,V,H,G,L,M=b.lights,N=b.fog;R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(na);c.projectionMatrix.flattenToArray(ha);oa.multiply(c.projectionMatrix,
+c.matrixWorldInverse);n(oa);this.initWebGLObjects(b);W(o);(this.autoClear||w)&&this.clear();V=b.__webglObjects.length;for(w=0;w<V;w++)if(I=b.__webglObjects[w],G=I.object,G.visible)if(!(G instanceof THREE.Mesh)||p(G)){if(G.matrixWorld.flattenToArray(G._objectMatrixArray),y(G,c),u(I),I.render=!0,this.sortObjects)I.object.renderDepth?I.z=I.object.renderDepth:(wa.copy(G.position),oa.multiplyVector3(wa),I.z=wa.z)}else I.render=!1;else I.render=!1;this.sortObjects&&b.__webglObjects.sort(v);H=b.__webglObjectsImmediate.length;
+for(w=0;w<H;w++)I=b.__webglObjectsImmediate[w],G=I.object,G.visible&&(G.matrixAutoUpdate&&G.matrixWorld.flattenToArray(G._objectMatrixArray),y(G,c),t(I));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(w=0;w<V;w++)if(I=b.__webglObjects[w],I.render)G=I.object,L=I.buffer,k(G),f(c,M,N,b.overrideMaterial,L,G);for(w=0;w<H;w++)I=b.__webglObjectsImmediate[w],G=I.object,G.visible&&(k(G),E=e(c,M,N,b.overrideMaterial,G),G.render(function(e){g(e,E,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);
+for(w=0;w<V;w++)if(I=b.__webglObjects[w],I.render){G=I.object;L=I.buffer;F=I.opaque;k(G);for(I=0;I<F.count;I++)D=F.list[I],h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,M,N,D,L,G)}for(w=0;w<H;w++)if(I=b.__webglObjectsImmediate[w],G=I.object,G.visible){F=I.opaque;k(G);for(I=0;I<F.count;I++)D=F.list[I],h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),E=e(c,M,N,D,G),G.render(function(b){g(b,E,D.shading)})}for(w=0;w<V;w++)if(I=b.__webglObjects[w],
+I.render){G=I.object;L=I.buffer;F=I.transparent;k(G);for(I=0;I<F.count;I++)D=F.list[I],J(D.blending),h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,M,N,D,L,G)}for(w=0;w<H;w++)if(I=b.__webglObjectsImmediate[w],G=I.object,G.visible){F=I.transparent;k(G);for(I=0;I<F.count;I++)D=F.list[I],J(D.blending),h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),E=e(c,M,N,D,G),G.render(function(b){g(b,E,D.shading)})}}b.__webglSprites.length&&B(b,c);ya&&
+b.__webglShadowVolumes.length&&b.lights.length&&x(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&&D(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,t=void 0,o=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,y=w=n=0,z=p=o=void 0,C=z=o=t=void 0,p=void 0,u=m.geometry,v=u.faces,z=k.faces,t=0,o=z.length;t<o;t++)p=z[t],p=v[p],p instanceof THREE.Face3?(n+=3,w+=1,y+=3):p instanceof THREE.Face4&&(n+=4,w+=2,y+=4);for(var t=k,o=m,D=z=v=void 0,N=void 0,D=void 0,p=[],v=0,z=o.materials.length;v<z;v++)if(D=o.materials[v],D instanceof THREE.MeshFaceMaterial){D=0;for(l=t.materials.length;D<
-l;D++)(N=t.materials[D])&&p.push(N)}else(N=D)&&p.push(N);t=p;k.__materials=t;a:{v=o=void 0;z=t.length;for(o=0;o<z;o++)if(v=t[o],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{z=v=void 0;p=t.length;for(v=0;v<p;v++)if(z=t[v],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||z instanceof THREE.MeshDepthMaterial)){z=z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{p=v=void 0;D=t.length;for(v=0;v<D;v++)if(p=t[v],
-p.vertexColors){p=p.vertexColors;break a}p=!1}k.__vertexArray=new Float32Array(n*3);if(z)k.__normalArray=new Float32Array(n*3);if(u.hasTangents)k.__tangentArray=new Float32Array(n*4);if(p)k.__colorArray=new Float32Array(n*3);if(o){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(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=z==THREE.SmoothShading;k.__uvType=o;k.__vertexColorType=p;k.__normalType=z;k.__webglFaceCount=
-w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=y*2;u=0;for(v=t.length;u<v;u++)if(o=t[u],o.attributes)for(a in k.__webglCustomAttributes={},o.attributes){p=o.attributes[a];z={};for(C in p)z[C]=p[C];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=!0,w=1,z.type==="v2"?w=2:z.type==="v3"?w=3:z.type==="v4"?w=4:z.type==="c"&&(w=3),z.size=w,z.array=new Float32Array(n*w),z.buffer=j.createBuffer(),z.buffer.belongsToAttribute=a,p.needsUpdate=!0,z.__original=
-p;k.__webglCustomAttributes[a]=z}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?F(c.__webglShadowVolumes,h,e):F(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)F(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;F(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;F(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;F(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;){c=b.__objectsRemoved[0];e=b;if(c instanceof THREE.ShadowVolume)x(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)x(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof
-THREE.LensFlare?x(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&x(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)G(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)G(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)G(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 qa}};
+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,x=void 0,y=x=n=0,w=t=p=void 0,A=w=p=o=void 0,t=void 0,u=m.geometry,v=u.faces,w=k.faces,o=0,p=w.length;o<p;o++)t=w[o],t=v[t],t instanceof THREE.Face3?(n+=3,x+=1,y+=3):t instanceof THREE.Face4&&(n+=4,x+=2,y+=4);for(var o=k,p=m,I=w=v=void 0,B=void 0,I=void 0,t=[],v=0,w=p.materials.length;v<w;v++)if(I=p.materials[v],I instanceof THREE.MeshFaceMaterial){I=0;for(l=o.materials.length;I<
+l;I++)(B=o.materials[I])&&t.push(B)}else(B=I)&&t.push(B);o=t;k.__materials=o;a:{v=p=void 0;w=o.length;for(p=0;p<w;p++)if(v=o[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{w=v=void 0;t=o.length;for(v=0;v<t;v++)if(w=o[v],!(w instanceof THREE.MeshBasicMaterial&&!w.envMap||w instanceof THREE.MeshDepthMaterial)){w=w&&w.shading!=void 0&&w.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}w=!1}a:{t=v=void 0;I=o.length;for(v=0;v<I;v++)if(t=o[v],
+t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(n*3);if(w)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>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(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(y*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=w==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=w;k.__webglFaceCount=
+x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(p=o[u],p.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];w={};for(A in t)w[A]=t[A];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,x=1,w.type==="v2"?x=2:w.type==="v3"?x=3:w.type==="v4"?x=4:w.type==="c"&&(x=3),w.size=x,w.array=new Float32Array(n*x),w.buffer=j.createBuffer(),w.buffer.belongsToAttribute=
+a,t.needsUpdate=!0,w.__original=t;k.__webglCustomAttributes[a]=w}}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?S(c.__webglShadowVolumes,h,e):S(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)S(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;S(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;S(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=e;k=f.vertices.length;f.__vertexArray=new Float32Array(k*3);f.__colorArray=new Float32Array(k*3);f.__sortArray=[];f.__webglParticleCount=k;f.__materials=h.materials;A=n=m=void 0;m=0;for(n=h.materials.length;m<n;m++)if(A=h.materials[m],A.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
+{};for(a in A.attributes){originalAttribute=A.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=j.createBuffer(),attribute.buffer.belongsToAttribute=
+a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}S(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;){c=b.__objectsRemoved[0];e=b;if(c instanceof
+THREE.ShadowVolume)E(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)E(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?E(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&E(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)H(b.__webglObjects[e].object,
+b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)H(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)H(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.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
@@ -339,8 +343,8 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,c,e,f){var 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,k=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==k)h=e=0;else{var m=k-h,h=m/k,e=e==k?(f-g)/m:f==k?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=h;c.v=k;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-var GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,k=b.vertices,h=g.vertices,m=b.faces,o=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=h.length;n<t;n++){var u=new THREE.Vertex(h[n].position.clone());e&&c.matrix.multiplyVector3(u.position);k.push(u)}n=0;for(t=o.length;n<t;n++){var h=o[n],v,w,C=h.vertexNormals,u=h.vertexColors;h instanceof THREE.Face3?v=new THREE.Face3(h.a+f,h.b+f,h.c+f):
-h instanceof THREE.Face4&&(v=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));v.normal.copy(h.normal);e=0;for(k=C.length;e<k;e++)w=C[e],v.vertexNormals.push(w.clone());v.color.copy(h.color);e=0;for(k=u.length;e<k;e++)w=u[e],v.vertexColors.push(w.clone());v.materials=h.materials.slice();v.centroid.copy(h.centroid);m.push(v)}n=0;for(t=g.length;n<t;n++){f=g[n];m=[];e=0;for(k=f.length;e<k;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,k=b.vertices,h=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=h.length;o<t;o++){var u=new THREE.Vertex(h[o].position.clone());e&&c.matrix.multiplyVector3(u.position);k.push(u)}o=0;for(t=n.length;o<t;o++){var h=n[o],v,x,B=h.vertexNormals,u=h.vertexColors;h instanceof THREE.Face3?v=new THREE.Face3(h.a+f,h.b+f,h.c+f):
+h instanceof THREE.Face4&&(v=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));v.normal.copy(h.normal);e=0;for(k=B.length;e<k;e++)x=B[e],v.vertexNormals.push(x.clone());v.color.copy(h.color);e=0;for(k=u.length;e<k;e++)x=u[e],v.vertexColors.push(x.clone());v.materials=h.materials.slice();v.centroid.copy(h.centroid);m.push(v)}o=0;for(t=g.length;o<t;o++){f=g[o];m=[];e=0;for(k=f.length;e<k;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.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.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],k=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)k.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return k}};
 THREE.SceneUtils={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)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
@@ -354,20 +358,20 @@ film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0}
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,k=2*Math.ceil(b*3)+1;k>25&&(k=25);g=(k-1)*0.5;e=Array(k);for(c=f=0;c<k;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<k;++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<
-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 o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++){var p=b.hierarchy[e].keys[f].morphTargets[o];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var n=
-{};for(p in m){for(o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++)if(b.hierarchy[e].keys[f].morphTargets[o]===p){n[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[o];break}o===b.hierarchy[e].keys[f].morphTargets.length&&(n[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=n}}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 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*
 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};
 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 k=g.animationCache.prevKey;g=g.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.scl=this.data.hierarchy[e].keys[0];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.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,k,h,m,o,p,n=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],o=b.animationCache,this.JITCompile&&n[v][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[v][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=n[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 C=0;C<3;C++){e=c[C];h=o.prevKey[e];m=o.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){h=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)h=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do h=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
-t)}o.prevKey[e]=h;o.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-h.time)/(m.time-h.time);g=h[e];k=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]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,k,h,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,x=this.hierarchy.length;v<x;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 B=0;B<3;B++){e=c[B];h=n.prevKey[e];m=n.nextKey[e];if(m.time<=u){if(t<u)if(this.loop){h=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<t;)h=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do h=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
+t)}n.prevKey[e]=h;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-h.time)/(m.time-h.time);g=h[e];k=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]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[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,h.index-1).pos,this.points[1]=g,this.points[2]=k,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,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f}}if(this.JITCompile&&n[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)n[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,k,h,m,o,p;g=(b.length-1)*c;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];o=b[e[2]];p=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],o[0],p[0],g,e,h);f[1]=this.interpolate(k[1],m[1],o[1],p[1],g,e,h);f[2]=this.interpolate(k[2],m[2],o[2],p[2],g,e,h);return f};
+"rot")THREE.Quaternion.slerp(g,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[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,k,h,m,n,p;g=(b.length-1)*c;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],n[0],p[0],g,e,h);f[1]=this.interpolate(k[1],m[1],n[1],p[1],g,e,h);f[2]=this.interpolate(k[2],m[2],n[2],p[2],g,e,h);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,g,k,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*k+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.FirstPersonCamera=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=
@@ -380,14 +384,14 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
 (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),
 !1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
 THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,k=e.getControlPointsArray(),m=e.getLength(),o=k.length,G=0;h=o-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<o-1;h++)G=f*m.chunks[h]/m.total,e.keys[h]={time:G,pos:k[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
-f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
-16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
+THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,k=e.getControlPointsArray(),m=e.getLength(),n=k.length,F=0;h=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<n-1;h++)F=f*m.chunks[h]/m.total,e.keys[h]={time:F,pos:k[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
+f,g=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),g.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
 window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,k=Math.PI/180;this.update=function(b,e,c){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var m=h[1]-h[0];this.phi=
 TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;m=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
-b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(o,h);b.position.set(0,10,0);this.animation=
+b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,h);b.position.set(0,10,0);this.animation=
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 THREE.FlyCamera=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.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
@@ -400,137 +404,137 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,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,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,o=!1,p=1,n=0,t=0,u=0,v=0,w=0,C=window.innerWidth/2,z=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*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*u);o&&(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,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,u=0,v=0,x=0,B=window.innerWidth/2,A=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*x));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();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);k.set(0,1,0);g.cross(k,h).normalize();k.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=k.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=k.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=k.z;this.matrix.n33=h.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.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){k.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);k.multiplyScalar(b);this.forward.addSelf(k);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){v=(b.clientX-C)/window.innerWidth;w=(b.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;
-case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:o=!0;p=1;break;case 69:o=!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:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:o=!1;break;case 69:o=!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-B)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65: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;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,k=new THREE.Vector3,h=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-
 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(k.dot(h)/k.length()/h.length());if(b){var c=(new THREE.Vector3).cross(k,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?k=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(o.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=o:m.y+=(o.y-m.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var b=n.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=n:p.addSelf(b.sub(n,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.rotateCamera=function(){var b=Math.acos(k.dot(h)/k.length()/h.length());if(b){var c=(new THREE.Vector3).cross(k,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?k=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(k))}};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),
 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&&(k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=o=this.getMouseOnScreen(b.clientX,b.clientY),p=n=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?o=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
-b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=o=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=n=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&&(k=h=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?h=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?k=h=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=
 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.QuakeCamera=THREE.FirstPersonCamera;THREE.Path=function(b){this.actions=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru"};THREE.Path.prototype.fromPoints=function(b){var c=0,e=b.length;this.moveTo(b[0].x,b[0].y);for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};
 THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};THREE.Path.prototype.lineTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.LINE_TO,args:b})};THREE.Path.prototype.quadraticCurveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:b})};
 THREE.Path.prototype.bezierCurveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:b})};THREE.Path.prototype.splineThru=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
-THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,k,h,m,o,p,n,t,u,v,w;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],k=g.action,g=g.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=g[2];h=g[3];p=g[0];n=g[1];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,w=THREE.FontUtils.b2(v,t,p,k),v=THREE.FontUtils.b2(v,u,n,h),c.push(new THREE.Vector2(w,
-v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=g[4];h=g[5];p=g[0];n=g[1];m=g[2];o=g[3];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,w=THREE.FontUtils.b3(v,t,p,m,k),v=THREE.FontUtils.b3(v,u,n,o,h),c.push(new THREE.Vector2(w,v));break;case THREE.PathActions.CSPLINE_THRU:u=this.actions[e-1].args;m=new THREE.Vector2(u[u.length-2],u[u.length-1]);k=g[0];h=b*k.length;k.unshift(m);m=new Spline2;for(g=0;g<h;g++)c.push(m.get2DPoint(k,
+THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,k,h,m,n,p,o,t,u,v,x;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],k=g.action,g=g.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=g[2];h=g[3];p=g[0];o=g[1];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,x=THREE.FontUtils.b2(v,t,p,k),v=THREE.FontUtils.b2(v,u,o,h),c.push(new THREE.Vector2(x,
+v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=g[4];h=g[5];p=g[0];o=g[1];m=g[2];n=g[3];c.length>0?(u=c[c.length-1],t=u.x,u=u.y):(u=this.actions[e-1].args,t=u[u.length-2],u=u[u.length-1]);for(g=1;g<=b;g++)v=g/b,x=THREE.FontUtils.b3(v,t,p,m,k),v=THREE.FontUtils.b3(v,u,o,n,h),c.push(new THREE.Vector2(x,v));break;case THREE.PathActions.CSPLINE_THRU:u=this.actions[e-1].args;m=new THREE.Vector2(u[u.length-2],u[u.length-1]);k=g[0];h=b*k.length;k.unshift(m);m=new Spline2;for(g=0;g<h;g++)c.push(m.get2DPoint(k,
 g/h))}return c};var Spline2=function(){function b(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,k=g*g;return(2*c-2*e+b+f)*g*k+(-3*c+3*e-2*b-f)*k+b*g+c}var c=[],e,f,g,k;this.get2DPoint=function(h,m){e=new THREE.Vector2;f=(h.length-1)*m;g=Math.floor(f);k=f-g;c[0]=g==0?g:g-1;c[1]=g;c[2]=g>h.length-2?g:g+1;c[3]=g>h.length-3?g:g+2;e.x=b(h[c[0]].x,h[c[1]].x,h[c[2]].x,h[c[3]].x,k);e.y=b(h[c[0]].y,h[c[1]].y,h[c[2]].y,h[c[3]].y,k);return e}};
 THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var k,h,m;h=0;for(m=b.length;h<m;h++){k=b[h];if(k.x>c)c=k.x;else if(k.x<f)f=k.x;if(k.y>e)e=k.y;else if(k.y<e)g=k.y}return{minX:f,minY:g,maxX:c,maxY:e}};
 THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.getPoints();
 b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.triangulate=function(){var b=this.getPoints();THREE.FontUtils.Triangulate.area(b)>0&&(b=b.reverse());return THREE.FontUtils.Triangulate(b,!0)};
 THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
-THREE.CubeGeometry=function(b,c,e,f,g,k,h,m,o){function p(b,c,e,h,m,o,p,t){var u,v,w=f||1,C=g||1,H=m/2,fa=o/2,j=n.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",C=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=k||1;var da=w+1,V=C+1;m/=w;var $=o/C;for(v=0;v<V;v++)for(o=0;o<da;o++){var O=new THREE.Vector3;O[b]=(o*m-H)*e;O[c]=(v*$-fa)*h;O[u]=p;n.vertices.push(new THREE.Vertex(O))}for(v=0;v<C;v++)for(o=0;o<w;o++)n.faces.push(new THREE.Face4(o+
-da*v+j,o+da*(v+1)+j,o+1+da*(v+1)+j,o+1+da*v+j,null,null,t)),n.faceVertexUvs[0].push([new THREE.UV(o/w,v/C),new THREE.UV(o/w,(v+1)/C),new THREE.UV((o+1)/w,(v+1)/C),new THREE.UV((o+1)/w,v/C)])}THREE.Geometry.call(this);var n=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var C in o)this.sides[C]!=void 0&&(this.sides[C]=
-o[C]);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=n.vertices.length;e<f;e++){for(var h=n.vertices[e],g=!1,k=0,m=b.length;k<m;k++){var o=b[k];if(h.position.x==o.position.x&&
-h.position.y==o.position.y&&h.position.z==o.position.z){c[e]=k;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=n.faces.length;e<f;e++)h=n.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];n.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,c,e,f,g,k){function h(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,o,p=Math.PI*2,n=f/2;for(o=0;o<b;o++)h(Math.sin(p*o/b)*c,Math.cos(p*o/b)*c,-n);for(o=0;o<b;o++)h(Math.sin(p*o/b)*e,Math.cos(p*o/b)*e,n);for(o=0;o<b;o++)m.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(e>0){h(0,0,-n-(k||0));for(o=b;o<b+b/2;o++)m.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){h(0,0,n+
-(g||0));for(o=b+b/2;o<2*b;o++)m.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],e=this.faces[o],g=this.vertices[e.a],k=this.vertices[e.b],n=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(k.position.x,k.position.y)/p,0.5+k.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/p,0.5+n.position.z/
+THREE.CubeGeometry=function(b,c,e,f,g,k,h,m,n){function p(b,c,e,h,m,n,p,t){var u,v,x=f||1,B=g||1,M=m/2,X=n/2,T=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",B=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",x=k||1;var R=x+1,j=B+1;m/=x;var fa=n/B;for(v=0;v<j;v++)for(n=0;n<R;n++){var P=new THREE.Vector3;P[b]=(n*m-M)*e;P[c]=(v*fa-X)*h;P[u]=p;o.vertices.push(new THREE.Vertex(P))}for(v=0;v<B;v++)for(n=0;n<x;n++)o.faces.push(new THREE.Face4(n+R*
+v+T,n+R*(v+1)+T,n+1+R*(v+1)+T,n+1+R*v+T,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/x,v/B),new THREE.UV(n/x,(v+1)/B),new THREE.UV((n+1)/x,(v+1)/B),new THREE.UV((n+1)/x,v/B)])}THREE.Geometry.call(this);var o=this,t=b/2,u=c/2,v=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var B in n)this.sides[B]!=void 0&&(this.sides[B]=
+n[B]);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 h=o.vertices[e],g=!1,k=0,m=b.length;k<m;k++){var n=b[k];if(h.position.x==n.position.x&&
+h.position.y==n.position.y&&h.position.z==n.position.z){c[e]=k;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)h=o.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.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,k){function h(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++)h(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)h(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){h(0,0,-o-(k||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){h(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],k=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(k.position.x,k.position.y)/p,0.5+k.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.ExtrudeGeometry=function(b,c){function e(b,c,e){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e){C?v.faces.push(new THREE.Face3(e,c,b)):v.faces.push(new THREE.Face3(b,c,e))}function g(b,c,e,f){C?v.faces.push(new THREE.Face4(f,e,c,b)):v.faces.push(new THREE.Face4(b,c,e,f))}var k=c.amount!==void 0?c.amount:100,h=c.bezelThickness!==void 0?c.bezelThickness:10,m=c.bezelEnabled!==void 0?c.bezelEnabled:!1,o=c.steps!==void 0?c.steps:1,p=c.path!==void 0?c.path:null,n,t=!1;
-if(p)n=p.getPoints(),o=n.length,t=!0;THREE.Geometry.call(this);var p=b.getPoints(),u=b.triangulate(),v=this,w=[],C=THREE.FontUtils.Triangulate.area(p)>0,z,y,G=p.length,x,B=u.length,F=w.length;for(z=0;z<G;z++)y=p[z],e(y.x,y.y,0);for(x=1;x<=o;x++)for(z=0;z<G;z++)y=p[z],t?e(y.x,y.y+n[x-1].y,n[x-1].x):e(y.x,y.y,k/o*x);if(m){for(z=0;z<F;z++)x=w[z],e(x.x,x.y,h);for(z=0;z<F;z++)x=w[z],e(x.x,x.y,k-h)}for(z=0;z<B;z++)x=u[z],f(x[2],x[1],x[0]);for(z=0;z<B;z++)x=u[z],f(x[0]+G*o,x[1]+G*o,x[2]+G*o);for(z=p.length;--z>=
-0;){k=z;h=z-1;h<0&&(h=p.length-1);for(x=0;x<o;x++)u=G*x,B=G*(x+1),g(k+u,h+u,h+B,k+B)}this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry=function(b,c){function e(b,c,e){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e){B?v.faces.push(new THREE.Face3(e,c,b)):v.faces.push(new THREE.Face3(b,c,e))}function g(b,c,e,f){B?v.faces.push(new THREE.Face4(f,e,c,b)):v.faces.push(new THREE.Face4(b,c,e,f))}var k=c.amount!==void 0?c.amount:100,h=c.bezelThickness!==void 0?c.bezelThickness:10,m=c.bezelEnabled!==void 0?c.bezelEnabled:!1,n=c.steps!==void 0?c.steps:1,p=c.path!==void 0?c.path:null,o,t=!1;
+if(p)o=p.getPoints(),n=o.length,t=!0;THREE.Geometry.call(this);var p=b.getPoints(),u=b.triangulate(),v=this,x=[],B=THREE.FontUtils.Triangulate.area(p)>0,A,y,F=p.length,w,H=u.length,E=x.length;for(A=0;A<F;A++)y=p[A],e(y.x,y.y,0);for(w=1;w<=n;w++)for(A=0;A<F;A++)y=p[A],t?e(y.x,y.y+o[w-1].y,o[w-1].x):e(y.x,y.y,k/n*w);if(m){for(A=0;A<E;A++)w=x[A],e(w.x,w.y,h);for(A=0;A<E;A++)w=x[A],e(w.x,w.y,k-h)}for(A=0;A<H;A++)w=u[A],f(w[2],w[1],w[0]);for(A=0;A<H;A++)w=u[A],f(w[0]+F*n,w[1]+F*n,w[2]+F*n);for(A=p.length;--A>=
+0;){k=A;h=A-1;h<0&&(h=p.length-1);for(w=0;w<n;w++)u=F*w,H=F*(w+1),g(k+u,h+u,h+H,k+H)}this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 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,k=new THREE.Geometry,h;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in k.faces){var o=f(k.faces[m].a,k.faces[m].b),p=f(k.faces[m].b,k.faces[m].c),n=f(k.faces[m].c,k.faces[m].a);e(k.faces[m].a,o,n,h);e(k.faces[m].b,p,o,h);
-e(k.faces[m].c,n,p,h);e(o,p,n,h)}k.faces=h.faces}g.faces=k.faces;delete k;delete h;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=[],k=[],h=(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 o=0;o<=this.angle+0.0010;o+=c){for(m=0;m<e.length;m++)o<this.angle?(e[m]=h.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=k;o==0&&(k=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-o/this.angle,m/b.length),new THREE.UV(1-o/this.angle,(m+1)/b.length),new THREE.UV(1-(o-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(o-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,k=b/2,h=c/2,e=e||1,f=f||1,m=e+1,o=f+1;b/=e;var p=c/f;for(g=0;g<o;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(g*p-h),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()};
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in k.faces){var n=f(k.faces[m].a,k.faces[m].b),p=f(k.faces[m].b,k.faces[m].c),o=f(k.faces[m].c,k.faces[m].a);e(k.faces[m].a,n,o,h);e(k.faces[m].b,p,n,h);
+e(k.faces[m].c,o,p,h);e(n,p,o,h)}k.faces=h.faces}g.faces=k.faces;delete k;delete h;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=[],k=[],h=(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]=h.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=k;n==0&&(k=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;
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,k=b/2,h=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-k,-(g*p-h),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.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,k=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),o=b*Math.sin(f*g),p=[],n=0;for(f=0;f<k;f++){var t=2*f/k,u=o*Math.sin(t*g),t=o*Math.cos(t*g);(e==0||e==h)&&f>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);p.push(n)}c.push(p)}for(var v,w,C,g=c.length,e=0;e<g;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){p=f==k-1;h=c[e][p?0:f+1];m=c[e][p?k-1:f];o=c[e-1][p?
-k-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);w=(f+1)/k;var t=f/k,n=new THREE.UV(1-w,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),z=new THREE.UV(1-w,v);e<c.length-1&&(v=this.vertices[h].position.clone(),w=this.vertices[m].position.clone(),C=this.vertices[o].position.clone(),v.normalize(),w.normalize(),C.normalize(),this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([n,u,t]));e>1&&(v=
-this.vertices[h].position.clone(),w=this.vertices[o].position.clone(),C=this.vertices[p].position.clone(),v.normalize(),w.normalize(),C.normalize(),this.faces.push(new THREE.Face3(h,o,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(C.x,C.y,C.z)])),this.faceVertexUvs[0].push([n,t,z]))}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,k=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<k;f++){var t=2*f/k,u=n*Math.sin(t*g),t=n*Math.cos(t*g);(e==0||e==h)&&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,x,B,g=c.length,e=0;e<g;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){p=f==k-1;h=c[e][p?0:f+1];m=c[e][p?k-1:f];n=c[e-1][p?
+k-1:f];p=c[e-1][p?0:f+1];u=e/(g-1);v=(e-1)/(g-1);x=(f+1)/k;var t=f/k,o=new THREE.UV(1-x,u),u=new THREE.UV(1-t,u),t=new THREE.UV(1-t,v),A=new THREE.UV(1-x,v);e<c.length-1&&(v=this.vertices[h].position.clone(),x=this.vertices[m].position.clone(),B=this.vertices[n].position.clone(),v.normalize(),x.normalize(),B.normalize(),this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,u,t]));e>1&&(v=
+this.vertices[h].position.clone(),x=this.vertices[n].position.clone(),B=this.vertices[p].position.clone(),v.normalize(),x.normalize(),B.normalize(),this.faces.push(new THREE.Face3(h,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)])),this.faceVertexUvs[0].push([o,t,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TextGeometry.prototype.set=function(b,c){function 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,k=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",o=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,n=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=k;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=o;THREE.FontUtils.bezelSize=n;var m=THREE.FontUtils.drawText(b),k=m.points,u=m.faces,h=m.contour,v=m.bezel,w=this;w.vertices=[];w.faces=[];for(var C,o=k.length,z=u.length,n=v.length,m=0;m<o;m++)C=k[m],e(C.x,C.y,0);for(m=0;m<o;m++)C=k[m],e(C.x,C.y,g);if(t){for(m=0;m<n;m++)C=v[m],e(C.x,C.y,p);for(m=0;m<n;m++)C=v[m],e(C.x,C.y,g-p)}for(m=
-0;m<z;m++)g=u[m],w.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<z;m++)g=u[m],w.faces.push(new THREE.Face3(g[0]+o,g[1]+o,g[2]+o));var y;if(t)for(m=v.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];p=o*2+m;u=p-1;f(p,u,u+n,p+n);for(t=0;t<o;t++)if(k[t].equals(h[m]))break;for(g=0;g<o;g++)if(k[g].equals(h[m-1]))break;f(t,g,u,p);f(p+n,u+n,g+o,t+o)}else for(m=h.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];for(t=0;t<o;t++)if(k[t].equals(h[m]))break;for(g=
-0;g<o;g++)if(k[g].equals(h[m-1]))break;f(t,g,g+o,t+o)}this.computeCentroids();this.computeFaceNormals()};
+THREE.TextGeometry.prototype.set=function(b,c){function e(b,c,e){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function f(b,c,e,f){x.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,k=c.curveSegments!==void 0?c.curveSegments:4,h=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=k;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),k=m.points,u=m.faces,h=m.contour,v=m.bezel,x=this;x.vertices=[];x.faces=[];for(var B,n=k.length,A=u.length,o=v.length,m=0;m<n;m++)B=k[m],e(B.x,B.y,0);for(m=0;m<n;m++)B=k[m],e(B.x,B.y,g);if(t){for(m=0;m<o;m++)B=v[m],e(B.x,B.y,p);for(m=0;m<o;m++)B=v[m],e(B.x,B.y,g-p)}for(m=
+0;m<A;m++)g=u[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<A;m++)g=u[m],x.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var y;if(t)for(m=v.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];p=n*2+m;u=p-1;f(p,u,u+o,p+o);for(t=0;t<n;t++)if(k[t].equals(h[m]))break;for(g=0;g<n;g++)if(k[g].equals(h[m-1]))break;f(t,g,u,p);f(p+o,u+o,g+n,t+n)}else for(m=h.length;--m>0;){if(y){if(y.equals(h[m])){y=null;continue}}else y=h[m];for(t=0;t<n;t++)if(k[t].equals(h[m]))break;for(g=
+0;g<n;g++)if(k[g].equals(h[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"),
-{points:b,faces:[]};for(var e,f,g,k,h,m=[],o=0;o<c.length;o++){h=c[o];k=[];for(e=0;e<h.length;e++)f=h[e],k.push(f.x+","+f.y);var p;e=k.slice(1).indexOf(k[0]);var n=this.Triangulate.area(h.slice(0,e+1))<0;f=[];for(e=-1;e<k.length;){p=e+1;e=k[p];e=k.slice(p+1).indexOf(e)+p;if(e<=p)break;var t=h.slice(p,e+1);n?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++}n&&m.push({shape:g,holes:f})}var u,v,w,
-C,z,y;k=[];for(h=0;h<m.length;h++){o=m[h];g=o.shape;f=o.holes;for(p=0;p<f.length;p++){n=f[p];w=Number.POSITIVE_INFINITY;for(t=0;t<n.length;t++){z=n[t];for(e=0;e<g.length;e++)C=g[e],C=z.distanceTo(C),C<w&&(w=C,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:n.length-1,G=[];G.push(n[u]);G.push(g[v]);G.push(g[e]);w=this.Triangulate.area(G);var x=[];x.push(n[u]);x.push(n[t]);x.push(g[v]);z=this.Triangulate.area(x);C=v;y=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=n.length);u%=g.length;e=v-
-1>=0?v-1:g.length-1;t=u-1>=0?u-1:n.length-1;G=[];G.push(n[u]);G.push(g[v]);G.push(g[e]);G=this.Triangulate.area(G);x=[];x.push(n[u]);x.push(n[t]);x.push(g[v]);x=this.Triangulate.area(x);w+z>G+x&&(v=C,u=y,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=n.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:n.length-1);w=g.slice(0,v);z=g.slice(v);C=n.slice(u);y=n.slice(0,u);k.push(n[u]);k.push(g[v]);k.push(g[e]);k.push(n[u]);k.push(n[t]);k.push(g[v]);g=w.concat(C).concat(y).concat(z)}o.shape=g}u=[];v=[];
-for(h=p=0;h<m.length;h++){o=m[h];g=o.shape;u=u.concat(g);n=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<n.length;f++)o=n[f],o[0]+=p,o[1]+=p,o[2]+=p;v=v.concat(n);p+=g.length}var B;for(f=0;f<k.length/3;f++){o=[];for(m=0;m<3;m++){h=!1;for(g=0;g<u.length&&!h;g++)B=f*3+m,u[g].equals(k[B])&&(o.push(g),h=!0);h||(u.push(k[B]),o.push(u.length-1),console.log("not found"))}v.push(o)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),k=this.size/g.resolution,h=0;f=String(b).split("");
-for(var m=f.length,o=[],b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,k,h);h+=p.offset;c.push(p.points);e=e.concat(p.points);o.push(p.path)}b=h/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];k=[];f=[];for(var h=[],m=new THREE.Vector2,n,b=e.length;--b>=0;){if(n){if(n.equals(e[b])){n=null;o=this.Triangulate.area(f)>0;h.push(o);k.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else n=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=0;--b>=0;)o=e[b],
-m=k[f],o=o.clone().subSelf(m),p=this.bezelSize/o.length(),h[f]?p+=1:p=1-p,p=o.multiplyScalar(p).addSelf(m),g.unshift(p),n?n.equals(e[b])&&(n=null,f++):n=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=[],k=new THREE.Path,h,m,o,p,n,t,u,v,w,C,z=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));o=c.length;for(b=0;b<o;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,p));k.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,
-p));k.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;k.quadraticCurveTo(u,v,m,p);if(h=g[g.length-1]){n=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,G=THREE.FontUtils.b2(y,n,u,m),y=THREE.FontUtils.b2(y,t,v,p);g.push(new THREE.Vector2(G,y))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,w=c[b++]*e+f,C=c[b++]*-e,k.quadraticCurveTo(m,p,u,v,w,C),h=g[g.length-1]){n=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=
-h/divisions,G=THREE.FontUtils.b3(y,n,u,w,m),y=THREE.FontUtils.b3(y,t,v,C,p),g.push(new THREE.Vector2(G,y))}}}k.debug(document.getElementById("boo"));console.log(k);return{offset:z.ha*e,points:g,path:k}}}};
-(function(b){var c=function(b){for(var c=b.length,g=0,k=c-1,h=0;h<c;k=h++)g+=b[k].x*b[h].y-b[h].x*b[k].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var k=[],h=[],m=[],o,p,n;if(c(b)>0)for(p=0;p<g;p++)h[p]=p;else for(p=0;p<g;p++)h[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 k}o=p;g<=o&&(o=0);p=o+1;g<=p&&(p=0);n=p+1;g<=n&&(n=0);var u;a:{u=b;var v=o,w=p,C=n,z=g,y=h,G=void 0,x=void 0,B=void 0,
-F=void 0,D=void 0,P=void 0,I=void 0,L=void 0,K=void 0,x=u[y[v]].x,B=u[y[v]].y,F=u[y[w]].x,D=u[y[w]].y,P=u[y[C]].x,I=u[y[C]].y;if(1.0E-10>(F-x)*(I-B)-(D-B)*(P-x))u=!1;else{for(G=0;G<z;G++)if(!(G==v||G==w||G==C)){var L=u[y[G]].x,K=u[y[G]].y,U=void 0,H=void 0,fa=void 0,j=void 0,da=void 0,V=void 0,$=void 0,O=void 0,ea=void 0,Y=void 0,T=void 0,ca=void 0,U=fa=da=void 0,U=P-F,H=I-D,fa=x-P,j=B-I,da=F-x,V=D-B,$=L-x,O=K-B,ea=L-F,Y=K-D,T=L-P,ca=K-I,U=U*Y-H*ea,da=da*O-V*$,fa=fa*ca-j*T;if(U>=0&&fa>=0&&da>=0){u=
-!1;break a}}u=!0}}if(u){t=h[o];u=h[p];v=h[n];k.push(b[t]);k.push(b[u]);k.push(b[v]);m.push([h[o],h[p],h[n]]);o=p;for(n=p+1;n<g;o++,n++)h[o]=h[n];g--;t=2*g}}if(f)return m;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+{points:b,faces:[]};for(var e,f,g,k,h,m=[],n=0;n<c.length;n++){h=c[n];k=[];for(e=0;e<h.length;e++)f=h[e],k.push(f.x+","+f.y);var p;e=k.slice(1).indexOf(k[0]);var o=this.Triangulate.area(h.slice(0,e+1))<0;f=[];for(e=-1;e<k.length;){p=e+1;e=k[p];e=k.slice(p+1).indexOf(e)+p;if(e<=p)break;var t=h.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,x,
+B,A,y;k=[];for(h=0;h<m.length;h++){n=m[h];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];x=Number.POSITIVE_INFINITY;for(t=0;t<o.length;t++){A=o[t];for(e=0;e<g.length;e++)B=g[e],B=A.distanceTo(B),B<x&&(x=B,u=t,v=e)}e=v-1>=0?v-1:g.length-1;var t=u-1>=0?u-1:o.length-1,F=[];F.push(o[u]);F.push(g[v]);F.push(g[e]);x=this.Triangulate.area(F);var w=[];w.push(o[u]);w.push(o[t]);w.push(g[v]);A=this.Triangulate.area(w);B=v;y=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;F=[];F.push(o[u]);F.push(g[v]);F.push(g[e]);F=this.Triangulate.area(F);w=[];w.push(o[u]);w.push(o[t]);w.push(g[v]);w=this.Triangulate.area(w);x+A>F+w&&(v=B,u=y,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);x=g.slice(0,v);A=g.slice(v);B=o.slice(u);y=o.slice(0,u);k.push(o[u]);k.push(g[v]);k.push(g[e]);k.push(o[u]);k.push(o[t]);k.push(g[v]);g=x.concat(B).concat(y).concat(A)}n.shape=g}u=[];v=[];
+for(h=p=0;h<m.length;h++){n=m[h];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 H;for(f=0;f<k.length/3;f++){n=[];for(m=0;m<3;m++){h=!1;for(g=0;g<u.length&&!h;g++)H=f*3+m,u[g].equals(k[H])&&(n.push(g),h=!0);h||(u.push(k[H]),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(),k=this.size/g.resolution,h=0;f=String(b).split("");
+for(var m=f.length,n=[],b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,k,h);h+=p.offset;c.push(p.points);e=e.concat(p.points);n.push(p.path)}b=h/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];k=[];f=[];for(var h=[],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;h.push(n);k.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;for(f=0;--b>=0;)n=e[b],
+m=k[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),h[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=[],k=new THREE.Path,h,m,n,p,o,t,u,v,x,B,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,p));k.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;g.push(new THREE.Vector2(m,
+p));k.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;k.quadraticCurveTo(u,v,m,p);if(h=g[g.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,F=THREE.FontUtils.b2(y,o,u,m),y=THREE.FontUtils.b2(y,t,v,p);g.push(new THREE.Vector2(F,y))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,x=c[b++]*e+f,B=c[b++]*-e,k.quadraticCurveTo(m,p,u,v,x,B),h=g[g.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=
+h/divisions,F=THREE.FontUtils.b3(y,o,u,x,m),y=THREE.FontUtils.b3(y,t,v,B,p),g.push(new THREE.Vector2(F,y))}}}k.debug(document.getElementById("boo"));console.log(k);return{offset:A.ha*e,points:g,path:k}}}};
+(function(b){var c=function(b){for(var c=b.length,g=0,k=c-1,h=0;h<c;k=h++)g+=b[k].x*b[h].y-b[h].x*b[k].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var k=[],h=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)h[p]=p;else for(p=0;p<g;p++)h[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 k}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,x=p,B=o,A=g,y=h,F=void 0,w=void 0,H=void 0,
+E=void 0,D=void 0,S=void 0,J=void 0,G=void 0,U=void 0,w=u[y[v]].x,H=u[y[v]].y,E=u[y[x]].x,D=u[y[x]].y,S=u[y[B]].x,J=u[y[B]].y;if(1.0E-10>(E-w)*(J-H)-(D-H)*(S-w))u=!1;else{for(F=0;F<A;F++)if(!(F==v||F==x||F==B)){var G=u[y[F]].x,U=u[y[F]].y,W=void 0,M=void 0,X=void 0,T=void 0,R=void 0,j=void 0,fa=void 0,P=void 0,da=void 0,ca=void 0,Y=void 0,ea=void 0,W=X=R=void 0,W=S-E,M=J-D,X=w-S,T=H-J,R=E-w,j=D-H,fa=G-w,P=U-H,da=G-E,ca=U-D,Y=G-S,ea=U-J,W=W*ca-M*da,R=R*P-j*fa,X=X*ea-T*Y;if(W>=0&&X>=0&&R>=0){u=!1;break a}}u=
+!0}}if(u){t=h[n];u=h[p];v=h[o];k.push(b[t]);k.push(b[u]);k.push(b[v]);m.push([h[n],h[p],h[o]]);n=p;for(o=p+1;o<g;n++,o++)h[n]=h[o];g--;t=2*g}}if(f)return m;return k};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=
 1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,k=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,k,h));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[k][0],b[k][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(b,c,e,f,g,k,h){function m(b,c,e,f,h,g){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,g*h*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=k||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var o=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(o,h,this.q,this.p,this.radius,this.heightScale),o=m(o+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=o.x-g.x;e.y=o.y-g.y;e.z=o.z-g.z;f.x=o.x+g.x;f.y=o.y+g.y;f.z=o.z+g.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();o=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=o*f.x+h*k.x;g.y+=o*f.y+h*k.y;g.z+=o*f.z+h*k.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,k=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,k));this.faceVertexUvs[0].push([h,o,p,n])}this.computeCentroids();
+this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(n,h,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,h,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;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=n*f.x+h*k.x;g.y+=n*f.y+h*k.y;g.z+=n*f.z+h*k.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,k=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],h=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,k));this.faceVertexUvs[0].push([h,n,p,o])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,k,m){var o=document.createElement("canvas");b[e]=new THREE.Texture(o);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
-1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,o;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,k,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
+1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,n;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
 if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=k(b.colorDiffuse);
 else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=k(b.colorSpecular);if(b.colorAmbient)h.ambient=k(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
-b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(p.uniforms),t=h.color;m=h.specular;o=h.ambient;var u=h.shininess;n.tNormal.texture=h.normalMap;if(b.mapNormalFactor)n.uNormalScale.value=b.mapNormalFactor;if(h.map)n.tDiffuse.texture=h.map,n.enableDiffuse.value=!0;if(h.specularMap)n.tSpecular.texture=h.specularMap,n.enableSpecular.value=!0;if(h.lightMap)n.tAO.texture=
-h.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(t);n.uSpecularColor.value.setHex(m);n.uAmbientColor.value.setHex(o);n.uShininess.value=u;if(h.opacity)n.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:n,lights:!0,fog:!0})}else h=new THREE[m](h);return h}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),t=h.color;m=h.specular;n=h.ambient;var u=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
+h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(t);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=u;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[m](h);return 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.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,o,p,n,t,u,v,w,C,z,y,G,x,B=b.faces;t=b.vertices;var F=b.normals,D=b.colors,P=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&P++;for(e=0;e<P;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(n=t.length;p<n;)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(n=B.length;p<n;){c=B[p++];t=c&1;o=c&2;e=c&4;g=c&8;v=c&16;u=c&32;C=c&64;c&=128;t?(z=new THREE.Face4,z.a=B[p++],z.b=B[p++],z.c=B[p++],z.d=B[p++],t=4):(z=new THREE.Face3,z.a=B[p++],z.b=B[p++],z.c=B[p++],t=3);if(o)o=B[p++],z.materials=f.materials[o];o=f.faces.length;if(e)for(e=0;e<P;e++)y=b.uvs[e],w=B[p++],x=y[w*2],w=y[w*2+1],f.faceUvs[e][o]=new THREE.UV(x,w);if(g)for(e=0;e<P;e++){y=b.uvs[e];G=[];for(g=0;g<t;g++)w=B[p++],x=y[w*2],w=y[w*2+1],G[g]=
-new THREE.UV(x,w);f.faceVertexUvs[e][o]=G}if(v)v=B[p++]*3,g=new THREE.Vector3,g.x=F[v++],g.y=F[v++],g.z=F[v],z.normal=g;if(u)for(e=0;e<t;e++)v=B[p++]*3,g=new THREE.Vector3,g.x=F[v++],g.y=F[v++],g.z=F[v],z.vertexNormals.push(g);if(C)u=B[p++],u=new THREE.Color(D[u]),z.color=u;if(c)for(e=0;e<t;e++)u=B[p++],u=new THREE.Color(D[u]),z.vertexColors.push(u);f.faces.push(z)}}})(g);(function(){var c,e,g,o;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],o=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
-o,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],o=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,o,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,o,p,n,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;o=0;for(p=w.length;o<p;o+=3)n=w[o]*c,t=w[o+1]*
-c,u=w[o+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(n,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;n=b.morphColors[e].colors;c=0;for(o=n.length;c<o;c+=3)t=new THREE.Color(16755200),t.setRGB(n[c],n[c+1],n[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,p,o,t,u,v,x,B,A,y,F,w,H=b.faces;t=b.vertices;var E=b.normals,D=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]=[];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=H.length;p<o;){c=H[p++];t=c&1;n=c&2;e=c&4;g=c&8;v=c&16;u=c&32;B=c&64;c&=128;t?(A=new THREE.Face4,A.a=H[p++],A.b=H[p++],A.c=H[p++],A.d=H[p++],t=4):(A=new THREE.Face3,A.a=H[p++],A.b=H[p++],A.c=H[p++],t=3);if(n)n=H[p++],A.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<S;e++)y=b.uvs[e],x=H[p++],w=y[x*2],x=y[x*2+1],f.faceUvs[e][n]=new THREE.UV(w,x);if(g)for(e=0;e<S;e++){y=b.uvs[e];F=[];for(g=0;g<t;g++)x=H[p++],w=y[x*2],x=y[x*2+1],F[g]=
+new THREE.UV(w,x);f.faceVertexUvs[e][n]=F}if(v)v=H[p++]*3,g=new THREE.Vector3,g.x=E[v++],g.y=E[v++],g.z=E[v],A.normal=g;if(u)for(e=0;e<t;e++)v=H[p++]*3,g=new THREE.Vector3,g.x=E[v++],g.y=E[v++],g.z=E[v],A.vertexNormals.push(g);if(B)u=H[p++],u=new THREE.Color(D[u]),A.color=u;if(c)for(e=0;e<t;e++)u=H[p++],u=new THREE.Color(D[u]),A.vertexColors.push(u);f.faces.push(A)}}})(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,x;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;x=b.morphTargets[e].vertices;n=0;for(p=x.length;n<p;n+=3)o=x[n]*c,t=x[n+1]*
+c,u=x[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],
 f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();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),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,k)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,k){var h=new XMLHttpRequest,m=f+"/"+b,o=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?k&&(o==0&&(o=h.getResponseHeader("Content-Length")),k({total:o,loaded:h.responseText.length})):h.readyState==2&&(o=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=n(b,c),g=n(b,c+1),h=n(b,c+2),j=n(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=n(b,c),f=n(b,c+1),h=n(b,c+2);return(n(b,c+3)<<24)+(h<<16)+(f<<8)+e}function o(b,c){var e=n(b,c);return(n(b,c+1)<<8)+e}function p(b,c){var e=n(b,c);return e>127?e-256:e}function n(b,
-c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+D);h=g(b,c+P);c=o(b,c+I);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function u(c){var e,f,h,j,k,n;e=g(b,c);f=g(b,c+D);h=g(b,c+P);j=o(b,c+I);k=g(b,c+L);n=g(b,c+K);c=g(b,c+U);THREE.BinaryLoader.prototype.f3n(y,B,e,f,h,j,k,n,c)}function v(c){var e,f,h,k;e=g(b,c);f=g(b,c+H);h=g(b,c+fa);k=g(b,c+j);c=o(b,c+da);THREE.BinaryLoader.prototype.f4(y,e,f,h,k,c)}function w(c){var e,f,h,k,n,p,t,u;e=g(b,c);f=g(b,c+H);h=g(b,c+fa);k=g(b,c+j);n=
-o(b,c+da);p=g(b,c+V);t=g(b,c+$);u=g(b,c+O);c=g(b,c+ea);THREE.BinaryLoader.prototype.f4n(y,B,e,f,h,k,n,p,t,u,c)}function C(c){var e,f;e=g(b,c);f=g(b,c+Y);c=g(b,c+T);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[c*2],F[c*2+1])}function z(c){var e,f,h;e=g(b,c);f=g(b,c+ca);h=g(b,c+ha);c=g(b,c+na);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[h*2],F[h*2+1],F[c*2],F[c*2+1])}var y=this,G=0,x,B=[],F=[],D,P,I,L,K,U,H,fa,j,da,V,
-$,O,ea,Y,T,ca,ha,na,ia,J,ga,X,W,ja;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);x={signature:b.substr(G,8),header_bytes:n(b,G+8),vertex_coordinate_bytes:n(b,G+9),normal_coordinate_bytes:n(b,G+10),uv_coordinate_bytes:n(b,G+11),vertex_index_bytes:n(b,G+12),normal_index_bytes:n(b,G+13),uv_index_bytes:n(b,G+14),material_index_bytes:n(b,G+15),nvertices: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+=x.header_bytes;D=x.vertex_index_bytes;P=x.vertex_index_bytes*2;I=x.vertex_index_bytes*3;L=x.vertex_index_bytes*3+x.material_index_bytes;K=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes;U=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*2;H=x.vertex_index_bytes;fa=x.vertex_index_bytes*2;j=x.vertex_index_bytes*3;da=x.vertex_index_bytes*4;V=x.vertex_index_bytes*
-4+x.material_index_bytes;$=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes;O=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*2;ea=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*3;Y=x.uv_index_bytes;T=x.uv_index_bytes*2;ca=x.uv_index_bytes;ha=x.uv_index_bytes*2;na=x.uv_index_bytes*3;c=x.vertex_index_bytes*3+x.material_index_bytes;ja=x.vertex_index_bytes*4+x.material_index_bytes;ia=x.ntri_flat*c;J=x.ntri_smooth*(c+x.normal_index_bytes*3);ga=
-x.ntri_flat_uv*(c+x.uv_index_bytes*3);X=x.ntri_smooth_uv*(c+x.normal_index_bytes*3+x.uv_index_bytes*3);W=x.nquad_flat*ja;c=x.nquad_smooth*(ja+x.normal_index_bytes*4);ja=x.nquad_flat_uv*(ja+x.uv_index_bytes*4);G+=function(c){for(var f,g,j,k=x.vertex_coordinate_bytes*3,m=c+x.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+x.vertex_coordinate_bytes),j=e(b,c+x.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,j);return x.nvertices*k}(G);G+=function(c){for(var e,f,g,h=x.normal_coordinate_bytes*3,j=
-c+x.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+x.normal_coordinate_bytes),g=p(b,c+x.normal_coordinate_bytes*2),B.push(e/127,f/127,g/127);return x.nnormals*h}(G);G+=function(c){for(var f,g,j=x.uv_coordinate_bytes*2,k=c+x.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+x.uv_coordinate_bytes),F.push(f,g);return x.nuvs*j}(G);ia=G+ia;J=ia+J;ga=J+ga;X=ga+X;W=X+W;c=W+c;ja=c+ja;(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes,f=e+x.uv_index_bytes*3,g=b+x.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),C(c+e);return g-
-b})(J);(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,f=e+x.uv_index_bytes*3,g=b+x.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),C(c+e);return g-b})(ga);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes,f=e+x.uv_index_bytes*4,g=b+x.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(c);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*4,f=e+x.uv_index_bytes*4,g=b+x.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
-z(c+e);return g-b})(ja);(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes,f=b+x.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(G);(function(b){var c,e=x.vertex_index_bytes*3+x.material_index_bytes+x.normal_index_bytes*3,f=b+x.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(ia);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes,f=b+x.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(X);(function(b){var c,e=x.vertex_index_bytes*4+x.material_index_bytes+x.normal_index_bytes*
-4,f=b+x.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(W);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};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,k){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[k]))},
-f3n:function(b,c,e,f,g,k,h,m,o){var k=b.materials[k],p=c[m*3],n=c[m*3+1],m=c[m*3+2],t=c[o*3],u=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(p,n,m),new THREE.Vector3(t,u,o)],null,k))},f4n:function(b,c,e,f,g,k,h,m,o,p,n){var h=b.materials[h],t=c[o*3],u=c[o*3+1],o=c[o*3+2],v=c[p*3],w=c[p*3+1],p=c[p*3+2],C=c[n*3],z=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(e,f,g,k,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
-u,o),new THREE.Vector3(v,w,p),new THREE.Vector3(C,z,n)],null,h))},uv3:function(b,c,e,f,g,k,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(k,h));b.push(m)},uv4:function(b,c,e,f,g,k,h,m,o){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(k,h));p.push(new THREE.UV(m,o));b.push(p)}};
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,k){var h=new XMLHttpRequest,m=f+"/"+b,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?k&&(n==0&&(n=h.getResponseHeader("Content-Length")),k({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
+h.setRequestHeader("Content-Type","text/plain");h.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+D);h=g(b,c+S);c=n(b,c+J);THREE.BinaryLoader.prototype.f3(y,e,f,h,c)}function u(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+D);h=g(b,c+S);j=n(b,c+J);k=g(b,c+G);o=g(b,c+U);c=g(b,c+W);THREE.BinaryLoader.prototype.f3n(y,H,e,f,h,j,k,o,c)}function v(c){var e,f,h,j;e=g(b,c);f=g(b,c+M);h=g(b,c+X);j=g(b,c+T);c=n(b,c+R);THREE.BinaryLoader.prototype.f4(y,e,f,h,j,c)}function x(c){var e,f,h,k,o,p,t,u;e=g(b,c);f=g(b,c+M);h=g(b,c+X);k=g(b,c+T);o=n(b,
+c+R);p=g(b,c+j);t=g(b,c+fa);u=g(b,c+P);c=g(b,c+da);THREE.BinaryLoader.prototype.f4n(y,H,e,f,h,k,o,p,t,u,c)}function B(c){var e,f;e=g(b,c);f=g(b,c+ca);c=g(b,c+Y);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],E[e*2],E[e*2+1],E[f*2],E[f*2+1],E[c*2],E[c*2+1])}function A(c){var e,f,h;e=g(b,c);f=g(b,c+ea);h=g(b,c+ga);c=g(b,c+la);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],E[e*2],E[e*2+1],E[f*2],E[f*2+1],E[h*2],E[h*2+1],E[c*2],E[c*2+1])}var y=this,F=0,w,H=[],E=[],D,S,J,G,U,W,M,X,T,R,j,fa,P,
+da,ca,Y,ea,ga,la,pa,N,ia,Z,ma,$;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,f,c);w={signature:b.substr(F,8),header_bytes:o(b,F+8),vertex_coordinate_bytes:o(b,F+9),normal_coordinate_bytes:o(b,F+10),uv_coordinate_bytes:o(b,F+11),vertex_index_bytes:o(b,F+12),normal_index_bytes:o(b,F+13),uv_index_bytes:o(b,F+14),material_index_bytes:o(b,F+15),nvertices:g(b,F+16),nnormals:g(b,F+16+4),nuvs:g(b,F+16+8),ntri_flat:g(b,F+16+12),ntri_smooth:g(b,F+16+16),ntri_flat_uv:g(b,F+16+20),ntri_smooth_uv:g(b,
+F+16+24),nquad_flat:g(b,F+16+28),nquad_smooth:g(b,F+16+32),nquad_flat_uv:g(b,F+16+36),nquad_smooth_uv:g(b,F+16+40)};F+=w.header_bytes;D=w.vertex_index_bytes;S=w.vertex_index_bytes*2;J=w.vertex_index_bytes*3;G=w.vertex_index_bytes*3+w.material_index_bytes;U=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;W=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;M=w.vertex_index_bytes;X=w.vertex_index_bytes*2;T=w.vertex_index_bytes*3;R=w.vertex_index_bytes*4;j=w.vertex_index_bytes*
+4+w.material_index_bytes;fa=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;P=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;da=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;ca=w.uv_index_bytes;Y=w.uv_index_bytes*2;ea=w.uv_index_bytes;ga=w.uv_index_bytes*2;la=w.uv_index_bytes*3;c=w.vertex_index_bytes*3+w.material_index_bytes;$=w.vertex_index_bytes*4+w.material_index_bytes;pa=w.ntri_flat*c;N=w.ntri_smooth*(c+w.normal_index_bytes*3);ia=
+w.ntri_flat_uv*(c+w.uv_index_bytes*3);Z=w.ntri_smooth_uv*(c+w.normal_index_bytes*3+w.uv_index_bytes*3);ma=w.nquad_flat*$;c=w.nquad_smooth*($+w.normal_index_bytes*4);$=w.nquad_flat_uv*($+w.uv_index_bytes*4);F+=function(c){for(var f,g,j,k=w.vertex_coordinate_bytes*3,m=c+w.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+w.vertex_coordinate_bytes),j=e(b,c+w.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,f,g,j);return w.nvertices*k}(F);F+=function(c){for(var e,f,g,h=w.normal_coordinate_bytes*3,j=c+
+w.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+w.normal_coordinate_bytes),g=p(b,c+w.normal_coordinate_bytes*2),H.push(e/127,f/127,g/127);return w.nnormals*h}(F);F+=function(c){for(var f,g,j=w.uv_coordinate_bytes*2,k=c+w.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+w.uv_coordinate_bytes),E.push(f,g);return w.nuvs*j}(F);pa=F+pa;N=pa+N;ia=N+ia;Z=ia+Z;ma=Z+ma;c=ma+c;$=c+$;(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes,f=e+w.uv_index_bytes*3,g=b+w.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),B(c+e);return g-b})(N);
+(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,f=e+w.uv_index_bytes*3,g=b+w.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),B(c+e);return g-b})(ia);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes,f=e+w.uv_index_bytes*4,g=b+w.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),A(c+e);return g-b})(c);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,f=e+w.uv_index_bytes*4,g=b+w.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),A(c+
+e);return g-b})($);(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes,f=b+w.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(F);(function(b){var c,e=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,f=b+w.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(pa);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes,f=b+w.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(Z);(function(b){var c,e=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*
+4,f=b+w.nquad_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(ma);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};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,k){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[k]))},
+f3n:function(b,c,e,f,g,k,h,m,n){var k=b.materials[k],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[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,u,n)],null,k))},f4n:function(b,c,e,f,g,k,h,m,n,p,o){var h=b.materials[h],t=c[n*3],u=c[n*3+1],n=c[n*3+2],v=c[p*3],x=c[p*3+1],p=c[p*3+2],B=c[o*3],A=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,k,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,
+u,n),new THREE.Vector3(v,x,p),new THREE.Vector3(B,A,o)],null,h))},uv3:function(b,c,e,f,g,k,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(k,h));b.push(m)},uv4:function(b,c,e,f,g,k,h,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(k,h));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 H.objects)if(!O.objects[v])if(G=H.objects[v],G.geometry!==void 0){if(D=O.geometries[G.geometry]){var b=!1;K=[];for(Y=0;Y<G.materials.length;Y++)K[Y]=O.materials[G.materials[Y]],b=K[Y]instanceof THREE.MeshShaderMaterial;b&&D.computeTangents();x=G.position;r=G.rotation;
-q=G.quaternion;s=G.scale;q=0;K.length==0&&(K[0]=new THREE.MeshFaceMaterial);K.length>1&&(K=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,K);object.name=v;object.position.set(x[0],x[1],x[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;O.scene.addObject(object);O.objects[v]=object;G.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),O.scene.collisions.colliders.push(b));
-if(G.castsShadow)b=new THREE.ShadowVolume(D),O.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},O.triggers[object.name]=b)}}else x=G.position,r=G.rotation,q=G.quaternion,s=G.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(x[0],x[1],x[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,O.scene.addObject(object),O.objects[v]=object,O.empties[v]=object,G.trigger&&G.trigger.toLowerCase()!="none"&&(b={type:G.trigger,object:G},O.triggers[object.name]=b)}function o(b){return function(c){O.geometries[b]=c;m();j-=1;e.onLoadComplete();n()}}function p(b){return function(c){O.geometries[b]=c}}function n(){e.callbackProgress({totalModels:V,totalTextures:$,loadedModels:V-j,loadedTextures:$-da},O);e.onLoadProgress();j==0&&da==0&&c(O)}
-var t,u,v,w,C,z,y,G,x,B,F,D,P,I,L,K,U,H,fa,j,da,V,$,O;H=b.data;L=new THREE.BinaryLoader;fa=new THREE.JSONLoader;da=j=0;O={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in H.objects)if(G=H.objects[v],G.meshCollider){b=!0;break}if(b)O.scene.collisions=new THREE.CollisionSystem;if(H.transform){b=H.transform.position;B=H.transform.rotation;var ea=H.transform.scale;b&&O.scene.position.set(b[0],b[1],b[2]);B&&O.scene.rotation.set(B[0],
-B[1],B[2]);ea&&O.scene.scale.set(ea[0],ea[1],ea[2]);(b||B||ea)&&O.scene.updateMatrix()}b=function(){da-=1;n();e.onLoadComplete()};for(C in H.cameras){B=H.cameras[C];if(B.type=="perspective")P=new THREE.Camera(B.fov,B.aspect,B.near,B.far);else if(B.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(B.left,B.right,B.top,B.bottom,B.near,B.far);x=B.position;B=B.target;P.position.set(x[0],x[1],x[2]);P.target.position.set(B[0],B[1],B[2]);O.cameras[C]=P}for(w in H.lights)C=H.lights[w],
-P=C.color!==void 0?C.color:16777215,B=C.intensity!==void 0?C.intensity:1,C.type=="directional"?(x=C.direction,U=new THREE.DirectionalLight(P,B),U.position.set(x[0],x[1],x[2]),U.position.normalize()):C.type=="point"?(x=C.position,d=C.distance,U=new THREE.PointLight(P,B,d),U.position.set(x[0],x[1],x[2])):C.type=="ambient"&&(U=new THREE.AmbientLight(P)),O.scene.addLight(U),O.lights[w]=U;for(z in H.fogs)w=H.fogs[z],w.type=="linear"?I=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(I=new THREE.FogExp2(0,
-w.density)),B=w.color,I.color.setRGB(B[0],B[1],B[2]),O.fogs[z]=I;if(O.cameras&&H.defaults.camera)O.currentCamera=O.cameras[H.defaults.camera];if(O.fogs&&H.defaults.fog)O.scene.fog=O.fogs[H.defaults.fog];B=H.defaults.bgcolor;O.bgColor=new THREE.Color;O.bgColor.setRGB(B[0],B[1],B[2]);O.bgColorAlpha=H.defaults.bgalpha;for(t in H.geometries)if(z=H.geometries[t],z.type=="bin_mesh"||z.type=="ascii_mesh")j+=1,e.onLoadStart();V=j;for(t in H.geometries)z=H.geometries[t],z.type=="cube"?(D=new THREE.CubeGeometry(z.width,
-z.height,z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),O.geometries[t]=D):z.type=="plane"?(D=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),O.geometries[t]=D):z.type=="sphere"?(D=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),O.geometries[t]=D):z.type=="cylinder"?(D=new THREE.CylinderGeometry(z.numSegs,z.topRad,z.botRad,z.height,z.topOffset,z.botOffset),O.geometries[t]=D):z.type=="torus"?(D=new THREE.TorusGeometry(z.radius,
-z.tube,z.segmentsR,z.segmentsT),O.geometries[t]=D):z.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(z.subdivisions),O.geometries[t]=D):z.type=="bin_mesh"?L.load({model:f(z.url,H.urlBaseType),callback:o(t)}):z.type=="ascii_mesh"?fa.load({model:f(z.url,H.urlBaseType),callback:o(t)}):z.type=="embedded_mesh"&&(z=H.embeds[z.id])&&fa.createModel(z,p(t),"");for(y in H.textures)if(t=H.textures[y],t.url instanceof Array){da+=t.url.length;for(L=0;L<t.url.length;L++)e.onLoadStart()}else da+=1,e.onLoadStart();
-$=da;for(y in H.textures){t=H.textures[y];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){L=[];for(var Y=0;Y<t.url.length;Y++)L[Y]=f(t.url[Y],H.urlBaseType);L=THREE.ImageUtils.loadTextureCube(L,t.mapping,b)}else{L=THREE.ImageUtils.loadTexture(f(t.url,H.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)L.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)L.magFilter=THREE[t.magFilter];if(t.repeat){L.repeat.set(t.repeat[0],t.repeat[1]);
-if(t.repeat[0]!=1)L.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)L.wrapT=THREE.RepeatWrapping}t.offset&&L.offset.set(t.offset[0],t.offset[1]);if(t.wrap){fa={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(fa[t.wrap[0]]!==void 0)L.wrapS=fa[t.wrap[0]];if(fa[t.wrap[1]]!==void 0)L.wrapT=fa[t.wrap[1]]}}O.textures[y]=L}for(u in H.materials){y=H.materials[u];for(F in y.parameters)if(F=="envMap"||F=="map"||F=="lightMap")y.parameters[F]=O.textures[y.parameters[F]];else if(F=="shading")y.parameters[F]=
-y.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")y.parameters[F]=THREE[y.parameters[F]]?THREE[y.parameters[F]]:THREE.NormalBlending;else if(F=="combine")y.parameters[F]=y.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(y.parameters[F]=="face")y.parameters[F]=THREE.FaceColors;else if(y.parameters[F])y.parameters[F]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
-!0;if(y.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);L=y.parameters.color;fa=y.parameters.specular;z=y.parameters.ambient;I=y.parameters.shininess;b.tNormal.texture=O.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=!0;if(y.parameters.specularMap)b.tSpecular.texture=
-O.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(L);b.uSpecularColor.value.setHex(fa);b.uAmbientColor.value.setHex(z);b.uShininess.value=I;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);O.materials[u]=y}m();e.callbackSync(O)}}};
+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 M.objects)if(!P.objects[v])if(F=M.objects[v],F.geometry!==void 0){if(D=P.geometries[F.geometry]){var b=!1;U=[];for(ca=0;ca<F.materials.length;ca++)U[ca]=P.materials[F.materials[ca]],b=U[ca]instanceof THREE.MeshShaderMaterial;b&&D.computeTangents();w=F.position;r=
+F.rotation;q=F.quaternion;s=F.scale;q=0;U.length==0&&(U[0]=new THREE.MeshFaceMaterial);U.length>1&&(U=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,U);object.name=v;object.position.set(w[0],w[1],w[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;P.scene.addObject(object);P.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(b));
+if(F.castsShadow)b=new THREE.ShadowVolume(D),P.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}}else w=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(w[0],w[1],w[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,P.scene.addObject(object),P.objects[v]=object,P.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}function n(b){return function(c){P.geometries[b]=c;m();T-=1;e.onLoadComplete();o()}}function p(b){return function(c){P.geometries[b]=c}}function o(){e.callbackProgress({totalModels:j,totalTextures:fa,loadedModels:j-T,loadedTextures:fa-R},P);e.onLoadProgress();T==0&&R==0&&c(P)}
+var t,u,v,x,B,A,y,F,w,H,E,D,S,J,G,U,W,M,X,T,R,j,fa,P;M=b.data;G=new THREE.BinaryLoader;X=new THREE.JSONLoader;R=T=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in M.objects)if(F=M.objects[v],F.meshCollider){b=!0;break}if(b)P.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var da=M.transform.scale;b&&P.scene.position.set(b[0],b[1],b[2]);H&&P.scene.rotation.set(H[0],
+H[1],H[2]);da&&P.scene.scale.set(da[0],da[1],da[2]);(b||H||da)&&P.scene.updateMatrix()}b=function(){R-=1;o();e.onLoadComplete()};for(B in M.cameras){H=M.cameras[B];if(H.type=="perspective")S=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);w=H.position;H=H.target;S.position.set(w[0],w[1],w[2]);S.target.position.set(H[0],H[1],H[2]);P.cameras[B]=S}for(x in M.lights)B=M.lights[x],
+S=B.color!==void 0?B.color:16777215,H=B.intensity!==void 0?B.intensity:1,B.type=="directional"?(w=B.direction,W=new THREE.DirectionalLight(S,H),W.position.set(w[0],w[1],w[2]),W.position.normalize()):B.type=="point"?(w=B.position,d=B.distance,W=new THREE.PointLight(S,H,d),W.position.set(w[0],w[1],w[2])):B.type=="ambient"&&(W=new THREE.AmbientLight(S)),P.scene.addLight(W),P.lights[x]=W;for(A in M.fogs)x=M.fogs[A],x.type=="linear"?J=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(J=new THREE.FogExp2(0,
+x.density)),H=x.color,J.color.setRGB(H[0],H[1],H[2]),P.fogs[A]=J;if(P.cameras&&M.defaults.camera)P.currentCamera=P.cameras[M.defaults.camera];if(P.fogs&&M.defaults.fog)P.scene.fog=P.fogs[M.defaults.fog];H=M.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=M.defaults.bgalpha;for(t in M.geometries)if(A=M.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")T+=1,e.onLoadStart();j=T;for(t in M.geometries)A=M.geometries[t],A.type=="cube"?(D=new THREE.CubeGeometry(A.width,
+A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),P.geometries[t]=D):A.type=="plane"?(D=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),P.geometries[t]=D):A.type=="sphere"?(D=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),P.geometries[t]=D):A.type=="cylinder"?(D=new THREE.CylinderGeometry(A.numSegs,A.topRad,A.botRad,A.height,A.topOffset,A.botOffset),P.geometries[t]=D):A.type=="torus"?(D=new THREE.TorusGeometry(A.radius,
+A.tube,A.segmentsR,A.segmentsT),P.geometries[t]=D):A.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(A.subdivisions),P.geometries[t]=D):A.type=="bin_mesh"?G.load({model:f(A.url,M.urlBaseType),callback:n(t)}):A.type=="ascii_mesh"?X.load({model:f(A.url,M.urlBaseType),callback:n(t)}):A.type=="embedded_mesh"&&(A=M.embeds[A.id])&&X.createModel(A,p(t),"");for(y in M.textures)if(t=M.textures[y],t.url instanceof Array){R+=t.url.length;for(G=0;G<t.url.length;G++)e.onLoadStart()}else R+=1,e.onLoadStart();
+fa=R;for(y in M.textures){t=M.textures[y];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var ca=0;ca<t.url.length;ca++)G[ca]=f(t.url[ca],M.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,t.mapping,b)}else{G=THREE.ImageUtils.loadTexture(f(t.url,M.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)G.magFilter=THREE[t.magFilter];if(t.repeat){G.repeat.set(t.repeat[0],
+t.repeat[1]);if(t.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}t.offset&&G.offset.set(t.offset[0],t.offset[1]);if(t.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[t.wrap[0]]!==void 0)G.wrapS=X[t.wrap[0]];if(X[t.wrap[1]]!==void 0)G.wrapT=X[t.wrap[1]]}}P.textures[y]=G}for(u in M.materials){y=M.materials[u];for(E in y.parameters)if(E=="envMap"||E=="map"||E=="lightMap")y.parameters[E]=P.textures[y.parameters[E]];else if(E=="shading")y.parameters[E]=
+y.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")y.parameters[E]=THREE[y.parameters[E]]?THREE[y.parameters[E]]:THREE.NormalBlending;else if(E=="combine")y.parameters[E]=y.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(E=="vertexColors")if(y.parameters[E]=="face")y.parameters[E]=THREE.FaceColors;else if(y.parameters[E])y.parameters[E]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
+!0;if(y.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);G=y.parameters.color;X=y.parameters.specular;A=y.parameters.ambient;J=y.parameters.shininess;b.tNormal.texture=P.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)b.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)b.tDiffuse.texture=y.parameters.map,b.enableDiffuse.value=!0;if(y.parameters.lightMap)b.tAO.texture=y.parameters.lightMap,b.enableAO.value=!0;if(y.parameters.specularMap)b.tSpecular.texture=
+P.textures[y.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(G);b.uSpecularColor.value.setHex(X);b.uAmbientColor.value.setHex(A);b.uShininess.value=J;if(y.parameters.opacity)b.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);P.materials[u]=y}m();e.callbackSync(P)}}};
 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,k,h,m,o,p,n,t){h=(h-n)/(t-n);n=this.normal_cache;c[k]=m+h*this.delta;c[k+1]=o;c[k+2]=p;g[k]=this.lerp(n[b],n[b+3],h);g[k+1]=this.lerp(n[b+1],n[b+4],h);g[k+2]=this.lerp(n[b+2],n[b+5],h)};this.VIntY=function(b,c,g,k,h,m,o,p,n,t){h=(h-n)/(t-n);n=this.normal_cache;c[k]=m;c[k+1]=o+h*this.delta;c[k+
-2]=p;c=b+this.yd*3;g[k]=this.lerp(n[b],n[c],h);g[k+1]=this.lerp(n[b+1],n[c+1],h);g[k+2]=this.lerp(n[b+2],n[c+2],h)};this.VIntZ=function(b,c,g,k,h,m,o,p,n,t){h=(h-n)/(t-n);n=this.normal_cache;c[k]=m;c[k+1]=o;c[k+2]=p+h*this.delta;c=b+this.zd*3;g[k]=this.lerp(n[b],n[c],h);g[k+1]=this.lerp(n[b+1],n[c+1],h);g[k+2]=this.lerp(n[b+2],n[c+2],h)};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,k,h,m){var o=k+1,p=k+this.yd,n=k+this.zd,t=o+this.yd,u=o+this.zd,v=k+this.yd+this.zd,w=o+this.yd+this.zd,C=0,z=this.field[k],y=this.field[o],G=this.field[p],x=this.field[t],B=this.field[n],F=this.field[u],D=this.field[v],P=this.field[w];z<h&&(C|=1);y<h&&(C|=2);G<h&&(C|=8);x<h&&(C|=4);B<h&&(C|=16);F<h&&(C|=32);D<h&&(C|=128);P<h&&(C|=64);var I=THREE.edgeTable[C];if(I==0)return 0;var L=this.delta,
-K=b+L,U=c+L,L=g+L;I&1&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,0,h,b,c,g,z,y));I&2&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,3,h,K,c,g,y,x));I&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,h,b,U,g,G,x));I&8&&(this.compNorm(k),this.compNorm(p),this.VIntY(k*3,this.vlist,this.nlist,9,h,b,c,g,z,G));I&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,h,b,c,L,B,F));I&32&&(this.compNorm(u),
-this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,15,h,K,c,L,F,P));I&64&&(this.compNorm(v),this.compNorm(w),this.VIntX(v*3,this.vlist,this.nlist,18,h,b,U,L,D,P));I&128&&(this.compNorm(n),this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,21,h,b,c,L,B,D));I&256&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,24,h,b,c,g,z,B));I&512&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,27,h,K,c,g,y,F));I&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
-3,this.vlist,this.nlist,30,h,K,U,g,x,P));I&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,h,b,U,g,G,D));C<<=4;for(h=k=0;THREE.triTable[C+h]!=-1;)b=C+h,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),h+=3,k++;return k};this.posnormtriv=function(b,c,g,k,h,m){var o=this.count*3;this.positionArray[o]=b[g];this.positionArray[o+1]=b[g+1];this.positionArray[o+2]=b[g+2];this.positionArray[o+3]=b[k];this.positionArray[o+
-4]=b[k+1];this.positionArray[o+5]=b[k+2];this.positionArray[o+6]=b[h];this.positionArray[o+7]=b[h+1];this.positionArray[o+8]=b[h+2];this.normalArray[o]=c[g];this.normalArray[o+1]=c[g+1];this.normalArray[o+2]=c[g+2];this.normalArray[o+3]=c[k];this.normalArray[o+4]=c[k+1];this.normalArray[o+5]=c[k+2];this.normalArray[o+6]=c[h];this.normalArray[o+7]=c[h+1];this.normalArray[o+8]=c[h+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,k,h){var m=this.size*Math.sqrt(k/h),o=g*this.size,p=c*this.size,n=b*this.size,t=Math.floor(o-m);t<1&&(t=1);o=Math.floor(o+m);o>this.size-1&&(o=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(n-m);v<1&&(v=1);m=Math.floor(n+m);m>this.size-1&&(m=this.size-
-1);for(var w,C,z,y,G,x;t<o;t++){n=this.size2*t;C=t/this.size-g;G=C*C;for(C=u;C<p;C++){z=n+this.size*C;w=C/this.size-c;x=w*w;for(w=v;w<m;w++)y=w/this.size-b,y=k/(1.0E-6+y*y+x+G)-h,y>0&&(this.field[z+w]+=y)}}};this.addPlaneX=function(b,c){var g,k,h,m,o,p=this.size,n=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(k=g/p,k*=k,m=b/(1.0E-4+k)-c,m>0)for(k=0;k<p;k++){o=g+k*n;for(h=0;h<p;h++)u[t*h+o]+=m}};this.addPlaneY=function(b,c){var g,k,h,m,o,p,n=this.size,t=this.yd,u=
-this.zd,v=this.field,w=n*Math.sqrt(b/c);w>n&&(w=n);for(k=0;k<w;k++)if(g=k/n,g*=g,m=b/(1.0E-4+g)-c,m>0){o=k*t;for(g=0;g<n;g++){p=o+g;for(h=0;h<n;h++)v[u*h+p]+=m}}};this.addPlaneZ=function(b,c){var g,k,h,m,o,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){o=zd*h;for(k=0;k<size;k++){p=o+k*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,k,h,m,o,p,n,t,u=this.size-2;for(h=1;h<u;h++){t=this.size2*h;p=(h-this.halfsize)/this.halfsize;for(k=1;k<u;k++){n=t+this.size*k;o=(k-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(m,o,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(k){var h,m,o,p,n,t,u,v;for(h=0;h<k.count;h++)u=h*3,n=u+1,v=u+2,m=k.positionArray[u],
-o=k.positionArray[n],p=k.positionArray[v],t=new THREE.Vector3(m,o,p),m=k.normalArray[u],o=k.normalArray[n],p=k.normalArray[v],u=new THREE.Vector3(m,o,p),u.normalize(),n=new THREE.Vertex(t),c.vertices.push(n),g.push(u);nfaces=k.count/3;for(h=0;h<nfaces;h++)u=(b+h)*3,n=u+1,v=u+2,t=g[u],m=g[n],o=g[v],u=new THREE.Face3(u,n,v,[t,m,o]),c.faces.push(u);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,k,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[k]=m+h*this.delta;c[k+1]=n;c[k+2]=p;g[k]=this.lerp(o[b],o[b+3],h);g[k+1]=this.lerp(o[b+1],o[b+4],h);g[k+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,k,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[k]=m;c[k+1]=n+h*this.delta;c[k+
+2]=p;c=b+this.yd*3;g[k]=this.lerp(o[b],o[c],h);g[k+1]=this.lerp(o[b+1],o[c+1],h);g[k+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,k,h,m,n,p,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[k]=m;c[k+1]=n;c[k+2]=p+h*this.delta;c=b+this.zd*3;g[k]=this.lerp(o[b],o[c],h);g[k+1]=this.lerp(o[b+1],o[c+1],h);g[k+2]=this.lerp(o[b+2],o[c+2],h)};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,k,h,m){var n=k+1,p=k+this.yd,o=k+this.zd,t=n+this.yd,u=n+this.zd,v=k+this.yd+this.zd,x=n+this.yd+this.zd,B=0,A=this.field[k],y=this.field[n],F=this.field[p],w=this.field[t],H=this.field[o],E=this.field[u],D=this.field[v],S=this.field[x];A<h&&(B|=1);y<h&&(B|=2);F<h&&(B|=8);w<h&&(B|=4);H<h&&(B|=16);E<h&&(B|=32);D<h&&(B|=128);S<h&&(B|=64);var J=THREE.edgeTable[B];if(J==0)return 0;var G=this.delta,
+U=b+G,W=c+G,G=g+G;J&1&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,0,h,b,c,g,A,y));J&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,h,U,c,g,y,w));J&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,h,b,W,g,F,w));J&8&&(this.compNorm(k),this.compNorm(p),this.VIntY(k*3,this.vlist,this.nlist,9,h,b,c,g,A,F));J&16&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,G,H,E));J&32&&(this.compNorm(u),
+this.compNorm(x),this.VIntY(u*3,this.vlist,this.nlist,15,h,U,c,G,E,S));J&64&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,18,h,b,W,G,D,S));J&128&&(this.compNorm(o),this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,G,H,D));J&256&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,24,h,b,c,g,A,H));J&512&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,27,h,U,c,g,y,E));J&1024&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*
+3,this.vlist,this.nlist,30,h,U,W,g,w,S));J&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,h,b,W,g,F,D));B<<=4;for(h=k=0;THREE.triTable[B+h]!=-1;)b=B+h,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),h+=3,k++;return k};this.posnormtriv=function(b,c,g,k,h,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[k];this.positionArray[n+
+4]=b[k+1];this.positionArray[n+5]=b[k+2];this.positionArray[n+6]=b[h];this.positionArray[n+7]=b[h+1];this.positionArray[n+8]=b[h+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[k];this.normalArray[n+4]=c[k+1];this.normalArray[n+5]=c[k+2];this.normalArray[n+6]=c[h];this.normalArray[n+7]=c[h+1];this.normalArray[n+8]=c[h+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,k,h){var m=this.size*Math.sqrt(k/h),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 x,B,A,y,F,w;t<n;t++){o=this.size2*t;B=t/this.size-g;F=B*B;for(B=u;B<p;B++){A=o+this.size*B;x=B/this.size-c;w=x*x;for(x=v;x<m;x++)y=x/this.size-b,y=k/(1.0E-6+y*y+w+F)-h,y>0&&(this.field[A+x]+=y)}}};this.addPlaneX=function(b,c){var g,k,h,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(k=g/p,k*=k,m=b/(1.0E-4+k)-c,m>0)for(k=0;k<p;k++){n=g+k*o;for(h=0;h<p;h++)u[t*h+n]+=m}};this.addPlaneY=function(b,c){var g,k,h,m,n,p,o=this.size,t=this.yd,u=
+this.zd,v=this.field,x=o*Math.sqrt(b/c);x>o&&(x=o);for(k=0;k<x;k++)if(g=k/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=k*t;for(g=0;g<o;g++){p=n+g;for(h=0;h<o;h++)v[u*h+p]+=m}}};this.addPlaneZ=function(b,c){var g,k,h,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(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*h;for(k=0;k<size;k++){p=n+k*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,k,h,m,n,p,o,t,u=this.size-2;for(h=1;h<u;h++){t=this.size2*h;p=(h-this.halfsize)/this.halfsize;for(k=1;k<u;k++){o=t+this.size*k;n=(k-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(k){var h,m,n,p,o,t,u,v;for(h=0;h<k.count;h++)u=h*3,o=u+1,v=u+2,m=k.positionArray[u],
+n=k.positionArray[o],p=k.positionArray[v],t=new THREE.Vector3(m,n,p),m=k.normalArray[u],n=k.normalArray[o],p=k.normalArray[v],u=new THREE.Vector3(m,n,p),u.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),g.push(u);nfaces=k.count/3;for(h=0;h<nfaces;h++)u=(b+h)*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;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 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]);
@@ -562,20 +566,20 @@ 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,k=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>k?this.hits.push(g):this.hits.unshift(g),k=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.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,k=0;k<c.numFaces;k++){var h=c.mesh.geometry.faces[k],m=c.mesh.geometry.vertices[h.a].position,o=c.mesh.geometry.vertices[h.b].position,p=c.mesh.geometry.vertices[h.c].position,n=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,m,o,p,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-h instanceof THREE.Face4&&(h=this.rayTriangle(e,m,o,n,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,o,p,n,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,k,h){var m=THREE.CollisionSystem.__v1,o=THREE.CollisionSystem.__v2;k.set(0,0,0);m.sub(e,c);o.sub(f,e);k.cross(m,o);m=k.dot(b.direction);if(!(m<0))if(h.doubleSided||h.flipSided)k.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;h=k.dot(c)-k.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(k.x)>
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,k=0;k<c.numFaces;k++){var h=c.mesh.geometry.faces[k],m=c.mesh.geometry.vertices[h.a].position,n=c.mesh.geometry.vertices[h.b].position,p=c.mesh.geometry.vertices[h.c].position,o=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,m,n,p,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+h instanceof THREE.Face4&&(h=this.rayTriangle(e,m,n,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,n,p,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,k,h){var m=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;k.set(0,0,0);m.sub(e,c);n.sub(f,e);k.cross(m,n);m=k.dot(b.direction);if(!(m<0))if(h.doubleSided||h.flipSided)k.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;h=k.dot(c)-k.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(k.x)>
 Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=m.y-c.y,k=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,k=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(k.y)>Math.abs(k.z)?(b=m.x-c.x,k=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,k=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=k*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*=k*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
 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,k=0,h=0,m=0,o=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,h=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?(k=c.min.z-e.origin.z,k/=e.direction.z,p=!1,o=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,p=!1,o=1);if(p)return-1;p=0;g>f&&(p=1,f=g);k>f&&(p=2,f=k);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(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>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:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>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,o)}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.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,k=0,h=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,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,h=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?(k=c.min.z-e.origin.z,k/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);k>f&&(p=2,f=k);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(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>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:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>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.__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))};
-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,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,o,p,n;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
+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,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:u}},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 w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||p!==e.near||n!==e.fov){o=e.aspect;p=e.near;n=e.fov;var y=e.projectionMatrix.clone(),G=125/30*0.5,x=G*p/125,B=p*Math.tan(n*Math.PI/360),F;h.n14=G;m.n14=-G;G=-B*o+x;F=B*o+x;y.n11=2*p/(F-G);y.n13=(F+G)/(F-G);g.projectionMatrix=y.clone();G=-B*o-x;F=B*o-x;y.n11=2*p/(F-G);
-y.n13=(F+G)/(F-G);k.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=p;k.far=e.far;f.call(c,b,k,u,!0);f.call(c,w,v)}};
+var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var y=e.projectionMatrix.clone(),F=125/30*0.5,w=F*p/125,H=p*Math.tan(o*Math.PI/360),E;h.n14=F;m.n14=-F;F=-H*n+w;E=H*n+w;y.n11=2*p/(E-F);y.n13=(E+F)/(E-F);g.projectionMatrix=y.clone();F=-H*n-w;E=H*n-w;y.n11=2*p/(E-F);
+y.n13=(E+F)/(E-F);k.projectionMatrix=y.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=p;k.far=e.far;f.call(c,b,k,u,!0);f.call(c,x,v)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,k,h=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;k=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
 h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,k);f.call(c,b,h);this.setViewport(g,0,g,k);f.call(c,b,m,!1)}};

+ 165 - 161
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js r42 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,g,i,h,j,k;if(e==0)f=g=i=0;else switch(h=Math.floor(b*6),j=b*6-h,b=e*(1-d),k=e*(1-d*j),d=e*(1-d*(1-j)),h){case 1:f=k;g=e;i=b;break;case 2:f=b;g=e;i=d;break;case 3:f=b;g=k;i=e;break;case 4:f=d;g=b;i=e;break;case 5:f=e;g=b;i=k;break;case 6:case 0:f=e,g=d,i=b}this.setRGB(f,
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,g,i,h,j,o;if(e==0)f=g=i=0;else switch(h=Math.floor(b*6),j=b*6-h,b=e*(1-d),o=e*(1-d*j),d=e*(1-d*(1-j)),h){case 1:f=o;g=e;i=b;break;case 2:f=b;g=e;i=d;break;case 3:f=b;g=o;i=e;break;case 4:f=d;g=b;i=e;break;case 5:f=e;g=b;i=o;break;case 6:case 0:f=e,g=d,i=b}this.setRGB(f,
 g,i)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)};
 THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,d){this.x=b.x+d.x;this.y=b.y+d.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,d){this.x=b.x-d.x;this.y=b.y-d.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
 (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,b=this.y-b.y;return d*d+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
@@ -14,35 +14,35 @@ 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())},
 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,e=e.matrixWorld.getPosition();f=e.clone().subSelf(b).dot(d);b=b.clone().addSelf(d.clone().multiplyScalar(f));return e.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,k,o,q,n,t,u,z=b.geometry,
-D=z.vertices,E=[],f=0;for(g=z.faces.length;f<g;f++)if(i=z.faces[f],t=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,h=o.multiplyVector3(D[i.a].position.clone()),j=o.multiplyVector3(D[i.b].position.clone()),k=o.multiplyVector3(D[i.c].position.clone()),o=i instanceof THREE.Face4?o.multiplyVector3(D[i.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),n=u.dot(q),b.doubleSided||(b.flipSided?n>0:n<0))if(q=q.dot((new THREE.Vector3).sub(h,t))/n,t=t.addSelf(u.multiplyScalar(q)),
-i instanceof THREE.Face3)e(t,h,j,k)&&(i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},E.push(i));else if(i instanceof THREE.Face4&&(e(t,h,j,o)||e(t,j,k,o)))i={distance:this.origin.distanceTo(t),point:t,face:i,object:b},E.push(i);return E}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,q,n){j=!1;d=h;e=i;f=q;g=n;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,q,n,t,u){j?(j=!1,d=h<q?h<t?h:t:q<t?q:t,e=i<n?i<u?i:u:n<u?n:u,f=h>q?h>t?h:t:q>t?q:t,g=i>n?i>u?i:u:n>u?n:u):(d=h<q?h<t?h<d?h:d:t<d?t:d:q<t?q<d?q:d:t<d?t:d,e=i<n?i<u?i<e?i:e:u<e?u:e:n<u?n<e?n:e:u<e?u:e,f=h>q?h>t?h>f?h:f:t>f?t:f:q>t?q>f?q:f:t>f?t:f,g=i>n?i>u?i>g?i:g:u>g?u:g:n>u?n>g?n:g:u>g?u: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>
+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,p,n,v,t,z=b.geometry,
+D=z.vertices,E=[],f=0;for(g=z.faces.length;f<g;f++)if(i=z.faces[f],v=this.origin.clone(),t=this.direction.clone(),k=b.matrixWorld,h=k.multiplyVector3(D[i.a].position.clone()),j=k.multiplyVector3(D[i.b].position.clone()),o=k.multiplyVector3(D[i.c].position.clone()),k=i instanceof THREE.Face4?k.multiplyVector3(D[i.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(i.normal.clone()),n=t.dot(p),b.doubleSided||(b.flipSided?n>0:n<0))if(p=p.dot((new THREE.Vector3).sub(h,v))/n,v=v.addSelf(t.multiplyScalar(p)),
+i instanceof THREE.Face3)e(v,h,j,o)&&(i={distance:this.origin.distanceTo(v),point:v,face:i,object:b},E.push(i));else if(i instanceof THREE.Face4&&(e(v,h,j,k)||e(v,j,o,k)))i={distance:this.origin.distanceTo(v),point:v,face:i,object:b},E.push(i);return E}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,p,n){j=!1;d=h;e=i;f=p;g=n;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,p,n,v,t){j?(j=!1,d=h<p?h<v?h:v:p<v?p:v,e=i<n?i<t?i:t:n<t?n:t,f=h>p?h>v?h:v:p>v?p:v,g=i>n?i>t?i:t:n>t?n:t):(d=h<p?h<v?h<d?h:d:v<d?v:d:p<v?p<d?p:d:v<d?v:d,e=i<n?i<t?i<e?i:e:t<e?t:e:n<t?n<e?n:e:t<e?t:e,f=h>p?h>v?h>f?h:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f,g=i>n?i>t?i>g?i:g:t>g?t:g:n>t?n>g?n:g:t>g?t: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=[]};
-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,k,o,q,n,t,u,z,D){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,k||0,o||0,q||1,n||0,t||0,u||0,z||0,D||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,e,f,g,i,h,j,k,o,q,n,t,u,z,D){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=k;this.n32=o;this.n33=q;this.n34=n;this.n41=t;this.n42=u;this.n43=z;this.n44=D;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,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,p,n,v,t,z,D){this.set(b||1,d||0,e||0,f||0,g||0,i||1,h||0,j||0,o||0,k||0,p||1,n||0,v||0,t||0,z||0,D||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,p,n,v,t,z,D){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=p;this.n34=n;this.n41=v;this.n42=t;this.n43=z;this.n44=D;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,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*
 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,k=b.n23,o=b.n24,q=b.n31,n=b.n32,t=b.n33,u=b.n34,z=b.n41,D=b.n42,E=b.n43,C=b.n44,N=d.n11,ea=d.n12,S=d.n13,H=d.n14,y=d.n21,aa=d.n22,
-P=d.n23,Q=d.n24,B=d.n31,ua=d.n32,M=d.n33,L=d.n34,c=d.n41,sa=d.n42,la=d.n43,ha=d.n44;this.n11=e*N+f*y+g*B+i*c;this.n12=e*ea+f*aa+g*ua+i*sa;this.n13=e*S+f*P+g*M+i*la;this.n14=e*H+f*Q+g*L+i*ha;this.n21=h*N+j*y+k*B+o*c;this.n22=h*ea+j*aa+k*ua+o*sa;this.n23=h*S+j*P+k*M+o*la;this.n24=h*H+j*Q+k*L+o*ha;this.n31=q*N+n*y+t*B+u*c;this.n32=q*ea+n*aa+t*ua+u*sa;this.n33=q*S+n*P+t*M+u*la;this.n34=q*H+n*Q+t*L+u*ha;this.n41=z*N+D*y+E*B+C*c;this.n42=z*ea+D*aa+E*ua+C*sa;this.n43=z*S+D*P+E*M+C*la;this.n44=z*H+D*Q+E*
-L+C*ha;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=
-b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,q=this.n33,n=this.n34,t=this.n41,u=this.n42,z=this.n43,D=this.n44;return f*h*o*t-e*j*o*t-f*i*q*t+d*j*q*t+e*i*n*t-d*h*n*t-f*h*k*u+e*j*k*u+f*g*q*u-b*j*q*u-e*g*n*u+b*h*n*u+f*i*k*z-d*j*k*z-f*g*o*z+b*j*o*z+d*g*n*z-b*i*n*z-e*i*k*D+d*h*k*D+e*g*o*D-b*h*o*D-d*g*q*D+b*i*q*D},
+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,p=b.n31,n=b.n32,v=b.n33,t=b.n34,z=b.n41,D=b.n42,E=b.n43,C=b.n44,oa=d.n11,pa=d.n12,T=d.n13,I=d.n14,y=d.n21,K=d.n22,
+G=d.n23,ca=d.n24,$=d.n31,qa=d.n32,Q=d.n33,na=d.n34,H=d.n41,M=d.n42,c=d.n43,ua=d.n44;this.n11=e*oa+f*y+g*$+i*H;this.n12=e*pa+f*K+g*qa+i*M;this.n13=e*T+f*G+g*Q+i*c;this.n14=e*I+f*ca+g*na+i*ua;this.n21=h*oa+j*y+o*$+k*H;this.n22=h*pa+j*K+o*qa+k*M;this.n23=h*T+j*G+o*Q+k*c;this.n24=h*I+j*ca+o*na+k*ua;this.n31=p*oa+n*y+v*$+t*H;this.n32=p*pa+n*K+v*qa+t*M;this.n33=p*T+n*G+v*Q+t*c;this.n34=p*I+n*ca+v*na+t*ua;this.n41=z*oa+D*y+E*$+C*H;this.n42=z*pa+D*K+E*qa+C*M;this.n43=z*T+D*G+E*Q+C*c;this.n44=z*I+D*ca+E*na+
+C*ua;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=
+b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,g=this.n21,i=this.n22,h=this.n23,j=this.n24,o=this.n31,k=this.n32,p=this.n33,n=this.n34,v=this.n41,t=this.n42,z=this.n43,D=this.n44;return f*h*k*v-e*j*k*v-f*i*p*v+d*j*p*v+e*i*n*v-d*h*n*v-f*h*o*t+e*j*o*t+f*g*p*t-b*j*p*t-e*g*n*t+b*h*n*t+f*i*o*z-d*j*o*z-f*g*k*z+b*j*k*z+d*g*n*z-b*i*n*z-e*i*o*D+d*h*o*D+e*g*k*D-b*h*k*D-d*g*p*D+b*i*p*D},
 transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;
 b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;
 b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,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},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,
-0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),g=1-e,i=b.x,h=b.y,j=b.z,k=g*i,o=g*h;this.set(k*i+e,k*h-f*j,k*j+f*h,0,k*h+f*j,o*h+e,o*j-f*i,0,k*j-f*h,o*j+f*i,g*j*j+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,d){var e=b.x,f=b.y,g=b.z,i=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),j=Math.cos(g),g=Math.sin(g);switch(d){case "YXZ":var k=
-h*j,o=h*g,q=f*j,n=f*g;this.n11=k+n*e;this.n12=q*e-o;this.n13=i*f;this.n21=i*g;this.n22=i*j;this.n23=-e;this.n31=o*e-q;this.n32=n+k*e;this.n33=i*h;break;case "ZXY":k=h*j;o=h*g;q=f*j;n=f*g;this.n11=k-n*e;this.n12=-i*g;this.n13=q+o*e;this.n21=o+q*e;this.n22=i*j;this.n23=n-k*e;this.n31=-i*f;this.n32=e;this.n33=i*h;break;case "ZYX":k=i*j;o=i*g;q=e*j;n=e*g;this.n11=h*j;this.n12=q*f-o;this.n13=k*f+n;this.n21=h*g;this.n22=n*f+k;this.n23=o*f-q;this.n31=-f;this.n32=e*h;this.n33=i*h;break;case "YZX":k=i*h;o=
-i*f;q=e*h;n=e*f;this.n11=h*j;this.n12=n-k*g;this.n13=q*g+o;this.n21=g;this.n22=i*j;this.n23=-e*j;this.n31=-f*j;this.n32=o*g+q;this.n33=k-n*g;break;case "XZY":k=i*h;o=i*f;q=e*h;n=e*f;this.n11=h*j;this.n12=-g;this.n13=f*j;this.n21=k*g+n;this.n22=i*j;this.n23=o*g-q;this.n31=q*g-o;this.n32=e*j;this.n33=n*g+k;break;default:k=i*j,o=i*g,q=e*j,n=e*g,this.n11=h*j,this.n12=-h*g,this.n13=f,this.n21=o+q*f,this.n22=k-n*f,this.n23=-e*h,this.n31=n-k*f,this.n32=q+o*f,this.n33=i*h}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,k=d*h;d*=j;var o=e*h;e*=j;f*=j;i*=g;h*=g;g*=j;this.n11=1-(o+f);this.n12=k-g;this.n13=d+h;this.n21=k+g;this.n22=1-(b+f);this.n23=e-i;this.n31=d-h;this.n32=e+i;this.n33=1-(b+o);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},
+0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),g=1-e,i=b.x,h=b.y,j=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,k*j+f*i,g*j*j+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,d){var e=b.x,f=b.y,g=b.z,i=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),j=Math.cos(g),g=Math.sin(g);switch(d){case "YXZ":var o=
+h*j,k=h*g,p=f*j,n=f*g;this.n11=o+n*e;this.n12=p*e-k;this.n13=i*f;this.n21=i*g;this.n22=i*j;this.n23=-e;this.n31=k*e-p;this.n32=n+o*e;this.n33=i*h;break;case "ZXY":o=h*j;k=h*g;p=f*j;n=f*g;this.n11=o-n*e;this.n12=-i*g;this.n13=p+k*e;this.n21=k+p*e;this.n22=i*j;this.n23=n-o*e;this.n31=-i*f;this.n32=e;this.n33=i*h;break;case "ZYX":o=i*j;k=i*g;p=e*j;n=e*g;this.n11=h*j;this.n12=p*f-k;this.n13=o*f+n;this.n21=h*g;this.n22=n*f+o;this.n23=k*f-p;this.n31=-f;this.n32=e*h;this.n33=i*h;break;case "YZX":o=i*h;k=
+i*f;p=e*h;n=e*f;this.n11=h*j;this.n12=n-o*g;this.n13=p*g+k;this.n21=g;this.n22=i*j;this.n23=-e*j;this.n31=-f*j;this.n32=k*g+p;this.n33=o-n*g;break;case "XZY":o=i*h;k=i*f;p=e*h;n=e*f;this.n11=h*j;this.n12=-g;this.n13=f*j;this.n21=o*g+n;this.n22=i*j;this.n23=k*g-p;this.n31=p*g-k;this.n32=e*j;this.n33=n*g+o;break;default:o=i*j,k=i*g,p=e*j,n=e*g,this.n11=h*j,this.n12=-h*g,this.n13=f,this.n21=k+p*f,this.n22=o-n*f,this.n23=-e*h,this.n31=n-o*f,this.n32=p+k*f,this.n33=i*h}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}};
-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,k=b.n23,o=b.n24,q=b.n31,n=b.n32,t=b.n33,u=b.n34,z=b.n41,D=b.n42,E=b.n43,C=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*u*D-o*t*D+o*n*E-j*u*E-k*n*C+j*t*C;d.n12=i*t*D-g*u*D-i*n*E+f*u*E+g*n*C-f*t*C;d.n13=g*o*D-i*k*D+i*j*E-f*o*E-g*j*C+f*k*C;d.n14=i*k*n-g*o*n-i*j*t+f*o*t+g*j*u-f*k*u;d.n21=o*t*z-k*u*z-o*q*E+h*u*E+k*q*C-h*t*C;d.n22=g*u*z-i*t*z+i*q*E-e*u*E-g*q*C+e*t*C;d.n23=i*k*z-g*o*z-i*h*E+e*o*E+g*h*C-e*k*C;d.n24=
-g*o*q-i*k*q+i*h*t-e*o*t-g*h*u+e*k*u;d.n31=j*u*z-o*n*z+o*q*D-h*u*D-j*q*C+h*n*C;d.n32=i*n*z-f*u*z-i*q*D+e*u*D+f*q*C-e*n*C;d.n33=g*o*z-i*j*z+i*h*D-e*o*D-f*h*C+e*j*C;d.n34=i*j*q-f*o*q-i*h*n+e*o*n+f*h*u-e*j*u;d.n41=k*n*z-j*t*z-k*q*D+h*t*D+j*q*E-h*n*E;d.n42=f*t*z-g*n*z+g*q*D-e*t*D-f*q*E+e*n*E;d.n43=g*j*z-f*k*z-g*h*D+e*k*D+f*h*E-e*j*E;d.n44=f*k*q-g*j*q+g*h*n-e*k*n-f*h*t+e*j*t;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,k=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+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*i;e[3]=b*h;e[4]=b*j;e[5]=b*k;e[6]=b*o;e[7]=b*q;e[8]=b*n;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,p=b.n31,n=b.n32,v=b.n33,t=b.n34,z=b.n41,D=b.n42,E=b.n43,C=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=o*t*D-k*v*D+k*n*E-j*t*E-o*n*C+j*v*C;d.n12=i*v*D-g*t*D-i*n*E+f*t*E+g*n*C-f*v*C;d.n13=g*k*D-i*o*D+i*j*E-f*k*E-g*j*C+f*o*C;d.n14=i*o*n-g*k*n-i*j*v+f*k*v+g*j*t-f*o*t;d.n21=k*v*z-o*t*z-k*p*E+h*t*E+o*p*C-h*v*C;d.n22=g*t*z-i*v*z+i*p*E-e*t*E-g*p*C+e*v*C;d.n23=i*o*z-g*k*z-i*h*E+e*k*E+g*h*C-e*o*C;d.n24=
+g*k*p-i*o*p+i*h*v-e*k*v-g*h*t+e*o*t;d.n31=j*t*z-k*n*z+k*p*D-h*t*D-j*p*C+h*n*C;d.n32=i*n*z-f*t*z-i*p*D+e*t*D+f*p*C-e*n*C;d.n33=g*k*z-i*j*z+i*h*D-e*k*D-f*h*C+e*j*C;d.n34=i*j*p-f*k*p-i*h*n+e*k*n+f*h*t-e*j*t;d.n41=o*n*z-j*v*z-o*p*D+h*v*D+j*p*E-h*n*E;d.n42=f*v*z-g*n*z+g*p*D-e*v*D-f*p*E+e*n*E;d.n43=g*j*z-f*o*z-g*h*D+e*o*D+f*h*E-e*j*E;d.n44=f*o*p-g*j*p+g*h*n-e*o*n-f*h*v+e*j*v;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,p=-b.n23*b.n11+b.n21*b.n13,n=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*p;e[8]=b*n;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.makeOrtho=function(b,d,e,f,g,i){var h,j,k,o;h=new THREE.Matrix4;j=d-b;k=e-f;o=i-g;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((d+b)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((e+f)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((i+g)/o);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;
 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.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
 this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.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)===
@@ -51,27 +51,27 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,e)}};THREE.Quaternion=function(b,d,e,f){this.set(b||0,d||0,e||0,f!==void 0?f:1)};
 THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;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 d=0.5*Math.PI/360,e=b.x*d,f=b.y*d,g=b.z*d,b=Math.cos(f),f=Math.sin(f),d=Math.cos(-g),g=Math.sin(-g),i=Math.cos(e),e=Math.sin(e),h=b*d,j=f*g;this.w=h*i-j*e;this.x=h*e+j*i;this.y=f*d*i+b*g*e;this.z=b*g*i-f*d*e;return this},setFromAxisAngle:function(b,d){var e=d/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},
-multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,k=this.w,o=k*e+h*g-j*f,q=
-k*f+j*e-i*g,n=k*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=o*k+e*-i+q*-j-n*-h;d.y=q*k+e*-h+n*-i-o*-j;d.z=n*k+e*-j+o*-h-q*-i;return d}};
+multiplySelf:function(b){var d=this.x,e=this.y,f=this.z,g=this.w,i=b.x,h=b.y,j=b.z,b=b.w;this.x=d*b+g*i+e*j-f*h;this.y=e*b+g*h+f*i-d*j;this.z=f*b+g*j+d*h-e*i;this.w=g*b-d*i-e*h-f*j;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var e=b.x,f=b.y,g=b.z,i=this.x,h=this.y,j=this.z,o=this.w,k=o*e+h*g-j*f,p=
+o*f+j*e-i*g,n=o*g+i*f-h*e,e=-i*e-h*f-j*g;d.x=k*o+e*-i+p*-j-n*-h;d.y=p*o+e*-h+n*-i-k*-j;d.z=n*o+e*-j+k*-h-p*-i;return d}};
 THREE.Quaternion.slerp=function(b,d,e,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.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 i=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;g=Math.sin((1-f)*i)/h;f=Math.sin(f*i)/h;e.w=b.w*g+d.w*f;e.x=b.x*g+d.x*f;e.y=b.y*g+d.y*f;e.z=b.z*g+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,f,g,i){this.a=b;this.b=d;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=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,f,g,i,h){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
 THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b<d;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
-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,k=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),k.sub(d.position,e.position),j.crossSelf(k);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=
 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;k=b.vertices[d].position;o=b.vertices[e].position;q=h[f];n=h[g];t=h[i];u=k.x-j.x;z=o.x-j.x;D=k.y-j.y;E=o.y-j.y;C=k.z-j.z;N=o.z-j.z;ea=n.u-q.u;S=t.u-q.u;H=n.v-q.v;y=t.v-q.v;aa=1/(ea*y-S*H);ua.set((y*u-H*
-z)*aa,(y*D-H*E)*aa,(y*C-H*N)*aa);M.set((ea*z-S*u)*aa,(ea*E-S*D)*aa,(ea*N-S*C)*aa);Q[c].addSelf(ua);Q[d].addSelf(ua);Q[e].addSelf(ua);B[c].addSelf(M);B[d].addSelf(M);B[e].addSelf(M)}var d,e,f,g,i,h,j,k,o,q,n,t,u,z,D,E,C,N,ea,S,H,y,aa,P,Q=[],B=[],ua=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3,c=new THREE.Vector3,sa=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)Q[d]=new THREE.Vector3,B[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 la=["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++)sa.copy(i.vertexNormals[f]),g=i[la[f]],P=Q[g],L.copy(P),L.subSelf(sa.multiplyScalar(sa.dot(P))).normalize(),c.cross(i.vertexNormals[f],P),g=c.dot(B[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(L.x,L.y,L.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;p=h[f];n=h[g];v=h[i];t=o.x-j.x;z=k.x-j.x;D=o.y-j.y;E=k.y-j.y;C=o.z-j.z;oa=k.z-j.z;pa=n.u-p.u;T=v.u-p.u;I=n.v-p.v;y=v.v-p.v;K=1/(pa*y-T*I);qa.set((y*t-I*
+z)*K,(y*D-I*E)*K,(y*C-I*oa)*K);Q.set((pa*z-T*t)*K,(pa*E-T*D)*K,(pa*oa-T*C)*K);ca[c].addSelf(qa);ca[d].addSelf(qa);ca[e].addSelf(qa);$[c].addSelf(Q);$[d].addSelf(Q);$[e].addSelf(Q)}var d,e,f,g,i,h,j,o,k,p,n,v,t,z,D,E,C,oa,pa,T,I,y,K,G,ca=[],$=[],qa=new THREE.Vector3,Q=new THREE.Vector3,na=new THREE.Vector3,H=new THREE.Vector3,M=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++)ca[d]=new THREE.Vector3,$[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 c=["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++)M.copy(i.vertexNormals[f]),g=i[c[f]],G=ca[g],na.copy(G),na.subSelf(M.multiplyScalar(M.dot(G))).normalize(),H.cross(i.vertexNormals[f],G),g=H.dot($[g]),g=g<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(na.x,na.y,na.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;
 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];
 h.faceIndices=j[b(g,i)].array;for(g=0;g<h.faceIndices.length;g++)i=h.faceIndices[g],h.faces.push(this.faces[i])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,k,o,q,n,t;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;o=this.points[e[0]];q=this.points[e[1]];
-n=this.points[e[2]];t=this.points[e[3]];j=h*h;k=h*j;f.x=d(o.x,q.x,n.x,t.x,h,j,k);f.y=d(o.y,q.y,n.y,t.y,h,j,k);f.z=d(o.z,q.z,n.z,t.z,h,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
-j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],o=new THREE.Vector3,k=this.getLength();j.push(o.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=k.chunks[d]-k.chunks[d-1];i=Math.ceil(b*e/k.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(o.copy(position).clone());
-j.push(o.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||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.Spline=function(b){function d(b,d,e,f,g,h,i){b=(e-b)*0.5;f=(f-d)*0.5;return(2*(d-e)+b+f)*i+(-3*(d-e)-2*b-f)*h+b*g+d}this.points=b;var e=[],f={x:0,y:0,z:0},g,i,h,j,o,k,p,n,v;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;i=Math.floor(g);h=g-i;e[0]=i==0?i:i-1;e[1]=i;e[2]=i>this.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;k=this.points[e[0]];p=this.points[e[1]];
+n=this.points[e[2]];v=this.points[e[3]];j=h*h;o=h*j;f.x=d(k.x,p.x,n.x,v.x,h,j,o);f.y=d(k.y,p.y,n.y,v.y,h,j,o);f.z=d(k.z,p.z,n.z,v.z,h,j,o);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b<e;b++)d=this.points[b],f[b]=[d.x,d.y,d.z];return f};this.getLength=function(b){var d,e,f=d=d=0,g=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;b||(b=100);e=this.points.length*b;g.copy(this.points[0]);for(b=1;b<e;b++)d=b/e,position=this.getPoint(d),h.copy(position),
+j+=h.distanceTo(g),g.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=f&&(i[d]=j,f=d);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(b){var d,e,f,g,h,i,j=[],k=new THREE.Vector3,o=this.getLength();j.push(k.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){e=o.chunks[d]-o.chunks[d-1];i=Math.ceil(b*e/o.total);g=(d-1)/(this.points.length-1);h=d/(this.points.length-1);for(e=1;e<i-1;e++)f=g+e*(1/i)*(h-g),position=this.getPoint(f),j.push(k.copy(position).clone());
+j.push(k.copy(this.points[d]).clone())}this.points=j}};THREE.Edge=function(b,d,e,f){this.vertices=[b,d];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||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,d){this.matrix.rotateAxis(d);d.multiplyScalar(b);this.position.addSelf(d);this.target.position.addSelf(d)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,d=Math.tan(this.fov*Math.PI/360)*this.near,e=-d,f=b*e,b=Math.abs(b*d-f),e=Math.abs(d-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,d-(this.y+this.height)*e/this.fullHeight,d-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.setViewOffset=function(b,d,e,f,g,i){this.fullWidth=b;this.fullHeight=d;this.x=e;this.y=f;this.width=g;this.height=i;this.updateProjectionMatrix()};
@@ -122,13 +122,13 @@ THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THR
 THREE.LOD.prototype.update=function(b,d,e){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,d=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,e)};THREE.ShadowVolume=function(b,d){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,k,o,q,n,t,u,z=new THREE.Geometry;z.vertices=this.geometry.vertices;f=z.faces=this.geometry.faces;var D=z.egdes=this.geometry.edges,E=z.edgeFaces=[];g=0;var C=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],C.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=D.length;b<d;b++)j=D[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?(k="a",q=C[g]+0):e.b===h?(k="b",q=C[g]+1):e.c===h?(k="c",q=C[g]+2):e.d===h&&(k="d",q=C[g]+3),e.a===j?(k+="a",n=C[g]+0):e.b===j?(k+="b",n=C[g]+1):e.c===j?(k+="c",n=C[g]+2):e.d===j&&(k+="d",n=C[g]+3),f.a===h?(o="a",t=C[i]+0):f.b===h?(o="b",t=C[i]+1):f.c===h?(o="c",t=C[i]+2):f.d===h&&(o="d",t=C[i]+3),f.a===j?(o+="a",u=C[i]+0):f.b===j?(o+="b",u=C[i]+
-1):f.c===j?(o+="c",u=C[i]+2):f.d===j&&(o+="d",u=C[i]+3),k==="ac"||k==="ad"||k==="ca"||k==="da"?q>n&&(e=q,q=n,n=e):q<n&&(e=q,q=n,n=e),o==="ac"||o==="ad"||o==="ca"||o==="da"?t>u&&(e=t,t=u,u=e):t<u&&(e=t,t=u,u=e),e=new THREE.Face4(q,n,t,u),e.normal.set(1,0,0),E.push(e);this.geometry=z}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,k,o,q,n=["a","b","c","d"];for(k=0;k<i;k++){j=d.length;h=g[k];h instanceof THREE.Face4?(o=4,j=new THREE.Face4(j,j+1,j+2,j+3)):(o=3,j=new THREE.Face3(j,j+1,j+2));j.normal.copy(h.normal);e.push(j);
-for(j=0;j<o;j++)q=b[h[n[j]]],d.push(new THREE.Vertex(q.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,k,o,q,n,t,u,z,D,E=0,C=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(z=0;z<f;z++){i=d[C[z]];j=b[i];for(D=0;D<g;D++)if(h=e[C[D]],k=b[h],Math.abs(j.position.x-k.position.x)<1.0E-4&&Math.abs(j.position.y-k.position.y)<1.0E-4&&Math.abs(j.position.z-k.position.z)<1.0E-4&&(E++,E===1&&(o=j,q=k,n=i,t=h,u=C[z]),E===2))return u+=C[z],u==="ad"||u==="ac"?{faces:[d,e],vertices:[o,q,k,j],indices:[n,t,
-h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[o,j,k,q],indices:[n,i,h,t],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,e,f,g,i,h,j,o,k,p,n,v,t,z=new THREE.Geometry;z.vertices=this.geometry.vertices;f=z.faces=this.geometry.faces;var D=z.egdes=this.geometry.edges,E=z.edgeFaces=[];g=0;var C=[];b=0;for(d=f.length;b<d;b++)if(e=f[b],C.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=D.length;b<d;b++)j=D[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",p=C[g]+0):e.b===h?(o="b",p=C[g]+1):e.c===h?(o="c",p=C[g]+2):e.d===h&&(o="d",p=C[g]+3),e.a===j?(o+="a",n=C[g]+0):e.b===j?(o+="b",n=C[g]+1):e.c===j?(o+="c",n=C[g]+2):e.d===j&&(o+="d",n=C[g]+3),f.a===h?(k="a",v=C[i]+0):f.b===h?(k="b",v=C[i]+1):f.c===h?(k="c",v=C[i]+2):f.d===h&&(k="d",v=C[i]+3),f.a===j?(k+="a",t=C[i]+0):f.b===j?(k+="b",t=C[i]+
+1):f.c===j?(k+="c",t=C[i]+2):f.d===j&&(k+="d",t=C[i]+3),o==="ac"||o==="ad"||o==="ca"||o==="da"?p>n&&(e=p,p=n,n=e):p<n&&(e=p,p=n,n=e),k==="ac"||k==="ad"||k==="ca"||k==="da"?v>t&&(e=v,v=t,t=e):v<t&&(e=v,v=t,t=e),e=new THREE.Face4(p,n,v,t),e.normal.set(1,0,0),E.push(e);this.geometry=z}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,p,n=["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++)p=b[h[n[j]]],d.push(new THREE.Vertex(p.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,p,n,v,t,z,D,E=0,C=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(z=0;z<f;z++){i=d[C[z]];j=b[i];for(D=0;D<g;D++)if(h=e[C[D]],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&&(E++,E===1&&(k=j,p=o,n=i,v=h,t=C[z]),E===2))return t+=C[z],t==="ad"||t==="ac"?{faces:[d,e],vertices:[k,p,o,j],indices:[n,v,
+h,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,e],vertices:[k,j,o,p],indices:[n,i,h,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
@@ -137,17 +137,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.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.Camera||(d=this.objects.indexOf(b),d!==-1&&(this.objects.splice(d,1),this.__objectsRemoved.push(b)));for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,e){this.color=new THREE.Color(b);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==void 0?d:2.5E-4};
-THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var e=0,c=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?e=Math.max(e,f/(f-g)):g<0&&(c=Math.min(c,f/(f-g))),h<0?e=Math.max(e,h/(h-i)):i<0&&(c=Math.min(c,h/(h-i))),c<e?!1:(b.lerpSelf(d,e),d.lerpSelf(b,1-c),!0))}var f,g,i=[],h,j,k=[],o,q,n=[],t,u=[],z,D,E=[],C,N,ea=[],S=new THREE.Vector4,H=new THREE.Vector4,
-y=new THREE.Matrix4,aa=new THREE.Matrix4,P=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Vector4,B=new THREE.Vector4;this.projectVector=function(b,d){y.multiply(d.projectionMatrix,d.matrixWorldInverse);y.multiplyVector3(b);return b};this.unprojectVector=function(b,d){y.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));y.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],c,j,o;g=0;
-j=b.objects;b=0;for(c=j.length;b<c;b++){o=j[b];var k;if(!(k=!o.visible))if(k=o instanceof THREE.Mesh){a:{k=void 0;for(var q=o.matrixWorld,n=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),t=0;t<6;t++)if(k=P[t].x*q.n14+P[t].y*q.n24+P[t].z*q.n34+P[t].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=i[g]=i[g]||new THREE.RenderableObject,g++,f=k,S.copy(o.position),y.multiplyVector3(S),f.object=o,f.z=S.z,e.push(f)}h&&e.sort(d);return e};this.projectScene=function(f,g,i){var c=
-[],S=g.near,la=g.far,ha,ma,$,na,F,T,I,R,pa,G,xa,va,qa,ra,ia,ta,ya;N=D=t=q=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);y.multiply(g.projectionMatrix,g.matrixWorldInverse);P[0].set(y.n41-y.n11,y.n42-y.n12,y.n43-y.n13,y.n44-y.n14);P[1].set(y.n41+y.n11,y.n42+y.n12,y.n43+y.n13,y.n44+y.n14);P[2].set(y.n41+y.n21,y.n42+y.n22,y.n43+y.n23,y.n44+y.n24);P[3].set(y.n41-y.n21,y.n42-y.n22,y.n43-y.n23,y.n44-y.n24);P[4].set(y.n41-y.n31,y.n42-y.n32,y.n43-y.n33,y.n44-y.n34);P[5].set(y.n41+y.n31,
-y.n42+y.n32,y.n43+y.n33,y.n44+y.n34);for(ha=0;ha<6;ha++)pa=P[ha],pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z));pa=this.projectObjects(f,g,!0);f=0;for(ha=pa.length;f<ha;f++)if(G=pa[f].object,G.visible)if(xa=G.matrixWorld,va=G.matrixRotationWorld,qa=G.materials,ra=G.overdraw,j=0,G instanceof THREE.Mesh){ia=G.geometry;na=ia.vertices;ta=ia.faces;ia=ia.faceVertexUvs;ma=0;for($=na.length;ma<$;ma++)h=b(),h.positionWorld.copy(na[ma].position),xa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
-y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>S&&h.positionScreen.z<la;na=0;for(ma=ta.length;na<ma;na++){$=ta[na];if($ instanceof THREE.Face3)if(F=k[$.a],T=k[$.b],I=k[$.c],F.visible&&T.visible&&I.visible&&(G.doubleSided||G.flipSided!=(I.positionScreen.x-F.positionScreen.x)*(T.positionScreen.y-F.positionScreen.y)-(I.positionScreen.y-F.positionScreen.y)*(T.positionScreen.x-F.positionScreen.x)<0))R=n[q]=
-n[q]||new THREE.RenderableFace3,q++,o=R,o.v1.copy(F),o.v2.copy(T),o.v3.copy(I);else continue;else if($ instanceof THREE.Face4)if(F=k[$.a],T=k[$.b],I=k[$.c],R=k[$.d],F.visible&&T.visible&&I.visible&&R.visible&&(G.doubleSided||G.flipSided!=((R.positionScreen.x-F.positionScreen.x)*(T.positionScreen.y-F.positionScreen.y)-(R.positionScreen.y-F.positionScreen.y)*(T.positionScreen.x-F.positionScreen.x)<0||(T.positionScreen.x-I.positionScreen.x)*(R.positionScreen.y-I.positionScreen.y)-(T.positionScreen.y-
-I.positionScreen.y)*(R.positionScreen.x-I.positionScreen.x)<0)))ya=u[t]=u[t]||new THREE.RenderableFace4,t++,o=ya,o.v1.copy(F),o.v2.copy(T),o.v3.copy(I),o.v4.copy(R);else continue;o.normalWorld.copy($.normal);va.multiplyVector3(o.normalWorld);o.centroidWorld.copy($.centroid);xa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);y.multiplyVector3(o.centroidScreen);I=$.vertexNormals;F=0;for(T=I.length;F<T;F++)R=o.vertexNormalsWorld[F],R.copy(I[F]),va.multiplyVector3(R);F=0;for(T=
-ia.length;F<T;F++)if(ya=ia[F][na]){I=0;for(R=ya.length;I<R;I++)o.uvs[F][I]=ya[I]}o.meshMaterials=qa;o.faceMaterials=$.materials;o.overdraw=ra;o.z=o.centroidScreen.z;c.push(o)}}else if(G instanceof THREE.Line){aa.multiply(y,xa);na=G.geometry.vertices;F=b();F.positionScreen.copy(na[0].position);aa.multiplyVector4(F.positionScreen);ma=1;for($=na.length;ma<$;ma++)if(F=b(),F.positionScreen.copy(na[ma].position),aa.multiplyVector4(F.positionScreen),T=k[j-2],Q.copy(F.positionScreen),B.copy(T.positionScreen),
-e(Q,B))Q.multiplyScalar(1/Q.w),B.multiplyScalar(1/B.w),xa=E[D]=E[D]||new THREE.RenderableLine,D++,z=xa,z.v1.positionScreen.copy(Q),z.v2.positionScreen.copy(B),z.z=Math.max(Q.z,B.z),z.materials=G.materials,c.push(z)}else if(G instanceof THREE.Particle&&(H.set(G.matrixWorld.n14,G.matrixWorld.n24,G.matrixWorld.n34,1),y.multiplyVector4(H),H.z/=H.w,H.z>0&&H.z<1))xa=ea[N]=ea[N]||new THREE.RenderableParticle,N++,C=xa,C.x=H.x/H.w,C.y=H.y/H.w,C.z=H.z,C.rotation=G.rotation.z,C.scale.x=G.scale.x*Math.abs(C.x-
-(H.x+g.projectionMatrix.n11)/(H.w+g.projectionMatrix.n14)),C.scale.y=G.scale.y*Math.abs(C.y-(H.y+g.projectionMatrix.n22)/(H.w+g.projectionMatrix.n24)),C.materials=G.materials,c.push(C);i&&c.sort(d);return c}};
+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 e=0,f=1,g=b.z+b.w,c=d.z+d.w,h=-b.z+b.w,i=-d.z+d.w;return g>=0&&c>=0&&h>=0&&i>=0?!0:g<0&&c<0||h<0&&i<0?!1:(g<0?e=Math.max(e,g/(g-c)):c<0&&(f=Math.min(f,g/(g-c))),h<0?e=Math.max(e,h/(h-i)):i<0&&(f=Math.min(f,h/(h-i))),f<e?!1:(b.lerpSelf(d,e),d.lerpSelf(b,1-f),!0))}var f,g,i=[],h,j,o=[],k,p,n=[],v,t=[],z,D,E=[],C,oa,pa=[],T=new THREE.Vector4,I=new THREE.Vector4,
+y=new THREE.Matrix4,K=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ca=new THREE.Vector4,$=new THREE.Vector4;this.projectVector=function(b,d){y.multiply(d.projectionMatrix,d.matrixWorldInverse);y.multiplyVector3(b);return b};this.unprojectVector=function(b,d){y.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));y.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],j,k,c;g=0;
+k=b.objects;b=0;for(j=k.length;b<j;b++){c=k[b];var o;if(!(o=!c.visible))if(o=c instanceof THREE.Mesh){a:{o=void 0;for(var p=c.matrixWorld,n=-c.geometry.boundingSphere.radius*Math.max(c.scale.x,Math.max(c.scale.y,c.scale.z)),v=0;v<6;v++)if(o=G[v].x*p.n14+G[v].y*p.n24+G[v].z*p.n34+G[v].w,o<=n){o=!1;break a}o=!0}o=!o}if(!o)o=i[g]=i[g]||new THREE.RenderableObject,g++,f=o,T.copy(c.position),y.multiplyVector3(T),f.object=c,f.z=T.z,e.push(f)}h&&e.sort(d);return e};this.projectScene=function(f,g,i){var H=
+[],M=g.near,c=g.far,T,ha,aa,ia,B,O,F,N,ja,R,ra,va,Ea,sa,P,la,ma;oa=D=v=p=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);y.multiply(g.projectionMatrix,g.matrixWorldInverse);G[0].set(y.n41-y.n11,y.n42-y.n12,y.n43-y.n13,y.n44-y.n14);G[1].set(y.n41+y.n11,y.n42+y.n12,y.n43+y.n13,y.n44+y.n14);G[2].set(y.n41+y.n21,y.n42+y.n22,y.n43+y.n23,y.n44+y.n24);G[3].set(y.n41-y.n21,y.n42-y.n22,y.n43-y.n23,y.n44-y.n24);G[4].set(y.n41-y.n31,y.n42-y.n32,y.n43-y.n33,y.n44-y.n34);G[5].set(y.n41+y.n31,y.n42+
+y.n32,y.n43+y.n33,y.n44+y.n34);for(T=0;T<6;T++)ja=G[T],ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z));ja=this.projectObjects(f,g,!0);f=0;for(T=ja.length;f<T;f++)if(R=ja[f].object,R.visible)if(ra=R.matrixWorld,va=R.matrixRotationWorld,Ea=R.materials,sa=R.overdraw,j=0,R instanceof THREE.Mesh){P=R.geometry;ia=P.vertices;la=P.faces;P=P.faceVertexUvs;ha=0;for(aa=ia.length;ha<aa;ha++)h=b(),h.positionWorld.copy(ia[ha].position),ra.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
+y.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>M&&h.positionScreen.z<c;ia=0;for(ha=la.length;ia<ha;ia++){aa=la[ia];if(aa instanceof THREE.Face3)if(B=o[aa.a],O=o[aa.b],F=o[aa.c],B.visible&&O.visible&&F.visible&&(R.doubleSided||R.flipSided!=(F.positionScreen.x-B.positionScreen.x)*(O.positionScreen.y-B.positionScreen.y)-(F.positionScreen.y-B.positionScreen.y)*(O.positionScreen.x-B.positionScreen.x)<0))N=n[p]=
+n[p]||new THREE.RenderableFace3,p++,k=N,k.v1.copy(B),k.v2.copy(O),k.v3.copy(F);else continue;else if(aa instanceof THREE.Face4)if(B=o[aa.a],O=o[aa.b],F=o[aa.c],N=o[aa.d],B.visible&&O.visible&&F.visible&&N.visible&&(R.doubleSided||R.flipSided!=((N.positionScreen.x-B.positionScreen.x)*(O.positionScreen.y-B.positionScreen.y)-(N.positionScreen.y-B.positionScreen.y)*(O.positionScreen.x-B.positionScreen.x)<0||(O.positionScreen.x-F.positionScreen.x)*(N.positionScreen.y-F.positionScreen.y)-(O.positionScreen.y-
+F.positionScreen.y)*(N.positionScreen.x-F.positionScreen.x)<0)))ma=t[v]=t[v]||new THREE.RenderableFace4,v++,k=ma,k.v1.copy(B),k.v2.copy(O),k.v3.copy(F),k.v4.copy(N);else continue;k.normalWorld.copy(aa.normal);va.multiplyVector3(k.normalWorld);k.centroidWorld.copy(aa.centroid);ra.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);y.multiplyVector3(k.centroidScreen);F=aa.vertexNormals;B=0;for(O=F.length;B<O;B++)N=k.vertexNormalsWorld[B],N.copy(F[B]),va.multiplyVector3(N);B=0;for(O=
+P.length;B<O;B++)if(ma=P[B][ia]){F=0;for(N=ma.length;F<N;F++)k.uvs[B][F]=ma[F]}k.meshMaterials=Ea;k.faceMaterials=aa.materials;k.overdraw=sa;k.z=k.centroidScreen.z;H.push(k)}}else if(R instanceof THREE.Line){K.multiply(y,ra);ia=R.geometry.vertices;B=b();B.positionScreen.copy(ia[0].position);K.multiplyVector4(B.positionScreen);ha=1;for(aa=ia.length;ha<aa;ha++)if(B=b(),B.positionScreen.copy(ia[ha].position),K.multiplyVector4(B.positionScreen),O=o[j-2],ca.copy(B.positionScreen),$.copy(O.positionScreen),
+e(ca,$))ca.multiplyScalar(1/ca.w),$.multiplyScalar(1/$.w),ra=E[D]=E[D]||new THREE.RenderableLine,D++,z=ra,z.v1.positionScreen.copy(ca),z.v2.positionScreen.copy($),z.z=Math.max(ca.z,$.z),z.materials=R.materials,H.push(z)}else if(R instanceof THREE.Particle&&(I.set(R.matrixWorld.n14,R.matrixWorld.n24,R.matrixWorld.n34,1),y.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))ra=pa[oa]=pa[oa]||new THREE.RenderableParticle,oa++,C=ra,C.x=I.x/I.w,C.y=I.y/I.w,C.z=I.z,C.rotation=R.rotation.z,C.scale.x=R.scale.x*Math.abs(C.x-
+(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),C.scale.y=R.scale.y*Math.abs(C.y-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),C.materials=R.materials,H.push(C);i&&H.sort(d);return H}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -177,119 +177,123 @@ THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderC
 THREE.ShaderChunk.morphtarget_pars_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.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,O=b.__colorArray,q=b.__sortArray,n=b.__dirtyVertices,t=b.__dirtyColors;if(e.sortParticles){ia.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,Da.copy(g),ia.multiplyVector3(Da),q[f]=[Da.z,f];q.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[q[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[q[f][1]],O[h]=color.r,O[h+1]=color.g,
-O[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(t)for(f=0;f<o;f++)color=k[f],h=f*3,O[h]=color.r,O[h+1]=color.g,O[h+2]=color.b}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,p,d);if(t||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,O,d)}function e(b,d,e,f,g){f.program||L.initMaterial(f,d,e,g);var h=f.program,i=h.uniforms,j=f.uniforms;h!=la&&(c.useProgram(h),
-la=h);c.uniformMatrix4fv(i.projectionMatrix,!1,ta);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,O=0,q=0,n,t,u,y,v=Ga,r=v.directional.colors,C=v.directional.positions,z=v.point.colors,D=v.point.positions,J=v.point.distances,x=0,s=0,e=o=y=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,t=o.position,u=o.intensity,y=o.distance,o instanceof THREE.AmbientLight)p+=n.r,O+=n.g,q+=n.b;else if(o instanceof THREE.DirectionalLight)y=x*3,r[y]=n.r*u,r[y+1]=n.g*u,r[y+2]=n.b*u,C[y]=t.x,C[y+1]=t.y,C[y+2]=t.z,x+=1;else if(o instanceof THREE.PointLight)o=s*3,z[o]=n.r*u,z[o+1]=n.g*u,z[o+2]=n.b*
-u,D[o]=t.x,D[o+1]=t.y,D[o+2]=t.z,J[s]=y,s+=1;for(e=x*3;e<r.length;e++)r[e]=0;for(e=s*3;e<z.length;e++)z[e]=0;v.point.length=s;v.directional.length=x;v.ambient[0]=p;v.ambient[1]=O;v.ambient[2]=q;e=Ga;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=
-e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,(j.map.texture=f.map)&&j.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),j.lightMap.texture=f.lightMap,j.envMap.texture=f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof
-THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=wa.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 A in j)if(O=h.uniforms[A])if(k=j[A],p=k.type,e=k.value,p=="i")c.uniform1i(O,e);else if(p=="f")c.uniform1f(O,e);else if(p=="fv1")c.uniform1fv(O,e);else if(p=="fv")c.uniform3fv(O,e);else if(p=="v2")c.uniform2f(O,e.x,e.y);else if(p=="v3")c.uniform3f(O,e.x,e.y,e.z);else if(p=="v4")c.uniform4f(O,e.x,e.y,e.z,e.w);else if(p=="c")c.uniform3f(O,e.r,e.g,e.b);else if(p=="t"&&(c.uniform1i(O,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}aa(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 P(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,ya);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,ya);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,ya),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=[],q=-1,
-p=0,o=i.morphTargetInfluences,O,n=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(O=0;O<n;O++)!k[O]&&o[O]>q&&(p=O,q=o[p]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=q;k[p]=1;q=-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,
-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.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),L.data.vertices+=h.__webglFaceCount,L.data.faces+=h.__webglFaceCount/3,L.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),L.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),L.data.drawCalls++):i instanceof
-THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),L.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,q,n,t=b.count*3;for(n=0;n<t;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],q=e[n+8],f=(f+i+j)/3,h=(h+k+o)/3,g=(g+p+q)/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($!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),$=b.doubleSided;if(na!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),na=b.flipSided}function h(b){T!=b&&(b?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),T=b)}function j(b,d,e){I!=b&&(b?c.enable(c.POLYGON_OFFSET_FILL):c.disable(c.POLYGON_OFFSET_FILL),I=b);if(b&&(R!=d||pa!=e))c.polygonOffset(d,e),R=d,pa=e}function k(b){ra[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
-b.n14);ra[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ra[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ra[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ra[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ra[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=ra[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=ra[e].x*c.n14+ra[e].y*c.n24+ra[e].z*c.n34+ra[e].w,b<=d)return!1;return!0}function q(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?q(h,d):q(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?q(j,f):q(i,f))}else(f=c)&&(f.transparent?q(j,f):q(i,f))}function u(b,c){return c.z-b.z}function z(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,i=b.__webglShadowVolumes[p].buffer,j=f.materials[0],j.program||L.initMaterial(j,h,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,la!==j&&(c.useProgram(j),la=j,c.uniformMatrix4fv(k.projectionMatrix,!1,ta),c.uniformMatrix4fv(k.viewMatrix,!1,ya),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);T=F=-1;la=x.program;c.useProgram(x.program);c.uniformMatrix4fv(x.projectionLocation,!1,ta);c.uniform1f(x.darknessLocation,x.darkness);c.bindBuffer(c.ARRAY_BUFFER,x.vertexBuffer);c.vertexAttribPointer(x.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(x.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.elementBuffer);
-c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ma)}function D(b,d){var e,f,h;e=r.attributes;var g=r.uniforms,i=qa/va,j,k=[],o=va*0.5,p=qa*0.5,n=!0;c.useProgram(r.program);la=r.program;T=F=-1;Ha||(c.enableVertexAttribArray(r.attributes.position),c.enableVertexAttribArray(r.attributes.uv),Ha=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,r.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,r.elementBuffer);c.uniformMatrix4fv(g.projectionMatrix,!1,ta);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(u);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.scaleByViewport?qa:1),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),y(h.blending),P(h.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ma)}function E(b,e){var d,f,h=b.__webglLensFlares.length,
-g,i,j,k=new THREE.Vector3,o=qa/va,p=va*0.5,n=qa*0.5,q=16/qa,t=[q*o,q],u=[1,1,0],r=[1,1],z=v.uniforms;d=v.attributes;c.useProgram(v.program);la=v.program;T=F=-1;Ia||(c.enableVertexAttribArray(v.attributes.vertex),c.enableVertexAttribArray(v.attributes.uv),Ia=!0);c.uniform1i(z.occlusionMap,0);c.uniform1i(z.map,1);c.bindBuffer(c.ARRAY_BUFFER,v.vertexBuffer);c.vertexAttribPointer(d.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(d.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(d=b.__webglLensFlares[f].object,k.set(d.matrixWorld.n14,d.matrixWorld.n24,d.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(k),e.projectionMatrix.multiplyVector3(k),u[0]=k.x,u[1]=k.y,u[2]=k.z,r[0]=u[0]*p+p,r[1]=u[1]*n+n,v.hasVertexTexture||r[0]>0&&r[0]<va&&r[1]>0&&r[1]<qa){c.bindTexture(c.TEXTURE_2D,v.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,
-0,c.RGB,r[0]-8,r[1]-8,16,16,0);c.uniform1i(z.renderType,0);c.uniform2fv(z.scale,t);c.uniform3fv(z.screenPosition,u);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,r[0]-8,r[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);d.positionScreen.x=u[0];d.positionScreen.y=
-u[1];d.positionScreen.z=u[2];d.customUpdateCallback?d.customUpdateCallback(d):d.updateLensFlares();c.uniform1i(z.renderType,2);c.enable(c.BLEND);g=0;for(i=d.lensFlares.length;g<i;g++)if(j=d.lensFlares[g],j.opacity>0.0010&&j.scale>0.0010)u[0]=j.x,u[1]=j.y,u[2]=j.z,q=j.size*j.scale/qa,t[0]=q*o,t[1]=q,c.uniform3fv(z.screenPosition,u),c.uniform2fv(z.scale,t),c.uniform1f(z.rotation,j.rotation),c.uniform1f(z.opacity,j.opacity),y(j.blending),P(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);
-c.enable(c.DEPTH_TEST);c.depthMask(ma)}function C(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function N(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,q=n=void 0,t=void 0,u=void 0,r=void 0,y=void 0,v=void 0,z=void 0,C=void 0,D=void 0,x=void 0,K=void 0,J=void 0,E=void 0,s=p=r=p=u=t=void 0,A=void 0,m=A=s=t=void 0,F=void 0,H=m=A=s=n=n=q=r=p=m=A=s=F=m=A=s=F=m=A=s=void 0,B=0,G=0,P=0,T=0,I=0,L=0,U=0,M=0,ca=0,w=0,da=0,A=s=0,fa=g.__vertexArray,
-$=g.__uvArray,aa=g.__uv2Array,Q=g.__normalArray,V=g.__tangentArray,ga=g.__colorArray,W=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ea=g.__morphTargetsArrays,S=g.__webglCustomAttributes,m=void 0,N=g.__faceArray,R=g.__lineArray,la=g.__needsSmoothNormals,v=g.__vertexColorType,y=g.__uvType,z=g.__normalType,ja=i.geometry,ma=ja.__dirtyVertices,na=ja.__dirtyElements,ha=ja.__dirtyUvs,pa=ja.__dirtyNormals,qa=ja.__dirtyTangents,ra=ja.__dirtyColors,sa=ja.__dirtyMorphTargets,
-ia=ja.vertices,ua=g.faces,xa=ja.faces,va=ja.faceVertexUvs[0],ya=ja.faceVertexUvs[1],oa=ja.skinVerticesA,ta=ja.skinVerticesB,wa=ja.skinIndices,Ba=ja.skinWeights,Ca=i instanceof THREE.ShadowVolume?ja.edgeFaces:void 0,Aa=ja.morphTargets;if(S)for(H in S)S[H].offset=0,S[H].offsetSrc=0;k=0;for(o=ua.length;k<o;k++)if(n=ua[k],p=xa[n],va&&(C=va[n]),ya&&(D=ya[n]),n=p.vertexNormals,q=p.normal,t=p.vertexColors,u=p.color,r=p.vertexTangents,p instanceof THREE.Face3){if(ma)x=ia[p.a].position,K=ia[p.b].position,
-J=ia[p.c].position,fa[G]=x.x,fa[G+1]=x.y,fa[G+2]=x.z,fa[G+3]=K.x,fa[G+4]=K.y,fa[G+5]=K.z,fa[G+6]=J.x,fa[G+7]=J.y,fa[G+8]=J.z,G+=9;if(S)for(H in S)if(m=S[H],m.__original.needsUpdate)s=m.offset,A=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[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[A+
-0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(x=m.value[p.a],K=m.value[p.b],J=m.value[p.c]):m.boundTo==="faces"?(x=m.value[A],K=m.value[A],J=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[A+0],K=m.value[A+1],J=m.value[A+2],m.offsetSrc+=3),m.size===2?(m.array[s+0]=x.x,m.array[s+1]=x.y,m.array[s+2]=K.x,m.array[s+3]=K.y,m.array[s+4]=J.x,m.array[s+5]=J.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s+
-0]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,m.array[s+3]=K.r,m.array[s+4]=K.g,m.array[s+5]=K.b,m.array[s+6]=J.r,m.array[s+7]=J.g,m.array[s+8]=J.b):(m.array[s+0]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=K.x,m.array[s+4]=K.y,m.array[s+5]=K.z,m.array[s+6]=J.x,m.array[s+7]=J.y,m.array[s+8]=J.z),m.offset+=9):(m.array[s+0]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=K.x,m.array[s+5]=K.y,m.array[s+6]=K.z,m.array[s+7]=K.w,m.array[s+8]=J.x,m.array[s+9]=J.y,m.array[s+10]=J.z,
-m.array[s+11]=J.w,m.offset+=12));if(sa){s=0;for(A=Aa.length;s<A;s++)x=Aa[s].vertices[p.a].position,K=Aa[s].vertices[p.b].position,J=Aa[s].vertices[p.c].position,m=ea[s],m[da+0]=x.x,m[da+1]=x.y,m[da+2]=x.z,m[da+3]=K.x,m[da+4]=K.y,m[da+5]=K.z,m[da+6]=J.x,m[da+7]=J.y,m[da+8]=J.z;da+=9}if(Ba.length)s=Ba[p.a],A=Ba[p.b],m=Ba[p.c],Z[w]=s.x,Z[w+1]=s.y,Z[w+2]=s.z,Z[w+3]=s.w,Z[w+4]=A.x,Z[w+5]=A.y,Z[w+6]=A.z,Z[w+7]=A.w,Z[w+8]=m.x,Z[w+9]=m.y,Z[w+10]=m.z,Z[w+11]=m.w,s=wa[p.a],A=wa[p.b],m=wa[p.c],Y[w]=s.x,Y[w+
-1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.w,Y[w+8]=m.x,Y[w+9]=m.y,Y[w+10]=m.z,Y[w+11]=m.w,s=oa[p.a],A=oa[p.b],m=oa[p.c],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.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=ta[p.a],A=ta[p.b],m=ta[p.c],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=1,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.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(ra&&v)t.length==3&&v==THREE.VertexColors?(p=t[0],s=t[1],A=t[2]):
-A=s=p=u,ga[ca]=p.r,ga[ca+1]=p.g,ga[ca+2]=p.b,ga[ca+3]=s.r,ga[ca+4]=s.g,ga[ca+5]=s.b,ga[ca+6]=A.r,ga[ca+7]=A.g,ga[ca+8]=A.b,ca+=9;if(qa&&ja.hasTangents)t=r[0],u=r[1],p=r[2],V[U]=t.x,V[U+1]=t.y,V[U+2]=t.z,V[U+3]=t.w,V[U+4]=u.x,V[U+5]=u.y,V[U+6]=u.z,V[U+7]=u.w,V[U+8]=p.x,V[U+9]=p.y,V[U+10]=p.z,V[U+11]=p.w,U+=12;if(pa&&z)if(n.length==3&&la)for(r=0;r<3;r++)q=n[r],Q[L]=q.x,Q[L+1]=q.y,Q[L+2]=q.z,L+=3;else for(r=0;r<3;r++)Q[L]=q.x,Q[L+1]=q.y,Q[L+2]=q.z,L+=3;if(ha&&C!==void 0&&y)for(r=0;r<3;r++)n=C[r],$[P]=
-n.u,$[P+1]=n.v,P+=2;if(ha&&D!==void 0&&y)for(r=0;r<3;r++)n=D[r],aa[T]=n.u,aa[T+1]=n.v,T+=2;na&&(N[I]=B,N[I+1]=B+1,N[I+2]=B+2,I+=3,R[M]=B,R[M+1]=B+1,R[M+2]=B,R[M+3]=B+2,R[M+4]=B+1,R[M+5]=B+2,M+=6,B+=3)}else if(p instanceof THREE.Face4){if(ma)x=ia[p.a].position,K=ia[p.b].position,J=ia[p.c].position,E=ia[p.d].position,fa[G]=x.x,fa[G+1]=x.y,fa[G+2]=x.z,fa[G+3]=K.x,fa[G+4]=K.y,fa[G+5]=K.z,fa[G+6]=J.x,fa[G+7]=J.y,fa[G+8]=J.z,fa[G+9]=E.x,fa[G+10]=E.y,fa[G+11]=E.z,G+=12;if(S)for(H in S)if(m=S[H],m.__original.needsUpdate)s=
-m.offset,A=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[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.array[s+3]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[A+0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.array[s+3]=m.value[A+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo===
-"vertices"?(x=m.value[p.a],K=m.value[p.b],J=m.value[p.c],E=m.value[p.d]):m.boundTo==="faces"?(x=m.value[A],K=m.value[A],J=m.value[A],E=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(x=m.value[A+0],K=m.value[A+1],J=m.value[A+2],E=m.value[A+3],m.offsetSrc+=4),m.size===2?(m.array[s+0]=x.x,m.array[s+1]=x.y,m.array[s+2]=K.x,m.array[s+3]=K.y,m.array[s+4]=J.x,m.array[s+5]=J.y,m.array[s+6]=E.x,m.array[s+7]=E.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s+0]=x.r,m.array[s+1]=x.g,m.array[s+2]=x.b,
-m.array[s+3]=K.r,m.array[s+4]=K.g,m.array[s+5]=K.b,m.array[s+6]=J.r,m.array[s+7]=J.g,m.array[s+8]=J.b,m.array[s+9]=E.r,m.array[s+10]=E.g,m.array[s+11]=E.b):(m.array[s+0]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=K.x,m.array[s+4]=K.y,m.array[s+5]=K.z,m.array[s+6]=J.x,m.array[s+7]=J.y,m.array[s+8]=J.z,m.array[s+9]=E.x,m.array[s+10]=E.y,m.array[s+11]=E.z),m.offset+=12):(m.array[s+0]=x.x,m.array[s+1]=x.y,m.array[s+2]=x.z,m.array[s+3]=x.w,m.array[s+4]=K.x,m.array[s+5]=K.y,m.array[s+6]=K.z,m.array[s+
-7]=K.w,m.array[s+8]=J.x,m.array[s+9]=J.y,m.array[s+10]=J.z,m.array[s+11]=J.w,m.array[s+12]=E.x,m.array[s+13]=E.y,m.array[s+14]=E.z,m.array[s+15]=E.w,m.offset+=16));if(sa){s=0;for(A=Aa.length;s<A;s++)x=Aa[s].vertices[p.a].position,K=Aa[s].vertices[p.b].position,J=Aa[s].vertices[p.c].position,E=Aa[s].vertices[p.d].position,m=ea[s],m[da+0]=x.x,m[da+1]=x.y,m[da+2]=x.z,m[da+3]=K.x,m[da+4]=K.y,m[da+5]=K.z,m[da+6]=J.x,m[da+7]=J.y,m[da+8]=J.z,m[da+9]=E.x,m[da+10]=E.y,m[da+11]=E.z;da+=12}if(Ba.length)s=Ba[p.a],
-A=Ba[p.b],m=Ba[p.c],F=Ba[p.d],Z[w]=s.x,Z[w+1]=s.y,Z[w+2]=s.z,Z[w+3]=s.w,Z[w+4]=A.x,Z[w+5]=A.y,Z[w+6]=A.z,Z[w+7]=A.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=wa[p.a],A=wa[p.b],m=wa[p.c],F=wa[p.d],Y[w]=s.x,Y[w+1]=s.y,Y[w+2]=s.z,Y[w+3]=s.w,Y[w+4]=A.x,Y[w+5]=A.y,Y[w+6]=A.z,Y[w+7]=A.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=oa[p.a],A=oa[p.b],m=oa[p.c],F=oa[p.d],W[w]=s.x,W[w+1]=s.y,W[w+2]=s.z,
-W[w+3]=1,W[w+4]=A.x,W[w+5]=A.y,W[w+6]=A.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=ta[p.a],A=ta[p.b],m=ta[p.c],p=ta[p.d],X[w]=s.x,X[w+1]=s.y,X[w+2]=s.z,X[w+3]=1,X[w+4]=A.x,X[w+5]=A.y,X[w+6]=A.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(ra&&v)t.length==4&&v==THREE.VertexColors?(p=t[0],s=t[1],A=t[2],t=t[3]):t=A=s=p=u,ga[ca]=p.r,ga[ca+1]=p.g,ga[ca+2]=p.b,ga[ca+3]=s.r,ga[ca+4]=
-s.g,ga[ca+5]=s.b,ga[ca+6]=A.r,ga[ca+7]=A.g,ga[ca+8]=A.b,ga[ca+9]=t.r,ga[ca+10]=t.g,ga[ca+11]=t.b,ca+=12;if(qa&&ja.hasTangents)t=r[0],u=r[1],p=r[2],r=r[3],V[U]=t.x,V[U+1]=t.y,V[U+2]=t.z,V[U+3]=t.w,V[U+4]=u.x,V[U+5]=u.y,V[U+6]=u.z,V[U+7]=u.w,V[U+8]=p.x,V[U+9]=p.y,V[U+10]=p.z,V[U+11]=p.w,V[U+12]=r.x,V[U+13]=r.y,V[U+14]=r.z,V[U+15]=r.w,U+=16;if(pa&&z)if(n.length==4&&la)for(r=0;r<4;r++)q=n[r],Q[L]=q.x,Q[L+1]=q.y,Q[L+2]=q.z,L+=3;else for(r=0;r<4;r++)Q[L]=q.x,Q[L+1]=q.y,Q[L+2]=q.z,L+=3;if(ha&&C!==void 0&&
-y)for(r=0;r<4;r++)n=C[r],$[P]=n.u,$[P+1]=n.v,P+=2;if(ha&&D!==void 0&&y)for(r=0;r<4;r++)n=D[r],aa[T]=n.u,aa[T+1]=n.v,T+=2;na&&(N[I]=B,N[I+1]=B+1,N[I+2]=B+3,N[I+3]=B+1,N[I+4]=B+2,N[I+5]=B+3,I+=6,R[M]=B,R[M+1]=B+1,R[M+2]=B,R[M+3]=B+3,R[M+4]=B+1,R[M+5]=B+2,R[M+6]=B+2,R[M+7]=B+3,M+=8,B+=4)}if(Ca){k=0;for(o=Ca.length;k<o;k++)N[I]=Ca[k].a,N[I+1]=Ca[k].b,N[I+2]=Ca[k].c,N[I+3]=Ca[k].a,N[I+4]=Ca[k].c,N[I+5]=Ca[k].d,I+=6}ma&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,fa,
-j));if(S)for(H in S)m=S[H],m.__original.needsUpdate&&(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(sa){s=0;for(A=Aa.length;s<A;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,ea[s],j)}ra&&ca>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ga,j));pa&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,Q,j));qa&&ja.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),
-c.bufferData(c.ARRAY_BUFFER,V,j));ha&&P>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ha&&T>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));na&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,N,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,R,j));w>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,
-W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));i.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,
-delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ka;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(e=h[f],e.attributes)for(ka in e.attributes)e.attributes[ka].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ka=f;b=c.DYNAMIC_DRAW;o=ka.vertices;h=ka.colors;y=o.length;g=
-h.length;v=ka.__vertexArray;i=ka.__colorArray;z=ka.__dirtyColors;if(ka.__dirtyVertices){for(j=0;j<y;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,ka.__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,ka.__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){ka=f;b=c.DYNAMIC_DRAW;o=ka.vertices;h=ka.colors;y=o.length;g=h.length;v=ka.__vertexArray;i=ka.__colorArray;z=ka.__dirtyColors;if(ka.__dirtyVertices){for(j=0;j<y;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,ka.__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,ka.__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 ea(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function S(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 H(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function y(b){if(b!=F){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)}F=b}}function aa(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,M(e.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,M(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,M(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,M(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,ua(e.magFilter)),
-c.texParameteri(b,c.TEXTURE_MIN_FILTER,ua(e.minFilter)))}function P(b,e){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,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),aa(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 Q(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,M(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,M(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,M(b.magFilter));
-c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,M(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,M(b.format),b.width,b.height,0,M(b.format),M(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,
-c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,
-d=va,b=qa);e!=ha&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(G,xa,d,b),ha=e)}function B(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 ua(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;
-default:return c.LINEAR}}function M(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}
-var L=this,c,sa=[],la=null,ha=null,ma=!0,$=null,na=null,F=null,T=null,I=null,R=null,pa=null,G=0,xa=0,va=0,qa=0,ra=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Matrix4,ta=new Float32Array(16),ya=new Float32Array(16),Da=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},wa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-Fa=b.stencil!==void 0?b.stencil:!0,Ka=b.antialias!==void 0?b.antialias:!1,oa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ea=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=wa;this.sortObjects=this.autoClear=!0;try{if(!(c=wa.getContext("experimental-webgl",{antialias:Ka,stencil:Fa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+
-" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(La){console.error(La)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(oa.r,oa.g,oa.b,Ea);this.context=c;var Ja=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Fa){var x={};x.vertices=new Float32Array(12);x.faces=
-new Uint16Array(6);x.darkness=0.5;x.vertices[0]=-20;x.vertices[1]=-20;x.vertices[2]=-1;x.vertices[3]=20;x.vertices[4]=-20;x.vertices[5]=-1;x.vertices[6]=20;x.vertices[7]=20;x.vertices[8]=-1;x.vertices[9]=-20;x.vertices[10]=20;x.vertices[11]=-1;x.faces[0]=0;x.faces[1]=1;x.faces[2]=2;x.faces[3]=0;x.faces[4]=2;x.faces[5]=3;x.vertexBuffer=c.createBuffer();x.elementBuffer=c.createBuffer();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);x.program=c.createProgram();c.attachShader(x.program,B("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(x.program,B("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(x.program);x.vertexLocation=c.getAttribLocation(x.program,"position");x.projectionLocation=c.getUniformLocation(x.program,"projectionMatrix");x.darknessLocation=c.getUniformLocation(x.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,B("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(v.program,B("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(v.hasVertexTexture=!0,v.program=c.createProgram(),c.attachShader(v.program,B("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(v.program,B("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 Ia=!1,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);b=0;r.vertices[b++]=-1;r.vertices[b++]=-1;r.vertices[b++]=0;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=-1;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=0;r.vertices[b++]=-1;r.vertices[b++]=1;r.vertices[b++]=0;b=r.vertices[b++]=0;r.faces[b++]=0;r.faces[b++]=1;r.faces[b++]=2;r.faces[b++]=0;r.faces[b++]=2;r.faces[b++]=
-3;r.vertexBuffer=c.createBuffer();r.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,r.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,r.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,r.faces,c.STATIC_DRAW);r.program=c.createProgram();c.attachShader(r.program,B("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(r.program,B("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(r.program);r.attributes={};r.uniforms=
-{};r.attributes.position=c.getAttribLocation(r.program,"position");r.attributes.uv=c.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=c.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=c.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=c.getUniformLocation(r.program,"rotation");r.uniforms.scale=c.getUniformLocation(r.program,"scale");r.uniforms.alignment=c.getUniformLocation(r.program,"alignment");r.uniforms.map=c.getUniformLocation(r.program,"map");r.uniforms.opacity=c.getUniformLocation(r.program,
-"opacity");r.uniforms.useScreenCoordinates=c.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=c.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=c.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix=c.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=c.getUniformLocation(r.program,"projectionMatrix");var Ha=!1;this.setSize=function(b,c){wa.width=b;wa.height=c;this.setViewport(0,0,wa.width,
-wa.height)};this.setViewport=function(b,e,d,f){G=b;xa=e;va=d;qa=f;c.viewport(G,xa,va,qa)};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){ma=b;c.depthMask(b)};this.setClearColorHex=function(b,e){oa.setHex(b);Ea=e;c.clearColor(oa.r,oa.g,oa.b,Ea)};this.setClearColor=function(b,e){oa.copy(b);Ea=e;c.clearColor(oa.r,oa.g,oa.b,Ea)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|
-c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){x.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=sa.length;q<h;q++)if(sa[q].code==i){n=sa[q].program;break a}q=
-c.createProgram();h=[Ja?"#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");
-p=["#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");c.attachShader(q,B("fragment",p+k));c.attachShader(q,B("vertex",h+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 t;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in j)k.push(t);t=k;j=0;for(k=t.length;j<k;j++)o=t[j],q.uniforms[o]=c.getUniformLocation(q,o);k=["position","normal",
-"uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<d.maxMorphTargets;t++)k.push("morphTarget"+t);for(n in e)k.push(n);n=k;t=0;for(e=n.length;t<e;t++)d=n[t],q.attributes[d]=c.getAttribLocation(q,d);sa.push({program:q,code:i});n=q}b.program=n;n=b.program.attributes;n.position>=0&&c.enableVertexAttribArray(n.position);n.color>=0&&c.enableVertexAttribArray(n.color);n.normal>=0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);
-b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),
+THREE.WebGLRenderer=function(b){function d(b,d,e){var f,g,h,i=b.vertices,j=i.length,o=b.colors,k=o.length,q=b.__vertexArray,S=b.__colorArray,p=b.__sortArray,n=b.__dirtyVertices,v=b.__dirtyColors,t=b.__webglCustomAttributes,za,r;if(t)for(za in t)t[za].offset=0;if(e.sortParticles){ma.multiplySelf(e.matrixWorld);for(f=0;f<j;f++)g=i[f].position,Fa.copy(g),ma.multiplyVector3(Fa),p[f]=[Fa.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<j;f++)g=i[p[f][1]].position,h=f*3,q[h]=g.x,q[h+1]=g.y,q[h+2]=
+g.z;for(f=0;f<k;f++)h=f*3,color=o[p[f][1]],S[h]=color.r,S[h+1]=color.g,S[h+2]=color.b;if(t)for(za in t){f=t[za];o=f.value.length;for(h=0;h<o;h++){index=p[h][1];k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")r=f.value[index];f.size===2?(f.array[k]=r.x,f.array[k+1]=r.y):f.size===3?f.type==="c"?(f.array[k]=r.r,f.array[k+1]=r.g,f.array[k+2]=r.b):(f.array[k]=r.x,f.array[k+1]=r.y,f.array[k+2]=r.z):(f.array[k]=
+r.x,f.array[k+1]=r.y,f.array[k+2]=r.z,f.array[k+3]=r.w)}f.offset+=f.size}}}else{if(n)for(f=0;f<j;f++)g=i[f].position,h=f*3,q[h]=g.x,q[h+1]=g.y,q[h+2]=g.z;if(v)for(f=0;f<k;f++)color=o[f],h=f*3,S[h]=color.r,S[h+1]=color.g,S[h+2]=color.b;if(t)for(za in t)if(f=t[za],f.__original.needsUpdate){o=f.value.length;for(h=0;h<o;h++){k=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[k]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")r=f.value[h];f.size===2?(f.array[k]=
+r.x,f.array[k+1]=r.y):f.size===3?f.type==="c"?(f.array[k]=r.r,f.array[k+1]=r.g,f.array[k+2]=r.b):(f.array[k]=r.x,f.array[k+1]=r.y,f.array[k+2]=r.z):(f.array[k]=r.x,f.array[k+1]=r.y,f.array[k+2]=r.z,f.array[k+3]=r.w)}f.offset+=f.size}}}if(n||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,q,d);if(v||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,S,d);if(t)for(za in t)if(f=t[za],f.__original.needsUpdate||e.sortParticles)c.bindBuffer(c.ARRAY_BUFFER,
+f.buffer),c.bufferData(c.ARRAY_BUFFER,f.array,d)}function e(b,d,e,f,g){f.program||M.initMaterial(f,d,e,g);var h=f.program,i=h.uniforms,j=f.uniforms;h!=ha&&(c.useProgram(h),ha=h);c.uniformMatrix4fv(i.projectionMatrix,!1,Ga);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,q=0,S=0,p=0,n,v,r,t,u=Ka,y=u.directional.colors,C=u.directional.positions,z=u.point.colors,D=u.point.positions,J=u.point.distances,w=0,s=0,e=o=t=0;for(k=d.length;e<k;e++)if(o=d[e],n=o.color,v=o.position,r=o.intensity,t=o.distance,o instanceof THREE.AmbientLight)q+=n.r,S+=n.g,p+=n.b;else if(o instanceof THREE.DirectionalLight)t=
+w*3,y[t]=n.r*r,y[t+1]=n.g*r,y[t+2]=n.b*r,C[t]=v.x,C[t+1]=v.y,C[t+2]=v.z,w+=1;else if(o instanceof THREE.PointLight)o=s*3,z[o]=n.r*r,z[o+1]=n.g*r,z[o+2]=n.b*r,D[o]=v.x,D[o+1]=v.y,D[o+2]=v.z,J[s]=t,s+=1;for(e=w*3;e<y.length;e++)y[e]=0;for(e=s*3;e<z.length;e++)z[e]=0;u.point.length=s;u.directional.length=w;u.ambient[0]=q;u.ambient[1]=S;u.ambient[2]=p;e=Ka;j.enableLighting.value=e.directional.length+e.point.length;j.ambientLightColor.value=e.ambient;j.directionalLightColor.value=e.directional.colors;
+j.directionalLightDirection.value=e.directional.positions;j.pointLightColor.value=e.point.colors;j.pointLightPosition.value=e.point.positions;j.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity,(j.map.texture=f.map)&&j.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),j.lightMap.texture=f.lightMap,j.envMap.texture=
+f.envMap,j.reflectivity.value=f.reflectivity,j.refractionRatio.value=f.refractionRatio,j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=wa.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 A in j)if(S=h.uniforms[A])if(k=j[A],q=k.type,e=k.value,q=="i")c.uniform1i(S,e);else if(q=="f")c.uniform1f(S,e);else if(q=="fv1")c.uniform1fv(S,e);else if(q=="fv")c.uniform3fv(S,e);else if(q=="v2")c.uniform2f(S,e.x,e.y);else if(q=="v3")c.uniform3f(S,
+e.x,e.y,e.z);else if(q=="v4")c.uniform4f(S,e.x,e.y,e.z,e.w);else if(q=="c")c.uniform3f(S,e.r,e.g,e.b);else if(q=="t"&&(c.uniform1i(S,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(q=0;q<6;++q)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[q])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,
+k.image.__webglTextureCube);for(q=0;q<6;++q)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[q]);k.__webglInit=!0}ca(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 $(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,Ha);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,Ha);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ha),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=[],p=-1,q=0,o=i.morphTargetInfluences,S,n=o.length,f=0;for(i.morphTargetBase!==-1&&(k[i.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(S=0;S<n;S++)!k[S]&&o[S]>p&&(q=S,p=o[q]);c.bindBuffer(c.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=
+p;k[q]=1;p=-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,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.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.drawElements(c.TRIANGLES,h.__webglFaceCount,c.UNSIGNED_SHORT,0)),M.data.vertices+=h.__webglFaceCount,M.data.faces+=h.__webglFaceCount/3,M.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),M.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,h.__webglParticleCount),M.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,h.__webglVertexCount),M.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,q,p,n,v=b.count*3;for(n=0;n<v;n+=9)e=b.normalArray,f=e[n],h=e[n+1],g=e[n+2],i=e[n+3],k=e[n+4],q=e[n+5],j=e[n+6],o=e[n+7],p=e[n+8],f=(f+i+j)/3,h=(h+k+o)/3,g=(g+q+p)/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(B!=b.doubleSided)b.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),B=b.doubleSided;if(O!=b.flipSided)b.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW),O=b.flipSided}function h(b){N!=b&&(b?c.enable(c.DEPTH_TEST):
+c.disable(c.DEPTH_TEST),N=b)}function j(b,d,e){ja!=b&&(b?c.enable(c.POLYGON_OFFSET_FILL):c.disable(c.POLYGON_OFFSET_FILL),ja=b);if(b&&(R!=d||ra!=e))c.polygonOffset(d,e),R=d,ra=e}function o(b){la[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);la[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);la[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);la[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);la[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);la[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=la[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function k(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=la[e].x*c.n14+la[e].y*c.n24+la[e].z*c.n34+la[e].w,b<=d)return!1;return!0}function p(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?p(h,d):p(f,d)}function v(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?p(j,f):p(i,f))}else(f=c)&&(f.transparent?p(j,f):p(i,f))}function t(b,c){return c.z-b.z}function z(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,q,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(q=0;q<n;q++)f=b.__webglShadowVolumes[q].object,i=b.__webglShadowVolumes[q].buffer,j=f.materials[0],j.program||M.initMaterial(j,
+h,void 0,f),j=j.program,k=j.uniforms,o=j.attributes,ha!==j&&(c.useProgram(j),ha=j,c.uniformMatrix4fv(k.projectionMatrix,!1,Ga),c.uniformMatrix4fv(k.viewMatrix,!1,Ha),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);N=F=-1;ha=w.program;c.useProgram(w.program);c.uniformMatrix4fv(w.projectionLocation,!1,Ga);c.uniform1f(w.darknessLocation,
+w.darkness);c.bindBuffer(c.ARRAY_BUFFER,w.vertexBuffer);c.vertexAttribPointer(w.vertexLocation,3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(w.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function D(b,d){var e,f,h;e=u.attributes;var g=u.uniforms,i=P/sa,j,k=[],o=sa*0.5,q=P*0.5,n=!0;c.useProgram(u.program);
+ha=u.program;N=F=-1;La||(c.enableVertexAttribArray(u.attributes.position),c.enableVertexAttribArray(u.attributes.uv),La=!0);c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,u.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,u.elementBuffer);c.uniformMatrix4fv(g.projectionMatrix,!1,Ga);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(t);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,(q-h.position.y)/q,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.scaleByViewport?P:1),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),G(h.blending),$(h.map,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0));c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function E(b,e){var d,f,h=b.__webglLensFlares.length,g,i,j,k=new THREE.Vector3,o=P/sa,q=sa*0.5,n=P*0.5,p=16/P,v=[p*o,p],t=[1,1,0],u=[1,1],y=r.uniforms;d=r.attributes;c.useProgram(r.program);ha=r.program;N=F=-1;Ma||(c.enableVertexAttribArray(r.attributes.vertex),c.enableVertexAttribArray(r.attributes.uv),
+Ma=!0);c.uniform1i(y.occlusionMap,0);c.uniform1i(y.map,1);c.bindBuffer(c.ARRAY_BUFFER,r.vertexBuffer);c.vertexAttribPointer(d.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(d.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,r.occlusionTexture);c.activeTexture(c.TEXTURE1);for(f=0;f<h;f++)if(d=b.__webglLensFlares[f].object,k.set(d.matrixWorld.n14,d.matrixWorld.n24,d.matrixWorld.n34),
+e.matrixWorldInverse.multiplyVector3(k),e.projectionMatrix.multiplyVector3(k),t[0]=k.x,t[1]=k.y,t[2]=k.z,u[0]=t[0]*q+q,u[1]=t[1]*n+n,r.hasVertexTexture||u[0]>0&&u[0]<sa&&u[1]>0&&u[1]<P){c.bindTexture(c.TEXTURE_2D,r.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,u[0]-8,u[1]-8,16,16,0);c.uniform1i(y.renderType,0);c.uniform2fv(y.scale,v);c.uniform3fv(y.screenPosition,t);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,r.occlusionTexture);
+c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,u[0]-8,u[1]-8,16,16,0);c.uniform1i(y.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,r.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);d.positionScreen.x=t[0];d.positionScreen.y=t[1];d.positionScreen.z=t[2];d.customUpdateCallback?d.customUpdateCallback(d):d.updateLensFlares();c.uniform1i(y.renderType,2);c.enable(c.BLEND);g=0;for(i=d.lensFlares.length;g<i;g++)if(j=d.lensFlares[g],j.opacity>0.0010&&j.scale>0.0010)t[0]=j.x,t[1]=j.y,
+t[2]=j.z,p=j.size*j.scale/P,v[0]=p*o,v[1]=p,c.uniform3fv(y.screenPosition,t),c.uniform2fv(y.scale,v),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),G(j.blending),$(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ia)}function C(b,c){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+function oa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)if(e.attributes[c].needsUpdate)return!0;return!1}function pa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b<d;b++)if(e=f[b],e.attributes)for(c in e.attributes)e.attributes[c].needsUpdate=!1}function T(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=oa(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||
+f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var i=b,j=c.DYNAMIC_DRAW;if(g.__inittedArrays){var k=void 0,o=void 0,n=void 0,q=void 0,p=n=void 0,v=void 0,t=void 0,r=void 0,u=void 0,y=void 0,z=void 0,C=void 0,D=void 0,w=void 0,L=void 0,J=void 0,E=void 0,s=q=r=q=t=v=void 0,A=void 0,m=A=s=v=void 0,B=void 0,I=m=A=s=n=n=p=r=q=m=A=s=B=m=A=s=B=m=A=s=void 0,G=0,F=0,R=0,T=0,H=0,K=0,U=0,M=0,da=0,x=0,ea=0,A=s=0,fa=g.__vertexArray,$=g.__uvArray,aa=g.__uv2Array,O=g.__normalArray,V=g.__tangentArray,
+ga=g.__colorArray,W=g.__skinVertexAArray,X=g.__skinVertexBArray,Y=g.__skinIndexArray,Z=g.__skinWeightArray,ca=g.__morphTargetsArrays,Q=g.__webglCustomAttributes,m=void 0,N=g.__faceArray,P=g.__lineArray,ha=g.__needsSmoothNormals,y=g.__vertexColorType,u=g.__uvType,z=g.__normalType,ka=i.geometry,ia=ka.__dirtyVertices,la=ka.__dirtyElements,ja=ka.__dirtyUvs,na=ka.__dirtyNormals,qa=ka.__dirtyTangents,ra=ka.__dirtyColors,sa=ka.__dirtyMorphTargets,ma=ka.vertices,ta=g.faces,ua=ka.faces,va=ka.faceVertexUvs[0],
+wa=ka.faceVertexUvs[1],Ba=ka.skinVerticesA,Ca=ka.skinVerticesB,Da=ka.skinIndices,ya=ka.skinWeights,Aa=i instanceof THREE.ShadowVolume?ka.edgeFaces:void 0,xa=ka.morphTargets;if(Q)for(I in Q)Q[I].offset=0,Q[I].offsetSrc=0;k=0;for(o=ta.length;k<o;k++)if(n=ta[k],q=ua[n],va&&(C=va[n]),wa&&(D=wa[n]),n=q.vertexNormals,p=q.normal,v=q.vertexColors,t=q.color,r=q.vertexTangents,q instanceof THREE.Face3){if(ia)w=ma[q.a].position,L=ma[q.b].position,J=ma[q.c].position,fa[F]=w.x,fa[F+1]=w.y,fa[F+2]=w.z,fa[F+3]=
+L.x,fa[F+4]=L.y,fa[F+5]=L.z,fa[F+6]=J.x,fa[F+7]=J.y,fa[F+8]=J.z,F+=9;if(Q)for(I in Q)if(m=Q[I],m.__original.needsUpdate)s=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[s+0]=m.value[q.a],m.array[s+1]=m.value[q.b],m.array[s+2]=m.value[q.c]):m.boundTo==="faces"?(m.array[s+0]=m.value[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[A+0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.offsetSrc+=
+3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(w=m.value[q.a],L=m.value[q.b],J=m.value[q.c]):m.boundTo==="faces"?(w=m.value[A],L=m.value[A],J=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(w=m.value[A+0],L=m.value[A+1],J=m.value[A+2],m.offsetSrc+=3),m.size===2?(m.array[s+0]=w.x,m.array[s+1]=w.y,m.array[s+2]=L.x,m.array[s+3]=L.y,m.array[s+4]=J.x,m.array[s+5]=J.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[s+0]=w.r,m.array[s+1]=w.g,m.array[s+2]=w.b,m.array[s+3]=L.r,m.array[s+
+4]=L.g,m.array[s+5]=L.b,m.array[s+6]=J.r,m.array[s+7]=J.g,m.array[s+8]=J.b):(m.array[s+0]=w.x,m.array[s+1]=w.y,m.array[s+2]=w.z,m.array[s+3]=L.x,m.array[s+4]=L.y,m.array[s+5]=L.z,m.array[s+6]=J.x,m.array[s+7]=J.y,m.array[s+8]=J.z),m.offset+=9):(m.array[s+0]=w.x,m.array[s+1]=w.y,m.array[s+2]=w.z,m.array[s+3]=w.w,m.array[s+4]=L.x,m.array[s+5]=L.y,m.array[s+6]=L.z,m.array[s+7]=L.w,m.array[s+8]=J.x,m.array[s+9]=J.y,m.array[s+10]=J.z,m.array[s+11]=J.w,m.offset+=12));if(sa){s=0;for(A=xa.length;s<A;s++)w=
+xa[s].vertices[q.a].position,L=xa[s].vertices[q.b].position,J=xa[s].vertices[q.c].position,m=ca[s],m[ea+0]=w.x,m[ea+1]=w.y,m[ea+2]=w.z,m[ea+3]=L.x,m[ea+4]=L.y,m[ea+5]=L.z,m[ea+6]=J.x,m[ea+7]=J.y,m[ea+8]=J.z;ea+=9}if(ya.length)s=ya[q.a],A=ya[q.b],m=ya[q.c],Z[x]=s.x,Z[x+1]=s.y,Z[x+2]=s.z,Z[x+3]=s.w,Z[x+4]=A.x,Z[x+5]=A.y,Z[x+6]=A.z,Z[x+7]=A.w,Z[x+8]=m.x,Z[x+9]=m.y,Z[x+10]=m.z,Z[x+11]=m.w,s=Da[q.a],A=Da[q.b],m=Da[q.c],Y[x]=s.x,Y[x+1]=s.y,Y[x+2]=s.z,Y[x+3]=s.w,Y[x+4]=A.x,Y[x+5]=A.y,Y[x+6]=A.z,Y[x+7]=A.w,
+Y[x+8]=m.x,Y[x+9]=m.y,Y[x+10]=m.z,Y[x+11]=m.w,s=Ba[q.a],A=Ba[q.b],m=Ba[q.c],W[x]=s.x,W[x+1]=s.y,W[x+2]=s.z,W[x+3]=1,W[x+4]=A.x,W[x+5]=A.y,W[x+6]=A.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=Ca[q.a],A=Ca[q.b],m=Ca[q.c],X[x]=s.x,X[x+1]=s.y,X[x+2]=s.z,X[x+3]=1,X[x+4]=A.x,X[x+5]=A.y,X[x+6]=A.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(ra&&y)v.length==3&&y==THREE.VertexColors?(q=v[0],s=v[1],A=v[2]):A=s=q=t,ga[da]=q.r,ga[da+1]=q.g,ga[da+2]=q.b,ga[da+3]=s.r,ga[da+4]=s.g,
+ga[da+5]=s.b,ga[da+6]=A.r,ga[da+7]=A.g,ga[da+8]=A.b,da+=9;if(qa&&ka.hasTangents)v=r[0],t=r[1],q=r[2],V[U]=v.x,V[U+1]=v.y,V[U+2]=v.z,V[U+3]=v.w,V[U+4]=t.x,V[U+5]=t.y,V[U+6]=t.z,V[U+7]=t.w,V[U+8]=q.x,V[U+9]=q.y,V[U+10]=q.z,V[U+11]=q.w,U+=12;if(na&&z)if(n.length==3&&ha)for(r=0;r<3;r++)p=n[r],O[K]=p.x,O[K+1]=p.y,O[K+2]=p.z,K+=3;else for(r=0;r<3;r++)O[K]=p.x,O[K+1]=p.y,O[K+2]=p.z,K+=3;if(ja&&C!==void 0&&u)for(r=0;r<3;r++)n=C[r],$[R]=n.u,$[R+1]=n.v,R+=2;if(ja&&D!==void 0&&u)for(r=0;r<3;r++)n=D[r],aa[T]=
+n.u,aa[T+1]=n.v,T+=2;la&&(N[H]=G,N[H+1]=G+1,N[H+2]=G+2,H+=3,P[M]=G,P[M+1]=G+1,P[M+2]=G,P[M+3]=G+2,P[M+4]=G+1,P[M+5]=G+2,M+=6,G+=3)}else if(q instanceof THREE.Face4){if(ia)w=ma[q.a].position,L=ma[q.b].position,J=ma[q.c].position,E=ma[q.d].position,fa[F]=w.x,fa[F+1]=w.y,fa[F+2]=w.z,fa[F+3]=L.x,fa[F+4]=L.y,fa[F+5]=L.z,fa[F+6]=J.x,fa[F+7]=J.y,fa[F+8]=J.z,fa[F+9]=E.x,fa[F+10]=E.y,fa[F+11]=E.z,F+=12;if(Q)for(I in Q)if(m=Q[I],m.__original.needsUpdate)s=m.offset,A=m.offsetSrc,m.size===1?(m.boundTo===void 0||
+m.boundTo==="vertices"?(m.array[s+0]=m.value[q.a],m.array[s+1]=m.value[q.b],m.array[s+2]=m.value[q.c],m.array[s+3]=m.value[q.d]):m.boundTo==="faces"?(m.array[s+0]=m.value[A],m.array[s+1]=m.value[A],m.array[s+2]=m.value[A],m.array[s+3]=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[s+0]=m.value[A+0],m.array[s+1]=m.value[A+1],m.array[s+2]=m.value[A+2],m.array[s+3]=m.value[A+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(w=m.value[q.a],L=m.value[q.b],J=m.value[q.c],
+E=m.value[q.d]):m.boundTo==="faces"?(w=m.value[A],L=m.value[A],J=m.value[A],E=m.value[A],m.offsetSrc++):m.boundTo==="faceVertices"&&(w=m.value[A+0],L=m.value[A+1],J=m.value[A+2],E=m.value[A+3],m.offsetSrc+=4),m.size===2?(m.array[s+0]=w.x,m.array[s+1]=w.y,m.array[s+2]=L.x,m.array[s+3]=L.y,m.array[s+4]=J.x,m.array[s+5]=J.y,m.array[s+6]=E.x,m.array[s+7]=E.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[s+0]=w.r,m.array[s+1]=w.g,m.array[s+2]=w.b,m.array[s+3]=L.r,m.array[s+4]=L.g,m.array[s+5]=L.b,m.array[s+
+6]=J.r,m.array[s+7]=J.g,m.array[s+8]=J.b,m.array[s+9]=E.r,m.array[s+10]=E.g,m.array[s+11]=E.b):(m.array[s+0]=w.x,m.array[s+1]=w.y,m.array[s+2]=w.z,m.array[s+3]=L.x,m.array[s+4]=L.y,m.array[s+5]=L.z,m.array[s+6]=J.x,m.array[s+7]=J.y,m.array[s+8]=J.z,m.array[s+9]=E.x,m.array[s+10]=E.y,m.array[s+11]=E.z),m.offset+=12):(m.array[s+0]=w.x,m.array[s+1]=w.y,m.array[s+2]=w.z,m.array[s+3]=w.w,m.array[s+4]=L.x,m.array[s+5]=L.y,m.array[s+6]=L.z,m.array[s+7]=L.w,m.array[s+8]=J.x,m.array[s+9]=J.y,m.array[s+10]=
+J.z,m.array[s+11]=J.w,m.array[s+12]=E.x,m.array[s+13]=E.y,m.array[s+14]=E.z,m.array[s+15]=E.w,m.offset+=16));if(sa){s=0;for(A=xa.length;s<A;s++)w=xa[s].vertices[q.a].position,L=xa[s].vertices[q.b].position,J=xa[s].vertices[q.c].position,E=xa[s].vertices[q.d].position,m=ca[s],m[ea+0]=w.x,m[ea+1]=w.y,m[ea+2]=w.z,m[ea+3]=L.x,m[ea+4]=L.y,m[ea+5]=L.z,m[ea+6]=J.x,m[ea+7]=J.y,m[ea+8]=J.z,m[ea+9]=E.x,m[ea+10]=E.y,m[ea+11]=E.z;ea+=12}if(ya.length)s=ya[q.a],A=ya[q.b],m=ya[q.c],B=ya[q.d],Z[x]=s.x,Z[x+1]=s.y,
+Z[x+2]=s.z,Z[x+3]=s.w,Z[x+4]=A.x,Z[x+5]=A.y,Z[x+6]=A.z,Z[x+7]=A.w,Z[x+8]=m.x,Z[x+9]=m.y,Z[x+10]=m.z,Z[x+11]=m.w,Z[x+12]=B.x,Z[x+13]=B.y,Z[x+14]=B.z,Z[x+15]=B.w,s=Da[q.a],A=Da[q.b],m=Da[q.c],B=Da[q.d],Y[x]=s.x,Y[x+1]=s.y,Y[x+2]=s.z,Y[x+3]=s.w,Y[x+4]=A.x,Y[x+5]=A.y,Y[x+6]=A.z,Y[x+7]=A.w,Y[x+8]=m.x,Y[x+9]=m.y,Y[x+10]=m.z,Y[x+11]=m.w,Y[x+12]=B.x,Y[x+13]=B.y,Y[x+14]=B.z,Y[x+15]=B.w,s=Ba[q.a],A=Ba[q.b],m=Ba[q.c],B=Ba[q.d],W[x]=s.x,W[x+1]=s.y,W[x+2]=s.z,W[x+3]=1,W[x+4]=A.x,W[x+5]=A.y,W[x+6]=A.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]=B.x,W[x+13]=B.y,W[x+14]=B.z,W[x+15]=1,s=Ca[q.a],A=Ca[q.b],m=Ca[q.c],q=Ca[q.d],X[x]=s.x,X[x+1]=s.y,X[x+2]=s.z,X[x+3]=1,X[x+4]=A.x,X[x+5]=A.y,X[x+6]=A.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]=q.x,X[x+13]=q.y,X[x+14]=q.z,X[x+15]=1,x+=16;if(ra&&y)v.length==4&&y==THREE.VertexColors?(q=v[0],s=v[1],A=v[2],v=v[3]):v=A=s=q=t,ga[da]=q.r,ga[da+1]=q.g,ga[da+2]=q.b,ga[da+3]=s.r,ga[da+4]=s.g,ga[da+5]=s.b,ga[da+6]=A.r,ga[da+7]=A.g,ga[da+8]=
+A.b,ga[da+9]=v.r,ga[da+10]=v.g,ga[da+11]=v.b,da+=12;if(qa&&ka.hasTangents)v=r[0],t=r[1],q=r[2],r=r[3],V[U]=v.x,V[U+1]=v.y,V[U+2]=v.z,V[U+3]=v.w,V[U+4]=t.x,V[U+5]=t.y,V[U+6]=t.z,V[U+7]=t.w,V[U+8]=q.x,V[U+9]=q.y,V[U+10]=q.z,V[U+11]=q.w,V[U+12]=r.x,V[U+13]=r.y,V[U+14]=r.z,V[U+15]=r.w,U+=16;if(na&&z)if(n.length==4&&ha)for(r=0;r<4;r++)p=n[r],O[K]=p.x,O[K+1]=p.y,O[K+2]=p.z,K+=3;else for(r=0;r<4;r++)O[K]=p.x,O[K+1]=p.y,O[K+2]=p.z,K+=3;if(ja&&C!==void 0&&u)for(r=0;r<4;r++)n=C[r],$[R]=n.u,$[R+1]=n.v,R+=2;
+if(ja&&D!==void 0&&u)for(r=0;r<4;r++)n=D[r],aa[T]=n.u,aa[T+1]=n.v,T+=2;la&&(N[H]=G,N[H+1]=G+1,N[H+2]=G+3,N[H+3]=G+1,N[H+4]=G+2,N[H+5]=G+3,H+=6,P[M]=G,P[M+1]=G+1,P[M+2]=G,P[M+3]=G+3,P[M+4]=G+1,P[M+5]=G+2,P[M+6]=G+2,P[M+7]=G+3,M+=8,G+=4)}if(Aa){k=0;for(o=Aa.length;k<o;k++)N[H]=Aa[k].a,N[H+1]=Aa[k].b,N[H+2]=Aa[k].c,N[H+3]=Aa[k].a,N[H+4]=Aa[k].c,N[H+5]=Aa[k].d,H+=6}ia&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,fa,j));if(Q)for(I in Q)m=Q[I],m.__original.needsUpdate&&
+(c.bindBuffer(c.ARRAY_BUFFER,m.buffer),c.bufferData(c.ARRAY_BUFFER,m.array,j));if(sa){s=0;for(A=xa.length;s<A;s++)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]),c.bufferData(c.ARRAY_BUFFER,ca[s],j)}ra&&da>0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ga,j));na&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,O,j));qa&&ka.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,
+j));ja&&R>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,N,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,P,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;pa(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;u=b.vertices;g=b.colors;y=u.length;i=g.length;z=b.__vertexArray;j=b.__colorArray;C=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k<y;k++)o=u[k].position,h=k*3,z[h]=o.x,z[h+1]=o.y,z[h+2]=o.z;
+c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,z,e)}if(C){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;u=b.vertices;g=b.colors;y=u.length;i=g.length;z=b.__vertexArray;j=b.__colorArray;C=b.__dirtyColors;if(b.__dirtyVertices){for(k=
+0;k<y;k++)o=u[k].position,h=k*3,z[h]=o.x,z[h+1]=o.y,z[h+2]=o.z;c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,z,e)}if(C){for(k=0;k<i;k++)color=g[k],h=k*3,j[h]=color.r,j[h+1]=color.g,j[h+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,b.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,j,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=oa(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&d(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=
+!1,f.__dirtyColors=!1,pa(f)}function I(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function y(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,q={},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),q[j]==void 0&&(q[j]={hash:j,counter:0}),k=q[j].hash+"_"+q[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&&(q[j].counter+=1,k=q[j].hash+"_"+q[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 K(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=F){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)}F=b}}function ca(b,e,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,H(e.wrapS)),c.texParameteri(b,
+c.TEXTURE_WRAP_T,H(e.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,H(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,H(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,na(e.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,na(e.minFilter)))}function $(b,e){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,
+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),ca(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 qa(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,H(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,H(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,H(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,H(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,H(b.format),b.width,b.height,0,H(b.format),H(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,
+b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,
+c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var e,d;b?(e=b.__webglFramebuffer,d=b.width,b=b.height):(e=null,d=sa,b=P);e!=aa&&(c.bindFramebuffer(c.FRAMEBUFFER,e),c.viewport(va,Ea,d,b),aa=e)}function Q(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 na(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function H(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
+case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
+case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var M=this,c,ua=[],ha=null,aa=null,ia=!0,B=null,O=null,F=null,N=null,ja=null,R=null,ra=null,va=0,Ea=0,sa=0,P=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Matrix4,Ga=new Float32Array(16),Ha=new Float32Array(16),Fa=new THREE.Vector4,Ka={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},wa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ja=b.stencil!==void 0?b.stencil:!0,Oa=b.antialias!==void 0?b.antialias:!1,ta=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ia=b.clearAlpha!==
+void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=wa;this.sortObjects=this.autoClear=!0;try{if(!(c=wa.getContext("experimental-webgl",{antialias:Oa,stencil:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(Pa){console.error(Pa)}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(ta.r,ta.g,ta.b,Ia);this.context=c;var Na=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Ja){var w={};w.vertices=new Float32Array(12);w.faces=new Uint16Array(6);w.darkness=0.5;w.vertices[0]=-20;w.vertices[1]=-20;w.vertices[2]=-1;w.vertices[3]=20;w.vertices[4]=-20;w.vertices[5]=-1;w.vertices[6]=20;w.vertices[7]=
+20;w.vertices[8]=-1;w.vertices[9]=-20;w.vertices[10]=20;w.vertices[11]=-1;w.faces[0]=0;w.faces[1]=1;w.faces[2]=2;w.faces[3]=0;w.faces[4]=2;w.faces[5]=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,Q("fragment",THREE.ShaderLib.shadowPost.fragmentShader));
+c.attachShader(w.program,Q("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(w.program);w.vertexLocation=c.getAttribLocation(w.program,"position");w.projectionLocation=c.getUniformLocation(w.program,"projectionMatrix");w.darknessLocation=c.getUniformLocation(w.program,"darkness")}var r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);b=0;r.vertices[b++]=-1;r.vertices[b++]=-1;r.vertices[b++]=0;r.vertices[b++]=0;r.vertices[b++]=1;r.vertices[b++]=-1;r.vertices[b++]=1;r.vertices[b++]=
+0;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=1;r.vertices[b++]=-1;r.vertices[b++]=1;r.vertices[b++]=0;r.vertices[b++]=1;b=0;r.faces[b++]=0;r.faces[b++]=1;r.faces[b++]=2;r.faces[b++]=0;r.faces[b++]=2;r.faces[b++]=3;r.vertexBuffer=c.createBuffer();r.elementBuffer=c.createBuffer();r.tempTexture=c.createTexture();r.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,r.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,r.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
+r.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,r.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,r.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,r.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?(r.hasVertexTexture=!1,r.program=c.createProgram(),c.attachShader(r.program,Q("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(r.program,
+Q("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(r.hasVertexTexture=!0,r.program=c.createProgram(),c.attachShader(r.program,Q("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(r.program,Q("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.vertex=c.getAttribLocation(r.program,"position");r.attributes.uv=c.getAttribLocation(r.program,"UV");r.uniforms.renderType=c.getUniformLocation(r.program,
+"renderType");r.uniforms.map=c.getUniformLocation(r.program,"map");r.uniforms.occlusionMap=c.getUniformLocation(r.program,"occlusionMap");r.uniforms.opacity=c.getUniformLocation(r.program,"opacity");r.uniforms.scale=c.getUniformLocation(r.program,"scale");r.uniforms.rotation=c.getUniformLocation(r.program,"rotation");r.uniforms.screenPosition=c.getUniformLocation(r.program,"screenPosition");var Ma=!1,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);b=0;u.vertices[b++]=-1;u.vertices[b++]=
+-1;u.vertices[b++]=0;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=-1;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=1;u.vertices[b++]=0;u.vertices[b++]=-1;u.vertices[b++]=1;u.vertices[b++]=0;b=u.vertices[b++]=0;u.faces[b++]=0;u.faces[b++]=1;u.faces[b++]=2;u.faces[b++]=0;u.faces[b++]=2;u.faces[b++]=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,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(u.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=c.getAttribLocation(u.program,"position");u.attributes.uv=c.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=c.getUniformLocation(u.program,
+"uvOffset");u.uniforms.uvScale=c.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=c.getUniformLocation(u.program,"rotation");u.uniforms.scale=c.getUniformLocation(u.program,"scale");u.uniforms.alignment=c.getUniformLocation(u.program,"alignment");u.uniforms.map=c.getUniformLocation(u.program,"map");u.uniforms.opacity=c.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=c.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=c.getUniformLocation(u.program,
+"affectedByDistance");u.uniforms.screenPosition=c.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=c.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=c.getUniformLocation(u.program,"projectionMatrix");var La=!1;this.setSize=function(b,c){wa.width=b;wa.height=c;this.setViewport(0,0,wa.width,wa.height)};this.setViewport=function(b,e,d,f){va=b;Ea=e;sa=d;P=f;c.viewport(va,Ea,sa,P)};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){ia=b;c.depthMask(b)};this.setClearColorHex=function(b,e){ta.setHex(b);Ia=e;c.clearColor(ta.r,ta.g,ta.b,Ia)};this.setClearColor=function(b,e){ta.copy(b);Ia=e;c.clearColor(ta.r,ta.g,ta.b,Ia)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){w.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,
+e,d,f){var h,g,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,q;k=q=j=0;for(o=e.length;k<o;k++)g=e[k],g instanceof THREE.DirectionalLight&&q++,g instanceof THREE.PointLight&&j++;j+q<=4?e=q:(e=Math.ceil(4*q/(j+q)),j=4-e);g={directional:e,point:j};q=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)q=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:g.directional,maxPointLights:g.point,maxBones:q},p;g=[];i?g.push(i):(g.push(k),g.push(o));for(p in d)g.push(p),g.push(d[p]);i=g.join();p=0;for(g=ua.length;p<g;p++)if(ua[p].code==i){n=ua[p].program;break a}p=c.createProgram();g=[Na?"#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");
+q=["#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");c.attachShader(p,Q("fragment",q+k));c.attachShader(p,Q("vertex",g+o));c.linkProgram(p);
+c.getProgramParameter(p,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.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],p.uniforms[o]=c.getUniformLocation(p,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],p.attributes[d]=c.getAttribLocation(p,d);ua.push({program:p,code:i});n=p}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(h in b.attributes)n[h]!==void 0&&n[h]>=0&&c.enableVertexAttribArray(n[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),
 b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>=0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=
-0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,q,r){var v,x,za,B,F,G,p,O,H=b.lights,I=b.fog;L.data.vertices=0;L.data.faces=0;L.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(ya);d.projectionMatrix.flattenToArray(ta);ia.multiply(d.projectionMatrix,
-d.matrixWorldInverse);k(ia);this.initWebGLObjects(b);Q(q);(this.autoClear||r)&&this.clear();F=b.__webglObjects.length;for(r=0;r<F;r++)if(v=b.__webglObjects[r],p=v.object,p.visible)if(!(p instanceof THREE.Mesh)||o(p)){if(p.matrixWorld.flattenToArray(p._objectMatrixArray),C(p,d),t(v),v.render=!0,this.sortObjects)v.object.renderDepth?v.z=v.object.renderDepth:(Da.copy(p.position),ia.multiplyVector3(Da),v.z=Da.z)}else v.render=!1;else v.render=!1;this.sortObjects&&b.__webglObjects.sort(u);G=b.__webglObjectsImmediate.length;
-for(r=0;r<G;r++)v=b.__webglObjectsImmediate[r],p=v.object,p.visible&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),C(p,d),n(v));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);y(b.overrideMaterial.blending);for(r=0;r<F;r++)if(v=b.__webglObjects[r],v.render)p=v.object,O=v.buffer,i(p),f(d,H,I,b.overrideMaterial,O,p);for(r=0;r<G;r++)v=b.__webglObjectsImmediate[r],p=v.object,p.visible&&(i(p),x=e(d,H,I,b.overrideMaterial,p),p.render(function(c){g(c,x,b.overrideMaterial.shading)}))}else{y(THREE.NormalBlending);
-for(r=0;r<F;r++)if(v=b.__webglObjects[r],v.render){p=v.object;O=v.buffer;za=v.opaque;i(p);for(v=0;v<za.count;v++)B=za.list[v],h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),f(d,H,I,B,O,p)}for(r=0;r<G;r++)if(v=b.__webglObjectsImmediate[r],p=v.object,p.visible){za=v.opaque;i(p);for(v=0;v<za.count;v++)B=za.list[v],h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),x=e(d,H,I,B,p),p.render(function(b){g(b,x,B.shading)})}for(r=0;r<F;r++)if(v=b.__webglObjects[r],
-v.render){p=v.object;O=v.buffer;za=v.transparent;i(p);for(v=0;v<za.count;v++)B=za.list[v],y(B.blending),h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),f(d,H,I,B,O,p)}for(r=0;r<G;r++)if(v=b.__webglObjectsImmediate[r],p=v.object,p.visible){za=v.transparent;i(p);for(v=0;v<za.count;v++)B=za.list[v],y(B.blending),h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),x=e(d,H,I,B,p),p.render(function(b){g(b,x,B.shading)})}}b.__webglSprites.length&&D(b,
-d);Fa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&E(b,d);q&&q.minFilter!==THREE.NearestFilter&&q.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,q.__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&&S(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=c.createBuffer();i.__webglNormalBuffer=c.createBuffer();
+0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,p,r){var u,y,w,B,F,H,q,S,I=b.lights,K=b.fog;M.data.vertices=0;M.data.faces=0;M.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(Ha);d.projectionMatrix.flattenToArray(Ga);ma.multiply(d.projectionMatrix,
+d.matrixWorldInverse);o(ma);this.initWebGLObjects(b);qa(p);(this.autoClear||r)&&this.clear();F=b.__webglObjects.length;for(r=0;r<F;r++)if(u=b.__webglObjects[r],q=u.object,q.visible)if(!(q instanceof THREE.Mesh)||k(q)){if(q.matrixWorld.flattenToArray(q._objectMatrixArray),C(q,d),v(u),u.render=!0,this.sortObjects)u.object.renderDepth?u.z=u.object.renderDepth:(Fa.copy(q.position),ma.multiplyVector3(Fa),u.z=Fa.z)}else u.render=!1;else u.render=!1;this.sortObjects&&b.__webglObjects.sort(t);H=b.__webglObjectsImmediate.length;
+for(r=0;r<H;r++)u=b.__webglObjectsImmediate[r],q=u.object,q.visible&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),C(q,d),n(u));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);G(b.overrideMaterial.blending);for(r=0;r<F;r++)if(u=b.__webglObjects[r],u.render)q=u.object,S=u.buffer,i(q),f(d,I,K,b.overrideMaterial,S,q);for(r=0;r<H;r++)u=b.__webglObjectsImmediate[r],q=u.object,q.visible&&(i(q),y=e(d,I,K,b.overrideMaterial,q),q.render(function(c){g(c,y,b.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);
+for(r=0;r<F;r++)if(u=b.__webglObjects[r],u.render){q=u.object;S=u.buffer;w=u.opaque;i(q);for(u=0;u<w.count;u++)B=w.list[u],h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),f(d,I,K,B,S,q)}for(r=0;r<H;r++)if(u=b.__webglObjectsImmediate[r],q=u.object,q.visible){w=u.opaque;i(q);for(u=0;u<w.count;u++)B=w.list[u],h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),y=e(d,I,K,B,q),q.render(function(b){g(b,y,B.shading)})}for(r=0;r<F;r++)if(u=b.__webglObjects[r],
+u.render){q=u.object;S=u.buffer;w=u.transparent;i(q);for(u=0;u<w.count;u++)B=w.list[u],G(B.blending),h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),f(d,I,K,B,S,q)}for(r=0;r<H;r++)if(u=b.__webglObjectsImmediate[r],q=u.object,q.visible){w=u.transparent;i(q);for(u=0;u<w.count;u++)B=w.list[u],G(B.blending),h(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),y=e(d,I,K,B,q),q.render(function(b){g(b,y,B.shading)})}}b.__webglSprites.length&&D(b,d);Ja&&
+b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&E(b,d);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(c.bindTexture(c.TEXTURE_2D,p.__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&&y(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,t=void 0,v=t=k=0,u=o=p=void 0,x=u=p=n=void 0,o=void 0,q=j.geometry,r=q.faces,u=i.faces,n=0,p=u.length;n<p;n++)o=u[n],o=r[o],o instanceof THREE.Face3?(k+=3,t+=1,v+=3):o instanceof THREE.Face4&&(k+=4,t+=2,v+=4);for(var n=i,p=j,y=u=r=void 0,z=void 0,y=void 0,o=[],r=0,u=p.materials.length;r<u;r++)if(y=p.materials[r],y instanceof THREE.MeshFaceMaterial){y=0;for(l=n.materials.length;y<
-l;y++)(z=n.materials[y])&&o.push(z)}else(z=y)&&o.push(z);n=o;i.__materials=n;a:{r=p=void 0;u=n.length;for(p=0;p<u;p++)if(r=n[p],r.map||r.lightMap||r instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{u=r=void 0;o=n.length;for(r=0;r<o;r++)if(u=n[r],!(u instanceof THREE.MeshBasicMaterial&&!u.envMap||u instanceof THREE.MeshDepthMaterial)){u=u&&u.shading!=void 0&&u.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}u=!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(u)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);i.__faceArray=new Uint16Array(t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(v*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q<r;q++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u==THREE.SmoothShading;i.__uvType=p;i.__vertexColorType=o;i.__normalType=u;i.__webglFaceCount=
-t*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;q=0;for(r=n.length;q<r;q++)if(p=n[q],p.attributes)for(a in i.__webglCustomAttributes={},p.attributes){o=p.attributes[a];u={};for(x in o)u[x]=o[x];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,t=1,u.type==="v2"?t=2:u.type==="v3"?t=3:u.type==="v4"?t=4:u.type==="c"&&(t=3),u.size=t,u.array=new Float32Array(k*t),u.buffer=c.createBuffer(),u.buffer.belongsToAttribute=a,o.needsUpdate=!0,u.__original=
-o;i.__webglCustomAttributes[a]=u}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?H(e.__webglShadowVolumes,h,d):H(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)H(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;H(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;H(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;H(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;){e=b.__objectsRemoved[0];d=b;if(e instanceof THREE.ShadowVolume)ea(d.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)ea(d.__webglObjects,e);else if(e instanceof THREE.Sprite){d=d.__webglSprites;g=void 0;for(g=d.length-1;g>=0;g--)d[g]==e&&d.splice(g,1)}else e instanceof
-THREE.LensFlare?ea(d.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&ea(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)N(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)N(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)N(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?
-c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Ja}};
+k;j++)i.__webglMorphTargetsBuffers.push(c.createBuffer())}for(var i=h,j=d,n=void 0,q=void 0,o=void 0,r=o=void 0,p=void 0,u=void 0,v=u=k=0,t=o=q=void 0,w=t=q=n=void 0,o=void 0,r=j.geometry,p=r.faces,t=i.faces,n=0,q=t.length;n<q;n++)o=t[n],o=p[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,q=j,z=t=p=void 0,B=void 0,z=void 0,o=[],p=0,t=q.materials.length;p<t;p++)if(z=q.materials[p],z instanceof THREE.MeshFaceMaterial){z=0;for(l=n.materials.length;z<
+l;z++)(B=n.materials[z])&&o.push(B)}else(B=z)&&o.push(B);n=o;i.__materials=n;a:{p=q=void 0;t=n.length;for(q=0;q<t;q++)if(p=n[q],p.map||p.lightMap||p instanceof THREE.MeshShaderMaterial){q=!0;break a}q=!1}a:{t=p=void 0;o=n.length;for(p=0;p<o;p++)if(t=n[p],!(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=p=void 0;z=n.length;for(p=0;p<z;p++)if(o=n[p],
+o.vertexColors){o=o.vertexColors;break a}o=!1}i.__vertexArray=new Float32Array(k*3);if(t)i.__normalArray=new Float32Array(k*3);if(r.hasTangents)i.__tangentArray=new Float32Array(k*4);if(o)i.__colorArray=new Float32Array(k*3);if(q){if(r.faceUvs.length>0||r.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(r.faceUvs.length>1||r.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=[];r=0;for(p=i.numMorphTargets;r<p;r++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=t==THREE.SmoothShading;i.__uvType=q;i.__vertexColorType=o;i.__normalType=t;i.__webglFaceCount=
+u*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0);i.__webglLineCount=v*2;r=0;for(p=n.length;r<p;r++)if(q=n[r],q.attributes){if(i.__webglCustomAttributes===void 0)i.__webglCustomAttributes={};for(a in q.attributes){o=q.attributes[a];t={};for(w in o)t[w]=o[w];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?K(e.__webglShadowVolumes,h,d):K(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)K(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;K(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;K(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=d;i=f.vertices.length;f.__vertexArray=new Float32Array(i*3);f.__colorArray=new Float32Array(i*3);f.__sortArray=[];f.__webglParticleCount=i;f.__materials=h.materials;w=k=j=void 0;j=0;for(k=h.materials.length;j<k;j++)if(w=h.materials[j],w.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
+{};for(a in w.attributes){originalAttribute=w.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(i*size),attribute.buffer=c.createBuffer(),attribute.buffer.belongsToAttribute=
+a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}K(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;){e=b.__objectsRemoved[0];d=b;if(e instanceof
+THREE.ShadowVolume)I(d.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)I(d.__webglObjects,e);else if(e instanceof THREE.Sprite){d=d.__webglSprites;g=void 0;for(g=d.length-1;g>=0;g--)d[g]==e&&d.splice(g,1)}else e instanceof THREE.LensFlare?I(d.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&I(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)T(b.__webglObjects[d].object,
+b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)T(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)T(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return Na}};
 THREE.WebGLRenderTarget=function(b,d,e){this.width=b;this.height=d;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};

BIN
examples/textures/sprites/spark1.png


+ 221 - 0
examples/webgl_custom_attributes_particles.html

@@ -0,0 +1,221 @@
+<!doctype html>
+<html>
+	<head>
+		<meta charset="utf-8" />
+		<title>three.js webgl - custom attributes [particles]</title>
+		<style>
+			body {
+				color: #ffffff;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+				font-weight: bold;
+
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+			}
+			#info {
+				color: #fff;
+				background-color: rgba( 0, 0, 0, 0.75 );
+				position: relative;
+				top: 0px; width: 100%;
+				padding: 5px;
+				z-index:100;
+				width:33em;
+				margin:0 auto -2em;
+			}
+			a { color: #ff0000 }
+		</style>
+	</head>
+
+	<body>
+		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - custom attributes example - particles</div>
+		<div id="container"></div>
+
+		<script src="../build/Three.js"></script>
+
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="x-shader/x-vertex" id="vertexshader">
+
+			uniform float amplitude;
+			attribute float size;
+			attribute vec3 customColor;
+
+			varying vec3 vColor;
+
+			void main() {
+
+				vColor = customColor;
+
+				vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
+
+				//gl_PointSize = size;
+				gl_PointSize = size * ( 300.0 / length( mvPosition.xyz ) );
+
+				gl_Position = projectionMatrix * mvPosition;
+
+			}
+
+		</script>
+
+		<script type="x-shader/x-fragment" id="fragmentshader">
+
+			uniform vec3 color;
+			uniform sampler2D texture;
+
+			varying vec3 vColor;
+
+			void main() {
+
+				gl_FragColor = vec4( color * vColor, 1.0 );
+				gl_FragColor = gl_FragColor * texture2D( texture, gl_PointCoord );
+
+			}
+
+		</script>
+
+
+		<script type="text/javascript">
+
+		var renderer, scene, camera, stats;
+
+		var sphere, uniforms, attributes;
+
+		var noise = [];
+
+		var WIDTH = window.innerWidth,
+			HEIGHT = window.innerHeight;
+
+		init();
+		animate();
+
+		function init() {
+
+			camera = new THREE.Camera( 40, WIDTH / HEIGHT, 1, 10000 );
+			camera.position.z = 300;
+
+			scene = new THREE.Scene();
+
+			attributes = {
+
+				size: {	type: 'f', value: [] },
+				customColor: { type: 'c', value: [] }
+
+			};
+
+			uniforms = {
+
+				amplitude: { type: "f", value: 1.0 },
+				color:     { type: "c", value: new THREE.Color( 0xffffff ) },
+				texture:   { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "textures/sprites/spark1.png" ) },
+
+			};
+
+			var shaderMaterial = new THREE.MeshShaderMaterial( {
+
+				uniforms: 		uniforms,
+				attributes:     attributes,
+				vertexShader:   document.getElementById( 'vertexshader' ).textContent,
+				fragmentShader: document.getElementById( 'fragmentshader' ).textContent,
+
+				blending: 		THREE.AdditiveBlending,
+				depthTest: 		false,
+				transparent:	true
+
+			});
+
+
+			var radius = 200;
+			var geometry = new THREE.Geometry();
+
+			for ( var i = 0; i < 100000; i++ ) {
+
+				vector = new THREE.Vector3( Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1 );
+				vector.multiplyScalar( radius );
+
+				geometry.vertices.push( new THREE.Vertex( vector ) );
+
+			}
+
+			sphere = new THREE.ParticleSystem( geometry, shaderMaterial );
+
+			sphere.dynamic = true;
+			//sphere.sortParticles = true;
+
+			var vertices = sphere.geometry.vertices;
+			var values_size = attributes.size.value;
+			var values_color = attributes.customColor.value;
+
+
+			for( var v = 0; v < vertices.length; v++ ) {
+
+				values_size[ v ] = 10;
+				values_color[ v ] = new THREE.Color( 0xffaa00 );
+
+				if ( vertices[ v ].position.x < 0 )
+					values_color[ v ].setHSV( 0.5 + 0.1 * ( v / vertices.length ), 0.7, 0.9 );
+				else
+					values_color[ v ].setHSV( 0.0 + 0.1 * ( v / vertices.length ), 0.9, 0.9 );
+
+			}
+
+			scene.addChild( sphere );
+
+			renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } );
+			renderer.setSize( WIDTH, HEIGHT );
+
+			var container = document.getElementById( 'container' );
+			container.appendChild( renderer.domElement );
+
+			stats = new Stats();
+			stats.domElement.style.position = 'absolute';
+			stats.domElement.style.top = '0px';
+			container.appendChild( stats.domElement );
+
+		}
+
+		function cap( x, a, b ) {
+
+			return ( x < a ) ? a : ( ( x > b ) ? b : x );
+
+		}
+
+		var i, value;
+
+		function animate() {
+
+			requestAnimationFrame( animate );
+
+			render();
+			stats.update();
+
+		}
+
+		function render() {
+
+			var time = new Date().getTime() * 0.005;
+
+			sphere.rotation.z = 0.01 * time;
+
+			for( i = 0; i < attributes.size.value.length; i++ ) {
+
+				attributes.size.value[ i ] = 14 + 13 * Math.sin( 0.1 * i + time );
+
+
+			}
+
+			attributes.size.needsUpdate = true;
+
+			renderer.render( scene, camera );
+
+		}
+
+
+	</script>
+
+</body>
+
+</html>

+ 258 - 6
src/renderers/WebGLRenderer.js

@@ -569,7 +569,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	function initParticleBuffers ( geometry ) {
+	function initParticleBuffers ( geometry, object ) {
 
 		var nvertices = geometry.vertices.length;
 
@@ -580,6 +580,72 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		geometry.__webglParticleCount = nvertices;
 
+		geometry.__materials = object.materials;
+
+		// custom attributes
+
+		var m, ml, material;
+
+		for ( m = 0, ml = object.materials.length; m < ml; m ++ ) {
+
+			material = object.materials[ m ];
+
+			if ( material.attributes ) {
+
+				if ( geometry.__webglCustomAttributes === undefined ) {
+
+					geometry.__webglCustomAttributes = {};
+
+				}
+
+				for ( a in material.attributes ) {
+
+					// Do a shallow copy of the attribute object so different geometryGroup chunks use different
+					// attribute buffers which are correctly indexed in the setMeshBuffers function
+
+					// Not sure how to best translate this into non-indexed arrays
+					// used for particles, as there are no geometry chunks here
+					// Probably could be simplified
+
+					originalAttribute = material.attributes[ a ];
+
+					attribute = {};
+
+					for ( property in originalAttribute ) {
+
+						attribute[ property ] = originalAttribute[ property ];
+
+					}
+
+					if( !attribute.__webglInitialized || attribute.createUniqueBuffers ) {
+
+						attribute.__webglInitialized = true;
+
+						size = 1;		// "f" and "i"
+
+						if( attribute.type === "v2" ) size = 2;
+						else if( attribute.type === "v3" ) size = 3;
+						else if( attribute.type === "v4" ) size = 4;
+						else if( attribute.type === "c"  ) size = 3;
+
+						attribute.size = size;
+						attribute.array = new Float32Array( nvertices * size );
+						attribute.buffer = _gl.createBuffer();
+						attribute.buffer.belongsToAttribute = a;
+
+						originalAttribute.needsUpdate = true;
+						attribute.__original = originalAttribute;
+
+					}
+
+					geometry.__webglCustomAttributes[ a ] = attribute;
+
+				}
+
+			}
+
+		}
+
 	};
 
 	function initMeshBuffers ( geometryGroup, object ) {
@@ -713,7 +779,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			if ( material.attributes ) {
 
-				geometryGroup.__webglCustomAttributes = {};
+				if ( geometryGroup.__webglCustomAttributes === undefined ) {
+
+					geometryGroup.__webglCustomAttributes = {};
+
+				}
 
 				for ( a in material.attributes ) {
 
@@ -1386,6 +1456,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 									customAttribute.array[ offset_custom + 3 ] = customAttribute.value[ offset_customSrc + 3 ];
 
 									customAttribute.offsetSrc += 4;
+
 								}
 
 								customAttribute.offset += 4;
@@ -1416,6 +1487,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 									v4 = customAttribute.value[ offset_customSrc + 3 ];
 
 									customAttribute.offsetSrc += 4;
+
 								}
 
 
@@ -2079,7 +2151,22 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		dirtyVertices = geometry.__dirtyVertices,
 		dirtyElements = geometry.__dirtyElements,
-		dirtyColors = geometry.__dirtyColors;
+		dirtyColors = geometry.__dirtyColors,
+
+		customAttributes = geometry.__webglCustomAttributes,
+		a, ca, cal, v1,
+		offset_custom,
+		customAttribute;
+
+		if ( customAttributes ) {
+
+			for ( a in customAttributes ) {
+
+				customAttributes[ a ].offset = 0;
+
+			}
+
+		}
 
 		if ( object.sortParticles ) {
 
@@ -2096,7 +2183,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
-			sortArray.sort( function(a,b) { return b[0] - a[0]; } );
+			sortArray.sort( function( a, b ) { return b[ 0 ] - a[ 0 ]; } );
 
 			for ( v = 0; v < vl; v++ ) {
 
@@ -2122,6 +2209,76 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
+			if ( customAttributes ) {
+
+				for ( a in customAttributes ) {
+
+					customAttribute = customAttributes[ a ];
+
+					cal = customAttribute.value.length;
+
+					for ( ca = 0; ca < cal; ca ++ ) {
+
+						index = sortArray[ca][1];
+
+						offset_custom = customAttribute.offset;
+
+						if ( customAttribute.size === 1 ) {
+
+							if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+
+								customAttribute.array[ offset_custom ] = customAttribute.value[ index ];
+
+							}
+
+						} else {
+
+							if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+
+								v1 = customAttribute.value[ index ];
+
+							}
+
+							if ( customAttribute.size === 2 ) {
+
+								customAttribute.array[ offset_custom ] 	   = v1.x;
+								customAttribute.array[ offset_custom + 1 ] = v1.y;
+
+							} else if ( customAttribute.size === 3 ) {
+
+								if ( customAttribute.type === "c" ) {
+
+									customAttribute.array[ offset_custom ] 	   = v1.r;
+									customAttribute.array[ offset_custom + 1 ] = v1.g;
+									customAttribute.array[ offset_custom + 2 ] = v1.b;
+
+								} else {
+
+									customAttribute.array[ offset_custom ] 	   = v1.x;
+									customAttribute.array[ offset_custom + 1 ] = v1.y;
+									customAttribute.array[ offset_custom + 2 ] = v1.z;
+
+								}
+
+							} else {
+
+								customAttribute.array[ offset_custom ] 		= v1.x;
+								customAttribute.array[ offset_custom + 1  ] = v1.y;
+								customAttribute.array[ offset_custom + 2  ] = v1.z;
+								customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+							}
+
+						}
+
+						customAttribute.offset += customAttribute.size;
+
+					}
+
+				}
+
+			}
+
 
 		} else {
 
@@ -2157,6 +2314,79 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
+			if ( customAttributes ) {
+
+				for ( a in customAttributes ) {
+
+					customAttribute = customAttributes[ a ];
+
+					if ( customAttribute.__original.needsUpdate ) {
+
+						cal = customAttribute.value.length;
+
+						for ( ca = 0; ca < cal; ca ++ ) {
+
+							offset_custom = customAttribute.offset;
+
+							if ( customAttribute.size === 1 ) {
+
+								if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+
+									customAttribute.array[ offset_custom ] = customAttribute.value[ ca ];
+
+								}
+
+							} else {
+
+								if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+
+									v1 = customAttribute.value[ ca ];
+
+								}
+
+								if ( customAttribute.size === 2 ) {
+
+									customAttribute.array[ offset_custom ] 	   = v1.x;
+									customAttribute.array[ offset_custom + 1 ] = v1.y;
+
+								} else if ( customAttribute.size === 3 ) {
+
+									if ( customAttribute.type === "c" ) {
+
+										customAttribute.array[ offset_custom ] 	   = v1.r;
+										customAttribute.array[ offset_custom + 1 ] = v1.g;
+										customAttribute.array[ offset_custom + 2 ] = v1.b;
+
+
+									} else {
+
+										customAttribute.array[ offset_custom ] 	   = v1.x;
+										customAttribute.array[ offset_custom + 1 ] = v1.y;
+										customAttribute.array[ offset_custom + 2 ] = v1.z;
+
+									}
+
+								} else {
+
+									customAttribute.array[ offset_custom ] 		= v1.x;
+									customAttribute.array[ offset_custom + 1  ] = v1.y;
+									customAttribute.array[ offset_custom + 2  ] = v1.z;
+									customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+								}
+
+							}
+
+							customAttribute.offset += customAttribute.size;
+
+						}
+
+					}
+
+				}
+
+			}
+
 		}
 
 		if ( dirtyVertices || object.sortParticles ) {
@@ -2173,6 +2403,24 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if ( customAttributes ) {
+
+			for ( a in customAttributes ) {
+
+				customAttribute = customAttributes[ a ];
+
+				if ( customAttribute.__original.needsUpdate || object.sortParticles ) {
+
+					_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );
+					_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );
+
+				}
+
+			}
+
+		}
+
+
 	};
 
 	function setMaterialShaders( material, shaders ) {
@@ -4100,7 +4348,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			if ( ! geometry.__webglVertexBuffer ) {
 
 				createParticleBuffers( geometry );
-				initParticleBuffers( geometry );
+				initParticleBuffers( geometry, object );
 
 				geometry.__dirtyVertices = true;
 				geometry.__dirtyColors = true;
@@ -4242,7 +4490,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			geometry = object.geometry;
 
-			if ( geometry.__dirtyVertices || geometry.__dirtyColors || object.sortParticles ) {
+			customAttributeDirty = areCustomAttributesDirty( geometry );
+
+			if ( geometry.__dirtyVertices || geometry.__dirtyColors || object.sortParticles || customAttributeDirty ) {
 
 				setParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object );
 
@@ -4251,6 +4501,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 			geometry.__dirtyVertices = false;
 			geometry.__dirtyColors = false;
 
+			clearCustomAttributes( geometry );
+
 		}/* else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) {
 
 			// it updates itself in render callback