Browse Source

Brought back broken particles.

Problem were attributes which were enabled for sprites and lens flares, but then not used.

I just delayed enabling till they are not rendered for the first time. There is probably some cleaner way how to do this.
alteredq 14 years ago
parent
commit
80696063ce

+ 290 - 289
build/Three.js

@@ -1,7 +1,7 @@
 // Three.js r38 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(b){this.setHex(b)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,c,d){var f,g,h,j,k,n;if(d==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=d*(1-c);n=d*(1-c*k);c=d*(1-c*(1-k));switch(j){case 1:f=n;g=d;h=b;break;case 2:f=b;g=d;h=c;break;case 3:f=b;g=n;h=d;break;case 4:f=c;g=b;h=d;break;case 5:f=d;g=b;
-h=n;break;case 6:case 0:f=d;g=c;h=b}}this.r=f;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
+THREE.Color.prototype={autoUpdate:!0,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex;this.__styleString=b.__styleString},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(b,c,d){var f,g,h,j,k,m;if(d==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=d*(1-c);m=d*(1-c*k);c=d*(1-c*(1-k));switch(j){case 1:f=m;g=d;h=b;break;case 2:f=b;g=d;h=c;break;case 3:f=b;g=m;h=d;break;case 4:f=c;g=b;h=d;break;case 5:f=d;g=b;
+h=m;break;case 6:case 0:f=d;g=c;h=b}}this.r=f;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(b){this.hex=~~b&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(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.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(b,c,d){this.set(b||0,c||0,d||0)};
@@ -12,33 +12,33 @@ this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPosit
 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(b,c,d,f){this.set(b||0,c||0,d||0,f||1)};
 THREE.Vector4.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,c){this.set(b.x+c.x,b.y+c.y,b.z+c.z,b.w+c.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,c){this.set(b.x-c.x,b.y-c.y,b.z-c.z,b.w-c.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
 b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,c){this.set(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)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b<c;b++){d=f[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function c(H,L,V,A){A=A.clone().subSelf(L);V=V.clone().subSelf(L);var J=H.clone().subSelf(L);H=A.dot(A);L=A.dot(V);A=A.dot(J);var O=V.dot(V);V=V.dot(J);J=1/(H*O-L*L);O=(O*A-L*V)*J;H=(H*V-L*A)*J;return O>0&&H>0&&O+H<1}var d,f,g,h,j,k,n,p,o,w,
-y,v=b.geometry,B=v.vertices,G=[];d=0;for(f=v.faces.length;d<f;d++){g=v.faces[d];w=this.origin.clone();y=this.direction.clone();n=b.matrixWorld;h=n.multiplyVector3(B[g.a].position.clone());j=n.multiplyVector3(B[g.b].position.clone());k=n.multiplyVector3(B[g.c].position.clone());n=g instanceof THREE.Face4?n.multiplyVector3(B[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(b.doubleSided||(b.flipSided?o>0:o<0)){p=p.dot((new THREE.Vector3).sub(h,w))/
-o;w=w.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(c(w,h,j,k)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:b};G.push(g)}}else if(g instanceof THREE.Face4&&(c(w,h,j,n)||c(w,j,k,n))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:b};G.push(g)}}}return G}};
-THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(n,p,o,w){k=!1;c=n;d=p;f=o;g=w;b()};this.addPoint=function(n,p){if(k){k=!1;c=n;d=p;f=n;g=p}else{c=c<n?c:n;d=d<p?d:p;f=f>n?f:n;g=g>p?g:p}b()};
-this.add3Points=function(n,p,o,w,y,v){if(k){k=!1;c=n<o?n<y?n:y:o<y?o:y;d=p<w?p<v?p:v:w<v?w:v;f=n>o?n>y?n:y:o>y?o:y;g=p>w?p>v?p:v:w>v?w:v}else{c=n<o?n<y?n<c?n:c:y<c?y:c:o<y?o<c?o:c:y<c?y:c;d=p<w?p<v?p<d?p:d:v<d?v:d:w<v?w<d?w:d:v<d?v:d;f=n>o?n>y?n>f?n:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>w?p>v?p>g?p:g:v>g?v:g:w>v?w>g?w:g:v>g?v:g}b()};this.addRectangle=function(n){if(k){k=!1;c=n.getLeft();d=n.getTop();f=n.getRight();g=n.getBottom()}else{c=c<n.getLeft()?c:n.getLeft();d=d<n.getTop()?d:n.getTop();f=f>n.getRight()?
-f:n.getRight();g=g>n.getBottom()?g:n.getBottom()}b()};this.inflate=function(n){c-=n;d-=n;f+=n;g+=n;b()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();d=d>n.getTop()?d:n.getTop();f=f<n.getRight()?f:n.getRight();g=g<n.getBottom()?g:n.getBottom();b()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(c,n.getLeft())>=0&&Math.min(g,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){k=!0;g=f=d=c=0;b()};this.isEmpty=function(){return k}};
+THREE.Ray.prototype={intersectScene:function(b){var c,d,f=b.objects,g=[];b=0;for(c=f.length;b<c;b++){d=f[b];d instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(d)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function c(I,N,W,A){A=A.clone().subSelf(N);W=W.clone().subSelf(N);var K=I.clone().subSelf(N);I=A.dot(A);N=A.dot(W);A=A.dot(K);var O=W.dot(W);W=W.dot(K);K=1/(I*O-N*N);O=(O*A-N*W)*K;I=(I*W-N*A)*K;return O>0&&I>0&&O+I<1}var d,f,g,h,j,k,m,p,o,x,
+y,v=b.geometry,B=v.vertices,F=[];d=0;for(f=v.faces.length;d<f;d++){g=v.faces[d];x=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(B[g.a].position.clone());j=m.multiplyVector3(B[g.b].position.clone());k=m.multiplyVector3(B[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(B[g.d].position.clone()):null;p=b.matrixRotationWorld.multiplyVector3(g.normal.clone());o=y.dot(p);if(b.doubleSided||(b.flipSided?o>0:o<0)){p=p.dot((new THREE.Vector3).sub(h,x))/
+o;x=x.addSelf(y.multiplyScalar(p));if(g instanceof THREE.Face3){if(c(x,h,j,k)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(c(x,h,j,m)||c(x,j,k,m))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};F.push(g)}}}return F}};
+THREE.Rectangle=function(){function b(){h=f-c;j=g-d}var c,d,f,g,h,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,p,o,x){k=!1;c=m;d=p;f=o;g=x;b()};this.addPoint=function(m,p){if(k){k=!1;c=m;d=p;f=m;g=p}else{c=c<m?c:m;d=d<p?d:p;f=f>m?f:m;g=g>p?g:p}b()};
+this.add3Points=function(m,p,o,x,y,v){if(k){k=!1;c=m<o?m<y?m:y:o<y?o:y;d=p<x?p<v?p:v:x<v?x:v;f=m>o?m>y?m:y:o>y?o:y;g=p>x?p>v?p:v:x>v?x:v}else{c=m<o?m<y?m<c?m:c:y<c?y:c:o<y?o<c?o:c:y<c?y:c;d=p<x?p<v?p<d?p:d:v<d?v:d:x<v?x<d?x:d:v<d?v:d;f=m>o?m>y?m>f?m:f:y>f?y:f:o>y?o>f?o:f:y>f?y:f;g=p>x?p>v?p>g?p:g:v>g?v:g:x>v?x>g?x:g:v>g?v:g}b()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();d=m.getTop();f=m.getRight();g=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();d=d<m.getTop()?d:m.getTop();f=f>m.getRight()?
+f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){c-=m;d-=m;f+=m;g+=m;b()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();d=d>m.getTop()?d:m.getTop();f=f<m.getRight()?f:m.getRight();g=g<m.getBottom()?g:m.getBottom();b()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(g,m.getBottom())-Math.max(d,m.getTop())>=0};this.empty=function(){k=!0;g=f=d=c=0;b()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
-THREE.Matrix4=function(b,c,d,f,g,h,j,k,n,p,o,w,y,v,B,G){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,n||0,p||0,o||1,w||0,y||0,v||0,B||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,n,p,o,w,y,v,B,G){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=n;this.n32=p;this.n33=o;this.n34=w;this.n41=y;this.n42=v;this.n43=B;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var f=THREE.Matrix4.__v1,
+THREE.Matrix4=function(b,c,d,f,g,h,j,k,m,p,o,x,y,v,B,F){this.set(b||1,c||0,d||0,f||0,g||0,h||1,j||0,k||0,m||0,p||0,o||1,x||0,y||0,v||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,d,f,g,h,j,k,m,p,o,x,y,v,B,F){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=p;this.n33=o;this.n34=x;this.n41=y;this.n42=v;this.n43=B;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(d,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,g=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*d+this.n23*
 f+this.n24)*g;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+d*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 d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,B=b.n41,G=b.n42,H=b.n43,L=b.n44,V=c.n11,A=c.n12,J=c.n13,O=c.n14,R=c.n21,Fa=c.n22,
-ka=c.n23,va=c.n24,$=c.n31,e=c.n32,ea=c.n33,Aa=c.n34;this.n11=d*V+f*R+g*$;this.n12=d*A+f*Fa+g*e;this.n13=d*J+f*ka+g*ea;this.n14=d*O+f*va+g*Aa+h;this.n21=j*V+k*R+n*$;this.n22=j*A+k*Fa+n*e;this.n23=j*J+k*ka+n*ea;this.n24=j*O+k*va+n*Aa+p;this.n31=o*V+w*R+y*$;this.n32=o*A+w*Fa+y*e;this.n33=o*J+w*ka+y*ea;this.n34=o*O+w*va+y*Aa+v;this.n41=B*V+G*R+H*$;this.n42=B*A+G*Fa+H*e;this.n43=B*J+G*ka+H*ea;this.n44=B*O+G*va+H*Aa+L;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;
-d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},
-determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,n=this.n31,p=this.n32,o=this.n33,w=this.n34,y=this.n41,v=this.n42,B=this.n43,G=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*w*y-c*j*w*y-f*j*n*v+d*k*n*v+f*g*o*v-b*k*o*v-d*g*w*v+b*j*w*v+f*h*n*B-c*k*n*B-f*g*p*B+b*k*p*B+c*g*w*B-b*h*w*B-d*h*n*G+c*j*n*G+d*g*p*G-b*j*p*G-c*g*o*G+b*h*o*G},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=
-b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;
-this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;
-b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},
-setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),g=1-d,h=b.x,j=b.y,k=
-b.z,n=g*h,p=g*j;this.set(n*h+d,n*j-f*k,n*k+f*j,0,n*j+f*k,p*j+d,p*k-f*h,0,n*k-f*j,p*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33=b*g;return this},
-setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var n=c*j;c*=k;var p=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
+return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,x=b.n32,y=b.n33,v=b.n34,B=b.n41,F=b.n42,I=b.n43,N=b.n44,W=c.n11,A=c.n12,K=c.n13,O=c.n14,R=c.n21,Ca=c.n22,
+ka=c.n23,va=c.n24,aa=c.n31,e=c.n32,da=c.n33,ya=c.n34;this.n11=d*W+f*R+g*aa;this.n12=d*A+f*Ca+g*e;this.n13=d*K+f*ka+g*da;this.n14=d*O+f*va+g*ya+h;this.n21=j*W+k*R+m*aa;this.n22=j*A+k*Ca+m*e;this.n23=j*K+k*ka+m*da;this.n24=j*O+k*va+m*ya+p;this.n31=o*W+x*R+y*aa;this.n32=o*A+x*Ca+y*e;this.n33=o*K+x*ka+y*da;this.n34=o*O+x*va+y*ya+v;this.n41=B*W+F*R+I*aa;this.n42=B*A+F*Ca+I*e;this.n43=B*K+F*ka+I*da;this.n44=B*O+F*va+I*ya+N;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=
+this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
+b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,p=this.n32,o=this.n33,x=this.n34,y=this.n41,v=this.n42,B=this.n43,F=this.n44;return f*j*p*y-d*k*p*y-f*h*o*y+c*k*o*y+d*h*x*y-c*j*x*y-f*j*m*v+d*k*m*v+f*g*o*v-b*k*o*v-d*g*x*v+b*j*x*v+f*h*m*B-c*k*m*B-f*g*p*B+b*k*p*B+c*g*x*B-b*h*x*B-d*h*m*F+c*j*m*F+d*g*p*F-b*j*p*F-c*g*o*F+b*h*o*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
+this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
+b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,
+0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b);b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),g=
+1-d,h=b.x,j=b.y,k=b.z,m=g*h,p=g*j;this.set(m*h+d,m*j-f*k,m*k+f*j,0,m*j+f*k,p*j+d,p*k-f*h,0,m*k-f*j,p*k+f*h,g*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},setRotationFromEuler:function(b){var c=b.x,d=b.y,f=b.z;b=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(f);f=Math.sin(f);var j=b*d,k=c*d;this.n11=g*h;this.n12=-g*f;this.n13=d;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-c*g;this.n31=-j*h+c*f;this.n32=j*f+c*h;this.n33=
+b*g;return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,g=b.w,h=c+c,j=d+d,k=f+f;b=c*h;var m=c*j;c*=k;var p=d*j;d*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(p+f);this.n12=m-g;this.n13=c+j;this.n21=m+g;this.n22=1-(b+f);this.n23=d-h;this.n31=c-j;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y;b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
 b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;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 d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,n=b.n23,p=b.n24,o=b.n31,w=b.n32,y=b.n33,v=b.n34,B=b.n41,G=b.n42,H=b.n43,L=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*v*G-p*y*G+p*w*H-k*v*H-n*w*L+k*y*L;c.n12=h*y*G-g*v*G-h*w*H+f*v*H+g*w*L-f*y*L;c.n13=g*p*G-h*n*G+h*k*H-f*p*H-g*k*L+f*n*L;c.n14=h*n*w-g*p*w-h*k*y+f*p*y+g*k*v-f*n*v;c.n21=p*y*B-n*v*B-p*o*H+j*v*H+n*o*L-j*y*L;c.n22=g*v*B-h*y*B+h*o*H-d*v*H-g*o*L+d*y*L;c.n23=h*n*B-g*p*B-h*j*H+d*p*H+g*j*L-d*n*L;
-c.n24=g*p*o-h*n*o+h*j*y-d*p*y-g*j*v+d*n*v;c.n31=k*v*B-p*w*B+p*o*G-j*v*G-k*o*L+j*w*L;c.n32=h*w*B-f*v*B-h*o*G+d*v*G+f*o*L-d*w*L;c.n33=g*p*B-h*k*B+h*j*G-d*p*G-f*j*L+d*k*L;c.n34=h*k*o-f*p*o-h*j*w+d*p*w+f*j*v-d*k*v;c.n41=n*w*B-k*y*B-n*o*G+j*y*G+k*o*H-j*w*H;c.n42=f*y*B-g*w*B+g*o*G-d*y*G-f*o*H+d*w*H;c.n43=g*k*B-f*n*B-g*j*G+d*n*G+f*j*H-d*k*H;c.n44=f*n*o-g*k*o+g*j*w-d*n*w-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=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,w=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*n;d[6]=b*p;d[7]=b*o;d[8]=b*w;return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,p=b.n24,o=b.n31,x=b.n32,y=b.n33,v=b.n34,B=b.n41,F=b.n42,I=b.n43,N=b.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*v*F-p*y*F+p*x*I-k*v*I-m*x*N+k*y*N;c.n12=h*y*F-g*v*F-h*x*I+f*v*I+g*x*N-f*y*N;c.n13=g*p*F-h*m*F+h*k*I-f*p*I-g*k*N+f*m*N;c.n14=h*m*x-g*p*x-h*k*y+f*p*y+g*k*v-f*m*v;c.n21=p*y*B-m*v*B-p*o*I+j*v*I+m*o*N-j*y*N;c.n22=g*v*B-h*y*B+h*o*I-d*v*I-g*o*N+d*y*N;c.n23=h*m*B-g*p*B-h*j*I+d*p*I+g*j*N-d*m*N;
+c.n24=g*p*o-h*m*o+h*j*y-d*p*y-g*j*v+d*m*v;c.n31=k*v*B-p*x*B+p*o*F-j*v*F-k*o*N+j*x*N;c.n32=h*x*B-f*v*B-h*o*F+d*v*F+f*o*N-d*x*N;c.n33=g*p*B-h*k*B+h*j*F-d*p*F-f*j*N+d*k*N;c.n34=h*k*o-f*p*o-h*j*x+d*p*x+f*j*v-d*k*v;c.n41=m*x*B-k*y*B-m*o*F+j*y*F+k*o*I-j*x*I;c.n42=f*y*B-g*x*B+g*o*F-d*y*F-f*o*I+d*x*I;c.n43=g*k*B-f*m*B-g*j*F+d*m*F+f*j*I-d*k*I;c.n44=f*m*o-g*k*o+g*j*x-d*m*x-f*j*y+d*k*y;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,x=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*p;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*f;d[1]=b*g;d[2]=b*h;d[3]=b*j;d[4]=b*k;d[5]=b*m;d[6]=b*p;d[7]=b*o;d[8]=b*x;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-d);j.n23=(f+d)/(f-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,f){var g;b=d*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,d,f)};
-THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,n,p;j=new THREE.Matrix4;k=c-b;n=d-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((d+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeOrtho=function(b,c,d,f,g,h){var j,k,m,p;j=new THREE.Matrix4;k=c-b;m=d-f;p=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((d+f)/m);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 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(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===-1){b.parent!==
@@ -47,41 +47,41 @@ undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c
 c,d)}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==undefined?f:1)};
 THREE.Quaternion.prototype={set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=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);var h=Math.cos(d);d=Math.sin(d);var j=b*c,k=f*g;this.w=j*h-k*d;this.x=j*d+k*h;this.y=f*c*h+b*g*d;this.z=b*g*h-f*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},multiplySelf:function(b){var c=this.x,d=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=c*b+g*h+d*k-f*j;this.y=d*b+g*j+f*h-c*k;this.z=f*b+g*k+c*j-d*h;this.w=g*b-c*h-d*j-f*k;return this},
-multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,n=this.w,p=n*d+j*g-k*f,o=n*f+k*d-h*g,w=n*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*n+d*-h+o*-k-w*-j;c.y=o*n+d*-j+w*-h-p*-k;c.z=w*n+d*-k+p*-j-o*-h;return c}};
-THREE.Quaternion.slerp=function(b,c,d,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){d.w=0.5*(b.w+c.w);d.x=0.5*(b.x+c.x);d.y=0.5*(b.y+c.y);d.z=0.5*(b.z+c.z);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,p=m*d+j*g-k*f,o=m*f+k*d-h*g,x=m*g+h*f-j*d;d=-h*d-j*f-k*g;c.x=p*m+d*-h+o*-k-x*-j;c.y=o*m+d*-j+x*-h-p*-k;c.z=x*m+d*-k+p*-j-o*-h;return c}};
+THREE.Quaternion.slerp=function(b,c,d,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1){d.w=b.w;d.x=b.x;d.y=b.y;d.z=b.z;return d}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){d.w=0.5*(b.w+c.w);d.x=0.5*(b.x+c.x);d.y=0.5*(b.y+c.y);d.z=0.5*(b.z+c.z);return d}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;d.w=b.w*g+c.w*f;d.x=b.x*g+c.x*f;d.y=b.y*g+c.y*f;d.z=b.z*g+c.z*f;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,c,d,f,g,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,f,g,h,j){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];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,d;b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var c,d,f,g,h,j,k=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,d.position);n.sub(c.position,d.position);k.crossSelf(n)}k.isZero()||
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var c,d,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,d.position);m.sub(c.position,d.position);k.crossSelf(m)}k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,f;if(this.__tmpVertices==undefined){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++){d=this.faces[b];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
 this.__tmpVertices;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++){d=this.faces[b];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);
-d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function b(oa,pa,ta,ga,Z,la,Ga){k=oa.vertices[pa].position;n=oa.vertices[ta].position;p=oa.vertices[ga].position;o=j[Z];w=j[la];y=j[Ga];v=n.x-k.x;B=p.x-k.x;G=n.y-k.y;H=p.y-k.y;L=n.z-k.z;V=p.z-k.z;A=w.u-o.u;J=y.u-o.u;O=w.v-o.v;R=y.v-o.v;Fa=1/(A*R-
-J*O);e.set((R*v-O*B)*Fa,(R*G-O*H)*Fa,(R*L-O*V)*Fa);ea.set((A*B-J*v)*Fa,(A*H-J*G)*Fa,(A*V-J*L)*Fa);va[pa].addSelf(e);va[ta].addSelf(e);va[ga].addSelf(e);$[pa].addSelf(ea);$[ta].addSelf(ea);$[ga].addSelf(ea)}var c,d,f,g,h,j,k,n,p,o,w,y,v,B,G,H,L,V,A,J,O,R,Fa,ka,va=[],$=[],e=new THREE.Vector3,ea=new THREE.Vector3,Aa=new THREE.Vector3,Ca=new THREE.Vector3,Ha=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){va[c]=new THREE.Vector3;$[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
-this.faces[c];j=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var X=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++){Ha.copy(h.vertexNormals[f]);g=h[X[f]];ka=va[g];Aa.copy(ka);Aa.subSelf(Ha.multiplyScalar(Ha.dot(ka))).normalize();Ca.cross(h.vertexNormals[f],ka);g=Ca.dot($[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(Aa.x,
-Aa.y,Aa.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,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
+d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function b(oa,pa,ta,fa,Z,ma,Da){k=oa.vertices[pa].position;m=oa.vertices[ta].position;p=oa.vertices[fa].position;o=j[Z];x=j[ma];y=j[Da];v=m.x-k.x;B=p.x-k.x;F=m.y-k.y;I=p.y-k.y;N=m.z-k.z;W=p.z-k.z;A=x.u-o.u;K=y.u-o.u;O=x.v-o.v;R=y.v-o.v;Ca=1/(A*R-
+K*O);e.set((R*v-O*B)*Ca,(R*F-O*I)*Ca,(R*N-O*W)*Ca);da.set((A*B-K*v)*Ca,(A*I-K*F)*Ca,(A*W-K*N)*Ca);va[pa].addSelf(e);va[ta].addSelf(e);va[fa].addSelf(e);aa[pa].addSelf(da);aa[ta].addSelf(da);aa[fa].addSelf(da)}var c,d,f,g,h,j,k,m,p,o,x,y,v,B,F,I,N,W,A,K,O,R,Ca,ka,va=[],aa=[],e=new THREE.Vector3,da=new THREE.Vector3,ya=new THREE.Vector3,za=new THREE.Vector3,Ea=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){va[c]=new THREE.Vector3;aa[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
+this.faces[c];j=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var Y=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++){Ea.copy(h.vertexNormals[f]);g=h[Y[f]];ka=va[g];ya.copy(ka);ya.subSelf(Ea.multiplyScalar(Ea.dot(ka))).normalize();za.cross(h.vertexNormals[f],ka);g=za.dot(aa[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(ya.x,
+ya.y,ya.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,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere=
-{radius:b}},computeEdgeFaces:function(){function b(n,p){return Math.min(n,p)+"_"+Math.max(n,p)}function c(n,p,o){if(n[p]===undefined){n[p]={set:{},array:[]};n[p].set[o]=1;n[p].array.push(o)}else if(n[p].set[o]===undefined){n[p].set[o]=1;n[p].array.push(o)}}var d,f,g,h,j,k={};d=0;for(f=this.faces.length;d<f;d++){j=this.faces[d];if(j instanceof THREE.Face3){g=b(j.a,j.b);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.a,j.c);c(k,g,d)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);c(k,g,d);g=b(j.a,j.b);c(k,g,d);
+{radius:b}},computeEdgeFaces:function(){function b(m,p){return Math.min(m,p)+"_"+Math.max(m,p)}function c(m,p,o){if(m[p]===undefined){m[p]={set:{},array:[]};m[p].set[o]=1;m[p].array.push(o)}else if(m[p].set[o]===undefined){m[p].set[o]=1;m[p].array.push(o)}}var d,f,g,h,j,k={};d=0;for(f=this.faces.length;d<f;d++){j=this.faces[d];if(j instanceof THREE.Face3){g=b(j.a,j.b);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.a,j.c);c(k,g,d)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);c(k,g,d);g=b(j.a,j.b);c(k,g,d);
 g=b(j.a,j.d);c(k,g,d);g=b(j.b,j.c);c(k,g,d);g=b(j.c,j.d);c(k,g,d)}}d=0;for(f=this.edges.length;d<f;d++){j=this.edges[d];g=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++){h=j.faceIndices[g];j.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(v,B,G,H,L,V,A){v=(G-v)*0.5;H=(H-B)*0.5;return(2*(B-G)+v+H)*A+(-3*(B-G)-2*v-H)*V+v*L+B}this.points=b;var d=[],f={x:0,y:0,z:0},g,h,j,k,n,p,o,w,y;this.initFromArray=function(v){this.points=[];for(var B=0;B<v.length;B++)this.points[B]={x:v[B][0],y:v[B][1],z:v[B][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]];
-w=this.points[d[2]];y=this.points[d[3]];k=j*j;n=j*k;f.x=c(p.x,o.x,w.x,y.x,j,k,n);f.y=c(p.y,o.y,w.y,y.y,j,k,n);f.z=c(p.z,o.z,w.z,y.z,j,k,n);return f};this.getControlPointsArray=function(){var v,B,G=this.points.length,H=[];for(v=0;v<G;v++){B=this.points[v];H[v]=[B.x,B.y,B.z]}return H};this.getLength=function(v){var B,G,H=B=B=0,L=new THREE.Vector3,V=new THREE.Vector3,A=[],J=0;A[0]=0;v||(v=100);G=this.points.length*v;L.copy(this.points[0]);for(v=1;v<G;v++){B=v/G;position=this.getPoint(B);V.copy(position);
-J+=V.distanceTo(L);L.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=H){A[B]=J;H=B}}A[A.length]=J;return{chunks:A,total:J}};this.reparametrizeByArcLength=function(v){var B,G,H,L,V,A,J=[],O=new THREE.Vector3,R=this.getLength();J.push(O.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){G=R.chunks[B]-R.chunks[B-1];A=Math.ceil(v*G/R.total);L=(B-1)/(this.points.length-1);V=B/(this.points.length-1);for(G=1;G<A-1;G++){H=L+G*(1/A)*(V-L);position=this.getPoint(H);J.push(O.copy(position).clone())}J.push(O.copy(this.points[B]).clone())}this.points=
-J}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};
+THREE.Spline=function(b){function c(v,B,F,I,N,W,A){v=(F-v)*0.5;I=(I-B)*0.5;return(2*(B-F)+v+I)*A+(-3*(B-F)-2*v-I)*W+v*N+B}this.points=b;var d=[],f={x:0,y:0,z:0},g,h,j,k,m,p,o,x,y;this.initFromArray=function(v){this.points=[];for(var B=0;B<v.length;B++)this.points[B]={x:v[B][0],y:v[B][1],z:v[B][2]}};this.getPoint=function(v){g=(this.points.length-1)*v;h=Math.floor(g);j=g-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];o=this.points[d[1]];
+x=this.points[d[2]];y=this.points[d[3]];k=j*j;m=j*k;f.x=c(p.x,o.x,x.x,y.x,j,k,m);f.y=c(p.y,o.y,x.y,y.y,j,k,m);f.z=c(p.z,o.z,x.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var v,B,F=this.points.length,I=[];for(v=0;v<F;v++){B=this.points[v];I[v]=[B.x,B.y,B.z]}return I};this.getLength=function(v){var B,F,I=B=B=0,N=new THREE.Vector3,W=new THREE.Vector3,A=[],K=0;A[0]=0;v||(v=100);F=this.points.length*v;N.copy(this.points[0]);for(v=1;v<F;v++){B=v/F;position=this.getPoint(B);W.copy(position);
+K+=W.distanceTo(N);N.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=I){A[B]=K;I=B}}A[A.length]=K;return{chunks:A,total:K}};this.reparametrizeByArcLength=function(v){var B,F,I,N,W,A,K=[],O=new THREE.Vector3,R=this.getLength();K.push(O.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){F=R.chunks[B]-R.chunks[B-1];A=Math.ceil(v*F/R.total);N=(B-1)/(this.points.length-1);W=B/(this.points.length-1);for(F=1;F<A-1;F++){I=N+F*(1/A)*(W-N);position=this.getPoint(I);K.push(O.copy(position).clone())}K.push(O.copy(this.points[B]).clone())}this.points=
+K}};THREE.Edge=function(b,c,d,f){this.vertices=[b,c];this.vertexIndices=[d,f];this.faces=[];this.faceIndices=[]};
 THREE.AnimationHandler=function(){var b=[],c={},d={};d.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};d.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};d.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};d.add=function(g){c[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");c[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<
-0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++){var p=g.hierarchy[h].keys[j].morphTargets[n];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
-{};for(p in k){for(n=0;n<g.hierarchy[h].keys[j].morphTargets.length;n++)if(g.hierarchy[h].keys[j].morphTargets[n]===p){o[p]=g.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===g.hierarchy[h].keys[j].morphTargets.length&&(o[p]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=o}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
+0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++){var p=g.hierarchy[h].keys[j].morphTargets[m];k[p]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var o=
+{};for(p in k){for(m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++)if(g.hierarchy[h].keys[j].morphTargets[m]===p){o[p]=g.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===g.hierarchy[h].keys[j].morphTargets.length&&(o[p]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=o}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
 g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(h=0;h<g.hierarchy.length;h++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};d.get=function(g){if(typeof g==="string")if(c[g])return c[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};d.parse=function(g){var h=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)h.push(g.bones[j]);else f(g,h);return h};var f=function(g,h){h.push(g);for(var j=0;j<g.children.length;j++)f(g.children[j],h)};d.LINEAR=
 0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(b,c,d,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.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?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!==undefined?b:!0;this.currentTime=c!==undefined?c:0;var d,f=this.hierarchy.length,g;for(d=0;d<f;d++){g=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
 g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];g.pos=this.getNextKeyWith("pos",d,1);g.rot=this.getNextKeyWith("rot",d,1);g.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,f,g,h,j,k,n,p,o=this.data.JIT.hierarchy,w,y;this.currentTime+=b*this.timeScale;y=this.currentTime;w=this.currentTime%=this.data.length;p=parseInt(Math.min(w*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,B=this.hierarchy.length;v<B;v++){b=this.hierarchy[v];n=b.animationCache;if(this.JITCompile&&o[v][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var G=0;G<3;G++){d=c[G];j=n.prevKey[d];k=n.nextKey[d];if(k.time<=y){if(w<y)if(this.loop){j=this.data.hierarchy[v].keys[0];for(k=this.getNextKeyWith(d,v,1);k.time<w;){j=k;k=this.getNextKeyWith(d,v,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(d,v,k.index+1)}while(k.time<
-w)}n.prevKey[d]=j;n.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(w-j.time)/(k.time-j.time);g=j[d];h=k[d];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(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,f,g,h,j,k,m,p,o=this.data.JIT.hierarchy,x,y;this.currentTime+=b*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;p=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,B=this.hierarchy.length;v<B;v++){b=this.hierarchy[v];m=b.animationCache;if(this.JITCompile&&o[v][p]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=o[v][p];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var F=0;F<3;F++){d=c[F];j=m.prevKey[d];k=m.nextKey[d];if(k.time<=y){if(x<y)if(this.loop){j=this.data.hierarchy[v].keys[0];for(k=this.getNextKeyWith(d,v,1);k.time<x;){j=k;k=this.getNextKeyWith(d,v,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(d,v,k.index+1)}while(k.time<
+x)}m.prevKey[d]=j;m.nextKey[d]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(x-j.time)/(k.time-j.time);g=j[d];h=k[d];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(d==="pos"){d=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",v,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);d.x=g[0];d.y=g[1];d.z=g[2];if(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(d);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(d===
 "rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(d==="scl"){d=b.scale;d.x=g[0]+(h[0]-g[0])*f;d.y=g[1]+(h[1]-g[1])*f;d.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&o[0][p]===undefined){this.hierarchy[0].update(undefined,!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 d=[],f=[],g,h,j,k,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>b.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];n=b[d[2]];p=b[d[3]];d=g*g;j=g*d;f[0]=this.interpolate(h[0],k[0],n[0],p[0],g,d,j);f[1]=this.interpolate(h[1],k[1],n[1],p[1],g,d,j);f[2]=this.interpolate(h[2],k[2],n[2],p[2],g,d,j);return f};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],f=[],g,h,j,k,m,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>b.length-2?h:h+1;d[3]=h>b.length-3?h:h+2;h=b[d[0]];k=b[d[1]];m=b[d[2]];p=b[d[3]];d=g*g;j=g*d;f[0]=this.interpolate(h[0],k[0],m[0],p[0],g,d,j);f[1]=this.interpolate(h[1],k[1],m[1],p[1],g,d,j);f[2]=this.interpolate(h[2],k[2],m[2],p[2],g,d,j);return f};
 THREE.Animation.prototype.interpolate=function(b,c,d,f,g,h,j){b=(d-b)*0.5;f=(f-c)*0.5;return(2*(c-d)+b+f)*j+(-3*(c-d)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<f.length-1?d:f.length-1;else d%=f.length;for(;d<f.length;d++)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){var f=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+f.length;d>=0;d--)if(f[d][b]!==undefined)return f[d];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.Camera=function(b,c,d,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||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;
@@ -139,10 +139,10 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var 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,d)};THREE.ShadowVolume=function(b,c){THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this);this.calculateShadowVolumeGeometry(b.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
 THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,n,p,o,w=["a","b","c","d"];for(n=0;n<h;n++){k=c.length;j=g[n];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);d.push(k);for(k=
-0;k<p;k++){o=b[j[w[k]]];c.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=d[h];for(j=h+1;j<g.length;j++){k=d[j];k=this.facesShareEdge(c,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var f,g,h,j,k,n,p,o,w,y,v,B,G,H=0,L=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=c[L[B]];k=b[h];for(G=0;G<g;G++){j=d[L[G]];n=b[j];if(Math.abs(k.position.x-n.position.x)<1.0E-4&&Math.abs(k.position.y-n.position.y)<1.0E-4&&Math.abs(k.position.z-n.position.z)<1.0E-4){H++;if(H===1){p=k;o=n;w=h;y=j;v=L[B]}if(H===2){v+=L[B];return v==="ad"||v==="ac"?{faces:[c,d],vertices:[p,o,n,k],indices:[w,
-y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[p,k,n,o],indices:[w,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,p,o,x=["a","b","c","d"];for(m=0;m<h;m++){k=c.length;j=g[m];if(j instanceof THREE.Face4){p=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{p=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);d.push(k);for(k=
+0;k<p;k++){o=b[j[x[k]]];c.push(new THREE.Vertex(o.position.clone()))}}for(h=0;h<g.length-1;h++){b=d[h];for(j=h+1;j<g.length;j++){k=d[j];k=this.facesShareEdge(c,b,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);f.push(k)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var f,g,h,j,k,m,p,o,x,y,v,B,F,I=0,N=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=d instanceof THREE.Face4?4:3;for(B=0;B<f;B++){h=c[N[B]];k=b[h];for(F=0;F<g;F++){j=d[N[F]];m=b[j];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){I++;if(I===1){p=k;o=m;x=h;y=j;v=N[B]}if(I===2){v+=N[B];return v==="ad"||v==="ac"?{faces:[c,d],vertices:[p,o,m,k],indices:[x,
+y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[p,k,m,o],indices:[x,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==undefined){this.material=b.material;this.map=undefined;this.blending=material.blending}else if(b.map!==undefined){this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map);this.material=undefined;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending}this.useScreenCoordinates=b.useScreenCoordinates!==undefined?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==undefined?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==undefined?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
 THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,this.scale.y)}this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
@@ -151,58 +151,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else if(b instanceof THREE.Sound){c=this.sounds.indexOf(b);c!==-1&&this.sounds.splice(c,1)}else if(!(b instanceof THREE.Camera)){c=this.objects.indexOf(b);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(b)}}for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function b(){var e=n[k]=n[k]||new THREE.RenderableVertex;k++;return e}function c(e,ea){return ea.z-e.z}function d(e,ea){var Aa=0,Ca=1,Ha=e.z+e.w,X=ea.z+ea.w,oa=-e.z+e.w,pa=-ea.z+ea.w;if(Ha>=0&&X>=0&&oa>=0&&pa>=0)return!0;else if(Ha<0&&X<0||oa<0&&pa<0)return!1;else{if(Ha<0)Aa=Math.max(Aa,Ha/(Ha-X));else X<0&&(Ca=Math.min(Ca,Ha/(Ha-X)));if(oa<0)Aa=Math.max(Aa,oa/(oa-pa));else pa<0&&(Ca=Math.min(Ca,oa/(oa-pa)));if(Ca<Aa)return!1;else{e.lerpSelf(ea,Aa);ea.lerpSelf(e,1-Ca);return!0}}}
-var f,g,h=[],j,k,n=[],p,o,w=[],y,v=[],B,G,H=[],L,V,A=[],J=new THREE.Vector4,O=new THREE.Vector4,R=new THREE.Matrix4,Fa=new THREE.Matrix4,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Vector4,$=new THREE.Vector4;this.projectVector=function(e,ea){R.multiply(ea.projectionMatrix,ea.matrixWorldInverse);R.multiplyVector3(e);return e};this.unprojectVector=function(e,ea){R.multiply(ea.matrixWorld,THREE.Matrix4.makeInvert(ea.projectionMatrix));
-R.multiplyVector3(e);return e};this.projectObjects=function(e,ea,Aa){ea=[];var Ca,Ha,X;g=0;Ha=e.objects;e=0;for(Ca=Ha.length;e<Ca;e++){X=Ha[e];var oa;if(!(oa=!X.visible))if(oa=X instanceof THREE.Mesh){a:{oa=void 0;for(var pa=X.matrixWorld,ta=-X.geometry.boundingSphere.radius*Math.max(X.scale.x,Math.max(X.scale.y,X.scale.z)),ga=0;ga<6;ga++){oa=ka[ga].x*pa.n14+ka[ga].y*pa.n24+ka[ga].z*pa.n34+ka[ga].w;if(oa<=ta){oa=!1;break a}}oa=!0}oa=!oa}if(!oa){oa=h[g]=h[g]||new THREE.RenderableObject;g++;f=oa;J.copy(X.position);
-R.multiplyVector3(J);f.object=X;f.z=J.z;ea.push(f)}}Aa&&ea.sort(c);return ea};this.projectScene=function(e,ea,Aa){var Ca=[],Ha=ea.near,X=ea.far,oa,pa,ta,ga,Z,la,Ga,ia,ja,ua,Ra,$a,ab,Oa,S,ca,ma;V=G=y=o=0;ea.matrixAutoUpdate&&ea.updateMatrix();e.update(undefined,!1,ea);R.multiply(ea.projectionMatrix,ea.matrixWorldInverse);ka[0].set(R.n41-R.n11,R.n42-R.n12,R.n43-R.n13,R.n44-R.n14);ka[1].set(R.n41+R.n11,R.n42+R.n12,R.n43+R.n13,R.n44+R.n14);ka[2].set(R.n41+R.n21,R.n42+R.n22,R.n43+R.n23,R.n44+R.n24);ka[3].set(R.n41-
-R.n21,R.n42-R.n22,R.n43-R.n23,R.n44-R.n24);ka[4].set(R.n41-R.n31,R.n42-R.n32,R.n43-R.n33,R.n44-R.n34);ka[5].set(R.n41+R.n31,R.n42+R.n32,R.n43+R.n33,R.n44+R.n34);for(oa=0;oa<6;oa++){ja=ka[oa];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(e,ea,!0);e=0;for(oa=ja.length;e<oa;e++){ua=ja[e].object;if(ua.visible){Ra=ua.matrixWorld;$a=ua.matrixRotationWorld;ab=ua.materials;Oa=ua.overdraw;k=0;if(ua instanceof THREE.Mesh){S=ua.geometry;ga=S.vertices;ca=S.faces;S=S.faceVertexUvs;
-pa=0;for(ta=ga.length;pa<ta;pa++){j=b();j.positionWorld.copy(ga[pa].position);Ra.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);R.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ha&&j.positionScreen.z<X}ga=0;for(pa=ca.length;ga<pa;ga++){ta=ca[ga];if(ta instanceof THREE.Face3){Z=n[ta.a];la=n[ta.b];Ga=n[ta.c];if(Z.visible&&la.visible&&Ga.visible&&(ua.doubleSided||ua.flipSided!=(Ga.positionScreen.x-
-Z.positionScreen.x)*(la.positionScreen.y-Z.positionScreen.y)-(Ga.positionScreen.y-Z.positionScreen.y)*(la.positionScreen.x-Z.positionScreen.x)<0)){ia=w[o]=w[o]||new THREE.RenderableFace3;o++;p=ia;p.v1.copy(Z);p.v2.copy(la);p.v3.copy(Ga)}else continue}else if(ta instanceof THREE.Face4){Z=n[ta.a];la=n[ta.b];Ga=n[ta.c];ia=n[ta.d];if(Z.visible&&la.visible&&Ga.visible&&ia.visible&&(ua.doubleSided||ua.flipSided!=((ia.positionScreen.x-Z.positionScreen.x)*(la.positionScreen.y-Z.positionScreen.y)-(ia.positionScreen.y-
-Z.positionScreen.y)*(la.positionScreen.x-Z.positionScreen.x)<0||(la.positionScreen.x-Ga.positionScreen.x)*(ia.positionScreen.y-Ga.positionScreen.y)-(la.positionScreen.y-Ga.positionScreen.y)*(ia.positionScreen.x-Ga.positionScreen.x)<0))){ma=v[y]=v[y]||new THREE.RenderableFace4;y++;p=ma;p.v1.copy(Z);p.v2.copy(la);p.v3.copy(Ga);p.v4.copy(ia)}else continue}p.normalWorld.copy(ta.normal);$a.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ta.centroid);Ra.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);
-R.multiplyVector3(p.centroidScreen);Ga=ta.vertexNormals;Z=0;for(la=Ga.length;Z<la;Z++){ia=p.vertexNormalsWorld[Z];ia.copy(Ga[Z]);$a.multiplyVector3(ia)}Z=0;for(la=S.length;Z<la;Z++)if(ma=S[Z][ga]){Ga=0;for(ia=ma.length;Ga<ia;Ga++)p.uvs[Z][Ga]=ma[Ga]}p.meshMaterials=ab;p.faceMaterials=ta.materials;p.overdraw=Oa;p.z=p.centroidScreen.z;Ca.push(p)}}else if(ua instanceof THREE.Line){Fa.multiply(R,Ra);ga=ua.geometry.vertices;Z=b();Z.positionScreen.copy(ga[0].position);Fa.multiplyVector4(Z.positionScreen);
-pa=1;for(ta=ga.length;pa<ta;pa++){Z=b();Z.positionScreen.copy(ga[pa].position);Fa.multiplyVector4(Z.positionScreen);la=n[k-2];va.copy(Z.positionScreen);$.copy(la.positionScreen);if(d(va,$)){va.multiplyScalar(1/va.w);$.multiplyScalar(1/$.w);Ra=H[G]=H[G]||new THREE.RenderableLine;G++;B=Ra;B.v1.positionScreen.copy(va);B.v2.positionScreen.copy($);B.z=Math.max(va.z,$.z);B.materials=ua.materials;Ca.push(B)}}}else if(ua instanceof THREE.Particle){O.set(ua.position.x,ua.position.y,ua.position.z,1);R.multiplyVector4(O);
-O.z/=O.w;if(O.z>0&&O.z<1){Ra=A[V]=A[V]||new THREE.RenderableParticle;V++;L=Ra;L.x=O.x/O.w;L.y=O.y/O.w;L.z=O.z;L.rotation=ua.rotation.z;L.scale.x=ua.scale.x*Math.abs(L.x-(O.x+ea.projectionMatrix.n11)/(O.w+ea.projectionMatrix.n14));L.scale.y=ua.scale.y*Math.abs(L.y-(O.y+ea.projectionMatrix.n22)/(O.w+ea.projectionMatrix.n24));L.materials=ua.materials;Ca.push(L)}}}}Aa&&Ca.sort(c);return Ca}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var n,p,o,w,y,v,B,G;b=c.projectScene(j,k);n=0;for(p=b.length;n<p;n++){y=b[n];if(y instanceof THREE.RenderableParticle){B=y.x*g+g;G=y.y*h+h;o=0;for(w=y.material.length;o<w;o++){v=y.material[o];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=B+"px";v.style.top=G+"px"}}}}}};
-THREE.CanvasRenderer=function(){function b(wa){if(v!=wa)o.globalAlpha=v=wa}function c(wa){if(B!=wa){switch(wa){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=wa}}function d(wa){if(G!=wa)o.strokeStyle=G=wa}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,n,p,o=h.getContext("2d"),w=new THREE.Color(0),y=0,v=1,B=0,
-G=null,H=null,L=null,V=null,A=null,J,O,R,Fa,ka=new THREE.RenderableVertex,va=new THREE.RenderableVertex,$,e,ea,Aa,Ca,Ha,X,oa,pa,ta,ga,Z,la=new THREE.Color,Ga=new THREE.Color,ia=new THREE.Color,ja=new THREE.Color,ua=new THREE.Color,Ra,$a,ab,Oa,S,ca,ma,Da,Ma,xa,fa=new THREE.Rectangle,m=new THREE.Rectangle,C=new THREE.Rectangle,x=!1,u=new THREE.Color,z=new THREE.Color,K=new THREE.Color,M=new THREE.Color,E=new THREE.Vector3,P,F,N,I,Y,U,ya=16;P=document.createElement("canvas");P.width=P.height=2;F=P.getContext("2d");
-F.fillStyle="rgba(0,0,0,1)";F.fillRect(0,0,2,2);N=F.getImageData(0,0,2,2);I=N.data;Y=document.createElement("canvas");Y.width=Y.height=ya;U=Y.getContext("2d");U.translate(-ya/2,-ya/2);U.scale(ya,ya);ya--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(wa,ra){j=wa;k=ra;n=j/2;p=k/2;h.width=j;h.height=k;fa.set(-n,-p,n,p);v=1;B=0;A=V=L=H=G=null};this.setClearColor=function(wa,ra){w=wa;y=ra};this.setClearColorHex=function(wa,ra){w.setHex(wa);y=ra};this.clear=
-function(){o.setTransform(1,0,0,-1,n,p);if(!m.isEmpty()){m.inflate(1);m.minSelf(fa);if(w.hex==0&&y==0)o.clearRect(m.getX(),m.getY(),m.getWidth(),m.getHeight());else{c(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*255)+","+y+")";o.fillRect(m.getX(),m.getY(),m.getWidth(),m.getHeight())}m.empty()}};this.render=function(wa,ra){function Na(W){var za,na,aa,Ba=W.lights;z.setRGB(0,0,0);K.setRGB(0,0,0);M.setRGB(0,0,0);W=0;for(za=Ba.length;W<za;W++){na=
-Ba[W];aa=na.color;if(na instanceof THREE.AmbientLight){z.r+=aa.r;z.g+=aa.g;z.b+=aa.b}else if(na instanceof THREE.DirectionalLight){K.r+=aa.r;K.g+=aa.g;K.b+=aa.b}else if(na instanceof THREE.PointLight){M.r+=aa.r;M.g+=aa.g;M.b+=aa.b}}}function Sa(W,za,na,aa){var Ba,qa,ha,Q,Ea=W.lights;W=0;for(Ba=Ea.length;W<Ba;W++){qa=Ea[W];ha=qa.color;if(qa instanceof THREE.DirectionalLight){Q=na.dot(qa.position);if(!(Q<=0)){Q*=qa.intensity;aa.r+=ha.r*Q;aa.g+=ha.g*Q;aa.b+=ha.b*Q}}else if(qa instanceof THREE.PointLight){Q=
-na.dot(E.sub(qa.position,za).normalize());if(!(Q<=0)){Q*=qa.distance==0?1:1-Math.min(za.distanceTo(qa.position)/qa.distance,1);if(Q!=0){Q*=qa.intensity;aa.r+=ha.r*Q;aa.g+=ha.g*Q;aa.b+=ha.b*Q}}}}}function Ka(W,za,na){b(na.opacity);c(na.blending);var aa,Ba,qa,ha,Q,Ea;if(na instanceof THREE.ParticleBasicMaterial){if(na.map){ha=na.map.image;Q=ha.width>>1;Ea=ha.height>>1;na=za.scale.x*n;qa=za.scale.y*p;aa=na*Q;Ba=qa*Ea;C.set(W.x-aa,W.y-Ba,W.x+aa,W.y+Ba);if(fa.instersects(C)){o.save();o.translate(W.x,W.y);
-o.rotate(-za.rotation);o.scale(na,-qa);o.translate(-Q,-Ea);o.drawImage(ha,0,0);o.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){aa=za.scale.x*n;Ba=za.scale.y*p;C.set(W.x-aa,W.y-Ba,W.x+aa,W.y+Ba);if(fa.instersects(C)){d(na.color.__styleString);qa=na.color.__styleString;if(H!=qa)o.fillStyle=H=qa;o.save();o.translate(W.x,W.y);o.rotate(-za.rotation);o.scale(aa,Ba);na.program(o);o.restore()}}}function Ja(W,za,na,aa){b(aa.opacity);c(aa.blending);o.beginPath();o.moveTo(W.positionScreen.x,
-W.positionScreen.y);o.lineTo(za.positionScreen.x,za.positionScreen.y);o.closePath();if(aa instanceof THREE.LineBasicMaterial){la.__styleString=aa.color.__styleString;W=aa.linewidth;if(L!=W)o.lineWidth=L=W;W=aa.linecap;if(V!=W)o.lineCap=V=W;W=aa.linejoin;if(A!=W)o.lineJoin=A=W;d(la.__styleString);o.stroke();C.inflate(aa.linewidth*2)}}function Ia(W,za,na,aa,Ba,qa,ha,Q,Ea){b(Q.opacity);c(Q.blending);$=W.positionScreen.x;e=W.positionScreen.y;ea=za.positionScreen.x;Aa=za.positionScreen.y;Ca=na.positionScreen.x;
-Ha=na.positionScreen.y;D($,e,ea,Aa,Ca,Ha);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Oa=ha.uvs[0];eb($,e,ea,Aa,Ca,Ha,Q.map.image,Oa[aa].u,Oa[aa].v,Oa[Ba].u,Oa[Ba].v,Oa[qa].u,Oa[qa].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=ra.matrixWorldInverse;E.copy(ha.vertexNormalsWorld[0]);S=(E.x*W.n11+E.y*W.n12+E.z*W.n13)*0.5+0.5;ca=-(E.x*W.n21+E.y*W.n22+E.z*W.n23)*0.5+0.5;E.copy(ha.vertexNormalsWorld[1]);ma=(E.x*
-W.n11+E.y*W.n12+E.z*W.n13)*0.5+0.5;Da=-(E.x*W.n21+E.y*W.n22+E.z*W.n23)*0.5+0.5;E.copy(ha.vertexNormalsWorld[2]);Ma=(E.x*W.n11+E.y*W.n12+E.z*W.n13)*0.5+0.5;xa=-(E.x*W.n21+E.y*W.n22+E.z*W.n23)*0.5+0.5;eb($,e,ea,Aa,Ca,Ha,Q.envMap.image,S,ca,ma,Da,Ma,xa)}}else Q.wireframe?t(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):bb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Oa=ha.uvs[0];
-eb($,e,ea,Aa,Ca,Ha,Q.map.image,Oa[aa].u,Oa[aa].v,Oa[Ba].u,Oa[Ba].v,Oa[qa].u,Oa[qa].v)}c(THREE.SubtractiveBlending)}if(x)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Ga.r=ia.r=ja.r=z.r;Ga.g=ia.g=ja.g=z.g;Ga.b=ia.b=ja.b=z.b;Sa(Ea,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Sa(Ea,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ia);Sa(Ea,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ja);ua.r=(ia.r+ja.r)*0.5;ua.g=(ia.g+ja.g)*0.5;ua.b=(ia.b+ja.b)*0.5;ab=Ta(Ga,ia,ja,
-ua);eb($,e,ea,Aa,Ca,Ha,ab,0,0,1,0,0,1)}else{u.r=z.r;u.g=z.g;u.b=z.b;Sa(Ea,ha.centroidWorld,ha.normalWorld,u);la.r=Q.color.r*u.r;la.g=Q.color.g*u.g;la.b=Q.color.b*u.b;la.updateStyleString();Q.wireframe?t(la.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):bb(la.__styleString)}else Q.wireframe?t(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):bb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ra=ra.near;$a=ra.far;Ga.r=
-Ga.g=Ga.b=1-Qa(W.positionScreen.z,Ra,$a);ia.r=ia.g=ia.b=1-Qa(za.positionScreen.z,Ra,$a);ja.r=ja.g=ja.b=1-Qa(na.positionScreen.z,Ra,$a);ua.r=(ia.r+ja.r)*0.5;ua.g=(ia.g+ja.g)*0.5;ua.b=(ia.b+ja.b)*0.5;ab=Ta(Ga,ia,ja,ua);eb($,e,ea,Aa,Ca,Ha,ab,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){la.r=hb(ha.normalWorld.x);la.g=hb(ha.normalWorld.y);la.b=hb(ha.normalWorld.z);la.updateStyleString();Q.wireframe?t(la.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):bb(la.__styleString)}}
-function Wa(W,za,na,aa,Ba,qa,ha,Q,Ea){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Ia(W,za,aa,0,1,3,ha,Q,Ea);Ia(Ba,na,qa,1,2,3,ha,Q,Ea)}else{$=W.positionScreen.x;e=W.positionScreen.y;ea=za.positionScreen.x;Aa=za.positionScreen.y;Ca=na.positionScreen.x;Ha=na.positionScreen.y;X=aa.positionScreen.x;oa=aa.positionScreen.y;pa=Ba.positionScreen.x;ta=Ba.positionScreen.y;ga=qa.positionScreen.x;Z=qa.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){da($,e,ea,Aa,Ca,Ha,X,oa);Q.wireframe?t(Q.color.__styleString,
-Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):bb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(x)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Ga.r=ia.r=ja.r=ua.r=z.r;Ga.g=ia.g=ja.g=ua.g=z.g;Ga.b=ia.b=ja.b=ua.b=z.b;Sa(Ea,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Ga);Sa(Ea,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ia);Sa(Ea,ha.v4.positionWorld,ha.vertexNormalsWorld[3],ja);Sa(Ea,ha.v3.positionWorld,ha.vertexNormalsWorld[2],
-ua);ab=Ta(Ga,ia,ja,ua);D($,e,ea,Aa,X,oa);eb($,e,ea,Aa,X,oa,ab,0,0,1,0,0,1);D(pa,ta,Ca,Ha,ga,Z);eb(pa,ta,Ca,Ha,ga,Z,ab,1,0,1,1,0,1)}else{u.r=z.r;u.g=z.g;u.b=z.b;Sa(Ea,ha.centroidWorld,ha.normalWorld,u);la.r=Q.color.r*u.r;la.g=Q.color.g*u.g;la.b=Q.color.b*u.b;la.updateStyleString();da($,e,ea,Aa,Ca,Ha,X,oa);Q.wireframe?t(la.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):bb(la.__styleString)}else{da($,e,ea,Aa,Ca,Ha,X,oa);Q.wireframe?t(Q.color.__styleString,Q.wireframeLinewidth,
-Q.wireframeLinecap,Q.wireframeLinejoin):bb(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){la.r=hb(ha.normalWorld.x);la.g=hb(ha.normalWorld.y);la.b=hb(ha.normalWorld.z);la.updateStyleString();da($,e,ea,Aa,Ca,Ha,X,oa);Q.wireframe?t(la.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):bb(la.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ra=ra.near;$a=ra.far;Ga.r=Ga.g=Ga.b=1-Qa(W.positionScreen.z,Ra,$a);ia.r=ia.g=ia.b=1-Qa(za.positionScreen.z,
-Ra,$a);ja.r=ja.g=ja.b=1-Qa(aa.positionScreen.z,Ra,$a);ua.r=ua.g=ua.b=1-Qa(na.positionScreen.z,Ra,$a);ab=Ta(Ga,ia,ja,ua);D($,e,ea,Aa,X,oa);eb($,e,ea,Aa,X,oa,ab,0,0,1,0,0,1);D(pa,ta,Ca,Ha,ga,Z);eb(pa,ta,Ca,Ha,ga,Z,ab,1,0,1,1,0,1)}}}function D(W,za,na,aa,Ba,qa){o.beginPath();o.moveTo(W,za);o.lineTo(na,aa);o.lineTo(Ba,qa);o.lineTo(W,za);o.closePath()}function da(W,za,na,aa,Ba,qa,ha,Q){o.beginPath();o.moveTo(W,za);o.lineTo(na,aa);o.lineTo(Ba,qa);o.lineTo(ha,Q);o.lineTo(W,za);o.closePath()}function t(W,
-za,na,aa){if(L!=za)o.lineWidth=L=za;if(V!=na)o.lineCap=V=na;if(A!=aa)o.lineJoin=A=aa;d(W);o.stroke();C.inflate(za*2)}function bb(W){if(H!=W)o.fillStyle=H=W;o.fill()}function eb(W,za,na,aa,Ba,qa,ha,Q,Ea,ib,Ya,Za,db){var jb,Ua;jb=ha.width-1;Ua=ha.height-1;Q*=jb;Ea*=Ua;ib*=jb;Ya*=Ua;Za*=jb;db*=Ua;na-=W;aa-=za;Ba-=W;qa-=za;ib-=Q;Ya-=Ea;Za-=Q;db-=Ea;jb=ib*db-Za*Ya;if(jb!=0){Ua=1/jb;jb=(db*na-Ya*Ba)*Ua;Ya=(db*aa-Ya*qa)*Ua;na=(ib*Ba-Za*na)*Ua;aa=(ib*qa-Za*aa)*Ua;W=W-jb*Q-na*Ea;za=za-Ya*Q-aa*Ea;o.save();
-o.transform(jb,Ya,na,aa,W,za);o.clip();o.drawImage(ha,0,0);o.restore()}}function Ta(W,za,na,aa){var Ba=~~(W.r*255),qa=~~(W.g*255);W=~~(W.b*255);var ha=~~(za.r*255),Q=~~(za.g*255);za=~~(za.b*255);var Ea=~~(na.r*255),ib=~~(na.g*255);na=~~(na.b*255);var Ya=~~(aa.r*255),Za=~~(aa.g*255);aa=~~(aa.b*255);I[0]=Ba<0?0:Ba>255?255:Ba;I[1]=qa<0?0:qa>255?255:qa;I[2]=W<0?0:W>255?255:W;I[4]=ha<0?0:ha>255?255:ha;I[5]=Q<0?0:Q>255?255:Q;I[6]=za<0?0:za>255?255:za;I[8]=Ea<0?0:Ea>255?255:Ea;I[9]=ib<0?0:ib>255?255:ib;
-I[10]=na<0?0:na>255?255:na;I[12]=Ya<0?0:Ya>255?255:Ya;I[13]=Za<0?0:Za>255?255:Za;I[14]=aa<0?0:aa>255?255:aa;F.putImageData(N,0,0);U.drawImage(P,0,0);return Y}function Qa(W,za,na){W=(W-za)/(na-za);return W*W*(3-2*W)}function hb(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function gb(W,za){var na=za.x-W.x,aa=za.y-W.y,Ba=1/Math.sqrt(na*na+aa*aa);na*=Ba;aa*=Ba;za.x+=na;za.y+=aa;W.x-=na;W.y-=aa}var cb,fb,sa,Va,Pa,T,Xa,La;this.autoClear?this.clear():o.setTransform(1,0,0,-1,n,p);f=g.projectScene(wa,ra,this.sortElements);
-(x=wa.lights.length>0)&&Na(wa);cb=0;for(fb=f.length;cb<fb;cb++){sa=f[cb];C.empty();if(sa instanceof THREE.RenderableParticle){J=sa;J.x*=n;J.y*=p;Va=0;for(Pa=sa.materials.length;Va<Pa;){La=sa.materials[Va++];La.opacity!=0&&Ka(J,sa,La,wa)}}else if(sa instanceof THREE.RenderableLine){J=sa.v1;O=sa.v2;J.positionScreen.x*=n;J.positionScreen.y*=p;O.positionScreen.x*=n;O.positionScreen.y*=p;C.addPoint(J.positionScreen.x,J.positionScreen.y);C.addPoint(O.positionScreen.x,O.positionScreen.y);if(fa.instersects(C)){Va=
-0;for(Pa=sa.materials.length;Va<Pa;){La=sa.materials[Va++];La.opacity!=0&&Ja(J,O,sa,La,wa)}}}else if(sa instanceof THREE.RenderableFace3){J=sa.v1;O=sa.v2;R=sa.v3;J.positionScreen.x*=n;J.positionScreen.y*=p;O.positionScreen.x*=n;O.positionScreen.y*=p;R.positionScreen.x*=n;R.positionScreen.y*=p;if(sa.overdraw){gb(J.positionScreen,O.positionScreen);gb(O.positionScreen,R.positionScreen);gb(R.positionScreen,J.positionScreen)}C.add3Points(J.positionScreen.x,J.positionScreen.y,O.positionScreen.x,O.positionScreen.y,
-R.positionScreen.x,R.positionScreen.y);if(fa.instersects(C)){Va=0;for(Pa=sa.meshMaterials.length;Va<Pa;){La=sa.meshMaterials[Va++];if(La instanceof THREE.MeshFaceMaterial){T=0;for(Xa=sa.faceMaterials.length;T<Xa;)(La=sa.faceMaterials[T++])&&La.opacity!=0&&Ia(J,O,R,0,1,2,sa,La,wa)}else La.opacity!=0&&Ia(J,O,R,0,1,2,sa,La,wa)}}}else if(sa instanceof THREE.RenderableFace4){J=sa.v1;O=sa.v2;R=sa.v3;Fa=sa.v4;J.positionScreen.x*=n;J.positionScreen.y*=p;O.positionScreen.x*=n;O.positionScreen.y*=p;R.positionScreen.x*=
-n;R.positionScreen.y*=p;Fa.positionScreen.x*=n;Fa.positionScreen.y*=p;ka.positionScreen.copy(O.positionScreen);va.positionScreen.copy(Fa.positionScreen);if(sa.overdraw){gb(J.positionScreen,O.positionScreen);gb(O.positionScreen,Fa.positionScreen);gb(Fa.positionScreen,J.positionScreen);gb(R.positionScreen,ka.positionScreen);gb(R.positionScreen,va.positionScreen)}C.addPoint(J.positionScreen.x,J.positionScreen.y);C.addPoint(O.positionScreen.x,O.positionScreen.y);C.addPoint(R.positionScreen.x,R.positionScreen.y);
-C.addPoint(Fa.positionScreen.x,Fa.positionScreen.y);if(fa.instersects(C)){Va=0;for(Pa=sa.meshMaterials.length;Va<Pa;){La=sa.meshMaterials[Va++];if(La instanceof THREE.MeshFaceMaterial){T=0;for(Xa=sa.faceMaterials.length;T<Xa;)(La=sa.faceMaterials[T++])&&La.opacity!=0&&Wa(J,O,R,Fa,ka,va,sa,La,wa)}else La.opacity!=0&&Wa(J,O,R,Fa,ka,va,sa,La,wa)}}}m.addRectangle(C)}o.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(X,oa,pa){var ta,ga,Z,la;ta=0;for(ga=X.lights.length;ta<ga;ta++){Z=X.lights[ta];if(Z instanceof THREE.DirectionalLight){la=oa.normalWorld.dot(Z.position)*Z.intensity;if(la>0){pa.r+=Z.color.r*la;pa.g+=Z.color.g*la;pa.b+=Z.color.b*la}}else if(Z instanceof THREE.PointLight){va.sub(Z.position,oa.centroidWorld);va.normalize();la=oa.normalWorld.dot(va)*Z.intensity;if(la>0){pa.r+=Z.color.r*la;pa.g+=Z.color.g*la;pa.b+=Z.color.b*la}}}}function c(X,oa,pa,ta,ga,Z){ea=f(Aa++);
-ea.setAttribute("d","M "+X.positionScreen.x+" "+X.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ga instanceof THREE.MeshBasicMaterial)A.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshLambertMaterial)if(V){J.r=O.r;J.g=O.g;J.b=O.b;b(Z,ta,J);A.r=ga.color.r*J.r;A.g=ga.color.g*J.g;A.b=ga.color.b*J.b;A.updateStyleString()}else A.__styleString=ga.color.__styleString;else if(ga instanceof THREE.MeshDepthMaterial){ka=
-1-ga.__2near/(ga.__farPlusNear-ta.z*ga.__farMinusNear);A.setRGB(ka,ka,ka)}else ga instanceof THREE.MeshNormalMaterial&&A.setRGB(g(ta.normalWorld.x),g(ta.normalWorld.y),g(ta.normalWorld.z));ga.wireframe?ea.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+ga.wireframeLinewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.wireframeLinecap+"; stroke-linejoin: "+ga.wireframeLinejoin):ea.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+ga.opacity);
-k.appendChild(ea)}function d(X,oa,pa,ta,ga,Z,la){ea=f(Aa++);ea.setAttribute("d","M "+X.positionScreen.x+" "+X.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(Z instanceof THREE.MeshBasicMaterial)A.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshLambertMaterial)if(V){J.r=O.r;J.g=O.g;J.b=O.b;b(la,ga,J);A.r=Z.color.r*J.r;A.g=Z.color.g*J.g;A.b=Z.color.b*J.b;
-A.updateStyleString()}else A.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshDepthMaterial){ka=1-Z.__2near/(Z.__farPlusNear-ga.z*Z.__farMinusNear);A.setRGB(ka,ka,ka)}else Z instanceof THREE.MeshNormalMaterial&&A.setRGB(g(ga.normalWorld.x),g(ga.normalWorld.y),g(ga.normalWorld.z));Z.wireframe?ea.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+Z.wireframeLinewidth+"; stroke-opacity: "+Z.opacity+"; stroke-linecap: "+Z.wireframeLinecap+"; stroke-linejoin: "+
-Z.wireframeLinejoin):ea.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+Z.opacity);k.appendChild(ea)}function f(X){if($[X]==null){$[X]=document.createElementNS("http://www.w3.org/2000/svg","path");Ha==0&&$[X].setAttribute("shape-rendering","crispEdges")}return $[X]}function g(X){return X<0?Math.min((1+X)*0.5,0.5):0.5+Math.min(X*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,o,w,y,v,B,G,H=new THREE.Rectangle,L=new THREE.Rectangle,
-V=!1,A=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),R=new THREE.Color(0),Fa=new THREE.Color(0),ka,va=new THREE.Vector3,$=[],e=[],ea,Aa,Ca,Ha=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(X){switch(X){case "high":Ha=1;break;case "low":Ha=0}};this.setSize=function(X,oa){n=X;p=oa;o=n/2;w=p/2;k.setAttribute("viewBox",-o+" "+-w+" "+n+" "+p);k.setAttribute("width",n);k.setAttribute("height",p);H.set(-o,-w,o,w)};this.clear=
-function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(X,oa){var pa,ta,ga,Z,la,Ga,ia,ja;this.autoClear&&this.clear();h=j.projectScene(X,oa,this.sortElements);Ca=Aa=0;if(V=X.lights.length>0){ia=X.lights;O.setRGB(0,0,0);R.setRGB(0,0,0);Fa.setRGB(0,0,0);pa=0;for(ta=ia.length;pa<ta;pa++){ga=ia[pa];Z=ga.color;if(ga instanceof THREE.AmbientLight){O.r+=Z.r;O.g+=Z.g;O.b+=Z.b}else if(ga instanceof THREE.DirectionalLight){R.r+=Z.r;R.g+=Z.g;R.b+=Z.b}else if(ga instanceof
-THREE.PointLight){Fa.r+=Z.r;Fa.g+=Z.g;Fa.b+=Z.b}}}pa=0;for(ta=h.length;pa<ta;pa++){ia=h[pa];L.empty();if(ia instanceof THREE.RenderableParticle){y=ia;y.x*=o;y.y*=-w;ga=0;for(Z=ia.materials.length;ga<Z;)ga++}else if(ia instanceof THREE.RenderableLine){y=ia.v1;v=ia.v2;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);if(H.instersects(L)){ga=0;for(Z=ia.materials.length;ga<
-Z;)if((ja=ia.materials[ga++])&&ja.opacity!=0){la=y;Ga=v;var ua=Ca++;if(e[ua]==null){e[ua]=document.createElementNS("http://www.w3.org/2000/svg","line");Ha==0&&e[ua].setAttribute("shape-rendering","crispEdges")}ea=e[ua];ea.setAttribute("x1",la.positionScreen.x);ea.setAttribute("y1",la.positionScreen.y);ea.setAttribute("x2",Ga.positionScreen.x);ea.setAttribute("y2",Ga.positionScreen.y);if(ja instanceof THREE.LineBasicMaterial){A.__styleString=ja.color.__styleString;ea.setAttribute("style","fill: none; stroke: "+
-A.__styleString+"; stroke-width: "+ja.linewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.linecap+"; stroke-linejoin: "+ja.linejoin);k.appendChild(ea)}}}}else if(ia instanceof THREE.RenderableFace3){y=ia.v1;v=ia.v2;B=ia.v3;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;B.positionScreen.x*=o;B.positionScreen.y*=-w;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);L.addPoint(B.positionScreen.x,
-B.positionScreen.y);if(H.instersects(L)){ga=0;for(Z=ia.meshMaterials.length;ga<Z;){ja=ia.meshMaterials[ga++];if(ja instanceof THREE.MeshFaceMaterial){la=0;for(Ga=ia.faceMaterials.length;la<Ga;)(ja=ia.faceMaterials[la++])&&ja.opacity!=0&&c(y,v,B,ia,ja,X)}else ja&&ja.opacity!=0&&c(y,v,B,ia,ja,X)}}}else if(ia instanceof THREE.RenderableFace4){y=ia.v1;v=ia.v2;B=ia.v3;G=ia.v4;y.positionScreen.x*=o;y.positionScreen.y*=-w;v.positionScreen.x*=o;v.positionScreen.y*=-w;B.positionScreen.x*=o;B.positionScreen.y*=
--w;G.positionScreen.x*=o;G.positionScreen.y*=-w;L.addPoint(y.positionScreen.x,y.positionScreen.y);L.addPoint(v.positionScreen.x,v.positionScreen.y);L.addPoint(B.positionScreen.x,B.positionScreen.y);L.addPoint(G.positionScreen.x,G.positionScreen.y);if(H.instersects(L)){ga=0;for(Z=ia.meshMaterials.length;ga<Z;){ja=ia.meshMaterials[ga++];if(ja instanceof THREE.MeshFaceMaterial){la=0;for(Ga=ia.faceMaterials.length;la<Ga;)(ja=ia.faceMaterials[la++])&&ja.opacity!=0&&d(y,v,B,G,ia,ja,X)}else ja&&ja.opacity!=
-0&&d(y,v,B,G,ia,ja,X)}}}}}};
+THREE.Projector=function(){function b(){var e=m[k]=m[k]||new THREE.RenderableVertex;k++;return e}function c(e,da){return da.z-e.z}function d(e,da){var ya=0,za=1,Ea=e.z+e.w,Y=da.z+da.w,oa=-e.z+e.w,pa=-da.z+da.w;if(Ea>=0&&Y>=0&&oa>=0&&pa>=0)return!0;else if(Ea<0&&Y<0||oa<0&&pa<0)return!1;else{if(Ea<0)ya=Math.max(ya,Ea/(Ea-Y));else Y<0&&(za=Math.min(za,Ea/(Ea-Y)));if(oa<0)ya=Math.max(ya,oa/(oa-pa));else pa<0&&(za=Math.min(za,oa/(oa-pa)));if(za<ya)return!1;else{e.lerpSelf(da,ya);da.lerpSelf(e,1-za);return!0}}}
+var f,g,h=[],j,k,m=[],p,o,x=[],y,v=[],B,F,I=[],N,W,A=[],K=new THREE.Vector4,O=new THREE.Vector4,R=new THREE.Matrix4,Ca=new THREE.Matrix4,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Vector4,aa=new THREE.Vector4;this.projectVector=function(e,da){R.multiply(da.projectionMatrix,da.matrixWorldInverse);R.multiplyVector3(e);return e};this.unprojectVector=function(e,da){R.multiply(da.matrixWorld,THREE.Matrix4.makeInvert(da.projectionMatrix));
+R.multiplyVector3(e);return e};this.projectObjects=function(e,da,ya){da=[];var za,Ea,Y;g=0;Ea=e.objects;e=0;for(za=Ea.length;e<za;e++){Y=Ea[e];var oa;if(!(oa=!Y.visible))if(oa=Y instanceof THREE.Mesh){a:{oa=void 0;for(var pa=Y.matrixWorld,ta=-Y.geometry.boundingSphere.radius*Math.max(Y.scale.x,Math.max(Y.scale.y,Y.scale.z)),fa=0;fa<6;fa++){oa=ka[fa].x*pa.n14+ka[fa].y*pa.n24+ka[fa].z*pa.n34+ka[fa].w;if(oa<=ta){oa=!1;break a}}oa=!0}oa=!oa}if(!oa){oa=h[g]=h[g]||new THREE.RenderableObject;g++;f=oa;K.copy(Y.position);
+R.multiplyVector3(K);f.object=Y;f.z=K.z;da.push(f)}}ya&&da.sort(c);return da};this.projectScene=function(e,da,ya){var za=[],Ea=da.near,Y=da.far,oa,pa,ta,fa,Z,ma,Da,ga,ia,ua,Ta,Ya,Za,Qa,U,ca,na;W=F=y=o=0;da.matrixAutoUpdate&&da.updateMatrix();e.update(undefined,!1,da);R.multiply(da.projectionMatrix,da.matrixWorldInverse);ka[0].set(R.n41-R.n11,R.n42-R.n12,R.n43-R.n13,R.n44-R.n14);ka[1].set(R.n41+R.n11,R.n42+R.n12,R.n43+R.n13,R.n44+R.n14);ka[2].set(R.n41+R.n21,R.n42+R.n22,R.n43+R.n23,R.n44+R.n24);ka[3].set(R.n41-
+R.n21,R.n42-R.n22,R.n43-R.n23,R.n44-R.n24);ka[4].set(R.n41-R.n31,R.n42-R.n32,R.n43-R.n33,R.n44-R.n34);ka[5].set(R.n41+R.n31,R.n42+R.n32,R.n43+R.n33,R.n44+R.n34);for(oa=0;oa<6;oa++){ia=ka[oa];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}ia=this.projectObjects(e,da,!0);e=0;for(oa=ia.length;e<oa;e++){ua=ia[e].object;if(ua.visible){Ta=ua.matrixWorld;Ya=ua.matrixRotationWorld;Za=ua.materials;Qa=ua.overdraw;k=0;if(ua instanceof THREE.Mesh){U=ua.geometry;fa=U.vertices;ca=U.faces;U=U.faceVertexUvs;
+pa=0;for(ta=fa.length;pa<ta;pa++){j=b();j.positionWorld.copy(fa[pa].position);Ta.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);R.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ea&&j.positionScreen.z<Y}fa=0;for(pa=ca.length;fa<pa;fa++){ta=ca[fa];if(ta instanceof THREE.Face3){Z=m[ta.a];ma=m[ta.b];Da=m[ta.c];if(Z.visible&&ma.visible&&Da.visible&&(ua.doubleSided||ua.flipSided!=(Da.positionScreen.x-
+Z.positionScreen.x)*(ma.positionScreen.y-Z.positionScreen.y)-(Da.positionScreen.y-Z.positionScreen.y)*(ma.positionScreen.x-Z.positionScreen.x)<0)){ga=x[o]=x[o]||new THREE.RenderableFace3;o++;p=ga;p.v1.copy(Z);p.v2.copy(ma);p.v3.copy(Da)}else continue}else if(ta instanceof THREE.Face4){Z=m[ta.a];ma=m[ta.b];Da=m[ta.c];ga=m[ta.d];if(Z.visible&&ma.visible&&Da.visible&&ga.visible&&(ua.doubleSided||ua.flipSided!=((ga.positionScreen.x-Z.positionScreen.x)*(ma.positionScreen.y-Z.positionScreen.y)-(ga.positionScreen.y-
+Z.positionScreen.y)*(ma.positionScreen.x-Z.positionScreen.x)<0||(ma.positionScreen.x-Da.positionScreen.x)*(ga.positionScreen.y-Da.positionScreen.y)-(ma.positionScreen.y-Da.positionScreen.y)*(ga.positionScreen.x-Da.positionScreen.x)<0))){na=v[y]=v[y]||new THREE.RenderableFace4;y++;p=na;p.v1.copy(Z);p.v2.copy(ma);p.v3.copy(Da);p.v4.copy(ga)}else continue}p.normalWorld.copy(ta.normal);Ya.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ta.centroid);Ta.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);
+R.multiplyVector3(p.centroidScreen);Da=ta.vertexNormals;Z=0;for(ma=Da.length;Z<ma;Z++){ga=p.vertexNormalsWorld[Z];ga.copy(Da[Z]);Ya.multiplyVector3(ga)}Z=0;for(ma=U.length;Z<ma;Z++)if(na=U[Z][fa]){Da=0;for(ga=na.length;Da<ga;Da++)p.uvs[Z][Da]=na[Da]}p.meshMaterials=Za;p.faceMaterials=ta.materials;p.overdraw=Qa;p.z=p.centroidScreen.z;za.push(p)}}else if(ua instanceof THREE.Line){Ca.multiply(R,Ta);fa=ua.geometry.vertices;Z=b();Z.positionScreen.copy(fa[0].position);Ca.multiplyVector4(Z.positionScreen);
+pa=1;for(ta=fa.length;pa<ta;pa++){Z=b();Z.positionScreen.copy(fa[pa].position);Ca.multiplyVector4(Z.positionScreen);ma=m[k-2];va.copy(Z.positionScreen);aa.copy(ma.positionScreen);if(d(va,aa)){va.multiplyScalar(1/va.w);aa.multiplyScalar(1/aa.w);Ta=I[F]=I[F]||new THREE.RenderableLine;F++;B=Ta;B.v1.positionScreen.copy(va);B.v2.positionScreen.copy(aa);B.z=Math.max(va.z,aa.z);B.materials=ua.materials;za.push(B)}}}else if(ua instanceof THREE.Particle){O.set(ua.position.x,ua.position.y,ua.position.z,1);
+R.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ta=A[W]=A[W]||new THREE.RenderableParticle;W++;N=Ta;N.x=O.x/O.w;N.y=O.y/O.w;N.z=O.z;N.rotation=ua.rotation.z;N.scale.x=ua.scale.x*Math.abs(N.x-(O.x+da.projectionMatrix.n11)/(O.w+da.projectionMatrix.n14));N.scale.y=ua.scale.y*Math.abs(N.y-(O.y+da.projectionMatrix.n22)/(O.w+da.projectionMatrix.n24));N.materials=ua.materials;za.push(N)}}}}ya&&za.sort(c);return za}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){d=j;f=k;g=d/2;h=f/2};this.render=function(j,k){var m,p,o,x,y,v,B,F;b=c.projectScene(j,k);m=0;for(p=b.length;m<p;m++){y=b[m];if(y instanceof THREE.RenderableParticle){B=y.x*g+g;F=y.y*h+h;o=0;for(x=y.material.length;o<x;o++){v=y.material[o];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=B+"px";v.style.top=F+"px"}}}}}};
+THREE.CanvasRenderer=function(){function b(P){if(v!=P)o.globalAlpha=v=P}function c(P){if(B!=P){switch(P){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}B=P}}function d(P){if(F!=P)o.strokeStyle=F=P}var f=null,g=new THREE.Projector,h=document.createElement("canvas"),j,k,m,p,o=h.getContext("2d"),x=new THREE.Color(0),y=0,v=1,B=0,F=null,I=null,
+N=null,W=null,A=null,K,O,R,Ca,ka=new THREE.RenderableVertex,va=new THREE.RenderableVertex,aa,e,da,ya,za,Ea,Y,oa,pa,ta,fa,Z,ma=new THREE.Color,Da=new THREE.Color,ga=new THREE.Color,ia=new THREE.Color,ua=new THREE.Color,Ta,Ya,Za,Qa,U,ca,na,Aa,La,wa,ea=new THREE.Rectangle,fb=new THREE.Rectangle,ab=new THREE.Rectangle,n=!1,C=new THREE.Color,u=new THREE.Color,w=new THREE.Color,z=new THREE.Color,G=new THREE.Vector3,L,H,S,E,M,J,X=16;L=document.createElement("canvas");L.width=L.height=2;H=L.getContext("2d");
+H.fillStyle="rgba(0,0,0,1)";H.fillRect(0,0,2,2);S=H.getImageData(0,0,2,2);E=S.data;M=document.createElement("canvas");M.width=M.height=X;J=M.getContext("2d");J.translate(-X/2,-X/2);J.scale(X,X);X--;this.domElement=h;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(P,ra){j=P;k=ra;m=j/2;p=k/2;h.width=j;h.height=k;ea.set(-m,-p,m,p);v=1;B=0;A=W=N=I=F=null};this.setClearColor=function(P,ra){x=P;y=ra};this.setClearColorHex=function(P,ra){x.setHex(P);y=ra};this.clear=function(){o.setTransform(1,
+0,0,-1,m,p);if(!fb.isEmpty()){fb.inflate(1);fb.minSelf(ea);if(x.hex==0&&y==0)o.clearRect(fb.getX(),fb.getY(),fb.getWidth(),fb.getHeight());else{c(THREE.NormalBlending);b(1);o.fillStyle="rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+Math.floor(x.b*255)+","+y+")";o.fillRect(fb.getX(),fb.getY(),fb.getWidth(),fb.getHeight())}fb.empty()}};this.render=function(P,ra){function Na(V){var ja,sa,la,Ja=V.lights;u.setRGB(0,0,0);w.setRGB(0,0,0);z.setRGB(0,0,0);V=0;for(ja=Ja.length;V<ja;V++){sa=Ja[V];la=
+sa.color;if(sa instanceof THREE.AmbientLight){u.r+=la.r;u.g+=la.g;u.b+=la.b}else if(sa instanceof THREE.DirectionalLight){w.r+=la.r;w.g+=la.g;w.b+=la.b}else if(sa instanceof THREE.PointLight){z.r+=la.r;z.g+=la.g;z.b+=la.b}}}function xa(V,ja,sa,la){var Ja,qa,ha,Q,Ba=V.lights;V=0;for(Ja=Ba.length;V<Ja;V++){qa=Ba[V];ha=qa.color;if(qa instanceof THREE.DirectionalLight){Q=sa.dot(qa.position);if(!(Q<=0)){Q*=qa.intensity;la.r+=ha.r*Q;la.g+=ha.g*Q;la.b+=ha.b*Q}}else if(qa instanceof THREE.PointLight){Q=sa.dot(G.sub(qa.position,
+ja).normalize());if(!(Q<=0)){Q*=qa.distance==0?1:1-Math.min(ja.distanceTo(qa.position)/qa.distance,1);if(Q!=0){Q*=qa.intensity;la.r+=ha.r*Q;la.g+=ha.g*Q;la.b+=ha.b*Q}}}}}function Ma(V,ja,sa){b(sa.opacity);c(sa.blending);var la,Ja,qa,ha,Q,Ba;if(sa instanceof THREE.ParticleBasicMaterial){if(sa.map){ha=sa.map.image;Q=ha.width>>1;Ba=ha.height>>1;sa=ja.scale.x*m;qa=ja.scale.y*p;la=sa*Q;Ja=qa*Ba;ab.set(V.x-la,V.y-Ja,V.x+la,V.y+Ja);if(ea.instersects(ab)){o.save();o.translate(V.x,V.y);o.rotate(-ja.rotation);
+o.scale(sa,-qa);o.translate(-Q,-Ba);o.drawImage(ha,0,0);o.restore()}}}else if(sa instanceof THREE.ParticleCanvasMaterial){la=ja.scale.x*m;Ja=ja.scale.y*p;ab.set(V.x-la,V.y-Ja,V.x+la,V.y+Ja);if(ea.instersects(ab)){d(sa.color.__styleString);qa=sa.color.__styleString;if(I!=qa)o.fillStyle=I=qa;o.save();o.translate(V.x,V.y);o.rotate(-ja.rotation);o.scale(la,Ja);sa.program(o);o.restore()}}}function cb(V,ja,sa,la){b(la.opacity);c(la.blending);o.beginPath();o.moveTo(V.positionScreen.x,V.positionScreen.y);
+o.lineTo(ja.positionScreen.x,ja.positionScreen.y);o.closePath();if(la instanceof THREE.LineBasicMaterial){ma.__styleString=la.color.__styleString;V=la.linewidth;if(N!=V)o.lineWidth=N=V;V=la.linecap;if(W!=V)o.lineCap=W=V;V=la.linejoin;if(A!=V)o.lineJoin=A=V;d(ma.__styleString);o.stroke();ab.inflate(la.linewidth*2)}}function Ga(V,ja,sa,la,Ja,qa,ha,Q,Ba){b(Q.opacity);c(Q.blending);aa=V.positionScreen.x;e=V.positionScreen.y;da=ja.positionScreen.x;ya=ja.positionScreen.y;za=sa.positionScreen.x;Ea=sa.positionScreen.y;
+Fa(aa,e,da,ya,za,Ea);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Qa=ha.uvs[0];t(aa,e,da,ya,za,Ea,Q.map.image,Qa[la].u,Qa[la].v,Qa[Ja].u,Qa[Ja].v,Qa[qa].u,Qa[qa].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){V=ra.matrixWorldInverse;G.copy(ha.vertexNormalsWorld[0]);U=(G.x*V.n11+G.y*V.n12+G.z*V.n13)*0.5+0.5;ca=-(G.x*V.n21+G.y*V.n22+G.z*V.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[1]);na=(G.x*V.n11+G.y*V.n12+G.z*
+V.n13)*0.5+0.5;Aa=-(G.x*V.n21+G.y*V.n22+G.z*V.n23)*0.5+0.5;G.copy(ha.vertexNormalsWorld[2]);La=(G.x*V.n11+G.y*V.n12+G.z*V.n13)*0.5+0.5;wa=-(G.x*V.n21+G.y*V.n22+G.z*V.n23)*0.5+0.5;t(aa,e,da,ya,za,Ea,Q.envMap.image,U,ca,na,Aa,La,wa)}}else Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Qa=ha.uvs[0];t(aa,e,da,ya,
+za,Ea,Q.map.image,Qa[la].u,Qa[la].v,Qa[Ja].u,Qa[Ja].v,Qa[qa].u,Qa[qa].v)}c(THREE.SubtractiveBlending)}if(n)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==3){Da.r=ga.r=ia.r=u.r;Da.g=ga.g=ia.g=u.g;Da.b=ga.b=ia.b=u.b;xa(Ba,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Da);xa(Ba,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ga);xa(Ba,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ia);ua.r=(ga.r+ia.r)*0.5;ua.g=(ga.g+ia.g)*0.5;ua.b=(ga.b+ia.b)*0.5;Za=db(Da,ga,ia,ua);t(aa,e,da,
+ya,za,Ea,Za,0,0,1,0,0,1)}else{C.r=u.r;C.g=u.g;C.b=u.b;xa(Ba,ha.centroidWorld,ha.normalWorld,C);ma.r=Q.color.r*C.r;ma.g=Q.color.g*C.g;ma.b=Q.color.b*C.b;ma.updateStyleString();Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ta=ra.near;Ya=ra.far;Da.r=Da.g=Da.b=1-hb(V.positionScreen.z,
+Ta,Ya);ga.r=ga.g=ga.b=1-hb(ja.positionScreen.z,Ta,Ya);ia.r=ia.g=ia.b=1-hb(sa.positionScreen.z,Ta,Ya);ua.r=(ga.r+ia.r)*0.5;ua.g=(ga.g+ia.g)*0.5;ua.b=(ga.b+ia.b)*0.5;Za=db(Da,ga,ia,ua);t(aa,e,da,ya,za,Ea,Za,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ra(ha.normalWorld.x);ma.g=Ra(ha.normalWorld.y);ma.b=Ra(ha.normalWorld.z);ma.updateStyleString();Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}}function Ha(V,ja,sa,la,
+Ja,qa,ha,Q,Ba){b(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){Ga(V,ja,la,0,1,3,ha,Q,Ba);Ga(Ja,sa,qa,1,2,3,ha,Q,Ba)}else{aa=V.positionScreen.x;e=V.positionScreen.y;da=ja.positionScreen.x;ya=ja.positionScreen.y;za=sa.positionScreen.x;Ea=sa.positionScreen.y;Y=la.positionScreen.x;oa=la.positionScreen.y;pa=Ja.positionScreen.x;ta=Ja.positionScreen.y;fa=qa.positionScreen.x;Z=qa.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,
+Q.wireframeLinecap,Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(n)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&ha.vertexNormalsWorld.length==4){Da.r=ga.r=ia.r=ua.r=u.r;Da.g=ga.g=ia.g=ua.g=u.g;Da.b=ga.b=ia.b=ua.b=u.b;xa(Ba,ha.v1.positionWorld,ha.vertexNormalsWorld[0],Da);xa(Ba,ha.v2.positionWorld,ha.vertexNormalsWorld[1],ga);xa(Ba,ha.v4.positionWorld,ha.vertexNormalsWorld[3],ia);xa(Ba,ha.v3.positionWorld,ha.vertexNormalsWorld[2],ua);Za=db(Da,ga,
+ia,ua);Fa(aa,e,da,ya,Y,oa);t(aa,e,da,ya,Y,oa,Za,0,0,1,0,0,1);Fa(pa,ta,za,Ea,fa,Z);t(pa,ta,za,Ea,fa,Z,Za,1,0,1,1,0,1)}else{C.r=u.r;C.g=u.g;C.b=u.b;xa(Ba,ha.centroidWorld,ha.normalWorld,C);ma.r=Q.color.r*C.r;ma.g=Q.color.g*C.g;ma.b=Q.color.b*C.b;ma.updateStyleString();Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else{Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,
+Q.wireframeLinejoin):$(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ra(ha.normalWorld.x);ma.g=Ra(ha.normalWorld.y);ma.b=Ra(ha.normalWorld.z);ma.updateStyleString();Ua(aa,e,da,ya,za,Ea,Y,oa);Q.wireframe?D(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):$(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ta=ra.near;Ya=ra.far;Da.r=Da.g=Da.b=1-hb(V.positionScreen.z,Ta,Ya);ga.r=ga.g=ga.b=1-hb(ja.positionScreen.z,Ta,Ya);ia.r=ia.g=
+ia.b=1-hb(la.positionScreen.z,Ta,Ya);ua.r=ua.g=ua.b=1-hb(sa.positionScreen.z,Ta,Ya);Za=db(Da,ga,ia,ua);Fa(aa,e,da,ya,Y,oa);t(aa,e,da,ya,Y,oa,Za,0,0,1,0,0,1);Fa(pa,ta,za,Ea,fa,Z);t(pa,ta,za,Ea,fa,Z,Za,1,0,1,1,0,1)}}}function Fa(V,ja,sa,la,Ja,qa){o.beginPath();o.moveTo(V,ja);o.lineTo(sa,la);o.lineTo(Ja,qa);o.lineTo(V,ja);o.closePath()}function Ua(V,ja,sa,la,Ja,qa,ha,Q){o.beginPath();o.moveTo(V,ja);o.lineTo(sa,la);o.lineTo(Ja,qa);o.lineTo(ha,Q);o.lineTo(V,ja);o.closePath()}function D(V,ja,sa,la){if(N!=
+ja)o.lineWidth=N=ja;if(W!=sa)o.lineCap=W=sa;if(A!=la)o.lineJoin=A=la;d(V);o.stroke();ab.inflate(ja*2)}function $(V){if(I!=V)o.fillStyle=I=V;o.fill()}function t(V,ja,sa,la,Ja,qa,ha,Q,Ba,Oa,Ka,ib,gb){var Xa,$a;Xa=ha.width-1;$a=ha.height-1;Q*=Xa;Ba*=$a;Oa*=Xa;Ka*=$a;ib*=Xa;gb*=$a;sa-=V;la-=ja;Ja-=V;qa-=ja;Oa-=Q;Ka-=Ba;ib-=Q;gb-=Ba;Xa=Oa*gb-ib*Ka;if(Xa!=0){$a=1/Xa;Xa=(gb*sa-Ka*Ja)*$a;Ka=(gb*la-Ka*qa)*$a;sa=(Oa*Ja-ib*sa)*$a;la=(Oa*qa-ib*la)*$a;V=V-Xa*Q-sa*Ba;ja=ja-Ka*Q-la*Ba;o.save();o.transform(Xa,Ka,
+sa,la,V,ja);o.clip();o.drawImage(ha,0,0);o.restore()}}function db(V,ja,sa,la){var Ja=~~(V.r*255),qa=~~(V.g*255);V=~~(V.b*255);var ha=~~(ja.r*255),Q=~~(ja.g*255);ja=~~(ja.b*255);var Ba=~~(sa.r*255),Oa=~~(sa.g*255);sa=~~(sa.b*255);var Ka=~~(la.r*255),ib=~~(la.g*255);la=~~(la.b*255);E[0]=Ja<0?0:Ja>255?255:Ja;E[1]=qa<0?0:qa>255?255:qa;E[2]=V<0?0:V>255?255:V;E[4]=ha<0?0:ha>255?255:ha;E[5]=Q<0?0:Q>255?255:Q;E[6]=ja<0?0:ja>255?255:ja;E[8]=Ba<0?0:Ba>255?255:Ba;E[9]=Oa<0?0:Oa>255?255:Oa;E[10]=sa<0?0:sa>255?
+255:sa;E[12]=Ka<0?0:Ka>255?255:Ka;E[13]=ib<0?0:ib>255?255:ib;E[14]=la<0?0:la>255?255:la;H.putImageData(S,0,0);J.drawImage(L,0,0);return M}function hb(V,ja,sa){V=(V-ja)/(sa-ja);return V*V*(3-2*V)}function Ra(V){V=(V+1)*0.5;return V<0?0:V>1?1:V}function Sa(V,ja){var sa=ja.x-V.x,la=ja.y-V.y,Ja=1/Math.sqrt(sa*sa+la*la);sa*=Ja;la*=Ja;ja.x+=sa;ja.y+=la;V.x-=sa;V.y-=la}var jb,kb,Ia,Va,Pa,bb,Wa,T;this.autoClear?this.clear():o.setTransform(1,0,0,-1,m,p);f=g.projectScene(P,ra,this.sortElements);(n=P.lights.length>
+0)&&Na(P);jb=0;for(kb=f.length;jb<kb;jb++){Ia=f[jb];ab.empty();if(Ia instanceof THREE.RenderableParticle){K=Ia;K.x*=m;K.y*=p;Va=0;for(Pa=Ia.materials.length;Va<Pa;){T=Ia.materials[Va++];T.opacity!=0&&Ma(K,Ia,T,P)}}else if(Ia instanceof THREE.RenderableLine){K=Ia.v1;O=Ia.v2;K.positionScreen.x*=m;K.positionScreen.y*=p;O.positionScreen.x*=m;O.positionScreen.y*=p;ab.addPoint(K.positionScreen.x,K.positionScreen.y);ab.addPoint(O.positionScreen.x,O.positionScreen.y);if(ea.instersects(ab)){Va=0;for(Pa=Ia.materials.length;Va<
+Pa;){T=Ia.materials[Va++];T.opacity!=0&&cb(K,O,Ia,T,P)}}}else if(Ia instanceof THREE.RenderableFace3){K=Ia.v1;O=Ia.v2;R=Ia.v3;K.positionScreen.x*=m;K.positionScreen.y*=p;O.positionScreen.x*=m;O.positionScreen.y*=p;R.positionScreen.x*=m;R.positionScreen.y*=p;if(Ia.overdraw){Sa(K.positionScreen,O.positionScreen);Sa(O.positionScreen,R.positionScreen);Sa(R.positionScreen,K.positionScreen)}ab.add3Points(K.positionScreen.x,K.positionScreen.y,O.positionScreen.x,O.positionScreen.y,R.positionScreen.x,R.positionScreen.y);
+if(ea.instersects(ab)){Va=0;for(Pa=Ia.meshMaterials.length;Va<Pa;){T=Ia.meshMaterials[Va++];if(T instanceof THREE.MeshFaceMaterial){bb=0;for(Wa=Ia.faceMaterials.length;bb<Wa;)(T=Ia.faceMaterials[bb++])&&T.opacity!=0&&Ga(K,O,R,0,1,2,Ia,T,P)}else T.opacity!=0&&Ga(K,O,R,0,1,2,Ia,T,P)}}}else if(Ia instanceof THREE.RenderableFace4){K=Ia.v1;O=Ia.v2;R=Ia.v3;Ca=Ia.v4;K.positionScreen.x*=m;K.positionScreen.y*=p;O.positionScreen.x*=m;O.positionScreen.y*=p;R.positionScreen.x*=m;R.positionScreen.y*=p;Ca.positionScreen.x*=
+m;Ca.positionScreen.y*=p;ka.positionScreen.copy(O.positionScreen);va.positionScreen.copy(Ca.positionScreen);if(Ia.overdraw){Sa(K.positionScreen,O.positionScreen);Sa(O.positionScreen,Ca.positionScreen);Sa(Ca.positionScreen,K.positionScreen);Sa(R.positionScreen,ka.positionScreen);Sa(R.positionScreen,va.positionScreen)}ab.addPoint(K.positionScreen.x,K.positionScreen.y);ab.addPoint(O.positionScreen.x,O.positionScreen.y);ab.addPoint(R.positionScreen.x,R.positionScreen.y);ab.addPoint(Ca.positionScreen.x,
+Ca.positionScreen.y);if(ea.instersects(ab)){Va=0;for(Pa=Ia.meshMaterials.length;Va<Pa;){T=Ia.meshMaterials[Va++];if(T instanceof THREE.MeshFaceMaterial){bb=0;for(Wa=Ia.faceMaterials.length;bb<Wa;)(T=Ia.faceMaterials[bb++])&&T.opacity!=0&&Ha(K,O,R,Ca,ka,va,Ia,T,P)}else T.opacity!=0&&Ha(K,O,R,Ca,ka,va,Ia,T,P)}}}fb.addRectangle(ab)}o.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(Y,oa,pa){var ta,fa,Z,ma;ta=0;for(fa=Y.lights.length;ta<fa;ta++){Z=Y.lights[ta];if(Z instanceof THREE.DirectionalLight){ma=oa.normalWorld.dot(Z.position)*Z.intensity;if(ma>0){pa.r+=Z.color.r*ma;pa.g+=Z.color.g*ma;pa.b+=Z.color.b*ma}}else if(Z instanceof THREE.PointLight){va.sub(Z.position,oa.centroidWorld);va.normalize();ma=oa.normalWorld.dot(va)*Z.intensity;if(ma>0){pa.r+=Z.color.r*ma;pa.g+=Z.color.g*ma;pa.b+=Z.color.b*ma}}}}function c(Y,oa,pa,ta,fa,Z){da=f(ya++);
+da.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(fa instanceof THREE.MeshBasicMaterial)A.__styleString=fa.color.__styleString;else if(fa instanceof THREE.MeshLambertMaterial)if(W){K.r=O.r;K.g=O.g;K.b=O.b;b(Z,ta,K);A.r=fa.color.r*K.r;A.g=fa.color.g*K.g;A.b=fa.color.b*K.b;A.updateStyleString()}else A.__styleString=fa.color.__styleString;else if(fa instanceof THREE.MeshDepthMaterial){ka=
+1-fa.__2near/(fa.__farPlusNear-ta.z*fa.__farMinusNear);A.setRGB(ka,ka,ka)}else fa instanceof THREE.MeshNormalMaterial&&A.setRGB(g(ta.normalWorld.x),g(ta.normalWorld.y),g(ta.normalWorld.z));fa.wireframe?da.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+fa.wireframeLinewidth+"; stroke-opacity: "+fa.opacity+"; stroke-linecap: "+fa.wireframeLinecap+"; stroke-linejoin: "+fa.wireframeLinejoin):da.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+fa.opacity);
+k.appendChild(da)}function d(Y,oa,pa,ta,fa,Z,ma){da=f(ya++);da.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(Z instanceof THREE.MeshBasicMaterial)A.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshLambertMaterial)if(W){K.r=O.r;K.g=O.g;K.b=O.b;b(ma,fa,K);A.r=Z.color.r*K.r;A.g=Z.color.g*K.g;A.b=Z.color.b*K.b;
+A.updateStyleString()}else A.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshDepthMaterial){ka=1-Z.__2near/(Z.__farPlusNear-fa.z*Z.__farMinusNear);A.setRGB(ka,ka,ka)}else Z instanceof THREE.MeshNormalMaterial&&A.setRGB(g(fa.normalWorld.x),g(fa.normalWorld.y),g(fa.normalWorld.z));Z.wireframe?da.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+Z.wireframeLinewidth+"; stroke-opacity: "+Z.opacity+"; stroke-linecap: "+Z.wireframeLinecap+"; stroke-linejoin: "+
+Z.wireframeLinejoin):da.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+Z.opacity);k.appendChild(da)}function f(Y){if(aa[Y]==null){aa[Y]=document.createElementNS("http://www.w3.org/2000/svg","path");Ea==0&&aa[Y].setAttribute("shape-rendering","crispEdges")}return aa[Y]}function g(Y){return Y<0?Math.min((1+Y)*0.5,0.5):0.5+Math.min(Y*0.5,0.5)}var h=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,o,x,y,v,B,F,I=new THREE.Rectangle,N=new THREE.Rectangle,
+W=!1,A=new THREE.Color(16777215),K=new THREE.Color(16777215),O=new THREE.Color(0),R=new THREE.Color(0),Ca=new THREE.Color(0),ka,va=new THREE.Vector3,aa=[],e=[],da,ya,za,Ea=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(Y){switch(Y){case "high":Ea=1;break;case "low":Ea=0}};this.setSize=function(Y,oa){m=Y;p=oa;o=m/2;x=p/2;k.setAttribute("viewBox",-o+" "+-x+" "+m+" "+p);k.setAttribute("width",m);k.setAttribute("height",p);I.set(-o,-x,o,x)};this.clear=
+function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(Y,oa){var pa,ta,fa,Z,ma,Da,ga,ia;this.autoClear&&this.clear();h=j.projectScene(Y,oa,this.sortElements);za=ya=0;if(W=Y.lights.length>0){ga=Y.lights;O.setRGB(0,0,0);R.setRGB(0,0,0);Ca.setRGB(0,0,0);pa=0;for(ta=ga.length;pa<ta;pa++){fa=ga[pa];Z=fa.color;if(fa instanceof THREE.AmbientLight){O.r+=Z.r;O.g+=Z.g;O.b+=Z.b}else if(fa instanceof THREE.DirectionalLight){R.r+=Z.r;R.g+=Z.g;R.b+=Z.b}else if(fa instanceof
+THREE.PointLight){Ca.r+=Z.r;Ca.g+=Z.g;Ca.b+=Z.b}}}pa=0;for(ta=h.length;pa<ta;pa++){ga=h[pa];N.empty();if(ga instanceof THREE.RenderableParticle){y=ga;y.x*=o;y.y*=-x;fa=0;for(Z=ga.materials.length;fa<Z;)fa++}else if(ga instanceof THREE.RenderableLine){y=ga.v1;v=ga.v2;y.positionScreen.x*=o;y.positionScreen.y*=-x;v.positionScreen.x*=o;v.positionScreen.y*=-x;N.addPoint(y.positionScreen.x,y.positionScreen.y);N.addPoint(v.positionScreen.x,v.positionScreen.y);if(I.instersects(N)){fa=0;for(Z=ga.materials.length;fa<
+Z;)if((ia=ga.materials[fa++])&&ia.opacity!=0){ma=y;Da=v;var ua=za++;if(e[ua]==null){e[ua]=document.createElementNS("http://www.w3.org/2000/svg","line");Ea==0&&e[ua].setAttribute("shape-rendering","crispEdges")}da=e[ua];da.setAttribute("x1",ma.positionScreen.x);da.setAttribute("y1",ma.positionScreen.y);da.setAttribute("x2",Da.positionScreen.x);da.setAttribute("y2",Da.positionScreen.y);if(ia instanceof THREE.LineBasicMaterial){A.__styleString=ia.color.__styleString;da.setAttribute("style","fill: none; stroke: "+
+A.__styleString+"; stroke-width: "+ia.linewidth+"; stroke-opacity: "+ia.opacity+"; stroke-linecap: "+ia.linecap+"; stroke-linejoin: "+ia.linejoin);k.appendChild(da)}}}}else if(ga instanceof THREE.RenderableFace3){y=ga.v1;v=ga.v2;B=ga.v3;y.positionScreen.x*=o;y.positionScreen.y*=-x;v.positionScreen.x*=o;v.positionScreen.y*=-x;B.positionScreen.x*=o;B.positionScreen.y*=-x;N.addPoint(y.positionScreen.x,y.positionScreen.y);N.addPoint(v.positionScreen.x,v.positionScreen.y);N.addPoint(B.positionScreen.x,
+B.positionScreen.y);if(I.instersects(N)){fa=0;for(Z=ga.meshMaterials.length;fa<Z;){ia=ga.meshMaterials[fa++];if(ia instanceof THREE.MeshFaceMaterial){ma=0;for(Da=ga.faceMaterials.length;ma<Da;)(ia=ga.faceMaterials[ma++])&&ia.opacity!=0&&c(y,v,B,ga,ia,Y)}else ia&&ia.opacity!=0&&c(y,v,B,ga,ia,Y)}}}else if(ga instanceof THREE.RenderableFace4){y=ga.v1;v=ga.v2;B=ga.v3;F=ga.v4;y.positionScreen.x*=o;y.positionScreen.y*=-x;v.positionScreen.x*=o;v.positionScreen.y*=-x;B.positionScreen.x*=o;B.positionScreen.y*=
+-x;F.positionScreen.x*=o;F.positionScreen.y*=-x;N.addPoint(y.positionScreen.x,y.positionScreen.y);N.addPoint(v.positionScreen.x,v.positionScreen.y);N.addPoint(B.positionScreen.x,B.positionScreen.y);N.addPoint(F.positionScreen.x,F.positionScreen.y);if(I.instersects(N)){fa=0;for(Z=ga.meshMaterials.length;fa<Z;){ia=ga.meshMaterials[fa++];if(ia instanceof THREE.MeshFaceMaterial){ma=0;for(Da=ga.faceMaterials.length;ma<Da;)(ia=ga.faceMaterials[ma++])&&ia.opacity!=0&&d(y,v,B,F,ga,ia,Y)}else ia&&ia.opacity!=
+0&&d(y,v,B,F,ga,ia,Y)}}}}}};
 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_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
@@ -232,119 +232,120 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,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(m,C,x){var u,z,K,M=m.vertices,E=M.length,P=m.colors,F=P.length,N=m.__vertexArray,I=m.__colorArray,Y=m.__sortArray,U=m.__dirtyVertices,ya=m.__dirtyColors;if(x.sortParticles){Ra.multiplySelf(x.matrixWorld);for(u=0;u<E;u++){z=M[u].position;Oa.copy(z);Ra.multiplyVector3(Oa);Y[u]=[Oa.z,u]}Y.sort(function(wa,ra){return ra[0]-wa[0]});for(u=0;u<E;u++){z=M[Y[u][1]].position;K=u*3;N[K]=z.x;N[K+1]=z.y;N[K+2]=z.z}for(u=0;u<F;u++){K=u*3;color=P[Y[u][1]];I[K]=color.r;
-I[K+1]=color.g;I[K+2]=color.b}}else{if(U)for(u=0;u<E;u++){z=M[u].position;K=u*3;N[K]=z.x;N[K+1]=z.y;N[K+2]=z.z}if(ya)for(u=0;u<F;u++){color=P[u];K=u*3;I[K]=color.r;I[K+1]=color.g;I[K+2]=color.b}}if(U||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,N,C)}if(ya||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,C)}}function d(m,C,x,u,z){u.program||oa.initMaterial(u,C,x,z);var K=u.program,M=K.uniforms,E=u.uniforms;
-if(K!=Ca){e.useProgram(K);Ca=K}e.uniformMatrix4fv(M.projectionMatrix,!1,$a);if(x&&(u instanceof THREE.MeshBasicMaterial||u instanceof THREE.MeshLambertMaterial||u instanceof THREE.MeshPhongMaterial||u instanceof THREE.LineBasicMaterial||u instanceof THREE.ParticleBasicMaterial||u.fog)){E.fogColor.value.setHex(x.color.hex);if(x instanceof THREE.Fog){E.fogNear.value=x.near;E.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)E.fogDensity.value=x.density}if(u instanceof THREE.MeshPhongMaterial||u instanceof
-THREE.MeshLambertMaterial||u.lights){var P,F,N=0,I=0,Y=0,U,ya,wa,ra,Na=S,Sa=Na.directional.colors,Ka=Na.directional.positions,Ja=Na.point.colors,Ia=Na.point.positions,Wa=Na.point.distances,D=0,da=0;x=F=ra=0;for(P=C.length;x<P;x++){F=C[x];U=F.color;ya=F.position;wa=F.intensity;ra=F.distance;if(F instanceof THREE.AmbientLight){N+=U.r;I+=U.g;Y+=U.b}else if(F instanceof THREE.DirectionalLight){ra=D*3;Sa[ra]=U.r*wa;Sa[ra+1]=U.g*wa;Sa[ra+2]=U.b*wa;Ka[ra]=ya.x;Ka[ra+1]=ya.y;Ka[ra+2]=ya.z;D+=1}else if(F instanceof
-THREE.PointLight){F=da*3;Ja[F]=U.r*wa;Ja[F+1]=U.g*wa;Ja[F+2]=U.b*wa;Ia[F]=ya.x;Ia[F+1]=ya.y;Ia[F+2]=ya.z;Wa[da]=ra;da+=1}}for(x=D*3;x<Sa.length;x++)Sa[x]=0;for(x=da*3;x<Ja.length;x++)Ja[x]=0;Na.point.length=da;Na.directional.length=D;Na.ambient[0]=N;Na.ambient[1]=I;Na.ambient[2]=Y;x=S;E.enableLighting.value=x.directional.length+x.point.length;E.ambientLightColor.value=x.ambient;E.directionalLightColor.value=x.directional.colors;E.directionalLightDirection.value=x.directional.positions;E.pointLightColor.value=
-x.point.colors;E.pointLightPosition.value=x.point.positions;E.pointLightDistance.value=x.point.distances}if(u instanceof THREE.MeshBasicMaterial||u instanceof THREE.MeshLambertMaterial||u instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(u.color.r,u.color.g,u.color.b);E.opacity.value=u.opacity;E.map.texture=u.map;E.lightMap.texture=u.lightMap;E.envMap.texture=u.envMap;E.reflectivity.value=u.reflectivity;E.refractionRatio.value=u.refractionRatio;E.combine.value=u.combine;E.useRefract.value=
-u.envMap&&u.envMap.mapping instanceof THREE.CubeRefractionMapping}if(u instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(u.color.r,u.color.g,u.color.b);E.opacity.value=u.opacity}else if(u instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(u.color.r,u.color.g,u.color.b);E.opacity.value=u.opacity;E.size.value=u.size;E.scale.value=ea.height/2;E.map.texture=u.map}else if(u instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(u.ambient.r,u.ambient.g,u.ambient.b);E.specular.value.setRGB(u.specular.r,
-u.specular.g,u.specular.b);E.shininess.value=u.shininess}else if(u instanceof THREE.MeshDepthMaterial){E.mNear.value=m.near;E.mFar.value=m.far;E.opacity.value=u.opacity}else if(u instanceof THREE.MeshNormalMaterial)E.opacity.value=u.opacity;for(var t in E)if(I=K.uniforms[t]){P=E[t];N=P.type;x=P.value;if(N=="i")e.uniform1i(I,x);else if(N=="f")e.uniform1f(I,x);else if(N=="fv1")e.uniform1fv(I,x);else if(N=="fv")e.uniform3fv(I,x);else if(N=="v2")e.uniform2f(I,x.x,x.y);else if(N=="v3")e.uniform3f(I,x.x,
-x.y,x.z);else if(N=="v4")e.uniform4f(I,x.x,x.y,x.z,x.w);else if(N=="c")e.uniform3f(I,x.r,x.g,x.b);else if(N=="t"){e.uniform1i(I,x);if(P=P.texture)if(P.image instanceof Array&&P.image.length==6){if(P.image.length==6){if(P.needsUpdate){if(P.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,P.image.__webglTextureCube);for(N=0;N<6;++N)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,0,0,e.RGBA,e.UNSIGNED_BYTE,P.image[N])}else{P.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
-P.image.__webglTextureCube);for(N=0;N<6;++N)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,P.image[N]);P.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,P,P.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);P.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,P.image.__webglTextureCube)}}else R(P,x)}}e.uniformMatrix4fv(M.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(M.normalMatrix,!1,z._normalMatrixArray);(u instanceof THREE.MeshShaderMaterial||
-u instanceof THREE.MeshPhongMaterial||u.envMap)&&e.uniform3f(M.cameraPosition,m.position.x,m.position.y,m.position.z);(u instanceof THREE.MeshShaderMaterial||u.envMap||u.skinning)&&e.uniformMatrix4fv(M.objectMatrix,!1,z._objectMatrixArray);(u instanceof THREE.MeshPhongMaterial||u instanceof THREE.MeshLambertMaterial||u instanceof THREE.MeshShaderMaterial||u.skinning)&&e.uniformMatrix4fv(M.viewMatrix,!1,ab);if(u instanceof THREE.ShadowVolumeDynamicMaterial){m=E.directionalLightDirection.value;m[0]=
--C.position.x;m[1]=-C.position.y;m[2]=-C.position.z;e.uniform3fv(M.directionalLightDirection,m);e.uniformMatrix4fv(M.objectMatrix,!1,z._objectMatrixArray);e.uniformMatrix4fv(M.viewMatrix,!1,ab)}if(u.skinning){e.uniformMatrix4fv(M.cameraInverseMatrix,!1,ab);e.uniformMatrix4fv(M.boneGlobalMatrices,!1,z.boneMatrices)}return K}function f(m,C,x,u,z,K){if(u.opacity!=0){var M;m=d(m,C,x,u,K).attributes;if(u.morphTargets){C=u.program.attributes;K.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[K.morphTargetBase]):
-e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(K.morphTargetForcedOrder.length){x=0;for(var E=K.morphTargetForcedOrder,P=K.morphTargetInfluences;x<u.numSupportedMorphTargets&&x<E.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[E[x]]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);K.__webglMorphTargetInfluences[x]=P[E[x]];x++}}else{E=[];var F=-1,N=0;P=K.morphTargetInfluences;var I,Y=P.length;x=0;for(K.morphTargetBase!==
--1&&(E[K.morphTargetBase]=!0);x<u.numSupportedMorphTargets;){for(I=0;I<Y;I++)if(!E[I]&&P[I]>F){N=I;F=P[N]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[N]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);K.__webglMorphTargetInfluences[x]=F;E[N]=1;F=-1;x++}}e.uniform1fv(u.program.uniforms.morphTargetInfluences,K.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(m.position,3,e.FLOAT,!1,0,0)}if(z.__webglCustomAttributes)for(M in z.__webglCustomAttributes)if(m[M]>=
-0){C=z.__webglCustomAttributes[M];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(m[M],C.size,e.FLOAT,!1,0,0)}if(m.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer);e.vertexAttribPointer(m.color,3,e.FLOAT,!1,0,0)}if(m.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglNormalBuffer);e.vertexAttribPointer(m.normal,3,e.FLOAT,!1,0,0)}if(m.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglTangentBuffer);e.vertexAttribPointer(m.tangent,4,e.FLOAT,!1,0,0)}if(m.uv>=0)if(z.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
-z.__webglUVBuffer);e.vertexAttribPointer(m.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv)}else e.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(z.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,z.__webglUV2Buffer);e.vertexAttribPointer(m.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(m.uv2)}else e.disableVertexAttribArray(m.uv2);if(u.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexABuffer);e.vertexAttribPointer(m.skinVertexA,
-4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexBBuffer);e.vertexAttribPointer(m.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinIndicesBuffer);e.vertexAttribPointer(m.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinWeightsBuffer);e.vertexAttribPointer(m.skinWeight,4,e.FLOAT,!1,0,0)}if(K instanceof THREE.Mesh)if(u.wireframe){e.lineWidth(u.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,
-z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(K instanceof THREE.Line){K=K.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(u.linewidth);e.drawArrays(K,0,z.__webglLineCount)}else if(K instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else K instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(m,C,
-x){if(!m.__webglVertexBuffer)m.__webglVertexBuffer=e.createBuffer();if(!m.__webglNormalBuffer)m.__webglNormalBuffer=e.createBuffer();if(m.hasPos){e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,m.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(m.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,m.__webglNormalBuffer);if(x==THREE.FlatShading){var u,z,K,M,E,P,F,N,I,Y,U=m.count*3;for(Y=
-0;Y<U;Y+=9){x=m.normalArray;u=x[Y];z=x[Y+1];K=x[Y+2];M=x[Y+3];P=x[Y+4];N=x[Y+5];E=x[Y+6];F=x[Y+7];I=x[Y+8];u=(u+M+E)/3;z=(z+P+F)/3;K=(K+N+I)/3;x[Y]=u;x[Y+1]=z;x[Y+2]=K;x[Y+3]=u;x[Y+4]=z;x[Y+5]=K;x[Y+6]=u;x[Y+7]=z;x[Y+8]=K}}e.bufferData(e.ARRAY_BUFFER,m.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,m.count);m.count=0}function h(m){if(pa!=m.doubleSided){m.doubleSided?e.disable(e.CULL_FACE):
-e.enable(e.CULL_FACE);pa=m.doubleSided}if(ta!=m.flipSided){m.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=m.flipSided}}function j(m){if(Z!=m){m?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Z=m}}function k(m){ua[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);ua[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);ua[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);ua[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);ua[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-
-m.n34);ua[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var C;for(m=0;m<6;m++){C=ua[m];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function n(m){for(var C=m.matrixWorld,x=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),u=0;u<6;u++){m=ua[u].x*C.n14+ua[u].y*C.n24+ua[u].z*C.n34+ua[u].w;if(m<=x)return!1}return!0}function p(m,C){m.list[m.count]=C;m.count+=1}function o(m){var C,x,u=m.object,z=m.opaque,K=m.transparent;K.count=0;m=z.count=0;for(C=u.materials.length;m<
-C;m++){x=u.materials[m];x.transparent?p(K,x):p(z,x)}}function w(m){var C,x,u,z,K=m.object,M=m.buffer,E=m.opaque,P=m.transparent;P.count=0;m=E.count=0;for(u=K.materials.length;m<u;m++){C=K.materials[m];if(C instanceof THREE.MeshFaceMaterial){C=0;for(x=M.materials.length;C<x;C++)(z=M.materials[C])&&(z.transparent?p(P,z):p(E,z))}else(z=C)&&(z.transparent?p(P,z):p(E,z))}}function y(m,C){return C.z-m.z}function v(m){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);
-e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,x=m.lights.length,u,z=m.lights,K=[],M,E,P,F,N,I=m.__webglShadowVolumes.length;for(C=0;C<x;C++){u=m.lights[C];if(u instanceof THREE.DirectionalLight){K[0]=-u.position.x;K[1]=-u.position.y;K[2]=-u.position.z;for(N=0;N<I;N++){u=m.__webglShadowVolumes[N].object;M=m.__webglShadowVolumes[N].buffer;E=u.materials[0];E.program||oa.initMaterial(E,
-z,undefined,u);E=E.program;P=E.uniforms;F=E.attributes;if(Ca!==E){e.useProgram(E);Ca=E;e.uniformMatrix4fv(P.projectionMatrix,!1,$a);e.uniformMatrix4fv(P.viewMatrix,!1,ab);e.uniform3fv(P.directionalLightDirection,K)}u.matrixWorld.flattenToArray(u._objectMatrixArray);e.uniformMatrix4fv(P.objectMatrix,!1,u._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,M.__webglVertexBuffer);e.vertexAttribPointer(F.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,M.__webglNormalBuffer);e.vertexAttribPointer(F.normal,
-3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,M.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,M.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,M.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);ga="";Ca=xa.program;e.useProgram(xa.program);e.uniformMatrix4fv(xa.projectionLocation,!1,$a);e.uniform1f(xa.darknessLocation,
-xa.darkness);e.bindBuffer(e.ARRAY_BUFFER,xa.vertexBuffer);e.vertexAttribPointer(xa.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(xa.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(X)}function B(m,C){var x,u,z;x=_sprite.attributes;var K=_sprite.uniforms,M=ja/ia,E,P=[],F=ia*0.5,N=ja*0.5,I=
-!0;e.useProgram(_sprite.program);Ca=_sprite.program;ga="";e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(x.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(K.projectionMatrix,!1,$a);e.activeTexture(e.TEXTURE0);e.uniform1i(K.map,0);x=0;for(u=m.__webglSprites.length;x<u;x++){z=m.__webglSprites[x];if(z.useScreenCoordinates)z.z=
--z.position.z;else{z._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}m.__webglSprites.sort(y);x=0;for(u=m.__webglSprites.length;x<u;x++){z=m.__webglSprites[x];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(K.useScreenCoordinates,1);e.uniform3f(K.screenPosition,(z.position.x-F)/F,(N-z.position.y)/N,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(K.useScreenCoordinates,
-0);e.uniform1i(K.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(K.modelViewMatrix,!1,z._modelViewMatrixArray)}E=z.map.image.width/(z.affectedByDistance?1:ja);P[0]=E*M*z.scale.x;P[1]=E*z.scale.y;e.uniform2f(K.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(K.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(K.alignment,z.alignment.x,z.alignment.y);e.uniform1f(K.opacity,z.opacity);e.uniform1f(K.rotation,z.rotation);e.uniform2fv(K.scale,P);if(z.mergeWith3D&&!I){e.enable(e.DEPTH_TEST);I=!0}else if(!z.mergeWith3D&&
-I){e.disable(e.DEPTH_TEST);I=!1}J(z.blending);R(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(X)}function G(m,C){var x,u,z=m.__webglLensFlares.length,K,M,E,P=new THREE.Vector3,F=ja/ia,N=ia*0.5,I=ja*0.5,Y=16/ja,U=[Y*F,Y],ya=[1,1,0],wa=[1,1],ra=fa.uniforms;x=fa.attributes;e.useProgram(fa.program);Ca=fa.program;ga="";e.uniform1i(ra.occlusionMap,0);e.uniform1i(ra.map,1);e.bindBuffer(e.ARRAY_BUFFER,fa.vertexBuffer);e.vertexAttribPointer(x.vertex,
-2,e.FLOAT,!1,16,0);e.vertexAttribPointer(x.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,fa.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.activeTexture(e.TEXTURE1);for(u=0;u<z;u++){x=m.__webglLensFlares[u].object;P.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(P);C.projectionMatrix.multiplyVector3(P);ya[0]=P.x;ya[1]=P.y;ya[2]=P.z;wa[0]=ya[0]*N+N;wa[1]=
-ya[1]*I+I;if(fa.hasVertexTexture||wa[0]>0&&wa[0]<ia&&wa[1]>0&&wa[1]<ja){e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,wa[0]-8,wa[1]-8,16,16,0);e.uniform1i(ra.renderType,0);e.uniform2fv(ra.scale,U);e.uniform3fv(ra.screenPosition,ya);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,wa[0]-8,wa[1]-8,16,16,0);e.uniform1i(ra.renderType,1);e.disable(e.DEPTH_TEST);
-e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=ya[0];x.positionScreen.y=ya[1];x.positionScreen.z=ya[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(ra.renderType,2);e.enable(e.BLEND);K=0;for(M=x.lensFlares.length;K<M;K++){E=x.lensFlares[K];if(E.opacity>0.001&&E.scale>0.001){ya[0]=E.x;ya[1]=E.y;ya[2]=E.z;Y=E.size*E.scale/ja;U[0]=Y*F;U[1]=Y;e.uniform3fv(ra.screenPosition,ya);e.uniform2fv(ra.scale,U);
-e.uniform1f(ra.rotation,E.rotation);e.uniform1f(ra.opacity,E.opacity);J(E.blending);R(E.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(X)}function H(m,C){m._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}function L(m){var C,x,u,z,K;if(m instanceof THREE.Mesh){x=m.geometry;for(C in x.geometryGroups){u=
-x.geometryGroups[C];K=!1;for(z in u.__webglCustomAttributes)if(u.__webglCustomAttributes[z].needsUpdate){K=!0;break}if(x.__dirtyVertices||x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||K){K=e.DYNAMIC_DRAW;var M=void 0,E=void 0,P=void 0,F=void 0;P=void 0;var N=void 0,I=void 0,Y=void 0,U=void 0,ya=void 0,wa=void 0,ra=void 0,Na=void 0,Sa=void 0,Ka=void 0,Ja=void 0,Ia=void 0,Wa=void 0;I=void 0;Y=void 0;F=void 0;U=void 0;F=void 0;var D=void 0,
-da=void 0;I=void 0;D=void 0;da=void 0;var t=void 0,bb=void 0;D=void 0;da=void 0;t=void 0;bb=void 0;D=void 0;da=void 0;t=void 0;bb=void 0;D=void 0;da=void 0;t=void 0;F=void 0;U=void 0;N=void 0;P=void 0;P=void 0;D=void 0;da=void 0;t=void 0;var eb=void 0,Ta=0,Qa=0,hb=0,gb=0,cb=0,fb=0,sa=0,Va=0,Pa=0,T=0,Xa=0;da=D=0;var La=u.__vertexArray,W=u.__uvArray,za=u.__uv2Array,na=u.__normalArray,aa=u.__tangentArray,Ba=u.__colorArray,qa=u.__skinVertexAArray,ha=u.__skinVertexBArray,Q=u.__skinIndexArray,Ea=u.__skinWeightArray,
-ib=u.__morphTargetsArrays,Ya=u.__webglCustomAttributes;t=void 0;var Za=u.__faceArray,db=u.__lineArray,jb=u.__needsSmoothNormals;wa=u.__vertexColorType;ya=u.__uvType;ra=u.__normalType;var Ua=m.geometry,sb=Ua.__dirtyVertices,tb=Ua.__dirtyElements,rb=Ua.__dirtyUvs,ub=Ua.__dirtyNormals,vb=Ua.__dirtyTangents,wb=Ua.__dirtyColors,xb=Ua.__dirtyMorphTargets,nb=Ua.vertices,yb=u.faces,Bb=Ua.faces,zb=Ua.faceVertexUvs[0],Ab=Ua.faceVertexUvs[1],ob=Ua.skinVerticesA,pb=Ua.skinVerticesB,qb=Ua.skinIndices,lb=Ua.skinWeights,
-mb=Ua.edgeFaces,kb=Ua.morphTargets;if(Ya)for(eb in Ya){Ya[eb].offset=0;Ya[eb].offsetSrc=0}M=0;for(E=yb.length;M<E;M++){P=yb[M];F=Bb[P];zb&&(Na=zb[P]);Ab&&(Sa=Ab[P]);P=F.vertexNormals;N=F.normal;I=F.vertexColors;Y=F.color;U=F.vertexTangents;if(F instanceof THREE.Face3){if(sb){Ka=nb[F.a].position;Ja=nb[F.b].position;Ia=nb[F.c].position;La[Qa]=Ka.x;La[Qa+1]=Ka.y;La[Qa+2]=Ka.z;La[Qa+3]=Ja.x;La[Qa+4]=Ja.y;La[Qa+5]=Ja.z;La[Qa+6]=Ia.x;La[Qa+7]=Ia.y;La[Qa+8]=Ia.z;Qa+=9}if(Ya)for(eb in Ya){t=Ya[eb];if(t.needsUpdate){D=
-t.offset;da=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[F.a];t.array[D+1]=t.value[F.b];t.array[D+2]=t.value[F.c]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[da];t.array[D+1]=t.value[da];t.array[D+2]=t.value[da];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[da+0];t.array[D+1]=t.value[da+1];t.array[D+2]=t.value[da+2];t.offsetSrc+=3}t.offset+=3}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Ka=t.value[F.a];Ja=
-t.value[F.b];Ia=t.value[F.c]}else if(t.boundTo==="faces"){Ka=t.value[da];Ja=t.value[da];Ia=t.value[da];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Ka=t.value[da+0];Ja=t.value[da+1];Ia=t.value[da+2];t.offsetSrc+=3}if(t.size===2){t.array[D+0]=Ka.x;t.array[D+1]=Ka.y;t.array[D+2]=Ja.x;t.array[D+3]=Ja.y;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.offset+=6}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Ka.r;t.array[D+1]=Ka.g;t.array[D+2]=Ka.b;t.array[D+3]=Ja.r;t.array[D+4]=Ja.g;t.array[D+5]=Ja.b;t.array[D+
-6]=Ia.r;t.array[D+7]=Ia.g;t.array[D+8]=Ia.b}else{t.array[D+0]=Ka.x;t.array[D+1]=Ka.y;t.array[D+2]=Ka.z;t.array[D+3]=Ja.x;t.array[D+4]=Ja.y;t.array[D+5]=Ja.z;t.array[D+6]=Ia.x;t.array[D+7]=Ia.y;t.array[D+8]=Ia.z}t.offset+=9}else{t.array[D+0]=Ka.x;t.array[D+1]=Ka.y;t.array[D+2]=Ka.z;t.array[D+3]=Ka.w;t.array[D+4]=Ja.x;t.array[D+5]=Ja.y;t.array[D+6]=Ja.z;t.array[D+7]=Ja.w;t.array[D+8]=Ia.x;t.array[D+9]=Ia.y;t.array[D+10]=Ia.z;t.array[D+11]=Ia.w;t.offset+=12}}}}if(xb){D=0;for(da=kb.length;D<da;D++){Ka=
-kb[D].vertices[F.a].position;Ja=kb[D].vertices[F.b].position;Ia=kb[D].vertices[F.c].position;t=ib[D];t[Xa+0]=Ka.x;t[Xa+1]=Ka.y;t[Xa+2]=Ka.z;t[Xa+3]=Ja.x;t[Xa+4]=Ja.y;t[Xa+5]=Ja.z;t[Xa+6]=Ia.x;t[Xa+7]=Ia.y;t[Xa+8]=Ia.z}Xa+=9}if(lb.length){D=lb[F.a];da=lb[F.b];t=lb[F.c];Ea[T]=D.x;Ea[T+1]=D.y;Ea[T+2]=D.z;Ea[T+3]=D.w;Ea[T+4]=da.x;Ea[T+5]=da.y;Ea[T+6]=da.z;Ea[T+7]=da.w;Ea[T+8]=t.x;Ea[T+9]=t.y;Ea[T+10]=t.z;Ea[T+11]=t.w;D=qb[F.a];da=qb[F.b];t=qb[F.c];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=da.x;
-Q[T+5]=da.y;Q[T+6]=da.z;Q[T+7]=da.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;D=ob[F.a];da=ob[F.b];t=ob[F.c];qa[T]=D.x;qa[T+1]=D.y;qa[T+2]=D.z;qa[T+3]=1;qa[T+4]=da.x;qa[T+5]=da.y;qa[T+6]=da.z;qa[T+7]=1;qa[T+8]=t.x;qa[T+9]=t.y;qa[T+10]=t.z;qa[T+11]=1;D=pb[F.a];da=pb[F.b];t=pb[F.c];ha[T]=D.x;ha[T+1]=D.y;ha[T+2]=D.z;ha[T+3]=1;ha[T+4]=da.x;ha[T+5]=da.y;ha[T+6]=da.z;ha[T+7]=1;ha[T+8]=t.x;ha[T+9]=t.y;ha[T+10]=t.z;ha[T+11]=1;T+=12}if(wb&&wa){if(I.length==3&&wa==THREE.VertexColors){F=I[0];D=I[1];da=I[2]}else da=
-D=F=Y;Ba[Pa]=F.r;Ba[Pa+1]=F.g;Ba[Pa+2]=F.b;Ba[Pa+3]=D.r;Ba[Pa+4]=D.g;Ba[Pa+5]=D.b;Ba[Pa+6]=da.r;Ba[Pa+7]=da.g;Ba[Pa+8]=da.b;Pa+=9}if(vb&&Ua.hasTangents){I=U[0];Y=U[1];F=U[2];aa[sa]=I.x;aa[sa+1]=I.y;aa[sa+2]=I.z;aa[sa+3]=I.w;aa[sa+4]=Y.x;aa[sa+5]=Y.y;aa[sa+6]=Y.z;aa[sa+7]=Y.w;aa[sa+8]=F.x;aa[sa+9]=F.y;aa[sa+10]=F.z;aa[sa+11]=F.w;sa+=12}if(ub&&ra)if(P.length==3&&jb)for(U=0;U<3;U++){N=P[U];na[fb]=N.x;na[fb+1]=N.y;na[fb+2]=N.z;fb+=3}else for(U=0;U<3;U++){na[fb]=N.x;na[fb+1]=N.y;na[fb+2]=N.z;fb+=3}if(rb&&
-Na!==undefined&&ya)for(U=0;U<3;U++){P=Na[U];W[hb]=P.u;W[hb+1]=P.v;hb+=2}if(rb&&Sa!==undefined&&ya)for(U=0;U<3;U++){P=Sa[U];za[gb]=P.u;za[gb+1]=P.v;gb+=2}if(tb){Za[cb]=Ta;Za[cb+1]=Ta+1;Za[cb+2]=Ta+2;cb+=3;db[Va]=Ta;db[Va+1]=Ta+1;db[Va+2]=Ta;db[Va+3]=Ta+2;db[Va+4]=Ta+1;db[Va+5]=Ta+2;Va+=6;Ta+=3}}else if(F instanceof THREE.Face4){if(sb){Ka=nb[F.a].position;Ja=nb[F.b].position;Ia=nb[F.c].position;Wa=nb[F.d].position;La[Qa]=Ka.x;La[Qa+1]=Ka.y;La[Qa+2]=Ka.z;La[Qa+3]=Ja.x;La[Qa+4]=Ja.y;La[Qa+5]=Ja.z;La[Qa+
-6]=Ia.x;La[Qa+7]=Ia.y;La[Qa+8]=Ia.z;La[Qa+9]=Wa.x;La[Qa+10]=Wa.y;La[Qa+11]=Wa.z;Qa+=12}if(Ya)for(eb in Ya){t=Ya[eb];if(t.needsUpdate){D=t.offset;da=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[F.a];t.array[D+1]=t.value[F.b];t.array[D+2]=t.value[F.c];t.array[D+2]=t.value[F.d]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[da];t.array[D+1]=t.value[da];t.array[D+2]=t.value[da];t.array[D+2]=t.value[da];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+
-0]=t.value[da+0];t.array[D+1]=t.value[da+1];t.array[D+2]=t.value[da+2];t.array[D+2]=t.value[da+3];t.offsetSrc+=4}t.offset+=4}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Ka=t.value[F.a];Ja=t.value[F.b];Ia=t.value[F.c];Wa=t.value[F.d]}else if(t.boundTo==="faces"){Ka=t.value[da];Ja=t.value[da];Ia=t.value[da];Wa=t.value[da];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Ka=t.value[da+0];Ja=t.value[da+1];Ia=t.value[da+2];Wa=t.value[da+3];t.offsetSrc+=4}if(t.size===2){t.array[D+0]=Ka.x;t.array[D+
-1]=Ka.y;t.array[D+2]=Ja.x;t.array[D+3]=Ja.y;t.array[D+4]=Ia.x;t.array[D+5]=Ia.y;t.array[D+6]=Wa.x;t.array[D+7]=Wa.y;t.offset+=8}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Ka.r;t.array[D+1]=Ka.g;t.array[D+2]=Ka.b;t.array[D+3]=Ja.r;t.array[D+4]=Ja.g;t.array[D+5]=Ja.b;t.array[D+6]=Ia.r;t.array[D+7]=Ia.g;t.array[D+8]=Ia.b;t.array[D+9]=Wa.r;t.array[D+10]=Wa.g;t.array[D+11]=Wa.b}else{t.array[D+0]=Ka.x;t.array[D+1]=Ka.y;t.array[D+2]=Ka.z;t.array[D+3]=Ja.x;t.array[D+4]=Ja.y;t.array[D+5]=Ja.z;t.array[D+
-6]=Ia.x;t.array[D+7]=Ia.y;t.array[D+8]=Ia.z;t.array[D+9]=Wa.x;t.array[D+10]=Wa.y;t.array[D+11]=Wa.z}t.offset+=12}else{t.array[D+0]=Ka.x;t.array[D+1]=Ka.y;t.array[D+2]=Ka.z;t.array[D+3]=Ka.w;t.array[D+4]=Ja.x;t.array[D+5]=Ja.y;t.array[D+6]=Ja.z;t.array[D+7]=Ja.w;t.array[D+8]=Ia.x;t.array[D+9]=Ia.y;t.array[D+10]=Ia.z;t.array[D+11]=Ia.w;t.array[D+12]=Wa.x;t.array[D+13]=Wa.y;t.array[D+14]=Wa.z;t.array[D+15]=Wa.w;t.offset+=16}}}}if(xb){D=0;for(da=kb.length;D<da;D++){Ka=kb[D].vertices[F.a].position;Ja=
-kb[D].vertices[F.b].position;Ia=kb[D].vertices[F.c].position;Wa=kb[D].vertices[F.d].position;t=ib[D];t[Xa+0]=Ka.x;t[Xa+1]=Ka.y;t[Xa+2]=Ka.z;t[Xa+3]=Ja.x;t[Xa+4]=Ja.y;t[Xa+5]=Ja.z;t[Xa+6]=Ia.x;t[Xa+7]=Ia.y;t[Xa+8]=Ia.z;t[Xa+9]=Wa.x;t[Xa+10]=Wa.y;t[Xa+11]=Wa.z}Xa+=12}if(lb.length){D=lb[F.a];da=lb[F.b];t=lb[F.c];bb=lb[F.d];Ea[T]=D.x;Ea[T+1]=D.y;Ea[T+2]=D.z;Ea[T+3]=D.w;Ea[T+4]=da.x;Ea[T+5]=da.y;Ea[T+6]=da.z;Ea[T+7]=da.w;Ea[T+8]=t.x;Ea[T+9]=t.y;Ea[T+10]=t.z;Ea[T+11]=t.w;Ea[T+12]=bb.x;Ea[T+13]=bb.y;Ea[T+
-14]=bb.z;Ea[T+15]=bb.w;D=qb[F.a];da=qb[F.b];t=qb[F.c];bb=qb[F.d];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=D.w;Q[T+4]=da.x;Q[T+5]=da.y;Q[T+6]=da.z;Q[T+7]=da.w;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=t.w;Q[T+12]=bb.x;Q[T+13]=bb.y;Q[T+14]=bb.z;Q[T+15]=bb.w;D=ob[F.a];da=ob[F.b];t=ob[F.c];bb=ob[F.d];qa[T]=D.x;qa[T+1]=D.y;qa[T+2]=D.z;qa[T+3]=1;qa[T+4]=da.x;qa[T+5]=da.y;qa[T+6]=da.z;qa[T+7]=1;qa[T+8]=t.x;qa[T+9]=t.y;qa[T+10]=t.z;qa[T+11]=1;qa[T+12]=bb.x;qa[T+13]=bb.y;qa[T+14]=bb.z;qa[T+15]=1;D=pb[F.a];da=
-pb[F.b];t=pb[F.c];F=pb[F.d];ha[T]=D.x;ha[T+1]=D.y;ha[T+2]=D.z;ha[T+3]=1;ha[T+4]=da.x;ha[T+5]=da.y;ha[T+6]=da.z;ha[T+7]=1;ha[T+8]=t.x;ha[T+9]=t.y;ha[T+10]=t.z;ha[T+11]=1;ha[T+12]=F.x;ha[T+13]=F.y;ha[T+14]=F.z;ha[T+15]=1;T+=16}if(wb&&wa){if(I.length==4&&wa==THREE.VertexColors){F=I[0];D=I[1];da=I[2];I=I[3]}else I=da=D=F=Y;Ba[Pa]=F.r;Ba[Pa+1]=F.g;Ba[Pa+2]=F.b;Ba[Pa+3]=D.r;Ba[Pa+4]=D.g;Ba[Pa+5]=D.b;Ba[Pa+6]=da.r;Ba[Pa+7]=da.g;Ba[Pa+8]=da.b;Ba[Pa+9]=I.r;Ba[Pa+10]=I.g;Ba[Pa+11]=I.b;Pa+=12}if(vb&&Ua.hasTangents){I=
-U[0];Y=U[1];F=U[2];U=U[3];aa[sa]=I.x;aa[sa+1]=I.y;aa[sa+2]=I.z;aa[sa+3]=I.w;aa[sa+4]=Y.x;aa[sa+5]=Y.y;aa[sa+6]=Y.z;aa[sa+7]=Y.w;aa[sa+8]=F.x;aa[sa+9]=F.y;aa[sa+10]=F.z;aa[sa+11]=F.w;aa[sa+12]=U.x;aa[sa+13]=U.y;aa[sa+14]=U.z;aa[sa+15]=U.w;sa+=16}if(ub&&ra)if(P.length==4&&jb)for(U=0;U<4;U++){N=P[U];na[fb]=N.x;na[fb+1]=N.y;na[fb+2]=N.z;fb+=3}else for(U=0;U<4;U++){na[fb]=N.x;na[fb+1]=N.y;na[fb+2]=N.z;fb+=3}if(rb&&Na!==undefined&&ya)for(U=0;U<4;U++){P=Na[U];W[hb]=P.u;W[hb+1]=P.v;hb+=2}if(rb&&Sa!==undefined&&
-ya)for(U=0;U<4;U++){P=Sa[U];za[gb]=P.u;za[gb+1]=P.v;gb+=2}if(tb){Za[cb]=Ta;Za[cb+1]=Ta+1;Za[cb+2]=Ta+3;Za[cb+3]=Ta+1;Za[cb+4]=Ta+2;Za[cb+5]=Ta+3;cb+=6;db[Va]=Ta;db[Va+1]=Ta+1;db[Va+2]=Ta;db[Va+3]=Ta+3;db[Va+4]=Ta+1;db[Va+5]=Ta+2;db[Va+6]=Ta+2;db[Va+7]=Ta+3;Va+=8;Ta+=4}}}if(mb){M=0;for(E=mb.length;M<E;M++){Za[cb]=mb[M].a;Za[cb+1]=mb[M].b;Za[cb+2]=mb[M].c;Za[cb+3]=mb[M].a;Za[cb+4]=mb[M].c;Za[cb+5]=mb[M].d;cb+=6}}if(sb){e.bindBuffer(e.ARRAY_BUFFER,u.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,La,
-K)}if(Ya)for(eb in Ya){t=Ya[eb];if(t.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);e.bufferData(e.ARRAY_BUFFER,t.array,K);t.needsUpdate=!1}}if(xb){D=0;for(da=kb.length;D<da;D++){e.bindBuffer(e.ARRAY_BUFFER,u.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,ib[D],K)}}if(wb&&Pa>0){e.bindBuffer(e.ARRAY_BUFFER,u.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,K)}if(ub){e.bindBuffer(e.ARRAY_BUFFER,u.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,na,K)}if(vb&&Ua.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
-u.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,aa,K)}if(rb&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,u.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,W,K)}if(rb&&gb>0){e.bindBuffer(e.ARRAY_BUFFER,u.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,za,K)}if(tb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Za,K);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,db,K)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinVertexABuffer);
-e.bufferData(e.ARRAY_BUFFER,qa,K);e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ha,K);e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Q,K);e.bindBuffer(e.ARRAY_BUFFER,u.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,K)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(m instanceof THREE.Ribbon){x=m.geometry;if(x.__dirtyVertices||
-x.__dirtyColors){m=x;C=e.DYNAMIC_DRAW;wa=m.vertices;u=m.colors;ra=wa.length;K=u.length;Na=m.__vertexArray;M=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(E=0;E<ra;E++){ya=wa[E].position;z=E*3;Na[z]=ya.x;Na[z+1]=ya.y;Na[z+2]=ya.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Na,C)}if(Sa){for(E=0;E<K;E++){color=u[E];z=E*3;M[z]=color.r;M[z+1]=color.g;M[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}}x.__dirtyVertices=
-!1;x.__dirtyColors=!1}else if(m instanceof THREE.Line){x=m.geometry;if(x.__dirtyVertices||x.__dirtyColors){m=x;C=e.DYNAMIC_DRAW;wa=m.vertices;u=m.colors;ra=wa.length;K=u.length;Na=m.__vertexArray;M=m.__colorArray;Sa=m.__dirtyColors;if(m.__dirtyVertices){for(E=0;E<ra;E++){ya=wa[E].position;z=E*3;Na[z]=ya.x;Na[z+1]=ya.y;Na[z+2]=ya.z}e.bindBuffer(e.ARRAY_BUFFER,m.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Na,C)}if(Sa){for(E=0;E<K;E++){color=u[E];z=E*3;M[z]=color.r;M[z+1]=color.g;M[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
-m.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(m instanceof THREE.ParticleSystem){x=m.geometry;(x.__dirtyVertices||x.__dirtyColors||m.sortParticles)&&c(x,e.DYNAMIC_DRAW,m);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function V(m){function C(Y){var U=[];x=0;for(u=Y.length;x<u;x++)Y[x]==undefined?U.push("undefined"):U.push(Y[x].id);return U.join("_")}var x,u,z,K,M,E,P,F,N={},I=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};
-z=0;for(K=m.faces.length;z<K;z++){M=m.faces[z];E=M.materials;P=C(E);N[P]==undefined&&(N[P]={hash:P,counter:0});F=N[P].hash+"_"+N[P].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:E,vertices:0,numMorphTargets:I});M=M instanceof THREE.Face3?3:4;if(m.geometryGroups[F].vertices+M>65535){N[P].counter+=1;F=N[P].hash+"_"+N[P].counter;m.geometryGroups[F]==undefined&&(m.geometryGroups[F]={faces:[],materials:E,vertices:0,numMorphTargets:I})}m.geometryGroups[F].faces.push(z);
-m.geometryGroups[F].vertices+=M}}function A(m,C,x){m.push({buffer:C,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(m){if(m!=ga){switch(m){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,
-e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ga=m}}function O(m,C,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(m,e.TEXTURE_WRAP_S,$(C.wrapS));e.texParameteri(m,e.TEXTURE_WRAP_T,$(C.wrapT));e.texParameteri(m,e.TEXTURE_MAG_FILTER,$(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,$(C.minFilter));e.generateMipmap(m)}else{e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);
-e.texParameteri(m,e.TEXTURE_MAG_FILTER,va(C.magFilter));e.texParameteri(m,e.TEXTURE_MIN_FILTER,va(C.minFilter))}}function R(m,C){if(m.needsUpdate){if(m.__webglInit){e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,m.image)}else{m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,m.image);m.__webglInit=!0}O(e.TEXTURE_2D,m,m.image);e.bindTexture(e.TEXTURE_2D,null);
-m.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,m.__webglTexture)}function Fa(m){if(m&&!m.__webglFramebuffer){if(m.depthBuffer===undefined)m.depthBuffer=!0;if(m.stencilBuffer===undefined)m.stencilBuffer=!0;m.__webglFramebuffer=e.createFramebuffer();m.__webglRenderbuffer=e.createRenderbuffer();m.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,m.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,$(m.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,
-$(m.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,$(m.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,$(m.minFilter));e.texImage2D(e.TEXTURE_2D,0,$(m.format),m.width,m.height,0,$(m.format),$(m.type),null);e.bindRenderbuffer(e.RENDERBUFFER,m.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m.__webglTexture,0);if(m.depthBuffer&&!m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,
-e.DEPTH_COMPONENT16,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else if(m.depthBuffer&&m.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,m.width,m.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,m.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,m.width,m.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,
-null)}var C,x;if(m){C=m.__webglFramebuffer;x=m.width;m=m.height}else{C=null;x=ia;m=ja}if(C!=Ha){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(la,Ga,x,m);Ha=C}}function ka(m,C){var x;if(m=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else m=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,C);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(C);return null}return x}function va(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
-default:return e.LINEAR}}function $(m){switch(m){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
-var e,ea=document.createElement("canvas"),Aa=[],Ca=null,Ha=null,X=!0,oa=this,pa=null,ta=null,ga=null,Z=null,la=0,Ga=0,ia=0,ja=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ra=new THREE.Matrix4,$a=new Float32Array(16),ab=new Float32Array(16),Oa=new THREE.Vector4,S={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ca=!0,ma=!0,Da=new THREE.Color(0),Ma=0;if(b){if(b.stencil!=
-undefined)ca=b.stencil;if(b.antialias!==undefined)ma=b.antialias;b.clearColor!==undefined&&Da.setHex(b.clearColor);if(b.clearAlpha!==undefined)Ma=b.clearAlpha}this.maxMorphTargets=8;this.domElement=ea;this.autoClear=!0;this.sortObjects=!0;(function(m,C,x,u){try{if(!(e=ea.getContext("experimental-webgl",{antialias:m,stencil:u})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+
-" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,x)})(ma,Da,Ma,ca);this.context=e;if(ca){var xa={};xa.vertices=new Float32Array(12);xa.faces=new Uint16Array(6);xa.darkness=0.5;xa.vertices[0]=-20;xa.vertices[1]=-20;xa.vertices[2]=-1;xa.vertices[3]=
-20;xa.vertices[4]=-20;xa.vertices[5]=-1;xa.vertices[6]=20;xa.vertices[7]=20;xa.vertices[8]=-1;xa.vertices[9]=-20;xa.vertices[10]=20;xa.vertices[11]=-1;xa.faces[0]=0;xa.faces[1]=1;xa.faces[2]=2;xa.faces[3]=0;xa.faces[4]=2;xa.faces[5]=3;xa.vertexBuffer=e.createBuffer();xa.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,xa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,xa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,xa.faces,
-e.STATIC_DRAW);xa.program=e.createProgram();e.attachShader(xa.program,ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(xa.program,ka("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(xa.program);xa.vertexLocation=e.getAttribLocation(xa.program,"position");xa.projectionLocation=e.getUniformLocation(xa.program,"projectionMatrix");xa.darknessLocation=e.getUniformLocation(xa.program,"darkness")}var fa={};fa.vertices=new Float32Array(16);fa.faces=new Uint16Array(6);
-b=0;fa.vertices[b++]=-1;fa.vertices[b++]=-1;fa.vertices[b++]=0;fa.vertices[b++]=0;fa.vertices[b++]=1;fa.vertices[b++]=-1;fa.vertices[b++]=1;fa.vertices[b++]=0;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=1;fa.vertices[b++]=-1;fa.vertices[b++]=1;fa.vertices[b++]=0;fa.vertices[b++]=1;b=0;fa.faces[b++]=0;fa.faces[b++]=1;fa.faces[b++]=2;fa.faces[b++]=0;fa.faces[b++]=2;fa.faces[b++]=3;fa.vertexBuffer=e.createBuffer();fa.elementBuffer=e.createBuffer();fa.tempTexture=e.createTexture();
-fa.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,fa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,fa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,fa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,fa.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,
-e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,fa.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=
-0){fa.hasVertexTexture=!1;fa.program=e.createProgram();e.attachShader(fa.program,ka("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(fa.program,ka("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{fa.hasVertexTexture=!0;fa.program=e.createProgram();e.attachShader(fa.program,ka("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(fa.program,ka("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(fa.program);fa.attributes=
-{};fa.uniforms={};fa.attributes.vertex=e.getAttribLocation(fa.program,"position");fa.attributes.uv=e.getAttribLocation(fa.program,"UV");fa.uniforms.renderType=e.getUniformLocation(fa.program,"renderType");fa.uniforms.map=e.getUniformLocation(fa.program,"map");fa.uniforms.occlusionMap=e.getUniformLocation(fa.program,"occlusionMap");fa.uniforms.opacity=e.getUniformLocation(fa.program,"opacity");fa.uniforms.scale=e.getUniformLocation(fa.program,"scale");fa.uniforms.rotation=e.getUniformLocation(fa.program,
-"rotation");fa.uniforms.screenPosition=e.getUniformLocation(fa.program,"screenPosition");e.enableVertexAttribArray(fa.attributes.vertex);e.enableVertexAttribArray(fa.attributes.uv);_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);
-e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,ka("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,ka("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=
-e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=
-e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);
-this.setSize=function(m,C){ea.width=m;ea.height=C;this.setViewport(0,0,ea.width,ea.height)};this.setViewport=function(m,C,x,u){la=m;Ga=C;ia=x;ja=u;e.viewport(la,Ga,ia,ja)};this.setScissor=function(m,C,x,u){e.scissor(m,C,x,u)};this.enableScissorTest=function(m){m?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){X=m;e.depthMask(m)};this.setClearColorHex=function(m,C){var x=new THREE.Color(m);e.clearColor(x.r,x.g,x.b,C)};this.setClearColor=function(m,C){e.clearColor(m.r,
-m.g,m.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(m){xa.darkness=m};this.initMaterial=function(m,C,x,u){var z,K,M;if(m instanceof THREE.MeshDepthMaterial)M="depth";else if(m instanceof THREE.ShadowVolumeDynamicMaterial)M="shadowVolumeDynamic";else if(m instanceof THREE.MeshNormalMaterial)M="normal";else if(m instanceof THREE.MeshBasicMaterial)M="basic";else if(m instanceof THREE.MeshLambertMaterial)M="lambert";
-else if(m instanceof THREE.MeshPhongMaterial)M="phong";else if(m instanceof THREE.LineBasicMaterial)M="basic";else m instanceof THREE.ParticleBasicMaterial&&(M="particle_basic");if(M){var E=THREE.ShaderLib[M];m.uniforms=Uniforms.clone(E.uniforms);m.vertexShader=E.vertexShader;m.fragmentShader=E.fragmentShader}var P,F,N;P=N=E=0;for(F=C.length;P<F;P++){K=C[P];K instanceof THREE.DirectionalLight&&N++;K instanceof THREE.PointLight&&E++}if(E+N<=4)C=N;else{C=Math.ceil(4*N/(E+N));E=4-C}K={directional:C,
-point:E};N=50;if(u!==undefined&&u instanceof THREE.SkinnedMesh)N=u.bones.length;var I;a:{P=m.fragmentShader;F=m.vertexShader;E=m.uniforms;C=m.attributes;x={map:!!m.map,envMap:!!m.envMap,lightMap:!!m.lightMap,vertexColors:m.vertexColors,fog:x,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:K.directional,maxPointLights:K.point,maxBones:N};var Y;K=[];if(M)K.push(M);else{K.push(P);K.push(F)}for(Y in x){K.push(Y);K.push(x[Y])}M=
-K.join();Y=0;for(K=Aa.length;Y<K;Y++)if(Aa[Y].code==M){I=Aa[Y].program;break a}Y=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,x.fog?"#define USE_FOG":"",x.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+x.maxPointLights,"#define MAX_BONES "+x.maxBones,x.map?"#define USE_MAP":"",x.envMap?"#define USE_ENVMAP":"",x.lightMap?"#define USE_LIGHTMAP":"",x.vertexColors?"#define USE_COLOR":"",x.skinning?"#define USE_SKINNING":"",x.morphTargets?"#define USE_MORPHTARGETS":"",x.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");
-e.attachShader(Y,ka("fragment",prefix_fragment+P));e.attachShader(Y,ka("vertex",prefix_vertex+F));e.linkProgram(Y);e.getProgramParameter(Y,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Y.uniforms={};Y.attributes={};var U;P=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(U in E)P.push(U);
-U=P;E=0;for(P=U.length;E<P;E++){F=U[E];Y.uniforms[F]=e.getUniformLocation(Y,F)}P=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(U=0;U<x.maxMorphTargets;U++)P.push("morphTarget"+U);for(I in C)P.push(I);I=P;U=0;for(C=I.length;U<C;U++){x=I[U];Y.attributes[x]=e.getAttribLocation(Y,x)}Aa.push({program:Y,code:M});I=Y}m.program=I;I=m.program.attributes;e.enableVertexAttribArray(I.position);I.color>=0&&e.enableVertexAttribArray(I.color);I.normal>=
-0&&e.enableVertexAttribArray(I.normal);I.tangent>=0&&e.enableVertexAttribArray(I.tangent);if(m.skinning&&I.skinVertexA>=0&&I.skinVertexB>=0&&I.skinIndex>=0&&I.skinWeight>=0){e.enableVertexAttribArray(I.skinVertexA);e.enableVertexAttribArray(I.skinVertexB);e.enableVertexAttribArray(I.skinIndex);e.enableVertexAttribArray(I.skinWeight)}for(z in m.attributes)I[z]>=0&&e.enableVertexAttribArray(I[z]);if(m.morphTargets){m.numSupportedMorphTargets=0;if(I.morphTarget0>=0){e.enableVertexAttribArray(I.morphTarget0);
-m.numSupportedMorphTargets++}if(I.morphTarget1>=0){e.enableVertexAttribArray(I.morphTarget1);m.numSupportedMorphTargets++}if(I.morphTarget2>=0){e.enableVertexAttribArray(I.morphTarget2);m.numSupportedMorphTargets++}if(I.morphTarget3>=0){e.enableVertexAttribArray(I.morphTarget3);m.numSupportedMorphTargets++}if(I.morphTarget4>=0){e.enableVertexAttribArray(I.morphTarget4);m.numSupportedMorphTargets++}if(I.morphTarget5>=0){e.enableVertexAttribArray(I.morphTarget5);m.numSupportedMorphTargets++}if(I.morphTarget6>=
-0){e.enableVertexAttribArray(I.morphTarget6);m.numSupportedMorphTargets++}if(I.morphTarget7>=0){e.enableVertexAttribArray(I.morphTarget7);m.numSupportedMorphTargets++}u.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(z=this.maxMorphTargets;m<z;m++)u.__webglMorphTargetInfluences[m]=0}};this.render=function(m,C,x,u){var z,K,M,E,P,F,N,I,Y=m.lights,U=m.fog;C.matrixAutoUpdate&&C.updateMatrix();m.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(ab);C.projectionMatrix.flattenToArray($a);
-Ra.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ra);this.initWebGLObjects(m);Fa(x);(this.autoClear||u)&&this.clear();P=m.__webglObjects.length;for(u=0;u<P;u++){z=m.__webglObjects[u];N=z.object;if(N.visible)if(!(N instanceof THREE.Mesh)||n(N)){N.matrixWorld.flattenToArray(N._objectMatrixArray);H(N,C);w(z);z.render=!0;if(this.sortObjects){Oa.copy(N.position);Ra.multiplyVector3(Oa);z.z=Oa.z}}else z.render=!1;else z.render=!1}this.sortObjects&&m.__webglObjects.sort(y);F=m.__webglObjectsImmediate.length;
-for(u=0;u<F;u++){z=m.__webglObjectsImmediate[u];N=z.object;if(N.visible){N.matrixAutoUpdate&&N.matrixWorld.flattenToArray(N._objectMatrixArray);H(N,C);o(z)}}J(THREE.NormalBlending);for(u=0;u<P;u++){z=m.__webglObjects[u];if(z.render){N=z.object;I=z.buffer;M=z.opaque;h(N);for(z=0;z<M.count;z++){E=M.list[z];j(E.depthTest);f(C,Y,U,E,I,N)}}}for(u=0;u<F;u++){z=m.__webglObjectsImmediate[u];N=z.object;if(N.visible){M=z.opaque;h(N);for(z=0;z<M.count;z++){E=M.list[z];j(E.depthTest);K=d(C,Y,U,E,N);N.render(function(ya){g(ya,
-K,E.shading)})}}}for(u=0;u<P;u++){z=m.__webglObjects[u];if(z.render){N=z.object;I=z.buffer;M=z.transparent;h(N);for(z=0;z<M.count;z++){E=M.list[z];J(E.blending);j(E.depthTest);f(C,Y,U,E,I,N)}}}for(u=0;u<F;u++){z=m.__webglObjectsImmediate[u];N=z.object;if(N.visible){M=z.transparent;h(N);for(z=0;z<M.count;z++){E=M.list[z];J(E.blending);j(E.depthTest);K=d(C,Y,U,E,N);N.render(function(ya){g(ya,K,E.shading)})}}}m.__webglSprites.length&&B(m,C);ca&&m.__webglShadowVolumes.length&&m.lights.length&&v(m);m.__webglLensFlares.length&&
-G(m,C);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,x.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[];m.__webglShadowVolumes=[];m.__webglLensFlares=[];m.__webglSprites=[]}for(;m.__objectsAdded.length;){var C=m.__objectsAdded[0],x=m,u=void 0,z=void 0,K=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=
-new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){z=C.geometry;z.geometryGroups==undefined&&V(z);for(u in z.geometryGroups){K=z.geometryGroups[u];if(!K.__webglVertexBuffer){var M=K;M.__webglVertexBuffer=e.createBuffer();M.__webglNormalBuffer=e.createBuffer();M.__webglTangentBuffer=e.createBuffer();M.__webglColorBuffer=e.createBuffer();
-M.__webglUVBuffer=e.createBuffer();M.__webglUV2Buffer=e.createBuffer();M.__webglSkinVertexABuffer=e.createBuffer();M.__webglSkinVertexBBuffer=e.createBuffer();M.__webglSkinIndicesBuffer=e.createBuffer();M.__webglSkinWeightsBuffer=e.createBuffer();M.__webglFaceBuffer=e.createBuffer();M.__webglLineBuffer=e.createBuffer();if(M.numMorphTargets){var E=void 0,P=void 0;M.__webglMorphTargetsBuffers=[];E=0;for(P=M.numMorphTargets;E<P;E++)M.__webglMorphTargetsBuffers.push(e.createBuffer())}M=K;E=C;var F=void 0,
-N=void 0,I=void 0;I=void 0;var Y=void 0,U=void 0,ya=void 0,wa=ya=P=0;N=void 0;I=void 0;var ra=void 0;F=void 0;N=void 0;Y=E.geometry;ra=Y.faces;U=M.faces;F=0;for(N=U.length;F<N;F++){I=U[F];I=ra[I];if(I instanceof THREE.Face3){P+=3;ya+=1;wa+=3}else if(I instanceof THREE.Face4){P+=4;ya+=2;wa+=4}}F=M;N=E;ra=void 0;U=void 0;var Na=void 0,Sa=void 0;Na=void 0;I=[];ra=0;for(U=N.materials.length;ra<U;ra++){Na=N.materials[ra];if(Na instanceof THREE.MeshFaceMaterial){Na=0;for(l=F.materials.length;Na<l;Na++)(Sa=
-F.materials[Na])&&I.push(Sa)}else(Sa=Na)&&I.push(Sa)}F=I;a:{N=void 0;ra=void 0;U=F.length;for(N=0;N<U;N++){ra=F[N];if(ra.map||ra.lightMap||ra instanceof THREE.MeshShaderMaterial){N=!0;break a}}N=!1}a:{ra=F;U=void 0;I=void 0;Na=ra.length;for(U=0;U<Na;U++){I=ra[U];if(!(I instanceof THREE.MeshBasicMaterial&&!I.envMap||I instanceof THREE.MeshDepthMaterial)){ra=I&&I.shading!=undefined&&I.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ra=!1}a:{U=void 0;I=void 0;Na=F.length;
-for(U=0;U<Na;U++){I=F[U];if(I.vertexColors){I=I.vertexColors;break a}}I=!1}M.__vertexArray=new Float32Array(P*3);if(ra)M.__normalArray=new Float32Array(P*3);if(Y.hasTangents)M.__tangentArray=new Float32Array(P*4);if(I)M.__colorArray=new Float32Array(P*3);if(N){if(Y.faceUvs.length>0||Y.faceVertexUvs.length>0)M.__uvArray=new Float32Array(P*2);if(Y.faceUvs.length>1||Y.faceVertexUvs.length>1)M.__uv2Array=new Float32Array(P*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){M.__skinVertexAArray=
-new Float32Array(P*4);M.__skinVertexBArray=new Float32Array(P*4);M.__skinIndexArray=new Float32Array(P*4);M.__skinWeightArray=new Float32Array(P*4)}M.__faceArray=new Uint16Array(ya*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0));M.__lineArray=new Uint16Array(wa*2);if(M.numMorphTargets){M.__morphTargetsArrays=[];Y=0;for(U=M.numMorphTargets;Y<U;Y++)M.__morphTargetsArrays.push(new Float32Array(P*3))}M.__needsSmoothNormals=ra==THREE.SmoothShading;M.__uvType=N;M.__vertexColorType=I;M.__normalType=
-ra;M.__webglFaceCount=ya*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0);M.__webglLineCount=wa*2;Y=0;for(U=F.length;Y<U;Y++)if(F[Y].attributes){M.__webglCustomAttributes={};for(a in F[Y].attributes){N=F[Y].attributes[a];ya=1;if(N.type==="v2")ya=2;else if(N.type==="v3")ya=3;else if(N.type==="v4")ya=4;else N.type==="c"&&(ya=3);N.size=ya;N.needsUpdate=!0;N.array=new Float32Array(P*ya);N.buffer=e.createBuffer();M.__webglCustomAttributes[a]=N}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=
-!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}C instanceof THREE.ShadowVolume?A(x.__webglShadowVolumes,K,C):A(x.__webglObjects,K,C)}}else if(C instanceof THREE.LensFlare)A(x.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){z=C.geometry;if(!z.__webglVertexBuffer){u=z;u.__webglVertexBuffer=e.createBuffer();u.__webglColorBuffer=e.createBuffer();u=z;K=u.vertices.length;u.__vertexArray=new Float32Array(K*3);u.__colorArray=new Float32Array(K*3);u.__webglVertexCount=
-K;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(x.__webglObjects,z,C)}else if(C instanceof THREE.Line){z=C.geometry;if(!z.__webglVertexBuffer){u=z;u.__webglVertexBuffer=e.createBuffer();u.__webglColorBuffer=e.createBuffer();u=z;K=u.vertices.length;u.__vertexArray=new Float32Array(K*3);u.__colorArray=new Float32Array(K*3);u.__webglLineCount=K;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(x.__webglObjects,z,C)}else if(C instanceof THREE.ParticleSystem){z=C.geometry;if(!z.__webglVertexBuffer){u=z;u.__webglVertexBuffer=
-e.createBuffer();u.__webglColorBuffer=e.createBuffer();u=z;K=u.vertices.length;u.__vertexArray=new Float32Array(K*3);u.__colorArray=new Float32Array(K*3);u.__sortArray=[];u.__webglParticleCount=K;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(x.__webglObjects,z,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&x.__webglSprites.push(C);m.__objectsAdded.splice(0,
-1)}for(;m.__objectsRemoved.length;){C=m.__objectsRemoved[0];x=m;z=void 0;u=void 0;for(z=x.__webglObjects.length-1;z>=0;z--){u=x.__webglObjects[z].object;if(C==u){x.__webglObjects.splice(z,1);break}}m.__objectsRemoved.splice(0,1)}C=0;for(x=m.__webglObjects.length;C<x;C++)L(m.__webglObjects[C].object,m);C=0;for(x=m.__webglShadowVolumes.length;C<x;C++)L(m.__webglShadowVolumes[C].object,m);C=0;for(x=m.__webglLensFlares.length;C<x;C++)L(m.__webglLensFlares[C].object,m)};this.setFaceCulling=function(m,
-C){if(m){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(m=="back")e.cullFace(e.BACK);else m=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.WebGLRenderer=function(b){function c(n,C,u){var w,z,G,L=n.vertices,H=L.length,S=n.colors,E=S.length,M=n.__vertexArray,J=n.__colorArray,X=n.__sortArray,P=n.__dirtyVertices,ra=n.__dirtyColors;if(u.sortParticles){Ta.multiplySelf(u.matrixWorld);for(w=0;w<H;w++){z=L[w].position;Qa.copy(z);Ta.multiplyVector3(Qa);X[w]=[Qa.z,w]}X.sort(function(Na,xa){return xa[0]-Na[0]});for(w=0;w<H;w++){z=L[X[w][1]].position;G=w*3;M[G]=z.x;M[G+1]=z.y;M[G+2]=z.z}for(w=0;w<E;w++){G=w*3;color=S[X[w][1]];J[G]=color.r;
+J[G+1]=color.g;J[G+2]=color.b}}else{if(P)for(w=0;w<H;w++){z=L[w].position;G=w*3;M[G]=z.x;M[G+1]=z.y;M[G+2]=z.z}if(ra)for(w=0;w<E;w++){color=S[w];G=w*3;J[G]=color.r;J[G+1]=color.g;J[G+2]=color.b}}if(P||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}if(ra||u.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,C)}}function d(n,C,u,w,z){w.program||oa.initMaterial(w,C,u,z);var G=w.program,L=G.uniforms,H=w.uniforms;
+if(G!=za){e.useProgram(G);za=G}e.uniformMatrix4fv(L.projectionMatrix,!1,Ya);if(u&&(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial||w instanceof THREE.LineBasicMaterial||w instanceof THREE.ParticleBasicMaterial||w.fog)){H.fogColor.value.setHex(u.color.hex);if(u instanceof THREE.Fog){H.fogNear.value=u.near;H.fogFar.value=u.far}else if(u instanceof THREE.FogExp2)H.fogDensity.value=u.density}if(w instanceof THREE.MeshPhongMaterial||w instanceof
+THREE.MeshLambertMaterial||w.lights){var S,E,M=0,J=0,X=0,P,ra,Na,xa,Ma=U,cb=Ma.directional.colors,Ga=Ma.directional.positions,Ha=Ma.point.colors,Fa=Ma.point.positions,Ua=Ma.point.distances,D=0,$=0;u=E=xa=0;for(S=C.length;u<S;u++){E=C[u];P=E.color;ra=E.position;Na=E.intensity;xa=E.distance;if(E instanceof THREE.AmbientLight){M+=P.r;J+=P.g;X+=P.b}else if(E instanceof THREE.DirectionalLight){xa=D*3;cb[xa]=P.r*Na;cb[xa+1]=P.g*Na;cb[xa+2]=P.b*Na;Ga[xa]=ra.x;Ga[xa+1]=ra.y;Ga[xa+2]=ra.z;D+=1}else if(E instanceof
+THREE.PointLight){E=$*3;Ha[E]=P.r*Na;Ha[E+1]=P.g*Na;Ha[E+2]=P.b*Na;Fa[E]=ra.x;Fa[E+1]=ra.y;Fa[E+2]=ra.z;Ua[$]=xa;$+=1}}for(u=D*3;u<cb.length;u++)cb[u]=0;for(u=$*3;u<Ha.length;u++)Ha[u]=0;Ma.point.length=$;Ma.directional.length=D;Ma.ambient[0]=M;Ma.ambient[1]=J;Ma.ambient[2]=X;u=U;H.enableLighting.value=u.directional.length+u.point.length;H.ambientLightColor.value=u.ambient;H.directionalLightColor.value=u.directional.colors;H.directionalLightDirection.value=u.directional.positions;H.pointLightColor.value=
+u.point.colors;H.pointLightPosition.value=u.point.positions;H.pointLightDistance.value=u.point.distances}if(w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial){H.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);H.opacity.value=w.opacity;H.map.texture=w.map;H.lightMap.texture=w.lightMap;H.envMap.texture=w.envMap;H.reflectivity.value=w.reflectivity;H.refractionRatio.value=w.refractionRatio;H.combine.value=w.combine;H.useRefract.value=
+w.envMap&&w.envMap.mapping instanceof THREE.CubeRefractionMapping}if(w instanceof THREE.LineBasicMaterial){H.diffuse.value.setRGB(w.color.r,w.color.g,w.color.b);H.opacity.value=w.opacity}else if(w instanceof THREE.ParticleBasicMaterial){H.psColor.value.setRGB(w.color.r,w.color.g,w.color.b);H.opacity.value=w.opacity;H.size.value=w.size;H.scale.value=da.height/2;H.map.texture=w.map}else if(w instanceof THREE.MeshPhongMaterial){H.ambient.value.setRGB(w.ambient.r,w.ambient.g,w.ambient.b);H.specular.value.setRGB(w.specular.r,
+w.specular.g,w.specular.b);H.shininess.value=w.shininess}else if(w instanceof THREE.MeshDepthMaterial){H.mNear.value=n.near;H.mFar.value=n.far;H.opacity.value=w.opacity}else if(w instanceof THREE.MeshNormalMaterial)H.opacity.value=w.opacity;for(var t in H)if(J=G.uniforms[t]){S=H[t];M=S.type;u=S.value;if(M=="i")e.uniform1i(J,u);else if(M=="f")e.uniform1f(J,u);else if(M=="fv1")e.uniform1fv(J,u);else if(M=="fv")e.uniform3fv(J,u);else if(M=="v2")e.uniform2f(J,u.x,u.y);else if(M=="v3")e.uniform3f(J,u.x,
+u.y,u.z);else if(M=="v4")e.uniform4f(J,u.x,u.y,u.z,u.w);else if(M=="c")e.uniform3f(J,u.r,u.g,u.b);else if(M=="t"){e.uniform1i(J,u);if(S=S.texture)if(S.image instanceof Array&&S.image.length==6){if(S.image.length==6){if(S.needsUpdate){if(S.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube);for(M=0;M<6;++M)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+M,0,0,0,e.RGBA,e.UNSIGNED_BYTE,S.image[M])}else{S.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,
+S.image.__webglTextureCube);for(M=0;M<6;++M)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+M,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,S.image[M]);S.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,S,S.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);S.needsUpdate=!1}e.activeTexture(e.TEXTURE0+u);e.bindTexture(e.TEXTURE_CUBE_MAP,S.image.__webglTextureCube)}}else R(S,u)}}e.uniformMatrix4fv(L.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(L.normalMatrix,!1,z._normalMatrixArray);(w instanceof THREE.MeshShaderMaterial||
+w instanceof THREE.MeshPhongMaterial||w.envMap)&&e.uniform3f(L.cameraPosition,n.position.x,n.position.y,n.position.z);(w instanceof THREE.MeshShaderMaterial||w.envMap||w.skinning)&&e.uniformMatrix4fv(L.objectMatrix,!1,z._objectMatrixArray);(w instanceof THREE.MeshPhongMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshShaderMaterial||w.skinning)&&e.uniformMatrix4fv(L.viewMatrix,!1,Za);if(w instanceof THREE.ShadowVolumeDynamicMaterial){n=H.directionalLightDirection.value;n[0]=
+-C.position.x;n[1]=-C.position.y;n[2]=-C.position.z;e.uniform3fv(L.directionalLightDirection,n);e.uniformMatrix4fv(L.objectMatrix,!1,z._objectMatrixArray);e.uniformMatrix4fv(L.viewMatrix,!1,Za)}if(w.skinning){e.uniformMatrix4fv(L.cameraInverseMatrix,!1,Za);e.uniformMatrix4fv(L.boneGlobalMatrices,!1,z.boneMatrices)}return G}function f(n,C,u,w,z,G){if(w.opacity!=0){var L;n=d(n,C,u,w,G).attributes;if(w.morphTargets){C=w.program.attributes;G.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[G.morphTargetBase]):
+e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0);if(G.morphTargetForcedOrder.length){u=0;for(var H=G.morphTargetForcedOrder,S=G.morphTargetInfluences;u<w.numSupportedMorphTargets&&u<H.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[H[u]]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);G.__webglMorphTargetInfluences[u]=S[H[u]];u++}}else{H=[];var E=-1,M=0;S=G.morphTargetInfluences;var J,X=S.length;u=0;for(G.morphTargetBase!==
+-1&&(H[G.morphTargetBase]=!0);u<w.numSupportedMorphTargets;){for(J=0;J<X;J++)if(!H[J]&&S[J]>E){M=J;E=S[M]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[M]);e.vertexAttribPointer(C["morphTarget"+u],3,e.FLOAT,!1,0,0);G.__webglMorphTargetInfluences[u]=E;H[M]=1;E=-1;u++}}e.uniform1fv(w.program.uniforms.morphTargetInfluences,G.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}if(z.__webglCustomAttributes)for(L in z.__webglCustomAttributes)if(n[L]>=
+0){C=z.__webglCustomAttributes[L];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[L],C.size,e.FLOAT,!1,0,0)}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglColorBuffer);e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(z.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
+z.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(z.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,z.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(w.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,
+4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,z.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(G instanceof THREE.Mesh)if(w.wireframe){e.lineWidth(w.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglLineBuffer);e.drawElements(e.LINES,
+z.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,z.__webglFaceBuffer);e.drawElements(e.TRIANGLES,z.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(G instanceof THREE.Line){G=G.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(w.linewidth);e.drawArrays(G,0,z.__webglLineCount)}else if(G instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,z.__webglParticleCount);else G instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount)}}function g(n,C,
+u){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.position);e.vertexAttribPointer(C.attributes.position,3,e.FLOAT,!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(u==THREE.FlatShading){var w,z,G,L,H,S,E,M,J,X,P=n.count*3;for(X=
+0;X<P;X+=9){u=n.normalArray;w=u[X];z=u[X+1];G=u[X+2];L=u[X+3];S=u[X+4];M=u[X+5];H=u[X+6];E=u[X+7];J=u[X+8];w=(w+L+H)/3;z=(z+S+E)/3;G=(G+M+J)/3;u[X]=w;u[X+1]=z;u[X+2]=G;u[X+3]=w;u[X+4]=z;u[X+5]=G;u[X+6]=w;u[X+7]=z;u[X+8]=G}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(C.attributes.normal);e.vertexAttribPointer(C.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(pa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):
+e.enable(e.CULL_FACE);pa=n.doubleSided}if(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=n.flipSided}}function j(n){if(Z!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Z=n}}function k(n){ua[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ua[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ua[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);ua[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ua[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-
+n.n34);ua[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var C;for(n=0;n<6;n++){C=ua[n];C.divideScalar(Math.sqrt(C.x*C.x+C.y*C.y+C.z*C.z))}}function m(n){for(var C=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),w=0;w<6;w++){n=ua[w].x*C.n14+ua[w].y*C.n24+ua[w].z*C.n34+ua[w].w;if(n<=u)return!1}return!0}function p(n,C){n.list[n.count]=C;n.count+=1}function o(n){var C,u,w=n.object,z=n.opaque,G=n.transparent;G.count=0;n=z.count=0;for(C=w.materials.length;n<
+C;n++){u=w.materials[n];u.transparent?p(G,u):p(z,u)}}function x(n){var C,u,w,z,G=n.object,L=n.buffer,H=n.opaque,S=n.transparent;S.count=0;n=H.count=0;for(w=G.materials.length;n<w;n++){C=G.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(u=L.materials.length;C<u;C++)(z=L.materials[C])&&(z.transparent?p(S,z):p(H,z))}else(z=C)&&(z.transparent?p(S,z):p(H,z))}}function y(n,C){return C.z-n.z}function v(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);
+e.depthMask(!1);e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);var C,u=n.lights.length,w,z=n.lights,G=[],L,H,S,E,M,J=n.__webglShadowVolumes.length;for(C=0;C<u;C++){w=n.lights[C];if(w instanceof THREE.DirectionalLight){G[0]=-w.position.x;G[1]=-w.position.y;G[2]=-w.position.z;for(M=0;M<J;M++){w=n.__webglShadowVolumes[M].object;L=n.__webglShadowVolumes[M].buffer;H=w.materials[0];H.program||oa.initMaterial(H,
+z,undefined,w);H=H.program;S=H.uniforms;E=H.attributes;if(za!==H){e.useProgram(H);za=H;e.uniformMatrix4fv(S.projectionMatrix,!1,Ya);e.uniformMatrix4fv(S.viewMatrix,!1,Za);e.uniform3fv(S.directionalLightDirection,G)}w.matrixWorld.flattenToArray(w._objectMatrixArray);e.uniformMatrix4fv(S.objectMatrix,!1,w._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,L.__webglVertexBuffer);e.vertexAttribPointer(E.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,L.__webglNormalBuffer);e.vertexAttribPointer(E.normal,
+3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,L.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,L.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,L.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);fa="";za=wa.program;e.useProgram(wa.program);e.uniformMatrix4fv(wa.projectionLocation,!1,Ya);e.uniform1f(wa.darknessLocation,
+wa.darkness);e.bindBuffer(e.ARRAY_BUFFER,wa.vertexBuffer);e.vertexAttribPointer(wa.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(wa.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,wa.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(Y)}function B(n,C){var u,w,z;u=_sprite.attributes;var G=_sprite.uniforms,L=ia/ga,H,S=[],E=ga*0.5,M=ia*0.5,J=
+!0;e.useProgram(_sprite.program);za=_sprite.program;fa="";if(!ab){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);ab=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(u.position,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(u.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(G.projectionMatrix,!1,Ya);e.activeTexture(e.TEXTURE0);
+e.uniform1i(G.map,0);u=0;for(w=n.__webglSprites.length;u<w;u++){z=n.__webglSprites[u];if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);u=0;for(w=n.__webglSprites.length;u<w;u++){z=n.__webglSprites[u];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(G.useScreenCoordinates,1);e.uniform3f(G.screenPosition,
+(z.position.x-E)/E,(M-z.position.y)/M,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(G.useScreenCoordinates,0);e.uniform1i(G.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(G.modelViewMatrix,!1,z._modelViewMatrixArray)}H=z.map.image.width/(z.affectedByDistance?1:ia);S[0]=H*L*z.scale.x;S[1]=H*z.scale.y;e.uniform2f(G.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(G.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(G.alignment,z.alignment.x,z.alignment.y);e.uniform1f(G.opacity,z.opacity);
+e.uniform1f(G.rotation,z.rotation);e.uniform2fv(G.scale,S);if(z.mergeWith3D&&!J){e.enable(e.DEPTH_TEST);J=!0}else if(!z.mergeWith3D&&J){e.disable(e.DEPTH_TEST);J=!1}K(z.blending);R(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Y)}function F(n,C){var u,w,z=n.__webglLensFlares.length,G,L,H,S=new THREE.Vector3,E=ia/ga,M=ga*0.5,J=ia*0.5,X=16/ia,P=[X*E,X],ra=[1,1,0],Na=[1,1],xa=ea.uniforms;u=ea.attributes;e.useProgram(ea.program);za=
+ea.program;fa="";if(!fb){e.enableVertexAttribArray(ea.attributes.vertex);e.enableVertexAttribArray(ea.attributes.uv);fb=!0}e.uniform1i(xa.occlusionMap,0);e.uniform1i(xa.map,1);e.bindBuffer(e.ARRAY_BUFFER,ea.vertexBuffer);e.vertexAttribPointer(u.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(u.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,ea.occlusionTexture);e.activeTexture(e.TEXTURE1);
+for(w=0;w<z;w++){u=n.__webglLensFlares[w].object;S.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(S);C.projectionMatrix.multiplyVector3(S);ra[0]=S.x;ra[1]=S.y;ra[2]=S.z;Na[0]=ra[0]*M+M;Na[1]=ra[1]*J+J;if(ea.hasVertexTexture||Na[0]>0&&Na[0]<ga&&Na[1]>0&&Na[1]<ia){e.bindTexture(e.TEXTURE_2D,ea.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Na[0]-8,Na[1]-8,16,16,0);e.uniform1i(xa.renderType,0);e.uniform2fv(xa.scale,P);e.uniform3fv(xa.screenPosition,
+ra);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,ea.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Na[0]-8,Na[1]-8,16,16,0);e.uniform1i(xa.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,ea.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);u.positionScreen.x=ra[0];u.positionScreen.y=ra[1];u.positionScreen.z=ra[2];u.customUpdateCallback?u.customUpdateCallback(u):u.updateLensFlares();e.uniform1i(xa.renderType,
+2);e.enable(e.BLEND);G=0;for(L=u.lensFlares.length;G<L;G++){H=u.lensFlares[G];if(H.opacity>0.0010&&H.scale>0.0010){ra[0]=H.x;ra[1]=H.y;ra[2]=H.z;X=H.size*H.scale/ia;P[0]=X*E;P[1]=X;e.uniform3fv(xa.screenPosition,ra);e.uniform2fv(xa.scale,P);e.uniform1f(xa.rotation,H.rotation);e.uniform1f(xa.opacity,H.opacity);K(H.blending);R(H.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(Y)}function I(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,
+n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function N(n){var C,u,w,z,G;if(n instanceof THREE.Mesh){u=n.geometry;for(C in u.geometryGroups){w=u.geometryGroups[C];G=!1;for(z in w.__webglCustomAttributes)if(w.__webglCustomAttributes[z].needsUpdate){G=!0;break}if(u.__dirtyVertices||u.__dirtyMorphTargets||u.__dirtyElements||u.__dirtyUvs||u.__dirtyNormals||u.__dirtyColors||u.__dirtyTangents||G){G=e.DYNAMIC_DRAW;var L=void 0,
+H=void 0,S=void 0,E=void 0;S=void 0;var M=void 0,J=void 0,X=void 0,P=void 0,ra=void 0,Na=void 0,xa=void 0,Ma=void 0,cb=void 0,Ga=void 0,Ha=void 0,Fa=void 0,Ua=void 0;J=void 0;X=void 0;E=void 0;P=void 0;E=void 0;var D=void 0,$=void 0;J=void 0;D=void 0;$=void 0;var t=void 0,db=void 0;D=void 0;$=void 0;t=void 0;db=void 0;D=void 0;$=void 0;t=void 0;db=void 0;D=void 0;$=void 0;t=void 0;E=void 0;P=void 0;M=void 0;S=void 0;S=void 0;D=void 0;$=void 0;t=void 0;var hb=void 0,Ra=0,Sa=0,jb=0,kb=0,Ia=0,Va=0,Pa=
+0,bb=0,Wa=0,T=0,V=0;$=D=0;var ja=w.__vertexArray,sa=w.__uvArray,la=w.__uv2Array,Ja=w.__normalArray,qa=w.__tangentArray,ha=w.__colorArray,Q=w.__skinVertexAArray,Ba=w.__skinVertexBArray,Oa=w.__skinIndexArray,Ka=w.__skinWeightArray,ib=w.__morphTargetsArrays,gb=w.__webglCustomAttributes;t=void 0;var Xa=w.__faceArray,$a=w.__lineArray,zb=w.__needsSmoothNormals;Na=w.__vertexColorType;ra=w.__uvType;xa=w.__normalType;var eb=n.geometry,tb=eb.__dirtyVertices,ub=eb.__dirtyElements,sb=eb.__dirtyUvs,vb=eb.__dirtyNormals,
+wb=eb.__dirtyTangents,xb=eb.__dirtyColors,yb=eb.__dirtyMorphTargets,ob=eb.vertices,Ab=w.faces,Db=eb.faces,Bb=eb.faceVertexUvs[0],Cb=eb.faceVertexUvs[1],pb=eb.skinVerticesA,qb=eb.skinVerticesB,rb=eb.skinIndices,mb=eb.skinWeights,nb=eb.edgeFaces,lb=eb.morphTargets;if(gb)for(hb in gb){gb[hb].offset=0;gb[hb].offsetSrc=0}L=0;for(H=Ab.length;L<H;L++){S=Ab[L];E=Db[S];Bb&&(Ma=Bb[S]);Cb&&(cb=Cb[S]);S=E.vertexNormals;M=E.normal;J=E.vertexColors;X=E.color;P=E.vertexTangents;if(E instanceof THREE.Face3){if(tb){Ga=
+ob[E.a].position;Ha=ob[E.b].position;Fa=ob[E.c].position;ja[Sa]=Ga.x;ja[Sa+1]=Ga.y;ja[Sa+2]=Ga.z;ja[Sa+3]=Ha.x;ja[Sa+4]=Ha.y;ja[Sa+5]=Ha.z;ja[Sa+6]=Fa.x;ja[Sa+7]=Fa.y;ja[Sa+8]=Fa.z;Sa+=9}if(gb)for(hb in gb){t=gb[hb];if(t.needsUpdate){D=t.offset;$=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+2]=t.value[E.c]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[$];t.array[D+1]=t.value[$];t.array[D+2]=t.value[$];
+t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[$+0];t.array[D+1]=t.value[$+1];t.array[D+2]=t.value[$+2];t.offsetSrc+=3}t.offset+=3}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Ga=t.value[E.a];Ha=t.value[E.b];Fa=t.value[E.c]}else if(t.boundTo==="faces"){Ga=t.value[$];Ha=t.value[$];Fa=t.value[$];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Ga=t.value[$+0];Ha=t.value[$+1];Fa=t.value[$+2];t.offsetSrc+=3}if(t.size===2){t.array[D+0]=Ga.x;t.array[D+1]=Ga.y;t.array[D+
+2]=Ha.x;t.array[D+3]=Ha.y;t.array[D+4]=Fa.x;t.array[D+5]=Fa.y;t.offset+=6}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Ga.r;t.array[D+1]=Ga.g;t.array[D+2]=Ga.b;t.array[D+3]=Ha.r;t.array[D+4]=Ha.g;t.array[D+5]=Ha.b;t.array[D+6]=Fa.r;t.array[D+7]=Fa.g;t.array[D+8]=Fa.b}else{t.array[D+0]=Ga.x;t.array[D+1]=Ga.y;t.array[D+2]=Ga.z;t.array[D+3]=Ha.x;t.array[D+4]=Ha.y;t.array[D+5]=Ha.z;t.array[D+6]=Fa.x;t.array[D+7]=Fa.y;t.array[D+8]=Fa.z}t.offset+=9}else{t.array[D+0]=Ga.x;t.array[D+1]=Ga.y;t.array[D+
+2]=Ga.z;t.array[D+3]=Ga.w;t.array[D+4]=Ha.x;t.array[D+5]=Ha.y;t.array[D+6]=Ha.z;t.array[D+7]=Ha.w;t.array[D+8]=Fa.x;t.array[D+9]=Fa.y;t.array[D+10]=Fa.z;t.array[D+11]=Fa.w;t.offset+=12}}}}if(yb){D=0;for($=lb.length;D<$;D++){Ga=lb[D].vertices[E.a].position;Ha=lb[D].vertices[E.b].position;Fa=lb[D].vertices[E.c].position;t=ib[D];t[V+0]=Ga.x;t[V+1]=Ga.y;t[V+2]=Ga.z;t[V+3]=Ha.x;t[V+4]=Ha.y;t[V+5]=Ha.z;t[V+6]=Fa.x;t[V+7]=Fa.y;t[V+8]=Fa.z}V+=9}if(mb.length){D=mb[E.a];$=mb[E.b];t=mb[E.c];Ka[T]=D.x;Ka[T+1]=
+D.y;Ka[T+2]=D.z;Ka[T+3]=D.w;Ka[T+4]=$.x;Ka[T+5]=$.y;Ka[T+6]=$.z;Ka[T+7]=$.w;Ka[T+8]=t.x;Ka[T+9]=t.y;Ka[T+10]=t.z;Ka[T+11]=t.w;D=rb[E.a];$=rb[E.b];t=rb[E.c];Oa[T]=D.x;Oa[T+1]=D.y;Oa[T+2]=D.z;Oa[T+3]=D.w;Oa[T+4]=$.x;Oa[T+5]=$.y;Oa[T+6]=$.z;Oa[T+7]=$.w;Oa[T+8]=t.x;Oa[T+9]=t.y;Oa[T+10]=t.z;Oa[T+11]=t.w;D=pb[E.a];$=pb[E.b];t=pb[E.c];Q[T]=D.x;Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=1;Q[T+4]=$.x;Q[T+5]=$.y;Q[T+6]=$.z;Q[T+7]=1;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=1;D=qb[E.a];$=qb[E.b];t=qb[E.c];Ba[T]=D.x;Ba[T+
+1]=D.y;Ba[T+2]=D.z;Ba[T+3]=1;Ba[T+4]=$.x;Ba[T+5]=$.y;Ba[T+6]=$.z;Ba[T+7]=1;Ba[T+8]=t.x;Ba[T+9]=t.y;Ba[T+10]=t.z;Ba[T+11]=1;T+=12}if(xb&&Na){if(J.length==3&&Na==THREE.VertexColors){E=J[0];D=J[1];$=J[2]}else $=D=E=X;ha[Wa]=E.r;ha[Wa+1]=E.g;ha[Wa+2]=E.b;ha[Wa+3]=D.r;ha[Wa+4]=D.g;ha[Wa+5]=D.b;ha[Wa+6]=$.r;ha[Wa+7]=$.g;ha[Wa+8]=$.b;Wa+=9}if(wb&&eb.hasTangents){J=P[0];X=P[1];E=P[2];qa[Pa]=J.x;qa[Pa+1]=J.y;qa[Pa+2]=J.z;qa[Pa+3]=J.w;qa[Pa+4]=X.x;qa[Pa+5]=X.y;qa[Pa+6]=X.z;qa[Pa+7]=X.w;qa[Pa+8]=E.x;qa[Pa+9]=
+E.y;qa[Pa+10]=E.z;qa[Pa+11]=E.w;Pa+=12}if(vb&&xa)if(S.length==3&&zb)for(P=0;P<3;P++){M=S[P];Ja[Va]=M.x;Ja[Va+1]=M.y;Ja[Va+2]=M.z;Va+=3}else for(P=0;P<3;P++){Ja[Va]=M.x;Ja[Va+1]=M.y;Ja[Va+2]=M.z;Va+=3}if(sb&&Ma!==undefined&&ra)for(P=0;P<3;P++){S=Ma[P];sa[jb]=S.u;sa[jb+1]=S.v;jb+=2}if(sb&&cb!==undefined&&ra)for(P=0;P<3;P++){S=cb[P];la[kb]=S.u;la[kb+1]=S.v;kb+=2}if(ub){Xa[Ia]=Ra;Xa[Ia+1]=Ra+1;Xa[Ia+2]=Ra+2;Ia+=3;$a[bb]=Ra;$a[bb+1]=Ra+1;$a[bb+2]=Ra;$a[bb+3]=Ra+2;$a[bb+4]=Ra+1;$a[bb+5]=Ra+2;bb+=6;Ra+=
+3}}else if(E instanceof THREE.Face4){if(tb){Ga=ob[E.a].position;Ha=ob[E.b].position;Fa=ob[E.c].position;Ua=ob[E.d].position;ja[Sa]=Ga.x;ja[Sa+1]=Ga.y;ja[Sa+2]=Ga.z;ja[Sa+3]=Ha.x;ja[Sa+4]=Ha.y;ja[Sa+5]=Ha.z;ja[Sa+6]=Fa.x;ja[Sa+7]=Fa.y;ja[Sa+8]=Fa.z;ja[Sa+9]=Ua.x;ja[Sa+10]=Ua.y;ja[Sa+11]=Ua.z;Sa+=12}if(gb)for(hb in gb){t=gb[hb];if(t.needsUpdate){D=t.offset;$=t.offsetSrc;if(t.size===1){if(t.boundTo===undefined||t.boundTo==="vertices"){t.array[D+0]=t.value[E.a];t.array[D+1]=t.value[E.b];t.array[D+2]=
+t.value[E.c];t.array[D+2]=t.value[E.d]}else if(t.boundTo==="faces"){t.array[D+0]=t.value[$];t.array[D+1]=t.value[$];t.array[D+2]=t.value[$];t.array[D+2]=t.value[$];t.offsetSrc++}else if(t.boundTo==="faceVertices"){t.array[D+0]=t.value[$+0];t.array[D+1]=t.value[$+1];t.array[D+2]=t.value[$+2];t.array[D+2]=t.value[$+3];t.offsetSrc+=4}t.offset+=4}else{if(t.boundTo===undefined||t.boundTo==="vertices"){Ga=t.value[E.a];Ha=t.value[E.b];Fa=t.value[E.c];Ua=t.value[E.d]}else if(t.boundTo==="faces"){Ga=t.value[$];
+Ha=t.value[$];Fa=t.value[$];Ua=t.value[$];t.offsetSrc++}else if(t.boundTo==="faceVertices"){Ga=t.value[$+0];Ha=t.value[$+1];Fa=t.value[$+2];Ua=t.value[$+3];t.offsetSrc+=4}if(t.size===2){t.array[D+0]=Ga.x;t.array[D+1]=Ga.y;t.array[D+2]=Ha.x;t.array[D+3]=Ha.y;t.array[D+4]=Fa.x;t.array[D+5]=Fa.y;t.array[D+6]=Ua.x;t.array[D+7]=Ua.y;t.offset+=8}else if(t.size===3){if(t.type==="c"){t.array[D+0]=Ga.r;t.array[D+1]=Ga.g;t.array[D+2]=Ga.b;t.array[D+3]=Ha.r;t.array[D+4]=Ha.g;t.array[D+5]=Ha.b;t.array[D+6]=Fa.r;
+t.array[D+7]=Fa.g;t.array[D+8]=Fa.b;t.array[D+9]=Ua.r;t.array[D+10]=Ua.g;t.array[D+11]=Ua.b}else{t.array[D+0]=Ga.x;t.array[D+1]=Ga.y;t.array[D+2]=Ga.z;t.array[D+3]=Ha.x;t.array[D+4]=Ha.y;t.array[D+5]=Ha.z;t.array[D+6]=Fa.x;t.array[D+7]=Fa.y;t.array[D+8]=Fa.z;t.array[D+9]=Ua.x;t.array[D+10]=Ua.y;t.array[D+11]=Ua.z}t.offset+=12}else{t.array[D+0]=Ga.x;t.array[D+1]=Ga.y;t.array[D+2]=Ga.z;t.array[D+3]=Ga.w;t.array[D+4]=Ha.x;t.array[D+5]=Ha.y;t.array[D+6]=Ha.z;t.array[D+7]=Ha.w;t.array[D+8]=Fa.x;t.array[D+
+9]=Fa.y;t.array[D+10]=Fa.z;t.array[D+11]=Fa.w;t.array[D+12]=Ua.x;t.array[D+13]=Ua.y;t.array[D+14]=Ua.z;t.array[D+15]=Ua.w;t.offset+=16}}}}if(yb){D=0;for($=lb.length;D<$;D++){Ga=lb[D].vertices[E.a].position;Ha=lb[D].vertices[E.b].position;Fa=lb[D].vertices[E.c].position;Ua=lb[D].vertices[E.d].position;t=ib[D];t[V+0]=Ga.x;t[V+1]=Ga.y;t[V+2]=Ga.z;t[V+3]=Ha.x;t[V+4]=Ha.y;t[V+5]=Ha.z;t[V+6]=Fa.x;t[V+7]=Fa.y;t[V+8]=Fa.z;t[V+9]=Ua.x;t[V+10]=Ua.y;t[V+11]=Ua.z}V+=12}if(mb.length){D=mb[E.a];$=mb[E.b];t=mb[E.c];
+db=mb[E.d];Ka[T]=D.x;Ka[T+1]=D.y;Ka[T+2]=D.z;Ka[T+3]=D.w;Ka[T+4]=$.x;Ka[T+5]=$.y;Ka[T+6]=$.z;Ka[T+7]=$.w;Ka[T+8]=t.x;Ka[T+9]=t.y;Ka[T+10]=t.z;Ka[T+11]=t.w;Ka[T+12]=db.x;Ka[T+13]=db.y;Ka[T+14]=db.z;Ka[T+15]=db.w;D=rb[E.a];$=rb[E.b];t=rb[E.c];db=rb[E.d];Oa[T]=D.x;Oa[T+1]=D.y;Oa[T+2]=D.z;Oa[T+3]=D.w;Oa[T+4]=$.x;Oa[T+5]=$.y;Oa[T+6]=$.z;Oa[T+7]=$.w;Oa[T+8]=t.x;Oa[T+9]=t.y;Oa[T+10]=t.z;Oa[T+11]=t.w;Oa[T+12]=db.x;Oa[T+13]=db.y;Oa[T+14]=db.z;Oa[T+15]=db.w;D=pb[E.a];$=pb[E.b];t=pb[E.c];db=pb[E.d];Q[T]=D.x;
+Q[T+1]=D.y;Q[T+2]=D.z;Q[T+3]=1;Q[T+4]=$.x;Q[T+5]=$.y;Q[T+6]=$.z;Q[T+7]=1;Q[T+8]=t.x;Q[T+9]=t.y;Q[T+10]=t.z;Q[T+11]=1;Q[T+12]=db.x;Q[T+13]=db.y;Q[T+14]=db.z;Q[T+15]=1;D=qb[E.a];$=qb[E.b];t=qb[E.c];E=qb[E.d];Ba[T]=D.x;Ba[T+1]=D.y;Ba[T+2]=D.z;Ba[T+3]=1;Ba[T+4]=$.x;Ba[T+5]=$.y;Ba[T+6]=$.z;Ba[T+7]=1;Ba[T+8]=t.x;Ba[T+9]=t.y;Ba[T+10]=t.z;Ba[T+11]=1;Ba[T+12]=E.x;Ba[T+13]=E.y;Ba[T+14]=E.z;Ba[T+15]=1;T+=16}if(xb&&Na){if(J.length==4&&Na==THREE.VertexColors){E=J[0];D=J[1];$=J[2];J=J[3]}else J=$=D=E=X;ha[Wa]=
+E.r;ha[Wa+1]=E.g;ha[Wa+2]=E.b;ha[Wa+3]=D.r;ha[Wa+4]=D.g;ha[Wa+5]=D.b;ha[Wa+6]=$.r;ha[Wa+7]=$.g;ha[Wa+8]=$.b;ha[Wa+9]=J.r;ha[Wa+10]=J.g;ha[Wa+11]=J.b;Wa+=12}if(wb&&eb.hasTangents){J=P[0];X=P[1];E=P[2];P=P[3];qa[Pa]=J.x;qa[Pa+1]=J.y;qa[Pa+2]=J.z;qa[Pa+3]=J.w;qa[Pa+4]=X.x;qa[Pa+5]=X.y;qa[Pa+6]=X.z;qa[Pa+7]=X.w;qa[Pa+8]=E.x;qa[Pa+9]=E.y;qa[Pa+10]=E.z;qa[Pa+11]=E.w;qa[Pa+12]=P.x;qa[Pa+13]=P.y;qa[Pa+14]=P.z;qa[Pa+15]=P.w;Pa+=16}if(vb&&xa)if(S.length==4&&zb)for(P=0;P<4;P++){M=S[P];Ja[Va]=M.x;Ja[Va+1]=M.y;
+Ja[Va+2]=M.z;Va+=3}else for(P=0;P<4;P++){Ja[Va]=M.x;Ja[Va+1]=M.y;Ja[Va+2]=M.z;Va+=3}if(sb&&Ma!==undefined&&ra)for(P=0;P<4;P++){S=Ma[P];sa[jb]=S.u;sa[jb+1]=S.v;jb+=2}if(sb&&cb!==undefined&&ra)for(P=0;P<4;P++){S=cb[P];la[kb]=S.u;la[kb+1]=S.v;kb+=2}if(ub){Xa[Ia]=Ra;Xa[Ia+1]=Ra+1;Xa[Ia+2]=Ra+3;Xa[Ia+3]=Ra+1;Xa[Ia+4]=Ra+2;Xa[Ia+5]=Ra+3;Ia+=6;$a[bb]=Ra;$a[bb+1]=Ra+1;$a[bb+2]=Ra;$a[bb+3]=Ra+3;$a[bb+4]=Ra+1;$a[bb+5]=Ra+2;$a[bb+6]=Ra+2;$a[bb+7]=Ra+3;bb+=8;Ra+=4}}}if(nb){L=0;for(H=nb.length;L<H;L++){Xa[Ia]=
+nb[L].a;Xa[Ia+1]=nb[L].b;Xa[Ia+2]=nb[L].c;Xa[Ia+3]=nb[L].a;Xa[Ia+4]=nb[L].c;Xa[Ia+5]=nb[L].d;Ia+=6}}if(tb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ja,G)}if(gb)for(hb in gb){t=gb[hb];if(t.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,t.buffer);e.bufferData(e.ARRAY_BUFFER,t.array,G);t.needsUpdate=!1}}if(yb){D=0;for($=lb.length;D<$;D++){e.bindBuffer(e.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[D]);e.bufferData(e.ARRAY_BUFFER,ib[D],G)}}if(xb&&Wa>0){e.bindBuffer(e.ARRAY_BUFFER,
+w.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ha,G)}if(vb){e.bindBuffer(e.ARRAY_BUFFER,w.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ja,G)}if(wb&&eb.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,w.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,qa,G)}if(sb&&jb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,sa,G)}if(sb&&kb>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,la,G)}if(ub){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);
+e.bufferData(e.ELEMENT_ARRAY_BUFFER,Xa,G);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,$a,G)}if(T>0){e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Q,G);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,G);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Oa,G);e.bindBuffer(e.ARRAY_BUFFER,w.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,
+Ka,G)}}}u.__dirtyVertices=!1;u.__dirtyMorphTargets=!1;u.__dirtyElements=!1;u.__dirtyUvs=!1;u.__dirtyNormals=!1;u.__dirtyTangents=!1;u.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){u=n.geometry;if(u.__dirtyVertices||u.__dirtyColors){n=u;C=e.DYNAMIC_DRAW;Na=n.vertices;w=n.colors;xa=Na.length;G=w.length;Ma=n.__vertexArray;L=n.__colorArray;cb=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<xa;H++){ra=Na[H].position;z=H*3;Ma[z]=ra.x;Ma[z+1]=ra.y;Ma[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);
+e.bufferData(e.ARRAY_BUFFER,Ma,C)}if(cb){for(H=0;H<G;H++){color=w[H];z=H*3;L[z]=color.r;L[z+1]=color.g;L[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(n instanceof THREE.Line){u=n.geometry;if(u.__dirtyVertices||u.__dirtyColors){n=u;C=e.DYNAMIC_DRAW;Na=n.vertices;w=n.colors;xa=Na.length;G=w.length;Ma=n.__vertexArray;L=n.__colorArray;cb=n.__dirtyColors;if(n.__dirtyVertices){for(H=0;H<xa;H++){ra=Na[H].position;
+z=H*3;Ma[z]=ra.x;Ma[z+1]=ra.y;Ma[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ma,C)}if(cb){for(H=0;H<G;H++){color=w[H];z=H*3;L[z]=color.r;L[z+1]=color.g;L[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,C)}}u.__dirtyVertices=!1;u.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){u=n.geometry;(u.__dirtyVertices||u.__dirtyColors||n.sortParticles)&&c(u,e.DYNAMIC_DRAW,n);u.__dirtyVertices=!1;u.__dirtyColors=
+!1}}function W(n){function C(X){var P=[];u=0;for(w=X.length;u<w;u++)X[u]==undefined?P.push("undefined"):P.push(X[u].id);return P.join("_")}var u,w,z,G,L,H,S,E,M={},J=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};z=0;for(G=n.faces.length;z<G;z++){L=n.faces[z];H=L.materials;S=C(H);M[S]==undefined&&(M[S]={hash:S,counter:0});E=M[S].hash+"_"+M[S].counter;n.geometryGroups[E]==undefined&&(n.geometryGroups[E]={faces:[],materials:H,vertices:0,numMorphTargets:J});L=L instanceof THREE.Face3?
+3:4;if(n.geometryGroups[E].vertices+L>65535){M[S].counter+=1;E=M[S].hash+"_"+M[S].counter;n.geometryGroups[E]==undefined&&(n.geometryGroups[E]={faces:[],materials:H,vertices:0,numMorphTargets:J})}n.geometryGroups[E].faces.push(z);n.geometryGroups[E].vertices+=L}}function A(n,C,u){n.push({buffer:C,object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(n){if(n!=fa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);
+e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}fa=n}}function O(n,C,u){if((u.width&u.width-1)==0&&(u.height&u.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,aa(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,aa(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,aa(C.magFilter));
+e.texParameteri(n,e.TEXTURE_MIN_FILTER,aa(C.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_MAG_FILTER,va(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,va(C.minFilter))}}function R(n,C){if(n.needsUpdate){if(n.__webglInit){e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,n.image)}else{n.__webglTexture=e.createTexture();
+e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);n.__webglInit=!0}O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+C);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function Ca(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();
+n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,aa(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,aa(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,aa(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,aa(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,aa(n.format),n.width,n.height,0,aa(n.format),aa(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,
+n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,
+n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var C,u;if(n){C=n.__webglFramebuffer;u=n.width;n=n.height}else{C=null;u=ga;n=ia}if(C!=Ea){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ma,Da,u,n);Ea=C}}function ka(n,C){var u;if(n=="fragment")u=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(u=e.createShader(e.VERTEX_SHADER));e.shaderSource(u,
+C);e.compileShader(u);if(!e.getShaderParameter(u,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(u));console.error(C);return null}return u}function va(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function aa(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;
+case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;
+case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var e,da=document.createElement("canvas"),ya=[],za=null,Ea=null,Y=!0,oa=this,pa=null,ta=null,fa=null,Z=null,ma=0,Da=0,ga=0,ia=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],Ta=new THREE.Matrix4,Ya=new Float32Array(16),Za=new Float32Array(16),Qa=new THREE.Vector4,U={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},ca=!0,na=!0,Aa=new THREE.Color(0),La=0;if(b){if(b.stencil!=undefined)ca=b.stencil;if(b.antialias!==undefined)na=b.antialias;b.clearColor!==undefined&&Aa.setHex(b.clearColor);if(b.clearAlpha!==undefined)La=b.clearAlpha}this.maxMorphTargets=8;this.domElement=
+da;this.autoClear=!0;this.sortObjects=!0;(function(n,C,u,w){try{if(!(e=da.getContext("experimental-webgl",{antialias:n,stencil:w})))throw"Error creating WebGL context.";}catch(z){console.error(z)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
+e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(C.r,C.g,C.b,u)})(na,Aa,La,ca);this.context=e;if(ca){var wa={};wa.vertices=new Float32Array(12);wa.faces=new Uint16Array(6);wa.darkness=0.5;wa.vertices[0]=-20;wa.vertices[1]=-20;wa.vertices[2]=-1;wa.vertices[3]=20;wa.vertices[4]=-20;wa.vertices[5]=-1;wa.vertices[6]=20;wa.vertices[7]=20;wa.vertices[8]=-1;wa.vertices[9]=-20;wa.vertices[10]=20;wa.vertices[11]=-1;wa.faces[0]=0;wa.faces[1]=1;wa.faces[2]=
+2;wa.faces[3]=0;wa.faces[4]=2;wa.faces[5]=3;wa.vertexBuffer=e.createBuffer();wa.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,wa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,wa.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,wa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,wa.faces,e.STATIC_DRAW);wa.program=e.createProgram();e.attachShader(wa.program,ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(wa.program,ka("vertex",THREE.ShaderLib.shadowPost.vertexShader));
+e.linkProgram(wa.program);wa.vertexLocation=e.getAttribLocation(wa.program,"position");wa.projectionLocation=e.getUniformLocation(wa.program,"projectionMatrix");wa.darknessLocation=e.getUniformLocation(wa.program,"darkness")}var ea={};ea.vertices=new Float32Array(16);ea.faces=new Uint16Array(6);b=0;ea.vertices[b++]=-1;ea.vertices[b++]=-1;ea.vertices[b++]=0;ea.vertices[b++]=0;ea.vertices[b++]=1;ea.vertices[b++]=-1;ea.vertices[b++]=1;ea.vertices[b++]=0;ea.vertices[b++]=1;ea.vertices[b++]=1;ea.vertices[b++]=
+1;ea.vertices[b++]=1;ea.vertices[b++]=-1;ea.vertices[b++]=1;ea.vertices[b++]=0;ea.vertices[b++]=1;b=0;ea.faces[b++]=0;ea.faces[b++]=1;ea.faces[b++]=2;ea.faces[b++]=0;ea.faces[b++]=2;ea.faces[b++]=3;ea.vertexBuffer=e.createBuffer();ea.elementBuffer=e.createBuffer();ea.tempTexture=e.createTexture();ea.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,ea.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ea.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
+ea.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ea.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,ea.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);
+e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){ea.hasVertexTexture=!1;ea.program=e.createProgram();e.attachShader(ea.program,ka("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(ea.program,ka("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{ea.hasVertexTexture=
+!0;ea.program=e.createProgram();e.attachShader(ea.program,ka("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(ea.program,ka("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(ea.program);ea.attributes={};ea.uniforms={};ea.attributes.vertex=e.getAttribLocation(ea.program,"position");ea.attributes.uv=e.getAttribLocation(ea.program,"UV");ea.uniforms.renderType=e.getUniformLocation(ea.program,"renderType");ea.uniforms.map=e.getUniformLocation(ea.program,
+"map");ea.uniforms.occlusionMap=e.getUniformLocation(ea.program,"occlusionMap");ea.uniforms.opacity=e.getUniformLocation(ea.program,"opacity");ea.uniforms.scale=e.getUniformLocation(ea.program,"scale");ea.uniforms.rotation=e.getUniformLocation(ea.program,"rotation");ea.uniforms.screenPosition=e.getUniformLocation(ea.program,"screenPosition");var fb=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=
+0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=
+e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,ka("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,ka("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(_sprite.program);_sprite.attributes=
+{};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,
+"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=e.getUniformLocation(_sprite.program,
+"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var ab=!1;this.setSize=function(n,C){da.width=n;da.height=C;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(n,C,u,w){ma=n;Da=C;ga=u;ia=w;e.viewport(ma,Da,ga,ia)};this.setScissor=function(n,C,u,w){e.scissor(n,C,u,w)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){Y=n;e.depthMask(n)};this.setClearColorHex=
+function(n,C){var u=new THREE.Color(n);e.clearColor(u.r,u.g,u.b,C)};this.setClearColor=function(n,C){e.clearColor(n.r,n.g,n.b,C)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){wa.darkness=n};this.initMaterial=function(n,C,u,w){var z,G,L;if(n instanceof THREE.MeshDepthMaterial)L="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)L="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)L=
+"normal";else if(n instanceof THREE.MeshBasicMaterial)L="basic";else if(n instanceof THREE.MeshLambertMaterial)L="lambert";else if(n instanceof THREE.MeshPhongMaterial)L="phong";else if(n instanceof THREE.LineBasicMaterial)L="basic";else n instanceof THREE.ParticleBasicMaterial&&(L="particle_basic");if(L){var H=THREE.ShaderLib[L];n.uniforms=Uniforms.clone(H.uniforms);n.vertexShader=H.vertexShader;n.fragmentShader=H.fragmentShader}var S,E,M;S=M=H=0;for(E=C.length;S<E;S++){G=C[S];G instanceof THREE.DirectionalLight&&
+M++;G instanceof THREE.PointLight&&H++}if(H+M<=4)C=M;else{C=Math.ceil(4*M/(H+M));H=4-C}G={directional:C,point:H};M=50;if(w!==undefined&&w instanceof THREE.SkinnedMesh)M=w.bones.length;var J;a:{S=n.fragmentShader;E=n.vertexShader;H=n.uniforms;C=n.attributes;u={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:u,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:G.directional,maxPointLights:G.point,
+maxBones:M};var X;G=[];if(L)G.push(L);else{G.push(S);G.push(E)}for(X in u){G.push(X);G.push(u[X])}L=G.join();X=0;for(G=ya.length;X<G;X++)if(ya[X].code==L){J=ya[X].program;break a}X=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":
+"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.morphTargets?
+"#define USE_MORPHTARGETS":"",u.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");
+e.attachShader(X,ka("fragment",prefix_fragment+S));e.attachShader(X,ka("vertex",prefix_vertex+E));e.linkProgram(X);e.getProgramParameter(X,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(X,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");X.uniforms={};X.attributes={};var P;S=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(P in H)S.push(P);
+P=S;H=0;for(S=P.length;H<S;H++){E=P[H];X.uniforms[E]=e.getUniformLocation(X,E)}S=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(P=0;P<u.maxMorphTargets;P++)S.push("morphTarget"+P);for(J in C)S.push(J);J=S;P=0;for(C=J.length;P<C;P++){u=J[P];X.attributes[u]=e.getAttribLocation(X,u)}ya.push({program:X,code:L});J=X}n.program=J;J=n.program.attributes;e.enableVertexAttribArray(J.position);J.color>=0&&e.enableVertexAttribArray(J.color);J.normal>=
+0&&e.enableVertexAttribArray(J.normal);J.tangent>=0&&e.enableVertexAttribArray(J.tangent);if(n.skinning&&J.skinVertexA>=0&&J.skinVertexB>=0&&J.skinIndex>=0&&J.skinWeight>=0){e.enableVertexAttribArray(J.skinVertexA);e.enableVertexAttribArray(J.skinVertexB);e.enableVertexAttribArray(J.skinIndex);e.enableVertexAttribArray(J.skinWeight)}for(z in n.attributes)J[z]>=0&&e.enableVertexAttribArray(J[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(J.morphTarget0>=0){e.enableVertexAttribArray(J.morphTarget0);
+n.numSupportedMorphTargets++}if(J.morphTarget1>=0){e.enableVertexAttribArray(J.morphTarget1);n.numSupportedMorphTargets++}if(J.morphTarget2>=0){e.enableVertexAttribArray(J.morphTarget2);n.numSupportedMorphTargets++}if(J.morphTarget3>=0){e.enableVertexAttribArray(J.morphTarget3);n.numSupportedMorphTargets++}if(J.morphTarget4>=0){e.enableVertexAttribArray(J.morphTarget4);n.numSupportedMorphTargets++}if(J.morphTarget5>=0){e.enableVertexAttribArray(J.morphTarget5);n.numSupportedMorphTargets++}if(J.morphTarget6>=
+0){e.enableVertexAttribArray(J.morphTarget6);n.numSupportedMorphTargets++}if(J.morphTarget7>=0){e.enableVertexAttribArray(J.morphTarget7);n.numSupportedMorphTargets++}w.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)w.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,u,w){var z,G,L,H,S,E,M,J,X=n.lights,P=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(Za);C.projectionMatrix.flattenToArray(Ya);
+Ta.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ta);this.initWebGLObjects(n);Ca(u);(this.autoClear||w)&&this.clear();S=n.__webglObjects.length;for(w=0;w<S;w++){z=n.__webglObjects[w];M=z.object;if(M.visible)if(!(M instanceof THREE.Mesh)||m(M)){M.matrixWorld.flattenToArray(M._objectMatrixArray);I(M,C);x(z);z.render=!0;if(this.sortObjects){Qa.copy(M.position);Ta.multiplyVector3(Qa);z.z=Qa.z}}else z.render=!1;else z.render=!1}this.sortObjects&&n.__webglObjects.sort(y);E=n.__webglObjectsImmediate.length;
+for(w=0;w<E;w++){z=n.__webglObjectsImmediate[w];M=z.object;if(M.visible){M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray);I(M,C);o(z)}}K(THREE.NormalBlending);for(w=0;w<S;w++){z=n.__webglObjects[w];if(z.render){M=z.object;J=z.buffer;L=z.opaque;h(M);for(z=0;z<L.count;z++){H=L.list[z];j(H.depthTest);f(C,X,P,H,J,M)}}}for(w=0;w<E;w++){z=n.__webglObjectsImmediate[w];M=z.object;if(M.visible){L=z.opaque;h(M);for(z=0;z<L.count;z++){H=L.list[z];j(H.depthTest);G=d(C,X,P,H,M);M.render(function(ra){g(ra,
+G,H.shading)})}}}for(w=0;w<S;w++){z=n.__webglObjects[w];if(z.render){M=z.object;J=z.buffer;L=z.transparent;h(M);for(z=0;z<L.count;z++){H=L.list[z];K(H.blending);j(H.depthTest);f(C,X,P,H,J,M)}}}for(w=0;w<E;w++){z=n.__webglObjectsImmediate[w];M=z.object;if(M.visible){L=z.transparent;h(M);for(z=0;z<L.count;z++){H=L.list[z];K(H.blending);j(H.depthTest);G=d(C,X,P,H,M);M.render(function(ra){g(ra,G,H.shading)})}}}n.__webglSprites.length&&B(n,C);ca&&n.__webglShadowVolumes.length&&n.lights.length&&v(n);n.__webglLensFlares.length&&
+F(n,C);if(u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,u.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],u=n,w=void 0,z=void 0,G=void 0;if(C._modelViewMatrix==undefined){C._modelViewMatrix=
+new THREE.Matrix4;C._normalMatrixArray=new Float32Array(9);C._modelViewMatrixArray=new Float32Array(16);C._objectMatrixArray=new Float32Array(16);C.matrixWorld.flattenToArray(C._objectMatrixArray)}if(C instanceof THREE.Mesh){z=C.geometry;z.geometryGroups==undefined&&W(z);for(w in z.geometryGroups){G=z.geometryGroups[w];if(!G.__webglVertexBuffer){var L=G;L.__webglVertexBuffer=e.createBuffer();L.__webglNormalBuffer=e.createBuffer();L.__webglTangentBuffer=e.createBuffer();L.__webglColorBuffer=e.createBuffer();
+L.__webglUVBuffer=e.createBuffer();L.__webglUV2Buffer=e.createBuffer();L.__webglSkinVertexABuffer=e.createBuffer();L.__webglSkinVertexBBuffer=e.createBuffer();L.__webglSkinIndicesBuffer=e.createBuffer();L.__webglSkinWeightsBuffer=e.createBuffer();L.__webglFaceBuffer=e.createBuffer();L.__webglLineBuffer=e.createBuffer();if(L.numMorphTargets){var H=void 0,S=void 0;L.__webglMorphTargetsBuffers=[];H=0;for(S=L.numMorphTargets;H<S;H++)L.__webglMorphTargetsBuffers.push(e.createBuffer())}L=G;H=C;var E=void 0,
+M=void 0,J=void 0;J=void 0;var X=void 0,P=void 0,ra=void 0,Na=ra=S=0;M=void 0;J=void 0;var xa=void 0;E=void 0;M=void 0;X=H.geometry;xa=X.faces;P=L.faces;E=0;for(M=P.length;E<M;E++){J=P[E];J=xa[J];if(J instanceof THREE.Face3){S+=3;ra+=1;Na+=3}else if(J instanceof THREE.Face4){S+=4;ra+=2;Na+=4}}E=L;M=H;xa=void 0;P=void 0;var Ma=void 0,cb=void 0;Ma=void 0;J=[];xa=0;for(P=M.materials.length;xa<P;xa++){Ma=M.materials[xa];if(Ma instanceof THREE.MeshFaceMaterial){Ma=0;for(l=E.materials.length;Ma<l;Ma++)(cb=
+E.materials[Ma])&&J.push(cb)}else(cb=Ma)&&J.push(cb)}E=J;a:{M=void 0;xa=void 0;P=E.length;for(M=0;M<P;M++){xa=E[M];if(xa.map||xa.lightMap||xa instanceof THREE.MeshShaderMaterial){M=!0;break a}}M=!1}a:{xa=E;P=void 0;J=void 0;Ma=xa.length;for(P=0;P<Ma;P++){J=xa[P];if(!(J instanceof THREE.MeshBasicMaterial&&!J.envMap||J instanceof THREE.MeshDepthMaterial)){xa=J&&J.shading!=undefined&&J.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}xa=!1}a:{P=void 0;J=void 0;Ma=E.length;
+for(P=0;P<Ma;P++){J=E[P];if(J.vertexColors){J=J.vertexColors;break a}}J=!1}L.__vertexArray=new Float32Array(S*3);if(xa)L.__normalArray=new Float32Array(S*3);if(X.hasTangents)L.__tangentArray=new Float32Array(S*4);if(J)L.__colorArray=new Float32Array(S*3);if(M){if(X.faceUvs.length>0||X.faceVertexUvs.length>0)L.__uvArray=new Float32Array(S*2);if(X.faceUvs.length>1||X.faceVertexUvs.length>1)L.__uv2Array=new Float32Array(S*2)}if(H.geometry.skinWeights.length&&H.geometry.skinIndices.length){L.__skinVertexAArray=
+new Float32Array(S*4);L.__skinVertexBArray=new Float32Array(S*4);L.__skinIndexArray=new Float32Array(S*4);L.__skinWeightArray=new Float32Array(S*4)}L.__faceArray=new Uint16Array(ra*3+(H.geometry.edgeFaces?H.geometry.edgeFaces.length*6:0));L.__lineArray=new Uint16Array(Na*2);if(L.numMorphTargets){L.__morphTargetsArrays=[];X=0;for(P=L.numMorphTargets;X<P;X++)L.__morphTargetsArrays.push(new Float32Array(S*3))}L.__needsSmoothNormals=xa==THREE.SmoothShading;L.__uvType=M;L.__vertexColorType=J;L.__normalType=
+xa;L.__webglFaceCount=ra*3+(H.geometry.edgeFaces?H.geometry.edgeFaces.length*6:0);L.__webglLineCount=Na*2;X=0;for(P=E.length;X<P;X++)if(E[X].attributes){L.__webglCustomAttributes={};for(a in E[X].attributes){M=E[X].attributes[a];ra=1;if(M.type==="v2")ra=2;else if(M.type==="v3")ra=3;else if(M.type==="v4")ra=4;else M.type==="c"&&(ra=3);M.size=ra;M.needsUpdate=!0;M.array=new Float32Array(S*ra);M.buffer=e.createBuffer();L.__webglCustomAttributes[a]=M}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=
+!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}C instanceof THREE.ShadowVolume?A(u.__webglShadowVolumes,G,C):A(u.__webglObjects,G,C)}}else if(C instanceof THREE.LensFlare)A(u.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){z=C.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;G=w.vertices.length;w.__vertexArray=new Float32Array(G*3);w.__colorArray=new Float32Array(G*3);w.__webglVertexCount=
+G;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(u.__webglObjects,z,C)}else if(C instanceof THREE.Line){z=C.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;G=w.vertices.length;w.__vertexArray=new Float32Array(G*3);w.__colorArray=new Float32Array(G*3);w.__webglLineCount=G;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(u.__webglObjects,z,C)}else if(C instanceof THREE.ParticleSystem){z=C.geometry;if(!z.__webglVertexBuffer){w=z;w.__webglVertexBuffer=
+e.createBuffer();w.__webglColorBuffer=e.createBuffer();w=z;G=w.vertices.length;w.__vertexArray=new Float32Array(G*3);w.__colorArray=new Float32Array(G*3);w.__sortArray=[];w.__webglParticleCount=G;z.__dirtyVertices=!0;z.__dirtyColors=!0}A(u.__webglObjects,z,C)}else if(THREE.MarchingCubes!==undefined&&C instanceof THREE.MarchingCubes)u.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});else C instanceof THREE.Sprite&&u.__webglSprites.push(C);n.__objectsAdded.splice(0,
+1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];u=n;z=void 0;w=void 0;for(z=u.__webglObjects.length-1;z>=0;z--){w=u.__webglObjects[z].object;if(C==w){u.__webglObjects.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(u=n.__webglObjects.length;C<u;C++)N(n.__webglObjects[C].object,n);C=0;for(u=n.__webglShadowVolumes.length;C<u;C++)N(n.__webglShadowVolumes[C].object,n);C=0;for(u=n.__webglLensFlares.length;C<u;C++)N(n.__webglLensFlares[C].object,n)};this.setFaceCulling=function(n,
+C){if(n){!C||C=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBAFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==
 undefined?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==undefined?d.stencilBuffer:!0};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,d){d&&b.update(undefined,!1,c);d=b.sounds;var f,g=d.length;for(f=0;f<g;f++){b=d[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
@@ -360,16 +361,16 @@ THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLoca
 THREE.CollisionSystem.prototype.rayTriangle=function(b,c,d,f,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;j.sub(d,c);k.sub(f,d);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*h))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(g.x)>Math.abs(g.y))if(Math.abs(g.x)>Math.abs(g.z)){b=k.y-c.y;g=d.y-c.y;h=f.y-c.y;
 k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}else if(Math.abs(g.y)>Math.abs(g.z)){b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.z-c.z;d=d.z-c.z;f=f.z-c.z}else{b=k.x-c.x;g=d.x-c.x;h=f.x-c.x;k=k.y-c.y;d=d.y-c.y;f=f.y-c.y}c=g*f-d*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-k*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=g*k-d*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=new THREE.Ray(b.origin.clone(),b.direction.clone()),f=THREE.Matrix4.makeInvert(c.matrixWorld);f.multiplyVector3(d.origin);f.rotateAxis(d.direction);d.direction.normalize();return d};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;d=c.dynamic&&c.mesh&&c.mesh.matrixWorld?this.makeRayLocal(b,c.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,n=0,p=!0;if(d.origin.x<c.min.x){f=c.min.x-d.origin.x;f/=d.direction.x;p=!1;j=-1}else if(d.origin.x>c.max.x){f=c.max.x-d.origin.x;f/=d.direction.x;p=!1;j=1}if(d.origin.y<c.min.y){g=c.min.y-d.origin.y;g/=d.direction.y;p=!1;k=-1}else if(d.origin.y>c.max.y){g=c.max.y-d.origin.y;g/=d.direction.y;p=!1;k=
-1}if(d.origin.z<c.min.z){h=c.min.z-d.origin.z;h/=d.direction.z;p=!1;n=-1}else if(d.origin.z>c.max.z){h=c.max.z-d.origin.z;h/=d.direction.z;p=!1;n=1}if(p)return-1;p=0;if(g>f){p=1;f=g}if(h>f){p=2;f=h}switch(p){case 0:k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(j,0,0);break;case 1:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+
-d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,k,0);break;case 2:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(d<0)d=(f-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;d=c.dynamic&&c.mesh&&c.mesh.matrixWorld?this.makeRayLocal(b,c.mesh):new THREE.Ray(b.origin.clone(),b.direction.clone());var f=0,g=0,h=0,j=0,k=0,m=0,p=!0;if(d.origin.x<c.min.x){f=c.min.x-d.origin.x;f/=d.direction.x;p=!1;j=-1}else if(d.origin.x>c.max.x){f=c.max.x-d.origin.x;f/=d.direction.x;p=!1;j=1}if(d.origin.y<c.min.y){g=c.min.y-d.origin.y;g/=d.direction.y;p=!1;k=-1}else if(d.origin.y>c.max.y){g=c.max.y-d.origin.y;g/=d.direction.y;p=!1;k=
+1}if(d.origin.z<c.min.z){h=c.min.z-d.origin.z;h/=d.direction.z;p=!1;m=-1}else if(d.origin.z>c.max.z){h=c.max.z-d.origin.z;h/=d.direction.z;p=!1;m=1}if(p)return-1;p=0;if(g>f){p=1;f=g}if(h>f){p=2;f=h}switch(p){case 0:k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(j,0,0);break;case 1:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;d=d.origin.z+
+d.direction.z*f;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,k,0);break;case 2:j=d.origin.x+d.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal=new THREE.Vector3(0,0,m)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(d<0)d=(f-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var f=d.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-f*f);if(d>=0)return Math.abs(f)-Math.sqrt(d);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionUtils={};
 THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=new THREE.Vector3(c.x[0],c.y[0],c.z[0]);c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]);d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
-THREE.CollisionUtils.MeshColliderWBox=function(b){for(var c=b.geometry.vertices,d=c.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],n=0;n<d;n++)h.push(new THREE.Vector3(c[n].position.x,c[n].position.y,c[n].position.z));for(n=0;n<g;n++){j.push(f[n].a,f[n].b,f[n].c);k.push(new THREE.Vector3(f[n].normal.x,f[n].normal.y,f[n].normal.z))}c=new THREE.MeshCollider(h,j,k,THREE.CollisionUtils.MeshOBB(b));c.mesh=b;return c};
-var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,f=b.vertices.length,g=d?c.geometry:c,h=b.vertices,j=g.vertices,k=b.faces,n=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,w=j.length;o<w;o++){var y=new THREE.Vertex(j[o].position.clone());d&&c.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(w=n.length;o<w;o++){j=n[o];var v,B,G=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)v=new THREE.Face3(j.a+f,j.b+f,j.c+
-f);else j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);d=0;for(h=G.length;d<h;d++){B=G[d];v.vertexNormals.push(B.clone())}v.color.copy(j.color);d=0;for(h=y.length;d<h;d++){B=y[d];v.vertexColors.push(B.clone())}v.materials=j.materials.slice();v.centroid.copy(j.centroid);k.push(v)}o=0;for(w=g.length;o<w;o++){f=g[o];k=[];d=0;for(h=f.length;d<h;d++)k.push(new THREE.UV(f[d].u,f[d].v));p.push(k)}}},ImageUtils={loadTexture:function(b,c,d){var f=new Image,g=
-new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;d&&d(this)};f.src=b;return g},loadTextureCube:function(b,c,d){var f,g=[],h=new THREE.Texture(g,c);c=g.loadCount=0;for(f=b.length;c<f;++c){g[c]=new Image;g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;d&&d(this)};g[c].src=b[c]}return h}},SceneUtils={addMesh:function(b,c,d,f,g,h,j,k,n,p){c=new THREE.Mesh(c,p);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=j;c.rotation.y=k;
-c.rotation.z=n;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),d);b.addObject(c);return c},addPanoramaCube:function(b,c,d){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));
+THREE.CollisionUtils.MeshColliderWBox=function(b){for(var c=b.geometry.vertices,d=c.length,f=b.geometry.faces,g=f.length,h=[],j=[],k=[],m=0;m<d;m++)h.push(new THREE.Vector3(c[m].position.x,c[m].position.y,c[m].position.z));for(m=0;m<g;m++){j.push(f[m].a,f[m].b,f[m].c);k.push(new THREE.Vector3(f[m].normal.x,f[m].normal.y,f[m].normal.z))}c=new THREE.MeshCollider(h,j,k,THREE.CollisionUtils.MeshOBB(b));c.mesh=b;return c};
+var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,f=b.vertices.length,g=d?c.geometry:c,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,p=b.faceVertexUvs[0];g=g.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,x=j.length;o<x;o++){var y=new THREE.Vertex(j[o].position.clone());d&&c.matrix.multiplyVector3(y.position);h.push(y)}o=0;for(x=m.length;o<x;o++){j=m[o];var v,B,F=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)v=new THREE.Face3(j.a+f,j.b+f,j.c+
+f);else j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);d=0;for(h=F.length;d<h;d++){B=F[d];v.vertexNormals.push(B.clone())}v.color.copy(j.color);d=0;for(h=y.length;d<h;d++){B=y[d];v.vertexColors.push(B.clone())}v.materials=j.materials.slice();v.centroid.copy(j.centroid);k.push(v)}o=0;for(x=g.length;o<x;o++){f=g[o];k=[];d=0;for(h=f.length;d<h;d++)k.push(new THREE.UV(f[d].u,f[d].v));p.push(k)}}},ImageUtils={loadTexture:function(b,c,d){var f=new Image,g=
+new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;d&&d(this)};f.src=b;return g},loadTextureCube:function(b,c,d){var f,g=[],h=new THREE.Texture(g,c);c=g.loadCount=0;for(f=b.length;c<f;++c){g[c]=new Image;g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;d&&d(this)};g[c].src=b[c]}return h}},SceneUtils={addMesh:function(b,c,d,f,g,h,j,k,m,p){c=new THREE.Mesh(c,p);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=f;c.position.y=g;c.position.z=h;c.rotation.x=j;c.rotation.y=k;
+c.rotation.z=m;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var f=ShaderUtils.lib.cube;f.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),d);b.addObject(c);return c},addPanoramaCube:function(b,c,d){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));
 f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,f,!0),new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,d){var f=c/2;c=new Plane(c,c);var g=Math.PI,h=Math.PI/2;SceneUtils.addMesh(b,c,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(b,
 c,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(b,c,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(b,c,1,0,f,0,h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(b,c,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))},showHierarchy:function(b,c){SceneUtils.traverseHierarchy(b,function(d){d.visible=c})},traverseHierarchy:function(b,c){var d,f,g=b.children.length;
 for(f=0;f<g;f++){d=b.children[f];c(d);SceneUtils.traverseHierarchy(d,c)}}},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}",
@@ -382,7 +383,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,d,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;d=Array(h);for(c=f=0;c<h;++c){d[c]=Math.exp(-((c-g)*(c-g))/(2*b*b));f+=d[c]}for(c=0;c<h;++c)d[c]/=f;return d}};
-THREE.QuakeCamera=function(b){function c(d,f){return function(){f.apply(d,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;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;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
+THREE.QuakeCamera=function(b){function c(d,f){return function(){f.apply(d,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;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=
 b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=
 b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(d){d.preventDefault();
 d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(d){d.preventDefault();d.stopPropagation();if(this.activeLook)switch(d.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(d){this.mouseX=d.clientX-this.windowHalfX;this.mouseY=d.clientY-this.windowHalfY};this.onKeyDown=function(d){switch(d.keyCode){case 38:case 87:this.moveForward=
@@ -391,89 +392,89 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
 (90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var f=this.target.position,g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*d;this.lookVertical&&(this.lat-=this.mouseY*d);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/
 3.14+this.verticalMin;f=this.target.position;g=this.position;f.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);f.y=g.y+100*Math.cos(this.phi);f.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(d){d.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.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.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(p,o,w,y){var v={name:w,fps:0.6,length:y,hierarchy:[]},B,G=o.getControlPointsArray(),H=o.getLength(),L=G.length,V=0;B=L-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:G[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<L-1;B++){V=y*H.chunks[B]/H.total;o.keys[B]={time:V,pos:G[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,w,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var w,
-y,v=new THREE.Geometry;for(w=0;w<p.points.length*o;w++){y=w/(p.points.length*o);y=p.getPoint(y);v.vertices[w]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var w=d(o,10),y=d(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(w,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
-16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){w=new THREE.Mesh(y,v);w.position.copy(o.points[i]);w.updateMatrix();p.addChild(w)}}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.005;this.lookVertical=
+THREE.PathCamera=function(b){function c(p,o,x,y){var v={name:x,fps:0.6,length:y,hierarchy:[]},B,F=o.getControlPointsArray(),I=o.getLength(),N=F.length,W=0;B=N-1;o={parent:-1,keys:[]};o.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};o.keys[B]={time:y,pos:F[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<N-1;B++){W=y*I.chunks[B]/I.total;o.keys[B]={time:W,pos:F[B]}}v.hierarchy[0]=o;THREE.AnimationHandler.add(v);return new THREE.Animation(p,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function d(p,o){var x,
+y,v=new THREE.Geometry;for(x=0;x<p.points.length*o;x++){y=x/(p.points.length*o);y=p.getPoint(y);v.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return v}function f(p,o){var x=d(o,10),y=d(o,10),v=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,v);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);p.addChild(lineObj);particleObj.scale.set(1,1,1);p.addChild(particleObj);y=new Sphere(1,
+16,8);v=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<o.points.length;i++){x=new THREE.Mesh(y,v);x.position.copy(o.points[i]);x.updateMatrix();p.addChild(x)}}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.lookVertical=
 !0;this.lookHorizontal=!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!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
 if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)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,h=Math.PI/180;this.update=function(p,o,w){var y,v;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)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,w)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),n=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(n,j);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=
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(p,o,x){var y,v;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)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;v=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.horizontalAngleMap.srcRange;v=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(v[1]-v[0])/(y[1]-y[0])+v[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,p,o,x)};this.onMouseMove=function(p){this.mouseX=p.clientX-this.windowHalfX;this.mouseY=p.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);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(p,o){return function(){o.apply(p,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;
-var Cube=function(b,c,d,f,g,h,j,k,n){function p(H,L,V,A,J,O,R,Fa){var ka,va,$=f||1,e=g||1,ea=J/2,Aa=O/2,Ca=o.vertices.length;if(H=="x"&&L=="y"||H=="y"&&L=="x")ka="z";else if(H=="x"&&L=="z"||H=="z"&&L=="x"){ka="y";e=h||1}else if(H=="z"&&L=="y"||H=="y"&&L=="z"){ka="x";$=h||1}var Ha=$+1,X=e+1;J/=$;var oa=O/e;for(va=0;va<X;va++)for(O=0;O<Ha;O++){var pa=new THREE.Vector3;pa[H]=(O*J-ea)*V;pa[L]=(va*oa-Aa)*A;pa[ka]=R;o.vertices.push(new THREE.Vertex(pa))}for(va=0;va<e;va++)for(O=0;O<$;O++){o.faces.push(new THREE.Face4(O+
-Ha*va+Ca,O+Ha*(va+1)+Ca,O+1+Ha*(va+1)+Ca,O+1+Ha*va+Ca,null,null,Fa));o.faceVertexUvs[0].push([new THREE.UV(O/$,va/e),new THREE.UV(O/$,(va+1)/e),new THREE.UV((O+1)/$,(va+1)/e),new THREE.UV((O+1)/$,va/e)])}}THREE.Geometry.call(this);var o=this,w=b/2,y=c/2,v=d/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=undefined)for(var G in n)this.sides[G]!=
-undefined&&(this.sides[G]=n[G]);this.sides.px&&p("z","y",1*k,-1,d,c,-w,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,w,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-v,this.materials[5]);(function(){for(var H=[],L=[],V=0,A=o.vertices.length;V<A;V++){for(var J=o.vertices[V],O=!1,R=0,Fa=H.length;R<Fa;R++){var ka=
-H[R];if(J.position.x==ka.position.x&&J.position.y==ka.position.y&&J.position.z==ka.position.z){L[V]=R;O=!0;break}}if(!O){L[V]=H.length;H.push(new THREE.Vertex(J.position.clone()))}}V=0;for(A=o.faces.length;V<A;V++){J=o.faces[V];J.a=L[J.a];J.b=L[J.b];J.c=L[J.c];J.d=L[J.d]}o.vertices=H})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(b,c,d,f,g,h){function j(y,v,B){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,v,B)))}THREE.Geometry.call(this);var k=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)j(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)j(Math.sin(p*n/b)*d,Math.cos(p*n/b)*d,o);for(n=0;n<b;n++)k.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(d>0){j(0,0,-o-(h||0));for(n=b;n<b+b/2;n++)k.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){j(0,0,o+(g||0));for(n=
-b+b/2;n<2*b;n++)k.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++){c=[];d=this.faces[n];g=this.vertices[d.a];h=this.vertices[d.b];o=this.vertices[d.c];var w=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/f));d instanceof
-THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(w.position.x,w.position.y)/p,0.5+w.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(b){function c(w,y,v){var B=Math.sqrt(w*w+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(w/B,y/B,v/B)))-1}function d(w,y,v,B){B.faces.push(new THREE.Face3(w,y,v))}function f(w,y){var v=g.vertices[w].position,B=g.vertices[y].position;return c((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
-1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var n=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,n,o,j);d(h.faces[k].b,p,n,j);d(h.faces[k].c,
-o,p,j);d(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;c=this.angle/this.steps;d=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));d[k]=b[k].clone();f[k]=this.vertices.length-1}for(var n=0;n<=this.angle+0.001;n+=c){for(k=0;k<d.length;k++)if(n<this.angle){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;n==0&&(h=f);for(k=
-0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,k/b.length),new THREE.UV(1-n/this.angle,(k+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(n-c)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(b,c,d,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2;d=d||1;f=f||1;var k=d+1,n=f+1;b/=d;var p=c/f;for(g=0;g<n;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeFaceNormals()};
+var Cube=function(b,c,d,f,g,h,j,k,m){function p(I,N,W,A,K,O,R,Ca){var ka,va,aa=f||1,e=g||1,da=K/2,ya=O/2,za=o.vertices.length;if(I=="x"&&N=="y"||I=="y"&&N=="x")ka="z";else if(I=="x"&&N=="z"||I=="z"&&N=="x"){ka="y";e=h||1}else if(I=="z"&&N=="y"||I=="y"&&N=="z"){ka="x";aa=h||1}var Ea=aa+1,Y=e+1;K/=aa;var oa=O/e;for(va=0;va<Y;va++)for(O=0;O<Ea;O++){var pa=new THREE.Vector3;pa[I]=(O*K-da)*W;pa[N]=(va*oa-ya)*A;pa[ka]=R;o.vertices.push(new THREE.Vertex(pa))}for(va=0;va<e;va++)for(O=0;O<aa;O++){o.faces.push(new THREE.Face4(O+
+Ea*va+za,O+Ea*(va+1)+za,O+1+Ea*(va+1)+za,O+1+Ea*va+za,null,null,Ca));o.faceVertexUvs[0].push([new THREE.UV(O/aa,va/e),new THREE.UV(O/aa,(va+1)/e),new THREE.UV((O+1)/aa,(va+1)/e),new THREE.UV((O+1)/aa,va/e)])}}THREE.Geometry.call(this);var o=this,x=b/2,y=c/2,v=d/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var F in m)this.sides[F]!=
+undefined&&(this.sides[F]=m[F]);this.sides.px&&p("z","y",1*k,-1,d,c,-x,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,x,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,y,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-y,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,v,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-v,this.materials[5]);(function(){for(var I=[],N=[],W=0,A=o.vertices.length;W<A;W++){for(var K=o.vertices[W],O=!1,R=0,Ca=I.length;R<Ca;R++){var ka=
+I[R];if(K.position.x==ka.position.x&&K.position.y==ka.position.y&&K.position.z==ka.position.z){N[W]=R;O=!0;break}}if(!O){N[W]=I.length;I.push(new THREE.Vertex(K.position.clone()))}}W=0;for(A=o.faces.length;W<A;W++){K=o.faces[W];K.a=N[K.a];K.b=N[K.b];K.c=N[K.c];K.d=N[K.d]}o.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(b,c,d,f,g,h){function j(y,v,B){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,v,B)))}THREE.Geometry.call(this);var k=this,m,p=Math.PI*2,o=f/2;for(m=0;m<b;m++)j(Math.sin(p*m/b)*c,Math.cos(p*m/b)*c,-o);for(m=0;m<b;m++)j(Math.sin(p*m/b)*d,Math.cos(p*m/b)*d,o);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(d>0){j(0,0,-o-(h||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(c>0){j(0,0,o+(g||0));for(m=
+b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){c=[];d=this.faces[m];g=this.vertices[d.a];h=this.vertices[d.b];o=this.vertices[d.c];var x=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/f));d instanceof
+THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(x.position.x,x.position.y)/p,0.5+x.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Icosahedron=function(b){function c(x,y,v){var B=Math.sqrt(x*x+y*y+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/B,y/B,v/B)))-1}function d(x,y,v,B){B.faces.push(new THREE.Face3(x,y,v))}function f(x,y){var v=g.vertices[x].position,B=g.vertices[y].position;return c((v.x+B.x)/2,(v.y+B.y)/2,(v.z+B.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,-b);c(0,
+1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,h);d(0,5,1,h);d(0,1,7,h);d(0,7,10,h);d(0,10,11,h);d(1,5,9,h);d(5,11,4,h);d(11,10,2,h);d(10,7,6,h);d(7,1,8,h);d(3,9,4,h);d(3,4,2,h);d(3,2,6,h);d(3,6,8,h);d(3,8,9,h);d(4,9,5,h);d(2,4,11,h);d(6,2,10,h);d(8,6,7,h);d(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),p=f(h.faces[k].b,h.faces[k].c),o=f(h.faces[k].c,h.faces[k].a);d(h.faces[k].a,m,o,j);d(h.faces[k].b,p,m,j);d(h.faces[k].c,
+o,p,j);d(m,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;c=this.angle/this.steps;d=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));d[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)if(m<this.angle){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=
+0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-c)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(b,c,d,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2;d=d||1;f=f||1;var k=d+1,m=f+1;b/=d;var p=c/f;for(g=0;g<m;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(c/d,g/f),new THREE.UV(c/d,(g+1)/f),new THREE.UV((c+1)/d,(g+1)/f),new THREE.UV((c+1)/d,g/f)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(b,c,d){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6);c=[];for(d=0;d<j+1;d++){f=d/j;var k=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var w=2*f/h,y=n*Math.sin(w*g);w=n*Math.cos(w*g);(d==0||d==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,y)))-1);p.push(o)}c.push(p)}var v,B,G;g=c.length;for(d=0;d<g;d++){h=c[d].length;if(d>0)for(f=0;f<h;f++){p=f==h-1;j=c[d][p?0:f+1];k=c[d][p?h-1:f];n=c[d-1][p?h-1:f];p=c[d-1][p?
-0:f+1];y=d/(g-1);v=(d-1)/(g-1);B=(f+1)/h;w=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-w,y);w=new THREE.UV(1-w,v);var H=new THREE.UV(1-B,v);if(d<c.length-1){v=this.vertices[j].position.clone();B=this.vertices[k].position.clone();G=this.vertices[n].position.clone();v.normalize();B.normalize();G.normalize();this.faces.push(new THREE.Face3(j,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([o,y,w])}if(d>1){v=this.vertices[j].position.clone();
-B=this.vertices[n].position.clone();G=this.vertices[p].position.clone();v.normalize();B.normalize();G.normalize();this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([o,w,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(b,c,d){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,d||6);c=[];for(d=0;d<j+1;d++){f=d/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var x=2*f/h,y=m*Math.sin(x*g);x=m*Math.cos(x*g);(d==0||d==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);p.push(o)}c.push(p)}var v,B,F;g=c.length;for(d=0;d<g;d++){h=c[d].length;if(d>0)for(f=0;f<h;f++){p=f==h-1;j=c[d][p?0:f+1];k=c[d][p?h-1:f];m=c[d-1][p?h-1:f];p=c[d-1][p?
+0:f+1];y=d/(g-1);v=(d-1)/(g-1);B=(f+1)/h;x=f/h;o=new THREE.UV(1-B,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,v);var I=new THREE.UV(1-B,v);if(d<c.length-1){v=this.vertices[j].position.clone();B=this.vertices[k].position.clone();F=this.vertices[m].position.clone();v.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,y,x])}if(d>1){v=this.vertices[j].position.clone();
+B=this.vertices[m].position.clone();F=this.vertices[p].position.clone();v.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([o,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(b,c,d,f){this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=f||6;b=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){f=d/this.segmentsT*2*Math.PI;var 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([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
 1;d<=this.segmentsT;++d){f=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var h=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(b,c,d,f,g,h,j){function k(w,y,v,B,G,H){y=v/B*w;v=Math.cos(y);return new THREE.Vector3(G*(2+v)*0.5*Math.cos(w),G*(2+v)*Math.sin(w)*0.5,H*G*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var n=
-b/this.segmentsR*2*this.p*Math.PI;j=c/this.segmentsT*2*Math.PI;g=k(n,j,this.q,this.p,this.radius,this.heightScale);n=k(n+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=n.x-g.x;d.y=n.y-g.y;d.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(d,f);f.cross(h,d);h.normalize();f.normalize();n=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=n*f.x+j*h.x;g.y+=n*f.y+j*h.y;g.z+=n*f.z+j*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=
-0;c<this.segmentsT;++c){f=(b+1)%this.segmentsR;h=(c+1)%this.segmentsT;g=this.grid[b][c];d=this.grid[f][c];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,c/this.segmentsT);n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT);var 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,d,f,h));this.faceVertexUvs[0].push([j,n,p,o])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+var TorusKnot=function(b,c,d,f,g,h,j){function k(x,y,v,B,F,I){y=v/B*x;v=Math.cos(y);return new THREE.Vector3(F*(2+v)*0.5*Math.cos(x),F*(2+v)*Math.sin(x)*0.5,I*F*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
+b/this.segmentsR*2*this.p*Math.PI;j=c/this.segmentsT*2*Math.PI;g=k(m,j,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=m.x-g.x;d.y=m.y-g.y;d.z=m.z-g.z;f.x=m.x+g.x;f.y=m.y+g.y;f.z=m.z+g.z;h.cross(d,f);f.cross(h,d);h.normalize();f.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=m*f.x+j*h.x;g.y+=m*f.y+j*h.y;g.z+=m*f.z+j*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=
+0;c<this.segmentsT;++c){f=(b+1)%this.segmentsR;h=(c+1)%this.segmentsT;g=this.grid[b][c];d=this.grid[f][c];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,c/this.segmentsT);m=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT);var 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,d,f,h));this.faceVertexUvs[0].push([j,m,p,o])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
 TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],d)]},createMaterial:function(b,c){function d(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,n){var p=new Image;p.onload=function(){if(!d(this.width)||!d(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=o;k.image.height=w;k.image.getContext("2d").drawImage(this,0,0,o,w)}else k.image=this;k.needsUpdate=!0};p.src=n}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="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==
+this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],d)]},createMaterial:function(b,c){function d(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,m){var p=new Image;p.onload=function(){if(!d(this.width)||!d(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=o;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,o,x)}else k.image=this;k.needsUpdate=!0};p.src=m}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="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!==undefined)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*
 255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&c){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,c+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(d);b=new Worker(d);b.onmessage=function(h){c.createModel(h.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,d){var f=new THREE.Geometry;this.init_materials(f,b.materials,d);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,n,p,o,w,y,v,B,G,H,L,V,A=b.faces;v=b.vertices;var J=b.normals,O=b.colors;p=b.scale!==undefined?b.scale:1;var R=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&R++;for(g=0;g<R;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(n=v.length;k<n;){o=new THREE.Vertex;o.position.x=v[k++]/
-p;o.position.y=v[k++]/p;o.position.z=v[k++]/p;f.vertices.push(o)}k=0;for(n=A.length;k<n;){v=A[k++];p=v&1;j=v&2;g=v&4;h=v&8;w=v&16;o=v&32;B=v&64;v&=128;if(p){G=new THREE.Face4;G.a=A[k++];G.b=A[k++];G.c=A[k++];G.d=A[k++];p=4}else{G=new THREE.Face3;G.a=A[k++];G.b=A[k++];G.c=A[k++];p=3}if(j){j=A[k++];G.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<R;g++){H=b.uvs[g];y=A[k++];V=H[y*2];y=H[y*2+1];f.faceUvs[g][j]=new THREE.UV(V,y)}if(h)for(g=0;g<R;g++){H=b.uvs[g];L=[];for(h=0;h<p;h++){y=A[k++];
-V=H[y*2];y=H[y*2+1];L[h]=new THREE.UV(V,y)}f.faceVertexUvs[g][j]=L}if(w){w=A[k++]*3;h=new THREE.Vector3;h.x=J[w++];h.y=J[w++];h.z=J[w];G.normal=h}if(o)for(g=0;g<p;g++){w=A[k++]*3;h=new THREE.Vector3;h.x=J[w++];h.y=J[w++];h.z=J[w];G.vertexNormals.push(h)}if(B){o=A[k++];o=new THREE.Color(O[o]);G.color=o}if(v)for(g=0;g<p;g++){o=A[k++];o=new THREE.Color(O[o]);G.vertexColors.push(o)}f.faces.push(G)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
-k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k,n,p;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];n=f.morphTargets[g].vertices;p=b.morphTargets[g].vertices;
-j=0;for(k=p.length;j<k;j+=3)n.push(new THREE.Vertex(new THREE.Vector3(p[j],p[j+1],p[j+2])))}}if(b.morphColors!==undefined){var o,w;g=0;for(h=b.morphColors.length;g<h;g++){f.morphColors[g]={};f.morphColors[g].name=b.morphColors[g].name;f.morphColors[g].colors=[];p=f.morphColors[g].colors;o=b.morphColors[g].colors;k=0;for(n=o.length;k<n;k+=3){w=new THREE.Color(16755200);w.setRGB(o[j],o[j+1],o[j+2]);p.push(w)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[g];
+THREE.JSONLoader.prototype.createModel=function(b,c,d){var f=new THREE.Geometry;this.init_materials(f,b.materials,d);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,m,p,o,x,y,v,B,F,I,N,W,A=b.faces;v=b.vertices;var K=b.normals,O=b.colors;p=b.scale!==undefined?b.scale:1;var R=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&R++;for(g=0;g<R;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(m=v.length;k<m;){o=new THREE.Vertex;o.position.x=v[k++]/
+p;o.position.y=v[k++]/p;o.position.z=v[k++]/p;f.vertices.push(o)}k=0;for(m=A.length;k<m;){v=A[k++];p=v&1;j=v&2;g=v&4;h=v&8;x=v&16;o=v&32;B=v&64;v&=128;if(p){F=new THREE.Face4;F.a=A[k++];F.b=A[k++];F.c=A[k++];F.d=A[k++];p=4}else{F=new THREE.Face3;F.a=A[k++];F.b=A[k++];F.c=A[k++];p=3}if(j){j=A[k++];F.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<R;g++){I=b.uvs[g];y=A[k++];W=I[y*2];y=I[y*2+1];f.faceUvs[g][j]=new THREE.UV(W,y)}if(h)for(g=0;g<R;g++){I=b.uvs[g];N=[];for(h=0;h<p;h++){y=A[k++];
+W=I[y*2];y=I[y*2+1];N[h]=new THREE.UV(W,y)}f.faceVertexUvs[g][j]=N}if(x){x=A[k++]*3;h=new THREE.Vector3;h.x=K[x++];h.y=K[x++];h.z=K[x];F.normal=h}if(o)for(g=0;g<p;g++){x=A[k++]*3;h=new THREE.Vector3;h.x=K[x++];h.y=K[x++];h.z=K[x];F.vertexNormals.push(h)}if(B){o=A[k++];o=new THREE.Color(O[o]);F.color=o}if(v)for(g=0;g<p;g++){o=A[k++];o=new THREE.Color(O[o]);F.vertexColors.push(o)}f.faces.push(F)}}})();(function(){var g,h,j,k;if(b.skinWeights){g=0;for(h=b.skinWeights.length;g<h;g+=2){j=b.skinWeights[g];
+k=b.skinWeights[g+1];f.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(b.skinIndices){g=0;for(h=b.skinIndices.length;g<h;g+=2){j=b.skinIndices[g];k=b.skinIndices[g+1];f.skinIndices.push(new THREE.Vector4(j,k,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(){if(b.morphTargets!==undefined){var g,h,j,k,m,p;g=0;for(h=b.morphTargets.length;g<h;g++){f.morphTargets[g]={};f.morphTargets[g].name=b.morphTargets[g].name;f.morphTargets[g].vertices=[];m=f.morphTargets[g].vertices;p=b.morphTargets[g].vertices;
+j=0;for(k=p.length;j<k;j+=3)m.push(new THREE.Vertex(new THREE.Vector3(p[j],p[j+1],p[j+2])))}}if(b.morphColors!==undefined){var o,x;g=0;for(h=b.morphColors.length;g<h;g++){f.morphColors[g]={};f.morphColors[g].name=b.morphColors[g].name;f.morphColors[g].colors=[];p=f.morphColors[g].colors;o=b.morphColors[g].colors;k=0;for(m=o.length;k<m;k+=3){x=new THREE.Color(16755200);x.setRGB(o[j],o[j+1],o[j+2]);p.push(x)}}}})();(function(){if(b.edges!==undefined){var g,h,j;for(g=0;g<b.edges.length;g+=2){h=b.edges[g];
 j=b.edges[g+1];f.edges.push(new THREE.Edge(f.vertices[h],f.vertices[j],h,j))}}})();f.computeCentroids();f.computeFaceNormals();f.computeEdgeFaces();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,d=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);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,d,g,f,h)};c.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
-c.postMessage(b)},loadAjaxBuffers:function(b,c,d,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,n=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,g,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){n==0&&(n=j.getResponseHeader("Content-Length"));h({total:n,loaded:j.responseText.length})}}else j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,f){var g=function(h){function j(S,ca){var ma=o(S,ca),Da=o(S,ca+1),Ma=o(S,ca+2),xa=o(S,ca+3),fa=(xa<<1&255|Ma>>7)-127;ma|=(Ma&127)<<16|Da<<8;if(ma==0&&fa==-127)return 0;return(1-2*(xa>>7))*(1+ma*Math.pow(2,-23))*Math.pow(2,fa)}function k(S,ca){var ma=o(S,ca),Da=o(S,ca+1),Ma=o(S,ca+2);return(o(S,ca+3)<<24)+(Ma<<16)+(Da<<8)+ma}function n(S,ca){var ma=o(S,ca);return(o(S,ca+1)<<8)+ma}function p(S,ca){var ma=o(S,
-ca);return ma>127?ma-256:ma}function o(S,ca){return S.charCodeAt(ca)&255}function w(S){var ca,ma,Da;ca=k(b,S);ma=k(b,S+R);Da=k(b,S+Fa);S=n(b,S+ka);THREE.BinaryLoader.prototype.f3(L,ca,ma,Da,S)}function y(S){var ca,ma,Da,Ma,xa,fa;ca=k(b,S);ma=k(b,S+R);Da=k(b,S+Fa);Ma=n(b,S+ka);xa=k(b,S+va);fa=k(b,S+$);S=k(b,S+e);THREE.BinaryLoader.prototype.f3n(L,J,ca,ma,Da,Ma,xa,fa,S)}function v(S){var ca,ma,Da,Ma;ca=k(b,S);ma=k(b,S+ea);Da=k(b,S+Aa);Ma=k(b,S+Ca);S=n(b,S+Ha);THREE.BinaryLoader.prototype.f4(L,ca,ma,
-Da,Ma,S)}function B(S){var ca,ma,Da,Ma,xa,fa,m,C;ca=k(b,S);ma=k(b,S+ea);Da=k(b,S+Aa);Ma=k(b,S+Ca);xa=n(b,S+Ha);fa=k(b,S+X);m=k(b,S+oa);C=k(b,S+pa);S=k(b,S+ta);THREE.BinaryLoader.prototype.f4n(L,J,ca,ma,Da,Ma,xa,fa,m,C,S)}function G(S){var ca,ma;ca=k(b,S);ma=k(b,S+ga);S=k(b,S+Z);THREE.BinaryLoader.prototype.uv3(L.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[ma*2],O[ma*2+1],O[S*2],O[S*2+1])}function H(S){var ca,ma,Da;ca=k(b,S);ma=k(b,S+la);Da=k(b,S+Ga);S=k(b,S+ia);THREE.BinaryLoader.prototype.uv4(L.faceVertexUvs[0],
-O[ca*2],O[ca*2+1],O[ma*2],O[ma*2+1],O[Da*2],O[Da*2+1],O[S*2],O[S*2+1])}var L=this,V=0,A,J=[],O=[],R,Fa,ka,va,$,e,ea,Aa,Ca,Ha,X,oa,pa,ta,ga,Z,la,Ga,ia,ja,ua,Ra,$a,ab,Oa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(L,f,h);A={signature:b.substr(V,8),header_bytes:o(b,V+8),vertex_coordinate_bytes:o(b,V+9),normal_coordinate_bytes:o(b,V+10),uv_coordinate_bytes:o(b,V+11),vertex_index_bytes:o(b,V+12),normal_index_bytes:o(b,V+13),uv_index_bytes:o(b,V+14),material_index_bytes:o(b,V+15),nvertices:k(b,
-V+16),nnormals:k(b,V+16+4),nuvs:k(b,V+16+8),ntri_flat:k(b,V+16+12),ntri_smooth:k(b,V+16+16),ntri_flat_uv:k(b,V+16+20),ntri_smooth_uv:k(b,V+16+24),nquad_flat:k(b,V+16+28),nquad_smooth:k(b,V+16+32),nquad_flat_uv:k(b,V+16+36),nquad_smooth_uv:k(b,V+16+40)};V+=A.header_bytes;R=A.vertex_index_bytes;Fa=A.vertex_index_bytes*2;ka=A.vertex_index_bytes*3;va=A.vertex_index_bytes*3+A.material_index_bytes;$=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;e=A.vertex_index_bytes*3+A.material_index_bytes+
-A.normal_index_bytes*2;ea=A.vertex_index_bytes;Aa=A.vertex_index_bytes*2;Ca=A.vertex_index_bytes*3;Ha=A.vertex_index_bytes*4;X=A.vertex_index_bytes*4+A.material_index_bytes;oa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;pa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;ta=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;ga=A.uv_index_bytes;Z=A.uv_index_bytes*2;la=A.uv_index_bytes;Ga=A.uv_index_bytes*2;ia=A.uv_index_bytes*3;h=A.vertex_index_bytes*
-3+A.material_index_bytes;Oa=A.vertex_index_bytes*4+A.material_index_bytes;ja=A.ntri_flat*h;ua=A.ntri_smooth*(h+A.normal_index_bytes*3);Ra=A.ntri_flat_uv*(h+A.uv_index_bytes*3);$a=A.ntri_smooth_uv*(h+A.normal_index_bytes*3+A.uv_index_bytes*3);ab=A.nquad_flat*Oa;h=A.nquad_smooth*(Oa+A.normal_index_bytes*4);Oa=A.nquad_flat_uv*(Oa+A.uv_index_bytes*4);V+=function(S){for(var ca,ma,Da,Ma=A.vertex_coordinate_bytes*3,xa=S+A.nvertices*Ma;S<xa;S+=Ma){ca=j(b,S);ma=j(b,S+A.vertex_coordinate_bytes);Da=j(b,S+A.vertex_coordinate_bytes*
-2);THREE.BinaryLoader.prototype.v(L,ca,ma,Da)}return A.nvertices*Ma}(V);V+=function(S){for(var ca,ma,Da,Ma=A.normal_coordinate_bytes*3,xa=S+A.nnormals*Ma;S<xa;S+=Ma){ca=p(b,S);ma=p(b,S+A.normal_coordinate_bytes);Da=p(b,S+A.normal_coordinate_bytes*2);J.push(ca/127,ma/127,Da/127)}return A.nnormals*Ma}(V);V+=function(S){for(var ca,ma,Da=A.uv_coordinate_bytes*2,Ma=S+A.nuvs*Da;S<Ma;S+=Da){ca=j(b,S);ma=j(b,S+A.uv_coordinate_bytes);O.push(ca,ma)}return A.nuvs*Da}(V);ja=V+ja;ua=ja+ua;Ra=ua+Ra;$a=Ra+$a;ab=
-$a+ab;h=ab+h;Oa=h+Oa;(function(S){var ca,ma=A.vertex_index_bytes*3+A.material_index_bytes,Da=ma+A.uv_index_bytes*3,Ma=S+A.ntri_flat_uv*Da;for(ca=S;ca<Ma;ca+=Da){w(ca);G(ca+ma)}return Ma-S})(ua);(function(S){var ca,ma=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Da=ma+A.uv_index_bytes*3,Ma=S+A.ntri_smooth_uv*Da;for(ca=S;ca<Ma;ca+=Da){y(ca);G(ca+ma)}return Ma-S})(Ra);(function(S){var ca,ma=A.vertex_index_bytes*4+A.material_index_bytes,Da=ma+A.uv_index_bytes*4,Ma=S+A.nquad_flat_uv*
-Da;for(ca=S;ca<Ma;ca+=Da){v(ca);H(ca+ma)}return Ma-S})(h);(function(S){var ca,ma=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,Da=ma+A.uv_index_bytes*4,Ma=S+A.nquad_smooth_uv*Da;for(ca=S;ca<Ma;ca+=Da){B(ca);H(ca+ma)}return Ma-S})(Oa);(function(S){var ca,ma=A.vertex_index_bytes*3+A.material_index_bytes,Da=S+A.ntri_flat*ma;for(ca=S;ca<Da;ca+=ma)w(ca);return Da-S})(V);(function(S){var ca,ma=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Da=S+A.ntri_smooth*
-ma;for(ca=S;ca<Da;ca+=ma)y(ca);return Da-S})(ja);(function(S){var ca,ma=A.vertex_index_bytes*4+A.material_index_bytes,Da=S+A.nquad_flat*ma;for(ca=S;ca<Da;ca+=ma)v(ca);return Da-S})($a);(function(S){var ca,ma=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,Da=S+A.nquad_smooth*ma;for(ca=S;ca<Da;ca+=ma)B(ca);return Da-S})(ab);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},v:function(b,c,d,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
-d,f)))},f3:function(b,c,d,f,g){b.faces.push(new THREE.Face3(c,d,f,null,null,b.materials[g]))},f4:function(b,c,d,f,g,h){b.faces.push(new THREE.Face4(c,d,f,g,null,null,b.materials[h]))},f3n:function(b,c,d,f,g,h,j,k,n){h=b.materials[h];var p=c[k*3],o=c[k*3+1];k=c[k*3+2];var w=c[n*3],y=c[n*3+1];n=c[n*3+2];b.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(w,y,n)],null,h))},f4n:function(b,c,d,f,g,h,j,k,n,p,o){j=b.materials[j];var w=
-c[n*3],y=c[n*3+1];n=c[n*3+2];var v=c[p*3],B=c[p*3+1];p=c[p*3+2];var G=c[o*3],H=c[o*3+1];o=c[o*3+2];b.faces.push(new THREE.Face4(d,f,g,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(w,y,n),new THREE.Vector3(v,B,p),new THREE.Vector3(G,H,o)],null,j))},uv3:function(b,c,d,f,g,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,f,g,h,j,k,n){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,
-j));p.push(new THREE.UV(k,n));b.push(p)}};THREE.SceneLoader=function(){};
-THREE.SceneLoader.prototype={load:function(b,c,d,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(ga,Z){return Z=="relativeToHTML"?ga:h+"/"+ga}function n(){for(v in $.objects)if(!X.objects[v]){V=$.objects[v];if(R=X.geometries[V.geometry]){va=[];for(ta=0;ta<V.materials.length;ta++)va[ta]=X.materials[V.materials[ta]];A=V.position;r=V.rotation;q=V.quaternion;s=V.scale;q=0;va.length==0&&(va[0]=new THREE.MeshFaceMaterial);object=
-new THREE.Mesh(R,va);object.position.set(A[0],A[1],A[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=V.visible;X.scene.addObject(object);X.objects[v]=object;if(V.meshCollider){var ga=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(ga)}}}}function p(ga){return function(Z){X.geometries[ga]=Z;n();ea-=1;o()}}function o(){f({total_models:Ca,total_textures:Ha,
-loaded_models:Ca-ea,loaded_textures:Ha-Aa},X);ea==0&&Aa==0&&d(X)}var w,y,v,B,G,H,L,V,A,J,O,R,Fa,ka,va,$,e,ea,Aa,Ca,Ha,X;$=j.data;j=new THREE.BinaryLoader;e=new THREE.JSONLoader;Aa=ea=0;X={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if($.transform){var oa=$.transform.position;J=$.transform.rotation;var pa=$.transform.scale;oa&&X.scene.position.set(oa[0],oa[1],oa[2]);J&&X.scene.rotation.set(J[0],J[1],J[2]);pa&&X.scene.scale.set(pa[0],pa[1],pa[2]);
-(oa||J||pa)&&X.scene.updateMatrix()}oa=function(){Aa-=1;o()};for(G in $.cameras){J=$.cameras[G];if(J.type=="perspective")Fa=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho"){Fa=new THREE.Camera;Fa.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far)}A=J.position;J=J.target;Fa.position.set(A[0],A[1],A[2]);Fa.target.position.set(J[0],J[1],J[2]);X.cameras[G]=Fa}for(B in $.lights){G=$.lights[B];Fa=G.color!==undefined?G.color:16777215;J=G.intensity!==
-undefined?G.intensity:1;if(G.type=="directional"){A=G.direction;light=new THREE.DirectionalLight(Fa,J);light.position.set(A[0],A[1],A[2]);light.position.normalize()}else if(G.type=="point"){A=G.position;light=new THREE.PointLight(Fa,J);light.position.set(A[0],A[1],A[2])}X.scene.addLight(light);X.lights[B]=light}for(H in $.fogs){B=$.fogs[H];if(B.type=="linear")ka=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(ka=new THREE.FogExp2(0,B.density));J=B.color;ka.color.setRGB(J[0],J[1],J[2]);X.fogs[H]=
-ka}if(X.cameras&&$.defaults.camera)X.currentCamera=X.cameras[$.defaults.camera];if(X.fogs&&$.defaults.fog)X.scene.fog=X.fogs[$.defaults.fog];J=$.defaults.bgcolor;X.bgColor=new THREE.Color;X.bgColor.setRGB(J[0],J[1],J[2]);X.bgColorAlpha=$.defaults.bgalpha;for(w in $.geometries){H=$.geometries[w];if(H.type=="bin_mesh"||H.type=="ascii_mesh")ea+=1}Ca=ea;for(w in $.geometries){H=$.geometries[w];if(H.type=="cube"){R=new Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,
-H.flipped,H.sides);X.geometries[w]=R}else if(H.type=="plane"){R=new Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);X.geometries[w]=R}else if(H.type=="sphere"){R=new Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);X.geometries[w]=R}else if(H.type=="cylinder"){R=new Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);X.geometries[w]=R}else if(H.type=="torus"){R=new Torus(H.radius,H.tube,H.segmentsR,H.segmentsT);X.geometries[w]=R}else if(H.type=="icosahedron"){R=new Icosahedron(H.subdivisions);
-X.geometries[w]=R}else if(H.type=="bin_mesh")j.load({model:k(H.url,$.urlBaseType),callback:p(w)});else H.type=="ascii_mesh"&&e.load({model:k(H.url,$.urlBaseType),callback:p(w)})}for(L in $.textures){w=$.textures[L];Aa+=w.url instanceof Array?w.url.length:1}Ha=Aa;for(L in $.textures){w=$.textures[L];if(w.mapping!=undefined&&THREE[w.mapping]!=undefined)w.mapping=new THREE[w.mapping];if(w.url instanceof Array){H=[];for(var ta=0;ta<w.url.length;ta++)H[ta]=k(w.url[ta],$.urlBaseType);H=ImageUtils.loadTextureCube(H,
-w.mapping,oa)}else{H=ImageUtils.loadTexture(k(w.url,$.urlBaseType),w.mapping,oa);if(THREE[w.minFilter]!=undefined)H.minFilter=THREE[w.minFilter];if(THREE[w.magFilter]!=undefined)H.magFilter=THREE[w.magFilter]}X.textures[L]=H}for(y in $.materials){L=$.materials[y];for(O in L.parameters)if(O=="envMap"||O=="map"||O=="lightMap")L.parameters[O]=X.textures[L.parameters[O]];else if(O=="shading")L.parameters[O]=L.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")L.parameters[O]=
-THREE[L.parameters[O]]?THREE[L.parameters[O]]:THREE.NormalBlending;else O=="combine"&&(L.parameters[O]=L.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);L=new THREE[L.type](L.parameters);X.materials[y]=L}n();c(X)}}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+c.postMessage(b)},loadAjaxBuffers:function(b,c,d,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,g,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,f){var g=function(h){function j(U,ca){var na=o(U,ca),Aa=o(U,ca+1),La=o(U,ca+2),wa=o(U,ca+3),ea=(wa<<1&255|La>>7)-127;na|=(La&127)<<16|Aa<<8;if(na==0&&ea==-127)return 0;return(1-2*(wa>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,ea)}function k(U,ca){var na=o(U,ca),Aa=o(U,ca+1),La=o(U,ca+2);return(o(U,ca+3)<<24)+(La<<16)+(Aa<<8)+na}function m(U,ca){var na=o(U,ca);return(o(U,ca+1)<<8)+na}function p(U,ca){var na=o(U,
+ca);return na>127?na-256:na}function o(U,ca){return U.charCodeAt(ca)&255}function x(U){var ca,na,Aa;ca=k(b,U);na=k(b,U+R);Aa=k(b,U+Ca);U=m(b,U+ka);THREE.BinaryLoader.prototype.f3(N,ca,na,Aa,U)}function y(U){var ca,na,Aa,La,wa,ea;ca=k(b,U);na=k(b,U+R);Aa=k(b,U+Ca);La=m(b,U+ka);wa=k(b,U+va);ea=k(b,U+aa);U=k(b,U+e);THREE.BinaryLoader.prototype.f3n(N,K,ca,na,Aa,La,wa,ea,U)}function v(U){var ca,na,Aa,La;ca=k(b,U);na=k(b,U+da);Aa=k(b,U+ya);La=k(b,U+za);U=m(b,U+Ea);THREE.BinaryLoader.prototype.f4(N,ca,na,
+Aa,La,U)}function B(U){var ca,na,Aa,La,wa,ea,fb,ab;ca=k(b,U);na=k(b,U+da);Aa=k(b,U+ya);La=k(b,U+za);wa=m(b,U+Ea);ea=k(b,U+Y);fb=k(b,U+oa);ab=k(b,U+pa);U=k(b,U+ta);THREE.BinaryLoader.prototype.f4n(N,K,ca,na,Aa,La,wa,ea,fb,ab,U)}function F(U){var ca,na;ca=k(b,U);na=k(b,U+fa);U=k(b,U+Z);THREE.BinaryLoader.prototype.uv3(N.faceVertexUvs[0],O[ca*2],O[ca*2+1],O[na*2],O[na*2+1],O[U*2],O[U*2+1])}function I(U){var ca,na,Aa;ca=k(b,U);na=k(b,U+ma);Aa=k(b,U+Da);U=k(b,U+ga);THREE.BinaryLoader.prototype.uv4(N.faceVertexUvs[0],
+O[ca*2],O[ca*2+1],O[na*2],O[na*2+1],O[Aa*2],O[Aa*2+1],O[U*2],O[U*2+1])}var N=this,W=0,A,K=[],O=[],R,Ca,ka,va,aa,e,da,ya,za,Ea,Y,oa,pa,ta,fa,Z,ma,Da,ga,ia,ua,Ta,Ya,Za,Qa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(N,f,h);A={signature:b.substr(W,8),header_bytes:o(b,W+8),vertex_coordinate_bytes:o(b,W+9),normal_coordinate_bytes:o(b,W+10),uv_coordinate_bytes:o(b,W+11),vertex_index_bytes:o(b,W+12),normal_index_bytes:o(b,W+13),uv_index_bytes:o(b,W+14),material_index_bytes:o(b,W+15),nvertices:k(b,
+W+16),nnormals:k(b,W+16+4),nuvs:k(b,W+16+8),ntri_flat:k(b,W+16+12),ntri_smooth:k(b,W+16+16),ntri_flat_uv:k(b,W+16+20),ntri_smooth_uv:k(b,W+16+24),nquad_flat:k(b,W+16+28),nquad_smooth:k(b,W+16+32),nquad_flat_uv:k(b,W+16+36),nquad_smooth_uv:k(b,W+16+40)};W+=A.header_bytes;R=A.vertex_index_bytes;Ca=A.vertex_index_bytes*2;ka=A.vertex_index_bytes*3;va=A.vertex_index_bytes*3+A.material_index_bytes;aa=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;e=A.vertex_index_bytes*3+A.material_index_bytes+
+A.normal_index_bytes*2;da=A.vertex_index_bytes;ya=A.vertex_index_bytes*2;za=A.vertex_index_bytes*3;Ea=A.vertex_index_bytes*4;Y=A.vertex_index_bytes*4+A.material_index_bytes;oa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;pa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;ta=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;fa=A.uv_index_bytes;Z=A.uv_index_bytes*2;ma=A.uv_index_bytes;Da=A.uv_index_bytes*2;ga=A.uv_index_bytes*3;h=A.vertex_index_bytes*
+3+A.material_index_bytes;Qa=A.vertex_index_bytes*4+A.material_index_bytes;ia=A.ntri_flat*h;ua=A.ntri_smooth*(h+A.normal_index_bytes*3);Ta=A.ntri_flat_uv*(h+A.uv_index_bytes*3);Ya=A.ntri_smooth_uv*(h+A.normal_index_bytes*3+A.uv_index_bytes*3);Za=A.nquad_flat*Qa;h=A.nquad_smooth*(Qa+A.normal_index_bytes*4);Qa=A.nquad_flat_uv*(Qa+A.uv_index_bytes*4);W+=function(U){for(var ca,na,Aa,La=A.vertex_coordinate_bytes*3,wa=U+A.nvertices*La;U<wa;U+=La){ca=j(b,U);na=j(b,U+A.vertex_coordinate_bytes);Aa=j(b,U+A.vertex_coordinate_bytes*
+2);THREE.BinaryLoader.prototype.v(N,ca,na,Aa)}return A.nvertices*La}(W);W+=function(U){for(var ca,na,Aa,La=A.normal_coordinate_bytes*3,wa=U+A.nnormals*La;U<wa;U+=La){ca=p(b,U);na=p(b,U+A.normal_coordinate_bytes);Aa=p(b,U+A.normal_coordinate_bytes*2);K.push(ca/127,na/127,Aa/127)}return A.nnormals*La}(W);W+=function(U){for(var ca,na,Aa=A.uv_coordinate_bytes*2,La=U+A.nuvs*Aa;U<La;U+=Aa){ca=j(b,U);na=j(b,U+A.uv_coordinate_bytes);O.push(ca,na)}return A.nuvs*Aa}(W);ia=W+ia;ua=ia+ua;Ta=ua+Ta;Ya=Ta+Ya;Za=
+Ya+Za;h=Za+h;Qa=h+Qa;(function(U){var ca,na=A.vertex_index_bytes*3+A.material_index_bytes,Aa=na+A.uv_index_bytes*3,La=U+A.ntri_flat_uv*Aa;for(ca=U;ca<La;ca+=Aa){x(ca);F(ca+na)}return La-U})(ua);(function(U){var ca,na=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Aa=na+A.uv_index_bytes*3,La=U+A.ntri_smooth_uv*Aa;for(ca=U;ca<La;ca+=Aa){y(ca);F(ca+na)}return La-U})(Ta);(function(U){var ca,na=A.vertex_index_bytes*4+A.material_index_bytes,Aa=na+A.uv_index_bytes*4,La=U+A.nquad_flat_uv*
+Aa;for(ca=U;ca<La;ca+=Aa){v(ca);I(ca+na)}return La-U})(h);(function(U){var ca,na=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,Aa=na+A.uv_index_bytes*4,La=U+A.nquad_smooth_uv*Aa;for(ca=U;ca<La;ca+=Aa){B(ca);I(ca+na)}return La-U})(Qa);(function(U){var ca,na=A.vertex_index_bytes*3+A.material_index_bytes,Aa=U+A.ntri_flat*na;for(ca=U;ca<Aa;ca+=na)x(ca);return Aa-U})(W);(function(U){var ca,na=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,Aa=U+A.ntri_smooth*
+na;for(ca=U;ca<Aa;ca+=na)y(ca);return Aa-U})(ia);(function(U){var ca,na=A.vertex_index_bytes*4+A.material_index_bytes,Aa=U+A.nquad_flat*na;for(ca=U;ca<Aa;ca+=na)v(ca);return Aa-U})(Ya);(function(U){var ca,na=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,Aa=U+A.nquad_smooth*na;for(ca=U;ca<Aa;ca+=na)B(ca);return Aa-U})(Za);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},v:function(b,c,d,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,
+d,f)))},f3:function(b,c,d,f,g){b.faces.push(new THREE.Face3(c,d,f,null,null,b.materials[g]))},f4:function(b,c,d,f,g,h){b.faces.push(new THREE.Face4(c,d,f,g,null,null,b.materials[h]))},f3n:function(b,c,d,f,g,h,j,k,m){h=b.materials[h];var p=c[k*3],o=c[k*3+1];k=c[k*3+2];var x=c[m*3],y=c[m*3+1];m=c[m*3+2];b.faces.push(new THREE.Face3(d,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,k),new THREE.Vector3(x,y,m)],null,h))},f4n:function(b,c,d,f,g,h,j,k,m,p,o){j=b.materials[j];var x=
+c[m*3],y=c[m*3+1];m=c[m*3+2];var v=c[p*3],B=c[p*3+1];p=c[p*3+2];var F=c[o*3],I=c[o*3+1];o=c[o*3+2];b.faces.push(new THREE.Face4(d,f,g,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,y,m),new THREE.Vector3(v,B,p),new THREE.Vector3(F,I,o)],null,j))},uv3:function(b,c,d,f,g,h,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,c,d,f,g,h,j,k,m){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,
+j));p.push(new THREE.UV(k,m));b.push(p)}};THREE.SceneLoader=function(){};
+THREE.SceneLoader.prototype={load:function(b,c,d,f){var g=new Worker(b);g.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);g.onmessage=function(j){function k(fa,Z){return Z=="relativeToHTML"?fa:h+"/"+fa}function m(){for(v in aa.objects)if(!Y.objects[v]){W=aa.objects[v];if(R=Y.geometries[W.geometry]){va=[];for(ta=0;ta<W.materials.length;ta++)va[ta]=Y.materials[W.materials[ta]];A=W.position;r=W.rotation;q=W.quaternion;s=W.scale;q=0;va.length==0&&(va[0]=new THREE.MeshFaceMaterial);object=
+new THREE.Mesh(R,va);object.position.set(A[0],A[1],A[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=W.visible;Y.scene.addObject(object);Y.objects[v]=object;if(W.meshCollider){var fa=THREE.CollisionUtils.MeshColliderWBox(object);THREE.Collisions.colliders.push(fa)}}}}function p(fa){return function(Z){Y.geometries[fa]=Z;m();da-=1;o()}}function o(){f({total_models:za,total_textures:Ea,
+loaded_models:za-da,loaded_textures:Ea-ya},Y);da==0&&ya==0&&d(Y)}var x,y,v,B,F,I,N,W,A,K,O,R,Ca,ka,va,aa,e,da,ya,za,Ea,Y;aa=j.data;j=new THREE.BinaryLoader;e=new THREE.JSONLoader;ya=da=0;Y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};if(aa.transform){var oa=aa.transform.position;K=aa.transform.rotation;var pa=aa.transform.scale;oa&&Y.scene.position.set(oa[0],oa[1],oa[2]);K&&Y.scene.rotation.set(K[0],K[1],K[2]);pa&&Y.scene.scale.set(pa[0],pa[1],
+pa[2]);(oa||K||pa)&&Y.scene.updateMatrix()}oa=function(){ya-=1;o()};for(F in aa.cameras){K=aa.cameras[F];if(K.type=="perspective")Ca=new THREE.Camera(K.fov,K.aspect,K.near,K.far);else if(K.type=="ortho"){Ca=new THREE.Camera;Ca.projectionMatrix=THREE.Matrix4.makeOrtho(K.left,K.right,K.top,K.bottom,K.near,K.far)}A=K.position;K=K.target;Ca.position.set(A[0],A[1],A[2]);Ca.target.position.set(K[0],K[1],K[2]);Y.cameras[F]=Ca}for(B in aa.lights){F=aa.lights[B];Ca=F.color!==undefined?F.color:16777215;K=F.intensity!==
+undefined?F.intensity:1;if(F.type=="directional"){A=F.direction;light=new THREE.DirectionalLight(Ca,K);light.position.set(A[0],A[1],A[2]);light.position.normalize()}else if(F.type=="point"){A=F.position;light=new THREE.PointLight(Ca,K);light.position.set(A[0],A[1],A[2])}Y.scene.addLight(light);Y.lights[B]=light}for(I in aa.fogs){B=aa.fogs[I];if(B.type=="linear")ka=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(ka=new THREE.FogExp2(0,B.density));K=B.color;ka.color.setRGB(K[0],K[1],K[2]);Y.fogs[I]=
+ka}if(Y.cameras&&aa.defaults.camera)Y.currentCamera=Y.cameras[aa.defaults.camera];if(Y.fogs&&aa.defaults.fog)Y.scene.fog=Y.fogs[aa.defaults.fog];K=aa.defaults.bgcolor;Y.bgColor=new THREE.Color;Y.bgColor.setRGB(K[0],K[1],K[2]);Y.bgColorAlpha=aa.defaults.bgalpha;for(x in aa.geometries){I=aa.geometries[x];if(I.type=="bin_mesh"||I.type=="ascii_mesh")da+=1}za=da;for(x in aa.geometries){I=aa.geometries[x];if(I.type=="cube"){R=new Cube(I.width,I.height,I.depth,I.segmentsWidth,I.segmentsHeight,I.segmentsDepth,
+null,I.flipped,I.sides);Y.geometries[x]=R}else if(I.type=="plane"){R=new Plane(I.width,I.height,I.segmentsWidth,I.segmentsHeight);Y.geometries[x]=R}else if(I.type=="sphere"){R=new Sphere(I.radius,I.segmentsWidth,I.segmentsHeight);Y.geometries[x]=R}else if(I.type=="cylinder"){R=new Cylinder(I.numSegs,I.topRad,I.botRad,I.height,I.topOffset,I.botOffset);Y.geometries[x]=R}else if(I.type=="torus"){R=new Torus(I.radius,I.tube,I.segmentsR,I.segmentsT);Y.geometries[x]=R}else if(I.type=="icosahedron"){R=new Icosahedron(I.subdivisions);
+Y.geometries[x]=R}else if(I.type=="bin_mesh")j.load({model:k(I.url,aa.urlBaseType),callback:p(x)});else I.type=="ascii_mesh"&&e.load({model:k(I.url,aa.urlBaseType),callback:p(x)})}for(N in aa.textures){x=aa.textures[N];ya+=x.url instanceof Array?x.url.length:1}Ea=ya;for(N in aa.textures){x=aa.textures[N];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){I=[];for(var ta=0;ta<x.url.length;ta++)I[ta]=k(x.url[ta],aa.urlBaseType);I=ImageUtils.loadTextureCube(I,
+x.mapping,oa)}else{I=ImageUtils.loadTexture(k(x.url,aa.urlBaseType),x.mapping,oa);if(THREE[x.minFilter]!=undefined)I.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)I.magFilter=THREE[x.magFilter]}Y.textures[N]=I}for(y in aa.materials){N=aa.materials[y];for(O in N.parameters)if(O=="envMap"||O=="map"||O=="lightMap")N.parameters[O]=Y.textures[N.parameters[O]];else if(O=="shading")N.parameters[O]=N.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")N.parameters[O]=
+THREE[N.parameters[O]]?THREE[N.parameters[O]]:THREE.NormalBlending;else O=="combine"&&(N.parameters[O]=N.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);N=new THREE[N.type](N.parameters);Y.materials[y]=N}m();c(Y)}}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(d){this.isolation=80;this.size=d;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(d,f,g){return d+(f-d)*g};this.VIntX=function(d,f,g,h,j,k,n,p,o,w){j=(j-o)/(w-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=n;f[h+2]=p;g[h]=this.lerp(o[d],o[d+3],j);g[h+1]=this.lerp(o[d+1],o[d+4],j);g[h+2]=this.lerp(o[d+2],o[d+5],j)};this.VIntY=function(d,f,g,h,j,k,n,p,o,w){j=(j-o)/(w-o);o=this.normal_cache;f[h]=k;f[h+1]=n+j*this.delta;f[h+
-2]=p;f=d+this.yd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.VIntZ=function(d,f,g,h,j,k,n,p,o,w){j=(j-o)/(w-o);o=this.normal_cache;f[h]=k;f[h+1]=n;f[h+2]=p+j*this.delta;f=d+this.zd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.compNorm=function(d){var f=d*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[d-1]-this.field[d+1];this.normal_cache[f+1]=this.field[d-this.yd]-
-this.field[d+this.yd];this.normal_cache[f+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,f,g,h,j,k){var n=h+1,p=h+this.yd,o=h+this.zd,w=n+this.yd,y=n+this.zd,v=h+this.yd+this.zd,B=n+this.yd+this.zd,G=0,H=this.field[h],L=this.field[n],V=this.field[p],A=this.field[w],J=this.field[o],O=this.field[y],R=this.field[v],Fa=this.field[B];H<j&&(G|=1);L<j&&(G|=2);V<j&&(G|=8);A<j&&(G|=4);J<j&&(G|=16);O<j&&(G|=32);R<j&&(G|=128);Fa<j&&(G|=64);var ka=THREE.edgeTable[G];if(ka==0)return 0;
-var va=this.delta,$=d+va,e=f+va;va=g+va;if(ka&1){this.compNorm(h);this.compNorm(n);this.VIntX(h*3,this.vlist,this.nlist,0,j,d,f,g,H,L)}if(ka&2){this.compNorm(n);this.compNorm(w);this.VIntY(n*3,this.vlist,this.nlist,3,j,$,f,g,L,A)}if(ka&4){this.compNorm(p);this.compNorm(w);this.VIntX(p*3,this.vlist,this.nlist,6,j,d,e,g,V,A)}if(ka&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,d,f,g,H,V)}if(ka&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
-12,j,d,f,va,J,O)}if(ka&32){this.compNorm(y);this.compNorm(B);this.VIntY(y*3,this.vlist,this.nlist,15,j,$,f,va,O,Fa)}if(ka&64){this.compNorm(v);this.compNorm(B);this.VIntX(v*3,this.vlist,this.nlist,18,j,d,e,va,R,Fa)}if(ka&128){this.compNorm(o);this.compNorm(v);this.VIntY(o*3,this.vlist,this.nlist,21,j,d,f,va,J,R)}if(ka&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,d,f,g,H,J)}if(ka&512){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,27,j,$,
-f,g,L,O)}if(ka&1024){this.compNorm(w);this.compNorm(B);this.VIntZ(w*3,this.vlist,this.nlist,30,j,$,e,g,A,Fa)}if(ka&2048){this.compNorm(p);this.compNorm(v);this.VIntZ(p*3,this.vlist,this.nlist,33,j,d,e,g,V,R)}G<<=4;for(j=h=0;THREE.triTable[G+j]!=-1;){d=G+j;f=d+1;g=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(d,f,g,h,j,k){var n=this.count*3;this.positionArray[n]=d[g];this.positionArray[n+1]=d[g+
-1];this.positionArray[n+2]=d[g+2];this.positionArray[n+3]=d[h];this.positionArray[n+4]=d[h+1];this.positionArray[n+5]=d[h+2];this.positionArray[n+6]=d[j];this.positionArray[n+7]=d[j+1];this.positionArray[n+8]=d[j+2];this.normalArray[n]=f[g];this.normalArray[n+1]=f[g+1];this.normalArray[n+2]=f[g+2];this.normalArray[n+3]=f[h];this.normalArray[n+4]=f[h+1];this.normalArray[n+5]=f[h+2];this.normalArray[n+6]=f[j];this.normalArray[n+7]=f[j+1];this.normalArray[n+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
-this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(d){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;d(this)}};this.addBall=function(d,f,g,h,j){var k=this.size*Math.sqrt(h/j),n=g*this.size,p=f*this.size,o=d*this.size,w=Math.floor(n-k);w<1&&(w=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
-this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,G,H,L,V,A;w<n;w++){o=this.size2*w;G=w/this.size-g;V=G*G;for(G=y;G<p;G++){H=o+this.size*G;B=G/this.size-f;A=B*B;for(B=v;B<k;B++){L=B/this.size-d;L=h/(1.0E-6+L*L+A+V)-j;L>0&&(this.field[H+B]+=L)}}}};this.addPlaneX=function(d,f){var g,h,j,k,n,p=this.size,o=this.yd,w=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g<v;g++){h=g/p;h*=h;k=d/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){n=g+h*o;for(j=
-0;j<p;j++)y[w*j+n]+=k}}};this.addPlaneY=function(d,f){var g,h,j,k,n,p,o=this.size,w=this.yd,y=this.zd,v=this.field,B=o*Math.sqrt(d/f);B>o&&(B=o);for(h=0;h<B;h++){g=h/o;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=h*w;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)v[y*j+p]+=k}}}};this.addPlaneZ=function(d,f){var g,h,j,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=d/(1.0E-4+g)-f;if(k>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;
-for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var d;for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var f,g,h,j,k,n,p,o,w,y=this.size-2;for(j=1;j<y;j++){w=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=w+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,n,p,f,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,f=new THREE.Geometry,
-g=[];this.render(function(h){var j,k,n,p,o,w,y,v;for(j=0;j<h.count;j++){y=j*3;o=y+1;v=y+2;k=h.positionArray[y];n=h.positionArray[o];p=h.positionArray[v];w=new THREE.Vector3(k,n,p);k=h.normalArray[y];n=h.normalArray[o];p=h.normalArray[v];y=new THREE.Vector3(k,n,p);y.normalize();o=new THREE.Vertex(w);f.vertices.push(o);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(d+j)*3;o=y+1;v=y+2;w=g[y];k=g[o];n=g[v];y=new THREE.Face3(y,o,v,[w,k,n]);f.faces.push(y)}d+=nfaces;h.count=0});return f};this.init(b)};
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(d,f,g){return d+(f-d)*g};this.VIntX=function(d,f,g,h,j,k,m,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=p;g[h]=this.lerp(o[d],o[d+3],j);g[h+1]=this.lerp(o[d+1],o[d+4],j);g[h+2]=this.lerp(o[d+2],o[d+5],j)};this.VIntY=function(d,f,g,h,j,k,m,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
+2]=p;f=d+this.yd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.VIntZ=function(d,f,g,h,j,k,m,p,o,x){j=(j-o)/(x-o);o=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=p+j*this.delta;f=d+this.zd*3;g[h]=this.lerp(o[d],o[f],j);g[h+1]=this.lerp(o[d+1],o[f+1],j);g[h+2]=this.lerp(o[d+2],o[f+2],j)};this.compNorm=function(d){var f=d*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[d-1]-this.field[d+1];this.normal_cache[f+1]=this.field[d-this.yd]-
+this.field[d+this.yd];this.normal_cache[f+2]=this.field[d-this.zd]-this.field[d+this.zd]}};this.polygonize=function(d,f,g,h,j,k){var m=h+1,p=h+this.yd,o=h+this.zd,x=m+this.yd,y=m+this.zd,v=h+this.yd+this.zd,B=m+this.yd+this.zd,F=0,I=this.field[h],N=this.field[m],W=this.field[p],A=this.field[x],K=this.field[o],O=this.field[y],R=this.field[v],Ca=this.field[B];I<j&&(F|=1);N<j&&(F|=2);W<j&&(F|=8);A<j&&(F|=4);K<j&&(F|=16);O<j&&(F|=32);R<j&&(F|=128);Ca<j&&(F|=64);var ka=THREE.edgeTable[F];if(ka==0)return 0;
+var va=this.delta,aa=d+va,e=f+va;va=g+va;if(ka&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,d,f,g,I,N)}if(ka&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,j,aa,f,g,N,A)}if(ka&4){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,6,j,d,e,g,W,A)}if(ka&8){this.compNorm(h);this.compNorm(p);this.VIntY(h*3,this.vlist,this.nlist,9,j,d,f,g,I,W)}if(ka&16){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,
+12,j,d,f,va,K,O)}if(ka&32){this.compNorm(y);this.compNorm(B);this.VIntY(y*3,this.vlist,this.nlist,15,j,aa,f,va,O,Ca)}if(ka&64){this.compNorm(v);this.compNorm(B);this.VIntX(v*3,this.vlist,this.nlist,18,j,d,e,va,R,Ca)}if(ka&128){this.compNorm(o);this.compNorm(v);this.VIntY(o*3,this.vlist,this.nlist,21,j,d,f,va,K,R)}if(ka&256){this.compNorm(h);this.compNorm(o);this.VIntZ(h*3,this.vlist,this.nlist,24,j,d,f,g,I,K)}if(ka&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,aa,
+f,g,N,O)}if(ka&1024){this.compNorm(x);this.compNorm(B);this.VIntZ(x*3,this.vlist,this.nlist,30,j,aa,e,g,A,Ca)}if(ka&2048){this.compNorm(p);this.compNorm(v);this.VIntZ(p*3,this.vlist,this.nlist,33,j,d,e,g,W,R)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){d=F+j;f=d+1;g=d+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[d],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(d,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=d[g];this.positionArray[m+1]=d[g+
+1];this.positionArray[m+2]=d[g+2];this.positionArray[m+3]=d[h];this.positionArray[m+4]=d[h+1];this.positionArray[m+5]=d[h+2];this.positionArray[m+6]=d[j];this.positionArray[m+7]=d[j+1];this.positionArray[m+8]=d[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
+this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(d){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;d(this)}};this.addBall=function(d,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,p=f*this.size,o=d*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=
+this.size-1);var v=Math.floor(o-k);v<1&&(v=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-1);for(var B,F,I,N,W,A;x<m;x++){o=this.size2*x;F=x/this.size-g;W=F*F;for(F=y;F<p;F++){I=o+this.size*F;B=F/this.size-f;A=B*B;for(B=v;B<k;B++){N=B/this.size-d;N=h/(1.0E-6+N*N+A+W)-j;N>0&&(this.field[I+B]+=N)}}}};this.addPlaneX=function(d,f){var g,h,j,k,m,p=this.size,o=this.yd,x=this.zd,y=this.field,v=p*Math.sqrt(d/f);v>p&&(v=p);for(g=0;g<v;g++){h=g/p;h*=h;k=d/(1.0E-4+h)-f;if(k>0)for(h=0;h<p;h++){m=g+h*o;for(j=
+0;j<p;j++)y[x*j+m]+=k}}};this.addPlaneY=function(d,f){var g,h,j,k,m,p,o=this.size,x=this.yd,y=this.zd,v=this.field,B=o*Math.sqrt(d/f);B>o&&(B=o);for(h=0;h<B;h++){g=h/o;g*=g;k=d/(1.0E-4+g)-f;if(k>0){m=h*x;for(g=0;g<o;g++){p=m+g;for(j=0;j<o;j++)v[y*j+p]+=k}}}};this.addPlaneZ=function(d,f){var g,h,j,k,m,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(d/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=d/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){p=m+h*yd;
+for(g=0;g<size;g++)field[p+g]+=k}}}};this.reset=function(){var d;for(d=0;d<this.size3;d++){this.normal_cache[d*3]=0;this.field[d]=0}};this.render=function(d){this.begin();var f,g,h,j,k,m,p,o,x,y=this.size-2;for(j=1;j<y;j++){x=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){o=x+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=o+g;this.polygonize(k,m,p,f,this.isolation,d)}}}this.end(d)};this.generateGeometry=function(){var d=0,f=new THREE.Geometry,
+g=[];this.render(function(h){var j,k,m,p,o,x,y,v;for(j=0;j<h.count;j++){y=j*3;o=y+1;v=y+2;k=h.positionArray[y];m=h.positionArray[o];p=h.positionArray[v];x=new THREE.Vector3(k,m,p);k=h.normalArray[y];m=h.normalArray[o];p=h.normalArray[v];y=new THREE.Vector3(k,m,p);y.normalize();o=new THREE.Vertex(x);f.vertices.push(o);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(d+j)*3;o=y+1;v=y+2;x=g[y];k=g[o];m=g[v];y=new THREE.Face3(y,o,v,[x,k,m]);f.faces.push(y)}d+=nfaces;h.count=0});return f};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,

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,k=h*e+i*c-g*d,n=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+k*-i-n*-f;b.y=k*h+c*-f+n*-g-j*-i;b.z=n*h+c*-i+j*-f-k*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.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};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,l=h*e+i*c-g*d,m=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+l*-i-m*-f;b.y=l*h+c*-f+m*-g-j*-i;b.z=m*h+c*-i+j*-f-l*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};

+ 3 - 3
build/custom/ThreeExtras.js

@@ -15,7 +15,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var f,b,e,c,d=2*Math.ceil(a*3)+1;d>25&&(d=25);c=(d-1)*0.5;b=Array(d);for(f=e=0;f<d;++f){b[f]=Math.exp(-((f-c)*(f-c))/(2*a*a));e+=b[f]}for(f=0;f<d;++f)b[f]/=e;return b}};
-THREE.QuakeCamera=function(a){function f(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;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;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=
+THREE.QuakeCamera=function(a){function f(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.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;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=
 a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.activeLook!==undefined)this.activeLook=a.activeLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.constrainVertical!==undefined)this.constrainVertical=
 a.constrainVertical;if(a.verticalMin!==undefined)this.verticalMin=a.verticalMin;if(a.verticalMax!==undefined)this.verticalMax=a.verticalMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
 b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
@@ -26,7 +26,7 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
 this.onMouseUp),!1);this.domElement.addEventListener("keydown",f(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",f(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.QuakeCamera.prototype.translate=function(a,f){this.matrix.rotateAxis(f);if(this.noFly)f.y=0;this.position.addSelf(f.multiplyScalar(a));this.target.position.addSelf(f.multiplyScalar(a))};
 THREE.PathCamera=function(a){function f(m,k,n,p){var t={name:n,fps:0.6,length:p,hierarchy:[]},w,x=k.getControlPointsArray(),u=k.getLength(),B=x.length,z=0;w=B-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:x[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[w]={time:p,pos:x[w],rot:[0,0,0,1],scl:[1,1,1]};for(w=1;w<B-1;w++){z=p*u.chunks[w]/u.total;k.keys[w]={time:z,pos:x[w]}}t.hierarchy[0]=k;THREE.AnimationHandler.add(t);return new THREE.Animation(m,n,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,k){var n,
 p,t=new THREE.Geometry;for(n=0;n<m.points.length*k;n++){p=n/(m.points.length*k);p=m.getPoint(p);t.vertices[n]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return t}function e(m,k){var n=b(k,10),p=b(k,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(n,t);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);p=new Sphere(1,
-16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){n=new THREE.Mesh(p,t);n.position.copy(k.points[i]);n.updateMatrix();m.addChild(n)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.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.005;this.lookVertical=
+16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){n=new THREE.Mesh(p,t);n.position.copy(k.points[i]);n.updateMatrix();m.addChild(n)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.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.lookVertical=
 !0;this.lookHorizontal=!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(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.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 c=Math.PI*2,d=Math.PI/180;this.update=function(m,k,n){var p,t;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)*d;this.theta=this.lon*d;p=this.phi%c;this.phi=p>=0?p:p+c;p=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange;
@@ -43,7 +43,7 @@ THREE.Face4&&f.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/m,0.5
 var Icosahedron=function(a){function f(n,p,t){var w=Math.sqrt(n*n+p*p+t*t);return c.vertices.push(new THREE.Vertex(new THREE.Vector3(n/w,p/w,t/w)))-1}function b(n,p,t,w){w.faces.push(new THREE.Face3(n,p,t))}function e(n,p){var t=c.vertices[n].position,w=c.vertices[p].position;return f((t.x+w.x)/2,(t.y+w.y)/2,(t.z+w.z)/2)}var c=this,d=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;f(-1,a,0);f(1,a,0);f(-1,-a,0);f(1,-a,0);f(0,-1,a);f(0,1,a);f(0,-1,-a);f(0,
 1,-a);f(a,0,-1);f(a,0,1);f(-a,0,-1);f(-a,0,1);b(0,11,5,d);b(0,5,1,d);b(0,1,7,d);b(0,7,10,d);b(0,10,11,d);b(1,5,9,d);b(5,11,4,d);b(11,10,2,d);b(10,7,6,d);b(7,1,8,d);b(3,9,4,d);b(3,4,2,d);b(3,2,6,d);b(3,6,8,d);b(3,8,9,d);b(4,9,5,d);b(2,4,11,d);b(6,2,10,d);b(8,6,7,d);b(9,8,1,d);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in d.faces){var j=e(d.faces[h].a,d.faces[h].b),m=e(d.faces[h].b,d.faces[h].c),k=e(d.faces[h].c,d.faces[h].a);b(d.faces[h].a,j,k,g);b(d.faces[h].b,m,j,g);b(d.faces[h].c,
 k,m,g);b(j,m,k,g)}d.faces=g.faces}c.faces=d.faces;delete d;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,f,b){THREE.Geometry.call(this);this.steps=f||12;this.angle=b||2*Math.PI;f=this.angle/this.steps;b=[];for(var e=[],c=[],d=[],g=(new THREE.Matrix4).setRotationZ(f),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.001;j+=f){for(h=0;h<b.length;h++)if(j<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));c[h]=this.vertices.length-1}else c=d;j==0&&(d=e);for(h=
+function Lathe(a,f,b){THREE.Geometry.call(this);this.steps=f||12;this.angle=b||2*Math.PI;f=this.angle/this.steps;b=[];for(var e=[],c=[],d=[],g=(new THREE.Matrix4).setRotationZ(f),h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));b[h]=a[h].clone();e[h]=this.vertices.length-1}for(var j=0;j<=this.angle+0.0010;j+=f){for(h=0;h<b.length;h++)if(j<this.angle){b[h]=g.multiplyVector3(b[h].clone());this.vertices.push(new THREE.Vertex(b[h]));c[h]=this.vertices.length-1}else c=d;j==0&&(d=e);for(h=
 0;h<e.length-1;h++){this.faces.push(new THREE.Face4(c[h],c[h+1],e[h+1],e[h]));this.faceVertexUvs[0].push([new THREE.UV(1-j/this.angle,h/a.length),new THREE.UV(1-j/this.angle,(h+1)/a.length),new THREE.UV(1-(j-f)/this.angle,(h+1)/a.length),new THREE.UV(1-(j-f)/this.angle,h/a.length)])}e=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
 var Plane=function(a,f,b,e){THREE.Geometry.call(this);var c,d=a/2,g=f/2;b=b||1;e=e||1;var h=b+1,j=e+1;a/=b;var m=f/e;for(c=0;c<j;c++)for(f=0;f<h;f++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(f*a-d,-(c*m-g),0)));for(c=0;c<e;c++)for(f=0;f<b;f++){this.faces.push(new THREE.Face4(f+h*c,f+h*(c+1),f+1+h*(c+1),f+1+h*c));this.faceVertexUvs[0].push([new THREE.UV(f/b,c/e),new THREE.UV(f/b,(c+1)/e),new THREE.UV((f+1)/b,(c+1)/e),new THREE.UV((f+1)/b,c/e)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;

+ 1 - 1
build/custom/ThreeSVG.js

@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(c);c=Math.sin(c);var f=a*b,i=e*d;this.w=f*g-i*c;this.x=f*c+i*g;this.y=e*b*g+a*d*c;this.z=a*d*g-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,l=h*e+i*c-g*d,m=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+l*-i-m*-f;b.y=l*h+c*-f+m*-g-j*-i;b.z=m*h+c*-i+j*-f-l*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
 THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.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};

+ 67 - 67
build/custom/ThreeWebGL.js

@@ -48,7 +48,7 @@ d,e)}};THREE.Quaternion=function(b,d,e,h){this.set(b||0,d||0,e||0,h!==undefined?
 THREE.Quaternion.prototype={set:function(b,d,e,h){this.x=b;this.y=d;this.z=e;this.w=h;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,e=b.x*d,h=b.y*d,g=b.z*d;b=Math.cos(h);h=Math.sin(h);d=Math.cos(-g);g=Math.sin(-g);var m=Math.cos(e);e=Math.sin(e);var j=b*d,p=h*g;this.w=j*m-p*e;this.x=j*e+p*m;this.y=h*d*m+b*g*e;this.z=b*g*m-h*d*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);if(b==0)this.w=this.z=this.y=this.x=0;else{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,h=this.z,g=this.w,m=b.x,j=b.y,p=b.z;b=b.w;this.x=d*b+g*m+e*p-h*j;this.y=e*b+g*j+h*m-d*p;this.z=h*b+g*p+d*j-e*m;this.w=g*b-d*m-e*j-h*p;return this},
 multiplyVector3:function(b,d){d||(d=b);var e=b.x,h=b.y,g=b.z,m=this.x,j=this.y,p=this.z,q=this.w,v=q*e+j*g-p*h,E=q*h+p*e-m*g,G=q*g+m*h-j*e;e=-m*e-j*h-p*g;d.x=v*q+e*-m+E*-p-G*-j;d.y=E*q+e*-j+G*-m-v*-p;d.z=G*q+e*-p+v*-j-E*-m;return d}};
-THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var m=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){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);return e}g=Math.sin((1-h)*m)/j;h=Math.sin(h*m)/j;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Quaternion.slerp=function(b,d,e,h){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){e.w=b.w;e.x=b.x;e.y=b.y;e.z=b.z;return e}var m=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){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);return e}g=Math.sin((1-h)*m)/j;h=Math.sin(h*m)/j;e.w=b.w*g+d.w*h;e.x=b.x*g+d.x*h;e.y=b.y*g+d.y*h;e.z=b.z*g+d.z*h;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,e,h,g,m){this.a=b;this.b=d;this.c=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,d,e,h,g,m,j){this.a=b;this.b=d;this.c=e;this.d=h;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];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};
@@ -206,72 +206,72 @@ f.transparent;A.count=0;f=u.count=0;for(k=w.materials.length;f<k;f++){s=w.materi
 c.KEEP,c.INCR,c.KEEP);c.stencilOpSeparate(c.FRONT,c.KEEP,c.DECR,c.KEEP);var s,n=f.lights.length,k,o=f.lights,w=[],x,u,A,t,y,z=f.__webglShadowVolumes.length;for(s=0;s<n;s++){k=f.lights[s];if(k instanceof THREE.DirectionalLight){w[0]=-k.position.x;w[1]=-k.position.y;w[2]=-k.position.z;for(y=0;y<z;y++){k=f.__webglShadowVolumes[y].object;x=f.__webglShadowVolumes[y].buffer;u=k.materials[0];u.program||aa.initMaterial(u,o,undefined,k);u=u.program;A=u.uniforms;t=u.attributes;if(ra!==u){c.useProgram(u);ra=
 u;c.uniformMatrix4fv(A.projectionMatrix,!1,Ua);c.uniformMatrix4fv(A.viewMatrix,!1,Ya);c.uniform3fv(A.directionalLightDirection,w)}k.matrixWorld.flattenToArray(k._objectMatrixArray);c.uniformMatrix4fv(A.objectMatrix,!1,k._objectMatrixArray);c.bindBuffer(c.ARRAY_BUFFER,x.__webglVertexBuffer);c.vertexAttribPointer(t.position,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,x.__webglNormalBuffer);c.vertexAttribPointer(t.normal,3,c.FLOAT,!1,0,0);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);c.cullFace(c.FRONT);
 c.drawElements(c.TRIANGLES,x.__webglFaceCount,c.UNSIGNED_SHORT,0);c.cullFace(c.BACK);c.drawElements(c.TRIANGLES,x.__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);ga="";ra=U.program;c.useProgram(U.program);c.uniformMatrix4fv(U.projectionLocation,!1,Ua);c.uniform1f(U.darknessLocation,U.darkness);c.bindBuffer(c.ARRAY_BUFFER,U.vertexBuffer);c.vertexAttribPointer(U.vertexLocation,
-3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(U.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,U.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function L(f,s){var n,k,o;n=_sprite.attributes;var w=_sprite.uniforms,x=za/ya,u,A=[],t=ya*0.5,y=za*0.5,z=!0;c.useProgram(_sprite.program);ra=_sprite.program;ga="";c.disable(c.CULL_FACE);c.enable(c.BLEND);
-c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(n.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(w.projectionMatrix,!1,Ua);c.activeTexture(c.TEXTURE0);c.uniform1i(w.map,0);n=0;for(k=f.__webglSprites.length;n<k;n++){o=f.__webglSprites[n];if(o.useScreenCoordinates)o.z=-o.position.z;else{o._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,o.matrixWorld,
-o._modelViewMatrixArray);o.z=-o._modelViewMatrix.n34}}f.__webglSprites.sort(I);n=0;for(k=f.__webglSprites.length;n<k;n++){o=f.__webglSprites[n];if(o.material===undefined&&o.map&&o.map.image&&o.map.image.width){if(o.useScreenCoordinates){c.uniform1i(w.useScreenCoordinates,1);c.uniform3f(w.screenPosition,(o.position.x-t)/t,(y-o.position.y)/y,Math.max(0,Math.min(1,o.position.z)))}else{c.uniform1i(w.useScreenCoordinates,0);c.uniform1i(w.affectedByDistance,o.affectedByDistance?1:0);c.uniformMatrix4fv(w.modelViewMatrix,
-!1,o._modelViewMatrixArray)}u=o.map.image.width/(o.affectedByDistance?1:za);A[0]=u*x*o.scale.x;A[1]=u*o.scale.y;c.uniform2f(w.uvScale,o.uvScale.x,o.uvScale.y);c.uniform2f(w.uvOffset,o.uvOffset.x,o.uvOffset.y);c.uniform2f(w.alignment,o.alignment.x,o.alignment.y);c.uniform1f(w.opacity,o.opacity);c.uniform1f(w.rotation,o.rotation);c.uniform2fv(w.scale,A);if(o.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!o.mergeWith3D&&z){c.disable(c.DEPTH_TEST);z=!1}oa(o.blending);K(o.map,0);c.drawElements(c.TRIANGLES,
-6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function M(f,s){var n,k,o=f.__webglLensFlares.length,w,x,u,A=new THREE.Vector3,t=za/ya,y=ya*0.5,z=za*0.5,D=16/za,B=[D*t,D],N=[1,1,0],W=[1,1],O=J.uniforms;n=J.attributes;c.useProgram(J.program);ra=J.program;ga="";c.uniform1i(O.occlusionMap,0);c.uniform1i(O.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-J.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(k=0;k<o;k++){n=f.__webglLensFlares[k].object;A.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(A);s.projectionMatrix.multiplyVector3(A);N[0]=A.x;N[1]=A.y;N[2]=A.z;W[0]=N[0]*y+y;W[1]=N[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<ya&&W[1]>0&&W[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);
-c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,W[0]-8,W[1]-8,16,16,0);c.uniform1i(O.renderType,0);c.uniform2fv(O.scale,B);c.uniform3fv(O.screenPosition,N);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGBA,W[0]-8,W[1]-8,16,16,0);c.uniform1i(O.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);n.positionScreen.x=
-N[0];n.positionScreen.y=N[1];n.positionScreen.z=N[2];n.customUpdateCallback?n.customUpdateCallback(n):n.updateLensFlares();c.uniform1i(O.renderType,2);c.enable(c.BLEND);w=0;for(x=n.lensFlares.length;w<x;w++){u=n.lensFlares[w];if(u.opacity>0.001&&u.scale>0.001){N[0]=u.x;N[1]=u.y;N[2]=u.z;D=u.size*u.scale/za;B[0]=D*t;B[1]=D;c.uniform3fv(O.screenPosition,N);c.uniform2fv(O.scale,B);c.uniform1f(O.rotation,u.rotation);c.uniform1f(O.opacity,u.opacity);oa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,
-6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function V(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function P(f){var s,n,k,o,w;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){k=n.geometryGroups[s];w=!1;for(o in k.__webglCustomAttributes)if(k.__webglCustomAttributes[o].needsUpdate){w=!0;break}if(n.__dirtyVertices||
-n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,D=void 0,B=void 0,N=void 0,W=void 0,O=void 0,X=void 0,Ga=void 0,S=void 0,Q=void 0,T=void 0,ua=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var r=void 0,F=void 0;z=void 0;r=void 0;F=void 0;var i=void 0,Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;
-F=void 0;i=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;r=void 0;F=void 0;i=void 0;var Wa=void 0,va=0,Aa=0,bb=0,cb=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;F=r=0;var Ca=k.__vertexArray,ib=k.__uvArray,jb=k.__uv2Array,Qa=k.__normalArray,ha=k.__tangentArray,Da=k.__colorArray,ia=k.__skinVertexAArray,ja=k.__skinVertexBArray,ka=k.__skinIndexArray,la=k.__skinWeightArray,kb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,rb=k.__needsSmoothNormals;W=k.__vertexColorType;
-N=k.__uvType;O=k.__normalType;var Ha=f.geometry,lb=Ha.__dirtyVertices,mb=Ha.__dirtyElements,hb=Ha.__dirtyUvs,nb=Ha.__dirtyNormals,ob=Ha.__dirtyTangents,pb=Ha.__dirtyColors,qb=Ha.__dirtyMorphTargets,db=Ha.vertices,sb=k.faces,xb=Ha.faces,tb=Ha.faceVertexUvs[0],ub=Ha.faceVertexUvs[1],eb=Ha.skinVerticesA,fb=Ha.skinVerticesB,gb=Ha.skinIndices,Xa=Ha.skinWeights,ab=Ha.edgeFaces,Ta=Ha.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}x=0;for(u=sb.length;x<u;x++){A=sb[x];t=xb[A];tb&&(X=tb[A]);
-ub&&(Ga=ub[A]);A=t.vertexNormals;y=t.normal;z=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){S=db[t.a].position;Q=db[t.b].position;T=db[t.c].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+7]=T.y;Ca[Aa+8]=T.z;Aa+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+
-2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c]}else if(i.boundTo==="faces"){S=i.value[F];Q=i.value[F];T=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[F+
-0];Q=i.value[F+1];T=i.value[F+2];i.offsetSrc+=3}if(i.size===2){i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=T.x;i.array[r+5]=T.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[r+0]=S.r;i.array[r+1]=S.g;i.array[r+2]=S.b;i.array[r+3]=Q.r;i.array[r+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=T.r;i.array[r+7]=T.g;i.array[r+8]=T.b}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=T.x;i.array[r+
-7]=T.y;i.array[r+8]=T.z}i.offset+=9}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=S.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=T.x;i.array[r+9]=T.y;i.array[r+10]=T.z;i.array[r+11]=T.w;i.offset+=12}}}}if(qb){r=0;for(F=Ta.length;r<F;r++){S=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;T=Ta[r].vertices[t.c].position;i=kb[r];i[Ba+0]=S.x;i[Ba+1]=S.y;i[Ba+2]=S.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=T.x;i[Ba+7]=T.y;i[Ba+
-8]=T.z}Ba+=9}if(Xa.length){r=Xa[t.a];F=Xa[t.b];i=Xa[t.c];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;r=gb[t.a];F=gb[t.b];i=gb[t.c];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=
-i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;r=fb[t.a];F=fb[t.b];i=fb[t.c];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;C+=12}if(pb&&W){if(z.length==3&&W==THREE.VertexColors){t=z[0];r=z[1];F=z[2]}else F=r=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=F.r;Da[xa+7]=F.g;Da[xa+8]=F.b;xa+=9}if(ob&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+
-3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ea+=12}if(nb&&O)if(A.length==3&&rb)for(B=0;B<3;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<3;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(hb&&X!==undefined&&N)for(B=0;B<3;B++){A=X[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(hb&&Ga!==undefined&&N)for(B=0;B<3;B++){A=Ga[B];jb[cb]=A.u;jb[cb+1]=A.v;cb+=2}if(mb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=va+2;Ja+=3;Oa[Ma]=va;Oa[Ma+
-1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+2;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Ma+=6;va+=3}}else if(t instanceof THREE.Face4){if(lb){S=db[t.a].position;Q=db[t.b].position;T=db[t.c].position;ua=db[t.d].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+7]=T.y;Ca[Aa+8]=T.z;Ca[Aa+9]=ua.x;Ca[Aa+10]=ua.y;Ca[Aa+11]=ua.z;Aa+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+
-0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c];i.array[r+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];i.array[r+2]=i.value[F+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c];ua=
-i.value[t.d]}else if(i.boundTo==="faces"){S=i.value[F];Q=i.value[F];T=i.value[F];ua=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[F+0];Q=i.value[F+1];T=i.value[F+2];ua=i.value[F+3];i.offsetSrc+=4}if(i.size===2){i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=T.x;i.array[r+5]=T.y;i.array[r+6]=ua.x;i.array[r+7]=ua.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[r+0]=S.r;i.array[r+1]=S.g;i.array[r+2]=S.b;i.array[r+3]=Q.r;i.array[r+
-4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=T.r;i.array[r+7]=T.g;i.array[r+8]=T.b;i.array[r+9]=ua.r;i.array[r+10]=ua.g;i.array[r+11]=ua.b}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=T.x;i.array[r+7]=T.y;i.array[r+8]=T.z;i.array[r+9]=ua.x;i.array[r+10]=ua.y;i.array[r+11]=ua.z}i.offset+=12}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=S.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+
-8]=T.x;i.array[r+9]=T.y;i.array[r+10]=T.z;i.array[r+11]=T.w;i.array[r+12]=ua.x;i.array[r+13]=ua.y;i.array[r+14]=ua.z;i.array[r+15]=ua.w;i.offset+=16}}}}if(qb){r=0;for(F=Ta.length;r<F;r++){S=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;T=Ta[r].vertices[t.c].position;ua=Ta[r].vertices[t.d].position;i=kb[r];i[Ba+0]=S.x;i[Ba+1]=S.y;i[Ba+2]=S.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=T.x;i[Ba+7]=T.y;i[Ba+8]=T.z;i[Ba+9]=ua.x;i[Ba+10]=ua.y;i[Ba+11]=ua.z}Ba+=12}if(Xa.length){r=Xa[t.a];
-F=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;r=gb[t.a];F=gb[t.b];i=gb[t.c];Ka=gb[t.d];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;ka[C+12]=Ka.x;ka[C+13]=Ka.y;ka[C+14]=Ka.z;ka[C+15]=Ka.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];
-Ka=eb[t.d];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;ia[C+12]=Ka.x;ia[C+13]=Ka.y;ia[C+14]=Ka.z;ia[C+15]=1;r=fb[t.a];F=fb[t.b];i=fb[t.c];t=fb[t.d];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;ja[C+12]=t.x;ja[C+13]=t.y;ja[C+14]=t.z;ja[C+15]=1;C+=16}if(pb&&W){if(z.length==4&&W==THREE.VertexColors){t=z[0];r=z[1];F=
-z[2];z=z[3]}else z=F=r=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=F.r;Da[xa+7]=F.g;Da[xa+8]=F.b;Da[xa+9]=z.r;Da[xa+10]=z.g;Da[xa+11]=z.b;xa+=12}if(ob&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];B=B[3];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ha[ea+12]=B.x;ha[ea+13]=B.y;ha[ea+14]=B.z;ha[ea+15]=B.w;ea+=16}if(nb&&O)if(A.length==4&&rb)for(B=0;B<4;B++){y=
-A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<4;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(hb&&X!==undefined&&N)for(B=0;B<4;B++){A=X[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(hb&&Ga!==undefined&&N)for(B=0;B<4;B++){A=Ga[B];jb[cb]=A.u;jb[cb+1]=A.v;cb+=2}if(mb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=va+3;Na[Ja+3]=va+1;Na[Ja+4]=va+2;Na[Ja+5]=va+3;Ja+=6;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+3;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Oa[Ma+6]=va+2;Oa[Ma+7]=va+3;Ma+=8;va+=4}}}if(ab){x=0;for(u=
-ab.length;x<u;x++){Na[Ja]=ab[x].a;Na[Ja+1]=ab[x].b;Na[Ja+2]=ab[x].c;Na[Ja+3]=ab[x].a;Na[Ja+4]=ab[x].c;Na[Ja+5]=ab[x].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ca,w)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,i.array,w);i.needsUpdate=!1}}if(qb){r=0;for(F=Ta.length;r<F;r++){c.bindBuffer(c.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[r]);c.bufferData(c.ARRAY_BUFFER,kb[r],w)}}if(pb&&
-xa>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(ob&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,k.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(hb&&bb>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,w)}if(hb&&cb>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,w)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
-k.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,ja,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,
-la,w)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;O=W.length;w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=W[u].position;o=u*3;X[o]=N.x;X[o+1]=N.y;X[o+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);
-c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=k[u];o=u*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;O=W.length;w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=W[u].position;
-o=u*3;X[o]=N.x;X[o+1]=N.y;X[o+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=k[u];o=u*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}
-function sa(f){function s(D){var B=[];n=0;for(k=D.length;n<k;n++)D[n]==undefined?B.push("undefined"):B.push(D[n].id);return B.join("_")}var n,k,o,w,x,u,A,t,y={},z=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};o=0;for(w=f.faces.length;o<w;o++){x=f.faces[o];u=x.materials;A=s(u);y[A]==undefined&&(y[A]={hash:A,counter:0});t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z});x=x instanceof THREE.Face3?
-3:4;if(f.geometryGroups[t].vertices+x>65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(o);f.geometryGroups[t].vertices+=x}}function da(f,s,n){f.push({buffer:s,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!=ga){switch(f){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)}ga=f}}function Z(f,s,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(s.magFilter));
-c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,Ea(s.minFilter))}}function K(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();
-c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();
-f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,fa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,fa(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,fa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,fa(f.format),f.width,f.height,0,fa(f.format),fa(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,
-f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,
-f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=f.height}else{s=null;n=ya;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(wa,qa,n,f);Fa=s}}function ca(f,s){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,
-s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);return null}return n}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;
-case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;
-case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.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 c,R=document.createElement("canvas"),pa=[],ra=null,Fa=null,ta=!0,aa=this,ma=null,na=null,ga=null,Y=null,wa=0,qa=0,ya=0,za=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ua=new Float32Array(16),Ya=new Float32Array(16),Va=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Za=!0,$a=!0,vb=new THREE.Color(0),wb=0;if(b){if(b.stencil!=undefined)Za=b.stencil;if(b.antialias!==undefined)$a=b.antialias;b.clearColor!==undefined&&vb.setHex(b.clearColor);if(b.clearAlpha!==undefined)wb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=
-R;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,k){try{if(!(c=R.getContext("experimental-webgl",{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(o){console.error(o)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);
-c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,n)})($a,vb,wb,Za);this.context=c;if(Za){var U={};U.vertices=new Float32Array(12);U.faces=new Uint16Array(6);U.darkness=0.5;U.vertices[0]=-20;U.vertices[1]=-20;U.vertices[2]=-1;U.vertices[3]=20;U.vertices[4]=-20;U.vertices[5]=-1;U.vertices[6]=20;U.vertices[7]=20;U.vertices[8]=-1;U.vertices[9]=-20;U.vertices[10]=20;U.vertices[11]=-1;U.faces[0]=0;U.faces[1]=1;U.faces[2]=2;U.faces[3]=
-0;U.faces[4]=2;U.faces[5]=3;U.vertexBuffer=c.createBuffer();U.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,U.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,U.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,U.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,U.faces,c.STATIC_DRAW);U.program=c.createProgram();c.attachShader(U.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(U.program,ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(U.program);
-U.vertexLocation=c.getAttribLocation(U.program,"position");U.projectionLocation=c.getUniformLocation(U.program,"projectionMatrix");U.darknessLocation=c.getUniformLocation(U.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;
-J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,J.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,
-J.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,J.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);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){J.hasVertexTexture=!1;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=!0;J.program=c.createProgram();
-c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program,"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");J.uniforms.occlusionMap=c.getUniformLocation(J.program,
-"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");c.enableVertexAttribArray(J.attributes.vertex);c.enableVertexAttribArray(J.attributes.uv);_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=
-0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=
-c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,ca("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(_sprite.program,ca("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes=
-{};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,
-"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,
-"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");c.enableVertexAttribArray(_sprite.attributes.position);c.enableVertexAttribArray(_sprite.attributes.uv);this.setSize=function(f,s){R.width=f;R.height=s;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(f,s,n,k){wa=f;qa=s;ya=n;za=k;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,s,n,k){c.scissor(f,s,n,k)};this.enableScissorTest=function(f){f?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};
-this.enableDepthBufferWrite=function(f){ta=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){U.darkness=f};this.initMaterial=function(f,s,n,k){var o,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x=
-"shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x="lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var u=THREE.ShaderLib[x];f.uniforms=Uniforms.clone(u.uniforms);f.vertexShader=u.vertexShader;f.fragmentShader=u.fragmentShader}var A,
-t,y;A=y=u=0;for(t=s.length;A<t;A++){w=s[A];w instanceof THREE.DirectionalLight&&y++;w instanceof THREE.PointLight&&u++}if(u+y<=4)s=y;else{s=Math.ceil(4*y/(u+y));u=4-s}w={directional:s,point:u};y=50;if(k!==undefined&&k instanceof THREE.SkinnedMesh)y=k.bones.length;var z;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,skinning:f.skinning,morphTargets:f.morphTargets,
-maxMorphTargets:this.maxMorphTargets,maxDirLights:w.directional,maxPointLights:w.point,maxBones:y};var D;w=[];if(x)w.push(x);else{w.push(A);w.push(t)}for(D in n){w.push(D);w.push(n[D])}x=w.join();D=0;for(w=pa.length;D<w;D++)if(pa[D].code==x){z=pa[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
-"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":
-"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.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");
+3,c.FLOAT,!1,0,0);c.enableVertexAttribArray(U.vertexLocation);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.blendEquation(c.FUNC_ADD);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,U.elementBuffer);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.disable(c.STENCIL_TEST);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function L(f,s){var n,k,o;n=_sprite.attributes;var w=_sprite.uniforms,x=za/ya,u,A=[],t=ya*0.5,y=za*0.5,z=!0;c.useProgram(_sprite.program);ra=_sprite.program;ga="";if(!rb){c.enableVertexAttribArray(_sprite.attributes.position);
+c.enableVertexAttribArray(_sprite.attributes.uv);rb=!0}c.disable(c.CULL_FACE);c.enable(c.BLEND);c.depthMask(!0);c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.vertexAttribPointer(n.position,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.uniformMatrix4fv(w.projectionMatrix,!1,Ua);c.activeTexture(c.TEXTURE0);c.uniform1i(w.map,0);n=0;for(k=f.__webglSprites.length;n<k;n++){o=f.__webglSprites[n];if(o.useScreenCoordinates)o.z=
+-o.position.z;else{o._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray);o.z=-o._modelViewMatrix.n34}}f.__webglSprites.sort(I);n=0;for(k=f.__webglSprites.length;n<k;n++){o=f.__webglSprites[n];if(o.material===undefined&&o.map&&o.map.image&&o.map.image.width){if(o.useScreenCoordinates){c.uniform1i(w.useScreenCoordinates,1);c.uniform3f(w.screenPosition,(o.position.x-t)/t,(y-o.position.y)/y,Math.max(0,Math.min(1,o.position.z)))}else{c.uniform1i(w.useScreenCoordinates,
+0);c.uniform1i(w.affectedByDistance,o.affectedByDistance?1:0);c.uniformMatrix4fv(w.modelViewMatrix,!1,o._modelViewMatrixArray)}u=o.map.image.width/(o.affectedByDistance?1:za);A[0]=u*x*o.scale.x;A[1]=u*o.scale.y;c.uniform2f(w.uvScale,o.uvScale.x,o.uvScale.y);c.uniform2f(w.uvOffset,o.uvOffset.x,o.uvOffset.y);c.uniform2f(w.alignment,o.alignment.x,o.alignment.y);c.uniform1f(w.opacity,o.opacity);c.uniform1f(w.rotation,o.rotation);c.uniform2fv(w.scale,A);if(o.mergeWith3D&&!z){c.enable(c.DEPTH_TEST);z=!0}else if(!o.mergeWith3D&&
+z){c.disable(c.DEPTH_TEST);z=!1}oa(o.blending);K(o.map,0);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function M(f,s){var n,k,o=f.__webglLensFlares.length,w,x,u,A=new THREE.Vector3,t=za/ya,y=ya*0.5,z=za*0.5,D=16/za,B=[D*t,D],N=[1,1,0],W=[1,1],O=J.uniforms;n=J.attributes;c.useProgram(J.program);ra=J.program;ga="";if(!sb){c.enableVertexAttribArray(J.attributes.vertex);c.enableVertexAttribArray(J.attributes.uv);sb=!0}c.uniform1i(O.occlusionMap,
+0);c.uniform1i(O.map,1);c.bindBuffer(c.ARRAY_BUFFER,J.vertexBuffer);c.vertexAttribPointer(n.vertex,2,c.FLOAT,!1,16,0);c.vertexAttribPointer(n.uv,2,c.FLOAT,!1,16,8);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);c.disable(c.CULL_FACE);c.depthMask(!1);c.activeTexture(c.TEXTURE0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.activeTexture(c.TEXTURE1);for(k=0;k<o;k++){n=f.__webglLensFlares[k].object;A.set(n.matrixWorld.n14,n.matrixWorld.n24,n.matrixWorld.n34);s.matrixWorldInverse.multiplyVector3(A);
+s.projectionMatrix.multiplyVector3(A);N[0]=A.x;N[1]=A.y;N[2]=A.z;W[0]=N[0]*y+y;W[1]=N[1]*z+z;if(J.hasVertexTexture||W[0]>0&&W[0]<ya&&W[1]>0&&W[1]<za){c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.copyTexImage2D(c.TEXTURE_2D,0,c.RGB,W[0]-8,W[1]-8,16,16,0);c.uniform1i(O.renderType,0);c.uniform2fv(O.scale,B);c.uniform3fv(O.screenPosition,N);c.disable(c.BLEND);c.enable(c.DEPTH_TEST);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);c.bindTexture(c.TEXTURE_2D,J.occlusionTexture);c.copyTexImage2D(c.TEXTURE_2D,
+0,c.RGBA,W[0]-8,W[1]-8,16,16,0);c.uniform1i(O.renderType,1);c.disable(c.DEPTH_TEST);c.bindTexture(c.TEXTURE_2D,J.tempTexture);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0);n.positionScreen.x=N[0];n.positionScreen.y=N[1];n.positionScreen.z=N[2];n.customUpdateCallback?n.customUpdateCallback(n):n.updateLensFlares();c.uniform1i(O.renderType,2);c.enable(c.BLEND);w=0;for(x=n.lensFlares.length;w<x;w++){u=n.lensFlares[w];if(u.opacity>0.0010&&u.scale>0.0010){N[0]=u.x;N[1]=u.y;N[2]=u.z;D=u.size*u.scale/
+za;B[0]=D*t;B[1]=D;c.uniform3fv(O.screenPosition,N);c.uniform2fv(O.scale,B);c.uniform1f(O.rotation,u.rotation);c.uniform1f(O.opacity,u.opacity);oa(u.blending);K(u.texture,1);c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}}}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(ta)}function V(f,s){f._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function P(f){var s,
+n,k,o,w;if(f instanceof THREE.Mesh){n=f.geometry;for(s in n.geometryGroups){k=n.geometryGroups[s];w=!1;for(o in k.__webglCustomAttributes)if(k.__webglCustomAttributes[o].needsUpdate){w=!0;break}if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents||w){w=c.DYNAMIC_DRAW;var x=void 0,u=void 0,A=void 0,t=void 0;A=void 0;var y=void 0,z=void 0,D=void 0,B=void 0,N=void 0,W=void 0,O=void 0,X=void 0,Ga=void 0,S=void 0,Q=void 0,T=
+void 0,ua=void 0;z=void 0;D=void 0;t=void 0;B=void 0;t=void 0;var r=void 0,F=void 0;z=void 0;r=void 0;F=void 0;var i=void 0,Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;Ka=void 0;r=void 0;F=void 0;i=void 0;t=void 0;B=void 0;y=void 0;A=void 0;A=void 0;r=void 0;F=void 0;i=void 0;var Wa=void 0,va=0,Aa=0,bb=0,cb=0,Ja=0,La=0,ea=0,Ma=0,xa=0,C=0,Ba=0;F=r=0;var Ca=k.__vertexArray,ib=k.__uvArray,jb=k.__uv2Array,Qa=k.__normalArray,ha=k.__tangentArray,Da=k.__colorArray,ia=k.__skinVertexAArray,
+ja=k.__skinVertexBArray,ka=k.__skinIndexArray,la=k.__skinWeightArray,kb=k.__morphTargetsArrays,Ra=k.__webglCustomAttributes;i=void 0;var Na=k.__faceArray,Oa=k.__lineArray,tb=k.__needsSmoothNormals;W=k.__vertexColorType;N=k.__uvType;O=k.__normalType;var Ha=f.geometry,lb=Ha.__dirtyVertices,mb=Ha.__dirtyElements,hb=Ha.__dirtyUvs,nb=Ha.__dirtyNormals,ob=Ha.__dirtyTangents,pb=Ha.__dirtyColors,qb=Ha.__dirtyMorphTargets,db=Ha.vertices,ub=k.faces,zb=Ha.faces,vb=Ha.faceVertexUvs[0],wb=Ha.faceVertexUvs[1],
+eb=Ha.skinVerticesA,fb=Ha.skinVerticesB,gb=Ha.skinIndices,Xa=Ha.skinWeights,ab=Ha.edgeFaces,Ta=Ha.morphTargets;if(Ra)for(Wa in Ra){Ra[Wa].offset=0;Ra[Wa].offsetSrc=0}x=0;for(u=ub.length;x<u;x++){A=ub[x];t=zb[A];vb&&(X=vb[A]);wb&&(Ga=wb[A]);A=t.vertexNormals;y=t.normal;z=t.vertexColors;D=t.color;B=t.vertexTangents;if(t instanceof THREE.Face3){if(lb){S=db[t.a].position;Q=db[t.b].position;T=db[t.c].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+
+7]=T.y;Ca[Aa+8]=T.z;Aa+=9}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];i.offsetSrc+=3}i.offset+=3}else{if(i.boundTo===
+undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c]}else if(i.boundTo==="faces"){S=i.value[F];Q=i.value[F];T=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[F+0];Q=i.value[F+1];T=i.value[F+2];i.offsetSrc+=3}if(i.size===2){i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=Q.x;i.array[r+3]=Q.y;i.array[r+4]=T.x;i.array[r+5]=T.y;i.offset+=6}else if(i.size===3){if(i.type==="c"){i.array[r+0]=S.r;i.array[r+1]=S.g;i.array[r+2]=S.b;i.array[r+3]=Q.r;i.array[r+
+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=T.r;i.array[r+7]=T.g;i.array[r+8]=T.b}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=T.x;i.array[r+7]=T.y;i.array[r+8]=T.z}i.offset+=9}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=S.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=T.x;i.array[r+9]=T.y;i.array[r+10]=T.z;i.array[r+11]=T.w;i.offset+=12}}}}if(qb){r=0;for(F=Ta.length;r<
+F;r++){S=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;T=Ta[r].vertices[t.c].position;i=kb[r];i[Ba+0]=S.x;i[Ba+1]=S.y;i[Ba+2]=S.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=T.x;i[Ba+7]=T.y;i[Ba+8]=T.z}Ba+=9}if(Xa.length){r=Xa[t.a];F=Xa[t.b];i=Xa[t.c];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;r=gb[t.a];F=gb[t.b];i=gb[t.c];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=r.w;ka[C+4]=F.x;ka[C+
+5]=F.y;ka[C+6]=F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;r=fb[t.a];F=fb[t.b];i=fb[t.c];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;C+=12}if(pb&&W){if(z.length==3&&W==THREE.VertexColors){t=z[0];r=z[1];F=z[2]}else F=r=
+t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=F.r;Da[xa+7]=F.g;Da[xa+8]=F.b;xa+=9}if(ob&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ea+=12}if(nb&&O)if(A.length==3&&tb)for(B=0;B<3;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<3;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(hb&&X!==
+undefined&&N)for(B=0;B<3;B++){A=X[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(hb&&Ga!==undefined&&N)for(B=0;B<3;B++){A=Ga[B];jb[cb]=A.u;jb[cb+1]=A.v;cb+=2}if(mb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=va+2;Ja+=3;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+2;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Ma+=6;va+=3}}else if(t instanceof THREE.Face4){if(lb){S=db[t.a].position;Q=db[t.b].position;T=db[t.c].position;ua=db[t.d].position;Ca[Aa]=S.x;Ca[Aa+1]=S.y;Ca[Aa+2]=S.z;Ca[Aa+3]=Q.x;Ca[Aa+4]=Q.y;Ca[Aa+5]=Q.z;Ca[Aa+6]=T.x;Ca[Aa+
+7]=T.y;Ca[Aa+8]=T.z;Ca[Aa+9]=ua.x;Ca[Aa+10]=ua.y;Ca[Aa+11]=ua.z;Aa+=12}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){r=i.offset;F=i.offsetSrc;if(i.size===1){if(i.boundTo===undefined||i.boundTo==="vertices"){i.array[r+0]=i.value[t.a];i.array[r+1]=i.value[t.b];i.array[r+2]=i.value[t.c];i.array[r+2]=i.value[t.d]}else if(i.boundTo==="faces"){i.array[r+0]=i.value[F];i.array[r+1]=i.value[F];i.array[r+2]=i.value[F];i.array[r+2]=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){i.array[r+0]=i.value[F+
+0];i.array[r+1]=i.value[F+1];i.array[r+2]=i.value[F+2];i.array[r+2]=i.value[F+3];i.offsetSrc+=4}i.offset+=4}else{if(i.boundTo===undefined||i.boundTo==="vertices"){S=i.value[t.a];Q=i.value[t.b];T=i.value[t.c];ua=i.value[t.d]}else if(i.boundTo==="faces"){S=i.value[F];Q=i.value[F];T=i.value[F];ua=i.value[F];i.offsetSrc++}else if(i.boundTo==="faceVertices"){S=i.value[F+0];Q=i.value[F+1];T=i.value[F+2];ua=i.value[F+3];i.offsetSrc+=4}if(i.size===2){i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=Q.x;i.array[r+
+3]=Q.y;i.array[r+4]=T.x;i.array[r+5]=T.y;i.array[r+6]=ua.x;i.array[r+7]=ua.y;i.offset+=8}else if(i.size===3){if(i.type==="c"){i.array[r+0]=S.r;i.array[r+1]=S.g;i.array[r+2]=S.b;i.array[r+3]=Q.r;i.array[r+4]=Q.g;i.array[r+5]=Q.b;i.array[r+6]=T.r;i.array[r+7]=T.g;i.array[r+8]=T.b;i.array[r+9]=ua.r;i.array[r+10]=ua.g;i.array[r+11]=ua.b}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=Q.x;i.array[r+4]=Q.y;i.array[r+5]=Q.z;i.array[r+6]=T.x;i.array[r+7]=T.y;i.array[r+8]=T.z;i.array[r+
+9]=ua.x;i.array[r+10]=ua.y;i.array[r+11]=ua.z}i.offset+=12}else{i.array[r+0]=S.x;i.array[r+1]=S.y;i.array[r+2]=S.z;i.array[r+3]=S.w;i.array[r+4]=Q.x;i.array[r+5]=Q.y;i.array[r+6]=Q.z;i.array[r+7]=Q.w;i.array[r+8]=T.x;i.array[r+9]=T.y;i.array[r+10]=T.z;i.array[r+11]=T.w;i.array[r+12]=ua.x;i.array[r+13]=ua.y;i.array[r+14]=ua.z;i.array[r+15]=ua.w;i.offset+=16}}}}if(qb){r=0;for(F=Ta.length;r<F;r++){S=Ta[r].vertices[t.a].position;Q=Ta[r].vertices[t.b].position;T=Ta[r].vertices[t.c].position;ua=Ta[r].vertices[t.d].position;
+i=kb[r];i[Ba+0]=S.x;i[Ba+1]=S.y;i[Ba+2]=S.z;i[Ba+3]=Q.x;i[Ba+4]=Q.y;i[Ba+5]=Q.z;i[Ba+6]=T.x;i[Ba+7]=T.y;i[Ba+8]=T.z;i[Ba+9]=ua.x;i[Ba+10]=ua.y;i[Ba+11]=ua.z}Ba+=12}if(Xa.length){r=Xa[t.a];F=Xa[t.b];i=Xa[t.c];Ka=Xa[t.d];la[C]=r.x;la[C+1]=r.y;la[C+2]=r.z;la[C+3]=r.w;la[C+4]=F.x;la[C+5]=F.y;la[C+6]=F.z;la[C+7]=F.w;la[C+8]=i.x;la[C+9]=i.y;la[C+10]=i.z;la[C+11]=i.w;la[C+12]=Ka.x;la[C+13]=Ka.y;la[C+14]=Ka.z;la[C+15]=Ka.w;r=gb[t.a];F=gb[t.b];i=gb[t.c];Ka=gb[t.d];ka[C]=r.x;ka[C+1]=r.y;ka[C+2]=r.z;ka[C+3]=
+r.w;ka[C+4]=F.x;ka[C+5]=F.y;ka[C+6]=F.z;ka[C+7]=F.w;ka[C+8]=i.x;ka[C+9]=i.y;ka[C+10]=i.z;ka[C+11]=i.w;ka[C+12]=Ka.x;ka[C+13]=Ka.y;ka[C+14]=Ka.z;ka[C+15]=Ka.w;r=eb[t.a];F=eb[t.b];i=eb[t.c];Ka=eb[t.d];ia[C]=r.x;ia[C+1]=r.y;ia[C+2]=r.z;ia[C+3]=1;ia[C+4]=F.x;ia[C+5]=F.y;ia[C+6]=F.z;ia[C+7]=1;ia[C+8]=i.x;ia[C+9]=i.y;ia[C+10]=i.z;ia[C+11]=1;ia[C+12]=Ka.x;ia[C+13]=Ka.y;ia[C+14]=Ka.z;ia[C+15]=1;r=fb[t.a];F=fb[t.b];i=fb[t.c];t=fb[t.d];ja[C]=r.x;ja[C+1]=r.y;ja[C+2]=r.z;ja[C+3]=1;ja[C+4]=F.x;ja[C+5]=F.y;ja[C+
+6]=F.z;ja[C+7]=1;ja[C+8]=i.x;ja[C+9]=i.y;ja[C+10]=i.z;ja[C+11]=1;ja[C+12]=t.x;ja[C+13]=t.y;ja[C+14]=t.z;ja[C+15]=1;C+=16}if(pb&&W){if(z.length==4&&W==THREE.VertexColors){t=z[0];r=z[1];F=z[2];z=z[3]}else z=F=r=t=D;Da[xa]=t.r;Da[xa+1]=t.g;Da[xa+2]=t.b;Da[xa+3]=r.r;Da[xa+4]=r.g;Da[xa+5]=r.b;Da[xa+6]=F.r;Da[xa+7]=F.g;Da[xa+8]=F.b;Da[xa+9]=z.r;Da[xa+10]=z.g;Da[xa+11]=z.b;xa+=12}if(ob&&Ha.hasTangents){z=B[0];D=B[1];t=B[2];B=B[3];ha[ea]=z.x;ha[ea+1]=z.y;ha[ea+2]=z.z;ha[ea+3]=z.w;ha[ea+4]=D.x;ha[ea+5]=D.y;
+ha[ea+6]=D.z;ha[ea+7]=D.w;ha[ea+8]=t.x;ha[ea+9]=t.y;ha[ea+10]=t.z;ha[ea+11]=t.w;ha[ea+12]=B.x;ha[ea+13]=B.y;ha[ea+14]=B.z;ha[ea+15]=B.w;ea+=16}if(nb&&O)if(A.length==4&&tb)for(B=0;B<4;B++){y=A[B];Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}else for(B=0;B<4;B++){Qa[La]=y.x;Qa[La+1]=y.y;Qa[La+2]=y.z;La+=3}if(hb&&X!==undefined&&N)for(B=0;B<4;B++){A=X[B];ib[bb]=A.u;ib[bb+1]=A.v;bb+=2}if(hb&&Ga!==undefined&&N)for(B=0;B<4;B++){A=Ga[B];jb[cb]=A.u;jb[cb+1]=A.v;cb+=2}if(mb){Na[Ja]=va;Na[Ja+1]=va+1;Na[Ja+2]=
+va+3;Na[Ja+3]=va+1;Na[Ja+4]=va+2;Na[Ja+5]=va+3;Ja+=6;Oa[Ma]=va;Oa[Ma+1]=va+1;Oa[Ma+2]=va;Oa[Ma+3]=va+3;Oa[Ma+4]=va+1;Oa[Ma+5]=va+2;Oa[Ma+6]=va+2;Oa[Ma+7]=va+3;Ma+=8;va+=4}}}if(ab){x=0;for(u=ab.length;x<u;x++){Na[Ja]=ab[x].a;Na[Ja+1]=ab[x].b;Na[Ja+2]=ab[x].c;Na[Ja+3]=ab[x].a;Na[Ja+4]=ab[x].c;Na[Ja+5]=ab[x].d;Ja+=6}}if(lb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,Ca,w)}if(Ra)for(Wa in Ra){i=Ra[Wa];if(i.needsUpdate){c.bindBuffer(c.ARRAY_BUFFER,i.buffer);c.bufferData(c.ARRAY_BUFFER,
+i.array,w);i.needsUpdate=!1}}if(qb){r=0;for(F=Ta.length;r<F;r++){c.bindBuffer(c.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[r]);c.bufferData(c.ARRAY_BUFFER,kb[r],w)}}if(pb&&xa>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,Da,w)}if(nb){c.bindBuffer(c.ARRAY_BUFFER,k.__webglNormalBuffer);c.bufferData(c.ARRAY_BUFFER,Qa,w)}if(ob&&Ha.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,k.__webglTangentBuffer);c.bufferData(c.ARRAY_BUFFER,ha,w)}if(hb&&bb>0){c.bindBuffer(c.ARRAY_BUFFER,
+k.__webglUVBuffer);c.bufferData(c.ARRAY_BUFFER,ib,w)}if(hb&&cb>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglUV2Buffer);c.bufferData(c.ARRAY_BUFFER,jb,w)}if(mb){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Na,w);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,Oa,w)}if(C>0){c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,ia,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinVertexBBuffer);
+c.bufferData(c.ARRAY_BUFFER,ja,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,ka,w);c.bindBuffer(c.ARRAY_BUFFER,k.__webglSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,la,w)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Ribbon){n=f.geometry;if(n.__dirtyVertices||n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;O=W.length;
+w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=W[u].position;o=u*3;X[o]=N.x;X[o+1]=N.y;X[o+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=k[u];o=u*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(f instanceof THREE.Line){n=f.geometry;if(n.__dirtyVertices||
+n.__dirtyColors){f=n;s=c.DYNAMIC_DRAW;W=f.vertices;k=f.colors;O=W.length;w=k.length;X=f.__vertexArray;x=f.__colorArray;Ga=f.__dirtyColors;if(f.__dirtyVertices){for(u=0;u<O;u++){N=W[u].position;o=u*3;X[o]=N.x;X[o+1]=N.y;X[o+2]=N.z}c.bindBuffer(c.ARRAY_BUFFER,f.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,X,s)}if(Ga){for(u=0;u<w;u++){color=k[u];o=u*3;x[o]=color.r;x[o+1]=color.g;x[o+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,f.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,x,s)}}n.__dirtyVertices=!1;
+n.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem){n=f.geometry;(n.__dirtyVertices||n.__dirtyColors||f.sortParticles)&&d(n,c.DYNAMIC_DRAW,f);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function sa(f){function s(D){var B=[];n=0;for(k=D.length;n<k;n++)D[n]==undefined?B.push("undefined"):B.push(D[n].id);return B.join("_")}var n,k,o,w,x,u,A,t,y={},z=f.morphTargets!==undefined?f.morphTargets.length:0;f.geometryGroups={};o=0;for(w=f.faces.length;o<w;o++){x=f.faces[o];u=x.materials;A=s(u);y[A]==
+undefined&&(y[A]={hash:A,counter:0});t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z});x=x instanceof THREE.Face3?3:4;if(f.geometryGroups[t].vertices+x>65535){y[A].counter+=1;t=y[A].hash+"_"+y[A].counter;f.geometryGroups[t]==undefined&&(f.geometryGroups[t]={faces:[],materials:u,vertices:0,numMorphTargets:z})}f.geometryGroups[t].faces.push(o);f.geometryGroups[t].vertices+=x}}function da(f,s,n){f.push({buffer:s,object:n,
+opaque:{list:[],count:0},transparent:{list:[],count:0}})}function oa(f){if(f!=ga){switch(f){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)}ga=f}}function Z(f,s,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){c.texParameteri(f,c.TEXTURE_WRAP_S,fa(s.wrapS));c.texParameteri(f,c.TEXTURE_WRAP_T,fa(s.wrapT));c.texParameteri(f,c.TEXTURE_MAG_FILTER,fa(s.magFilter));c.texParameteri(f,c.TEXTURE_MIN_FILTER,fa(s.minFilter));c.generateMipmap(f)}else{c.texParameteri(f,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(f,c.TEXTURE_MAG_FILTER,Ea(s.magFilter));c.texParameteri(f,
+c.TEXTURE_MIN_FILTER,Ea(s.minFilter))}}function K(f,s){if(f.needsUpdate){if(f.__webglInit){c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,f.image)}else{f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.image);f.__webglInit=!0}Z(c.TEXTURE_2D,f,f.image);c.bindTexture(c.TEXTURE_2D,null);f.needsUpdate=!1}c.activeTexture(c.TEXTURE0+s);c.bindTexture(c.TEXTURE_2D,
+f.__webglTexture)}function Ia(f){if(f&&!f.__webglFramebuffer){if(f.depthBuffer===undefined)f.depthBuffer=!0;if(f.stencilBuffer===undefined)f.stencilBuffer=!0;f.__webglFramebuffer=c.createFramebuffer();f.__webglRenderbuffer=c.createRenderbuffer();f.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,f.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,fa(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,fa(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,fa(f.magFilter));
+c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,fa(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,fa(f.format),f.width,f.height,0,fa(f.format),fa(f.type),null);c.bindRenderbuffer(c.RENDERBUFFER,f.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,f.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webglTexture,0);if(f.depthBuffer&&!f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,
+c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else if(f.depthBuffer&&f.stencilBuffer){c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,f.width,f.height);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,f.__webglRenderbuffer)}else c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,f.width,f.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var s,n;if(f){s=f.__webglFramebuffer;n=f.width;f=
+f.height}else{s=null;n=ya;f=za}if(s!=Fa){c.bindFramebuffer(c.FRAMEBUFFER,s);c.viewport(wa,qa,n,f);Fa=s}}function ca(f,s){var n;if(f=="fragment")n=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(n=c.createShader(c.VERTEX_SHADER));c.shaderSource(n,s);c.compileShader(n);if(!c.getShaderParameter(n,c.COMPILE_STATUS)){console.error(c.getShaderInfoLog(n));console.error(s);return null}return n}function Ea(f){switch(f){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;
+default:return c.LINEAR}}function fa(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.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 c,R=document.createElement("canvas"),pa=[],ra=null,Fa=null,ta=!0,aa=this,ma=null,na=null,ga=null,Y=null,wa=0,qa=0,ya=0,za=0,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Pa=new THREE.Matrix4,Ua=new Float32Array(16),Ya=new Float32Array(16),Va=new THREE.Vector4,Sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Za=!0,$a=!0,xb=new THREE.Color(0),yb=0;if(b){if(b.stencil!=
+undefined)Za=b.stencil;if(b.antialias!==undefined)$a=b.antialias;b.clearColor!==undefined&&xb.setHex(b.clearColor);if(b.clearAlpha!==undefined)yb=b.clearAlpha}this.maxMorphTargets=8;this.domElement=R;this.autoClear=!0;this.sortObjects=!0;(function(f,s,n,k){try{if(!(c=R.getContext("experimental-webgl",{antialias:f,stencil:k})))throw"Error creating WebGL context.";}catch(o){console.error(o)}console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+
+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION));c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(s.r,s.g,s.b,n)})($a,xb,yb,Za);this.context=c;if(Za){var U={};U.vertices=new Float32Array(12);U.faces=new Uint16Array(6);U.darkness=0.5;U.vertices[0]=-20;U.vertices[1]=-20;U.vertices[2]=-1;U.vertices[3]=
+20;U.vertices[4]=-20;U.vertices[5]=-1;U.vertices[6]=20;U.vertices[7]=20;U.vertices[8]=-1;U.vertices[9]=-20;U.vertices[10]=20;U.vertices[11]=-1;U.faces[0]=0;U.faces[1]=1;U.faces[2]=2;U.faces[3]=0;U.faces[4]=2;U.faces[5]=3;U.vertexBuffer=c.createBuffer();U.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,U.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,U.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,U.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,U.faces,c.STATIC_DRAW);U.program=
+c.createProgram();c.attachShader(U.program,ca("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(U.program,ca("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(U.program);U.vertexLocation=c.getAttribLocation(U.program,"position");U.projectionLocation=c.getUniformLocation(U.program,"projectionMatrix");U.darknessLocation=c.getUniformLocation(U.program,"darkness")}var J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);b=0;J.vertices[b++]=-1;J.vertices[b++]=
+-1;J.vertices[b++]=0;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=1;J.vertices[b++]=-1;J.vertices[b++]=1;J.vertices[b++]=0;J.vertices[b++]=1;b=0;J.faces[b++]=0;J.faces[b++]=1;J.faces[b++]=2;J.faces[b++]=0;J.faces[b++]=2;J.faces[b++]=3;J.vertexBuffer=c.createBuffer();J.elementBuffer=c.createBuffer();J.tempTexture=c.createTexture();J.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,
+J.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,J.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,J.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,J.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,J.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);if(c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){J.hasVertexTexture=!1;J.program=c.createProgram();
+c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlare.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{J.hasVertexTexture=!0;J.program=c.createProgram();c.attachShader(J.program,ca("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));c.attachShader(J.program,ca("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}c.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.vertex=c.getAttribLocation(J.program,
+"position");J.attributes.uv=c.getAttribLocation(J.program,"UV");J.uniforms.renderType=c.getUniformLocation(J.program,"renderType");J.uniforms.map=c.getUniformLocation(J.program,"map");J.uniforms.occlusionMap=c.getUniformLocation(J.program,"occlusionMap");J.uniforms.opacity=c.getUniformLocation(J.program,"opacity");J.uniforms.scale=c.getUniformLocation(J.program,"scale");J.uniforms.rotation=c.getUniformLocation(J.program,"rotation");J.uniforms.screenPosition=c.getUniformLocation(J.program,"screenPosition");
+var sb=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=
+0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=c.createBuffer();_sprite.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,_sprite.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,_sprite.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,_sprite.faces,c.STATIC_DRAW);_sprite.program=c.createProgram();c.attachShader(_sprite.program,ca("fragment",THREE.ShaderLib.sprite.fragmentShader));
+c.attachShader(_sprite.program,ca("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=c.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=c.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=c.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=c.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=c.getUniformLocation(_sprite.program,
+"rotation");_sprite.uniforms.scale=c.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=c.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=c.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=c.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=c.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=c.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=
+c.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=c.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=c.getUniformLocation(_sprite.program,"projectionMatrix");var rb=!1;this.setSize=function(f,s){R.width=f;R.height=s;this.setViewport(0,0,R.width,R.height)};this.setViewport=function(f,s,n,k){wa=f;qa=s;ya=n;za=k;c.viewport(wa,qa,ya,za)};this.setScissor=function(f,s,n,k){c.scissor(f,s,n,k)};this.enableScissorTest=function(f){f?
+c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(f){ta=f;c.depthMask(f)};this.setClearColorHex=function(f,s){var n=new THREE.Color(f);c.clearColor(n.r,n.g,n.b,s)};this.setClearColor=function(f,s){c.clearColor(f.r,f.g,f.b,s)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(f){U.darkness=f};this.initMaterial=function(f,s,n,k){var o,w,x;if(f instanceof THREE.MeshDepthMaterial)x="depth";
+else if(f instanceof THREE.ShadowVolumeDynamicMaterial)x="shadowVolumeDynamic";else if(f instanceof THREE.MeshNormalMaterial)x="normal";else if(f instanceof THREE.MeshBasicMaterial)x="basic";else if(f instanceof THREE.MeshLambertMaterial)x="lambert";else if(f instanceof THREE.MeshPhongMaterial)x="phong";else if(f instanceof THREE.LineBasicMaterial)x="basic";else f instanceof THREE.ParticleBasicMaterial&&(x="particle_basic");if(x){var u=THREE.ShaderLib[x];f.uniforms=Uniforms.clone(u.uniforms);f.vertexShader=
+u.vertexShader;f.fragmentShader=u.fragmentShader}var A,t,y;A=y=u=0;for(t=s.length;A<t;A++){w=s[A];w instanceof THREE.DirectionalLight&&y++;w instanceof THREE.PointLight&&u++}if(u+y<=4)s=y;else{s=Math.ceil(4*y/(u+y));u=4-s}w={directional:s,point:u};y=50;if(k!==undefined&&k instanceof THREE.SkinnedMesh)y=k.bones.length;var z;a:{A=f.fragmentShader;t=f.vertexShader;u=f.uniforms;s=f.attributes;n={map:!!f.map,envMap:!!f.envMap,lightMap:!!f.lightMap,vertexColors:f.vertexColors,fog:n,sizeAttenuation:f.sizeAttenuation,
+skinning:f.skinning,morphTargets:f.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:w.directional,maxPointLights:w.point,maxBones:y};var D;w=[];if(x)w.push(x);else{w.push(A);w.push(t)}for(D in n){w.push(D);w.push(n[D])}x=w.join();D=0;for(w=pa.length;D<w;D++)if(pa[D].code==x){z=pa[D].program;break a}D=c.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":
+"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",
+n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 c.attachShader(D,ca("fragment",prefix_fragment+A));c.attachShader(D,ca("vertex",prefix_vertex+t));c.linkProgram(D);c.getProgramParameter(D,c.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+c.getProgramParameter(D,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");D.uniforms={};D.attributes={};var B;A=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in u)A.push(B);
 B=A;u=0;for(A=B.length;u<A;u++){t=B[u];D.uniforms[t]=c.getUniformLocation(D,t)}A=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<n.maxMorphTargets;B++)A.push("morphTarget"+B);for(z in s)A.push(z);z=A;B=0;for(s=z.length;B<s;B++){n=z[B];D.attributes[n]=c.getAttribLocation(D,n)}pa.push({program:D,code:x});z=D}f.program=z;z=f.program.attributes;c.enableVertexAttribArray(z.position);z.color>=0&&c.enableVertexAttribArray(z.color);z.normal>=
 0&&c.enableVertexAttribArray(z.normal);z.tangent>=0&&c.enableVertexAttribArray(z.tangent);if(f.skinning&&z.skinVertexA>=0&&z.skinVertexB>=0&&z.skinIndex>=0&&z.skinWeight>=0){c.enableVertexAttribArray(z.skinVertexA);c.enableVertexAttribArray(z.skinVertexB);c.enableVertexAttribArray(z.skinIndex);c.enableVertexAttribArray(z.skinWeight)}for(o in f.attributes)z[o]>=0&&c.enableVertexAttribArray(z[o]);if(f.morphTargets){f.numSupportedMorphTargets=0;if(z.morphTarget0>=0){c.enableVertexAttribArray(z.morphTarget0);

+ 24 - 4
src/renderers/WebGLRenderer.js

@@ -215,9 +215,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_lensFlare.uniforms.rotation       = _gl.getUniformLocation( _lensFlare.program, "rotation" );
 	_lensFlare.uniforms.screenPosition = _gl.getUniformLocation( _lensFlare.program, "screenPosition" );
 
-	_gl.enableVertexAttribArray( _lensFlare.attributes.vertex );
-	_gl.enableVertexAttribArray( _lensFlare.attributes.uv );
+	//_gl.enableVertexAttribArray( _lensFlare.attributes.vertex );
+	//_gl.enableVertexAttribArray( _lensFlare.attributes.uv );
 
+	var _lensFlareAttributesEnabled = false;
 
 	// prepare sprites
 	
@@ -272,9 +273,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_sprite.uniforms.modelViewMatrix      = _gl.getUniformLocation( _sprite.program, "modelViewMatrix" );
 	_sprite.uniforms.projectionMatrix     = _gl.getUniformLocation( _sprite.program, "projectionMatrix" );
 
-	_gl.enableVertexAttribArray( _sprite.attributes.position );
-	_gl.enableVertexAttribArray( _sprite.attributes.uv );
+	//_gl.enableVertexAttribArray( _sprite.attributes.position );
+	//_gl.enableVertexAttribArray( _sprite.attributes.uv );
 
+	var _spriteAttributesEnabled = false;
 
 	this.setSize = function ( width, height ) {
 
@@ -3335,6 +3337,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_currentProgram = _sprite.program;
 		_oldBlending = "";
 
+		if ( !_spriteAttributesEnabled ) {
+	
+			_gl.enableVertexAttribArray( _sprite.attributes.position );
+			_gl.enableVertexAttribArray( _sprite.attributes.uv );
+			
+			_spriteAttributesEnabled = true;
+
+		}
+		
 		_gl.disable( _gl.CULL_FACE );
 		_gl.enable( _gl.BLEND );
 		_gl.depthMask( true );
@@ -3491,6 +3502,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_oldBlending = "";
 
 
+		if ( ! _lensFlareAttributesEnabled ) {
+		
+			_gl.enableVertexAttribArray( _lensFlare.attributes.vertex );
+			_gl.enableVertexAttribArray( _lensFlare.attributes.uv );
+			
+			_lensFlareAttributesEnabled = true;
+
+		}
+
 		// loop through all lens flares to update their occlusion and positions
 		// setup gl and common used attribs/unforms