浏览代码

JSONLoader: added scaling also to morphs.

alteredq 14 年之前
父节点
当前提交
4bfca67caa
共有 3 个文件被更改,包括 405 次插入402 次删除
  1. 260 260
      build/Three.js
  2. 133 133
      build/custom/ThreeExtras.js
  3. 12 9
      src/extras/io/JSONLoader.js

+ 260 - 260
build/Three.js

@@ -12,21 +12,21 @@ 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,d,c,f){this.set(b||0,d||0,c||0,f||1)};
 THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.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,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.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,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(J,B,U,C){C=C.clone().subSelf(B);U=U.clone().subSelf(B);var V=J.clone().subSelf(B);J=C.dot(C);B=C.dot(U);C=C.dot(V);var O=U.dot(U);U=U.dot(V);V=1/(J*O-B*B);O=(O*C-B*U)*V;J=(J*U-B*C)*V;return O>0&&J>0&&O+J<1}var c,f,g,h,j,k,m,o,p,t,
-y,u=b.geometry,A=u.vertices,F=[];c=0;for(f=u.faces.length;c<f;c++){g=u.faces[c];t=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(A[g.a].position.clone());j=m.multiplyVector3(A[g.b].position.clone());k=m.multiplyVector3(A[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(A[g.d].position.clone()):null;o=b.matrixRotationWorld.multiplyVector3(g.normal.clone());p=y.dot(o);if(b.doubleSided||(b.flipSided?p>0:p<0)){o=o.dot((new THREE.Vector3).sub(h,t))/
-p;t=t.addSelf(y.multiplyScalar(o));if(g instanceof THREE.Face3){if(d(t,h,j,k)){g={distance:this.origin.distanceTo(t),point:t,face:g,object:b};F.push(g)}}else if(g instanceof THREE.Face4&&(d(t,h,j,m)||d(t,j,k,m))){g={distance:this.origin.distanceTo(t),point:t,face:g,object:b};F.push(g)}}}return F}};
-THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,o,p,t){k=!1;d=m;c=o;f=p;g=t;b()};this.addPoint=function(m,o){if(k){k=!1;d=m;c=o;f=m;g=o}else{d=d<m?d:m;c=c<o?c:o;f=f>m?f:m;g=g>o?g:o}b()};
-this.add3Points=function(m,o,p,t,y,u){if(k){k=!1;d=m<p?m<y?m:y:p<y?p:y;c=o<t?o<u?o:u:t<u?t:u;f=m>p?m>y?m:y:p>y?p:y;g=o>t?o>u?o:u:t>u?t:u}else{d=m<p?m<y?m<d?m:d:y<d?y:d:p<y?p<d?p:d:y<d?y:d;c=o<t?o<u?o<c?o:c:u<c?u:c:t<u?t<c?t:c:u<c?u:c;f=m>p?m>y?m>f?m:f:y>f?y:f:p>y?p>f?p:f:y>f?y:f;g=o>t?o>u?o>g?o:g:u>g?u:g:t>u?t>g?t:g:u>g?u:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=d<m.getLeft()?d:m.getLeft();c=c<m.getTop()?c:m.getTop();f=f>m.getRight()?
+THREE.Ray.prototype={intersectScene:function(b){var d,c,f=b.objects,g=[];b=0;for(d=f.length;b<d;b++){c=f[b];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(H,B,W,D){D=D.clone().subSelf(B);W=W.clone().subSelf(B);var R=H.clone().subSelf(B);H=D.dot(D);B=D.dot(W);D=D.dot(R);var L=W.dot(W);W=W.dot(R);R=1/(H*L-B*B);L=(L*D-B*W)*R;H=(H*W-B*D)*R;return L>0&&H>0&&L+H<1}var c,f,g,h,j,k,m,o,t,p,
+y,u=b.geometry,A=u.vertices,I=[];c=0;for(f=u.faces.length;c<f;c++){g=u.faces[c];p=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(A[g.a].position.clone());j=m.multiplyVector3(A[g.b].position.clone());k=m.multiplyVector3(A[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(A[g.d].position.clone()):null;o=b.matrixRotationWorld.multiplyVector3(g.normal.clone());t=y.dot(o);if(b.doubleSided||(b.flipSided?t>0:t<0)){o=o.dot((new THREE.Vector3).sub(h,p))/
+t;p=p.addSelf(y.multiplyScalar(o));if(g instanceof THREE.Face3){if(d(p,h,j,k)){g={distance:this.origin.distanceTo(p),point:p,face:g,object:b};I.push(g)}}else if(g instanceof THREE.Face4&&(d(p,h,j,m)||d(p,j,k,m))){g={distance:this.origin.distanceTo(p),point:p,face:g,object:b};I.push(g)}}}return I}};
+THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,o,t,p){k=!1;d=m;c=o;f=t;g=p;b()};this.addPoint=function(m,o){if(k){k=!1;d=m;c=o;f=m;g=o}else{d=d<m?d:m;c=c<o?c:o;f=f>m?f:m;g=g>o?g:o}b()};
+this.add3Points=function(m,o,t,p,y,u){if(k){k=!1;d=m<t?m<y?m:y:t<y?t:y;c=o<p?o<u?o:u:p<u?p:u;f=m>t?m>y?m:y:t>y?t:y;g=o>p?o>u?o:u:p>u?p:u}else{d=m<t?m<y?m<d?m:d:y<d?y:d:t<y?t<d?t:d:y<d?y:d;c=o<p?o<u?o<c?o:c:u<c?u:c:p<u?p<c?p:c:u<c?u:c;f=m>t?m>y?m>f?m:f:y>f?y:f:t>y?t>f?t:f:y>f?y:f;g=o>p?o>u?o>g?o:g:u>g?u:g:p>u?p>g?p:g:u>g?u:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=d<m.getLeft()?d:m.getLeft();c=c<m.getTop()?c:m.getTop();f=f>m.getRight()?
 f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){d-=m;c-=m;f+=m;g+=m;b()};this.minSelf=function(m){d=d>m.getLeft()?d:m.getLeft();c=c>m.getTop()?c: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(d,m.getLeft())>=0&&Math.min(g,m.getBottom())-Math.max(c,m.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
-THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,o,p,t,y,u,A,F){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,o||0,p||1,t||0,y||0,u||0,A||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,p,t,y,u,A,F){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=p;this.n34=t;this.n41=y;this.n42=u;this.n43=A;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,d,c){var f=THREE.Matrix4.__v1,
+THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,o,t,p,y,u,A,I){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,o||0,t||1,p||0,y||0,u||0,A||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,t,p,y,u,A,I){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=t;this.n34=p;this.n41=y;this.n42=u;this.n43=A;this.n44=I;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
 g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,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 d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
 f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
-return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,t=b.n32,y=b.n33,u=b.n34,A=b.n41,F=b.n42,J=b.n43,B=b.n44,U=d.n11,C=d.n12,V=d.n13,O=d.n14,M=d.n21,va=d.n22,
-la=d.n23,qa=d.n24,ga=d.n31,ea=d.n32,e=d.n33,oa=d.n34;this.n11=c*U+f*M+g*ga;this.n12=c*C+f*va+g*ea;this.n13=c*V+f*la+g*e;this.n14=c*O+f*qa+g*oa+h;this.n21=j*U+k*M+m*ga;this.n22=j*C+k*va+m*ea;this.n23=j*V+k*la+m*e;this.n24=j*O+k*qa+m*oa+o;this.n31=p*U+t*M+y*ga;this.n32=p*C+t*va+y*ea;this.n33=p*V+t*la+y*e;this.n34=p*O+t*qa+y*oa+u;this.n41=A*U+F*M+J*ga;this.n42=A*C+F*va+J*ea;this.n43=A*V+F*la+J*e;this.n44=A*O+F*qa+J*oa+B;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
+return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,t=b.n31,p=b.n32,y=b.n33,u=b.n34,A=b.n41,I=b.n42,H=b.n43,B=b.n44,W=d.n11,D=d.n12,R=d.n13,L=d.n14,Q=d.n21,qa=d.n22,
+la=d.n23,ra=d.n24,ga=d.n31,ea=d.n32,e=d.n33,oa=d.n34;this.n11=c*W+f*Q+g*ga;this.n12=c*D+f*qa+g*ea;this.n13=c*R+f*la+g*e;this.n14=c*L+f*ra+g*oa+h;this.n21=j*W+k*Q+m*ga;this.n22=j*D+k*qa+m*ea;this.n23=j*R+k*la+m*e;this.n24=j*L+k*ra+m*oa+o;this.n31=t*W+p*Q+y*ga;this.n32=t*D+p*qa+y*ea;this.n33=t*R+p*la+y*e;this.n34=t*L+p*ra+y*oa+u;this.n41=A*W+I*Q+H*ga;this.n42=A*D+I*qa+H*ea;this.n43=A*R+I*la+H*e;this.n44=A*L+I*ra+H*oa+B;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=
 this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=
-b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,p=this.n33,t=this.n34,y=this.n41,u=this.n42,A=this.n43,F=this.n44;return f*j*o*y-c*k*o*y-f*h*p*y+d*k*p*y+c*h*t*y-d*j*t*y-f*j*m*u+c*k*m*u+f*g*p*u-b*k*p*u-c*g*t*u+b*j*t*u+f*h*m*A-d*k*m*A-f*g*o*A+b*k*o*A+d*g*t*A-b*h*t*A-c*h*m*F+d*j*m*F+c*g*o*F-b*j*o*F-d*g*p*F+b*h*p*F},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
+b;return this},determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,t=this.n33,p=this.n34,y=this.n41,u=this.n42,A=this.n43,I=this.n44;return f*j*o*y-c*k*o*y-f*h*t*y+d*k*t*y+c*h*p*y-d*j*p*y-f*j*m*u+c*k*m*u+f*g*t*u-b*k*t*u-c*g*p*u+b*j*p*u+f*h*m*A-d*k*m*A-f*g*o*A+b*k*o*A+d*g*p*A-b*h*p*A-c*h*m*I+d*j*m*I+c*g*o*I-b*j*o*I-d*g*t*I+b*h*t*I},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=
 this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;
 b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,
@@ -35,9 +35,9 @@ b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=t
 new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+
 d*h;this.n33=b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var o=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},
 extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
-THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,t=b.n32,y=b.n33,u=b.n34,A=b.n41,F=b.n42,J=b.n43,B=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*F-o*y*F+o*t*J-k*u*J-m*t*B+k*y*B;d.n12=h*y*F-g*u*F-h*t*J+f*u*J+g*t*B-f*y*B;d.n13=g*o*F-h*m*F+h*k*J-f*o*J-g*k*B+f*m*B;d.n14=h*m*t-g*o*t-h*k*y+f*o*y+g*k*u-f*m*u;d.n21=o*y*A-m*u*A-o*p*J+j*u*J+m*p*B-j*y*B;d.n22=g*u*A-h*y*A+h*p*J-c*u*J-g*p*B+c*y*B;d.n23=h*m*A-g*o*A-h*j*J+c*o*J+g*j*B-c*m*B;
-d.n24=g*o*p-h*m*p+h*j*y-c*o*y-g*j*u+c*m*u;d.n31=k*u*A-o*t*A+o*p*F-j*u*F-k*p*B+j*t*B;d.n32=h*t*A-f*u*A-h*p*F+c*u*F+f*p*B-c*t*B;d.n33=g*o*A-h*k*A+h*j*F-c*o*F-f*j*B+c*k*B;d.n34=h*k*p-f*o*p-h*j*t+c*o*t+f*j*u-c*k*u;d.n41=m*t*A-k*y*A-m*p*F+j*y*F+k*p*J-j*t*J;d.n42=f*y*A-g*t*A+g*p*F-c*y*F-f*p*J+c*t*J;d.n43=g*k*A-f*m*A-g*j*F+c*m*F+f*j*J-c*k*J;d.n44=f*m*p-g*k*p+g*j*t-c*m*t-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
-THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.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,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*o;c[7]=b*p;c[8]=b*t;return d};
+THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,t=b.n31,p=b.n32,y=b.n33,u=b.n34,A=b.n41,I=b.n42,H=b.n43,B=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*u*I-o*y*I+o*p*H-k*u*H-m*p*B+k*y*B;d.n12=h*y*I-g*u*I-h*p*H+f*u*H+g*p*B-f*y*B;d.n13=g*o*I-h*m*I+h*k*H-f*o*H-g*k*B+f*m*B;d.n14=h*m*p-g*o*p-h*k*y+f*o*y+g*k*u-f*m*u;d.n21=o*y*A-m*u*A-o*t*H+j*u*H+m*t*B-j*y*B;d.n22=g*u*A-h*y*A+h*t*H-c*u*H-g*t*B+c*y*B;d.n23=h*m*A-g*o*A-h*j*H+c*o*H+g*j*B-c*m*B;
+d.n24=g*o*t-h*m*t+h*j*y-c*o*y-g*j*u+c*m*u;d.n31=k*u*A-o*p*A+o*t*I-j*u*I-k*t*B+j*p*B;d.n32=h*p*A-f*u*A-h*t*I+c*u*I+f*t*B-c*p*B;d.n33=g*o*A-h*k*A+h*j*I-c*o*I-f*j*B+c*k*B;d.n34=h*k*t-f*o*t-h*j*p+c*o*p+f*j*u-c*k*u;d.n41=m*p*A-k*y*A-m*t*I+j*y*I+k*t*H-j*p*H;d.n42=f*y*A-g*p*A+g*t*I-c*y*I-f*t*H+c*p*H;d.n43=g*k*A-f*m*A-g*j*I+c*m*I+f*j*H-c*k*H;d.n44=f*m*t-g*k*t+g*j*p-c*m*p-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
+THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.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,o=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*o;c[7]=b*t;c[8]=b*p;return d};
 THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);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,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)};
 THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,m,o;j=new THREE.Matrix4;k=d-b;m=c-f;o=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((c+f)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+g)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.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=
@@ -48,8 +48,8 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,c)}};THREE.Quaternion=function(b,d,c,f){this.set(b||0,d||0,c||0,f!==undefined?f:1)};
 THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,c=b.x*d,f=b.y*d,g=b.z*d;b=Math.cos(f);f=Math.sin(f);d=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var j=b*d,k=f*g;this.w=j*h-k*c;this.x=j*c+k*h;this.y=f*d*h+b*g*c;this.z=b*g*h-f*d*c;return this},setFromAxisAngle:function(b,d){var c=d/2,f=Math.sin(c);this.x=b.x*f;this.y=
 b.y*f;this.z=b.z*f;this.w=Math.cos(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 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,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*c+j*g-k*f,p=
-m*f+k*c-h*g,t=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+p*-k-t*-j;d.y=p*m+c*-j+t*-h-o*-k;d.z=t*m+c*-k+o*-j-p*-h;return d}};
+multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*c+j*g-k*f,t=
+m*f+k*c-h*g,p=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+t*-k-p*-j;d.y=t*m+c*-j+p*-h-o*-k;d.z=p*m+c*-k+o*-j-t*-h;return d}};
 THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
 THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;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,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;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,d){this.set(b||0,d||0)};
@@ -58,17 +58,17 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,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);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
 k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
 this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(fa,wa,ta,pa,ca,ka,ma){k=fa.vertices[wa].position;m=fa.vertices[ta].position;o=fa.vertices[pa].position;p=j[ca];t=j[ka];y=j[ma];u=m.x-k.x;A=o.x-k.x;F=m.y-k.y;J=o.y-k.y;B=m.z-k.z;U=o.z-k.z;C=t.u-p.u;V=y.u-p.u;O=t.v-p.v;M=y.v-p.v;va=1/(C*
-M-V*O);ea.set((M*u-O*A)*va,(M*F-O*J)*va,(M*B-O*U)*va);e.set((C*A-V*u)*va,(C*J-V*F)*va,(C*U-V*B)*va);qa[wa].addSelf(ea);qa[ta].addSelf(ea);qa[pa].addSelf(ea);ga[wa].addSelf(e);ga[ta].addSelf(e);ga[pa].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa=[],ga=[],ea=new THREE.Vector3,e=new THREE.Vector3,oa=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){qa[d]=new THREE.Vector3;ga[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
-this.faces[d];j=this.faceVertexUvs[0][d];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 da=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Aa.copy(h.vertexNormals[f]);g=h[da[f]];la=qa[g];oa.copy(la);oa.subSelf(Aa.multiplyScalar(Aa.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(ga[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
+c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(fa,wa,ua,pa,ca,ka,ma){k=fa.vertices[wa].position;m=fa.vertices[ua].position;o=fa.vertices[pa].position;t=j[ca];p=j[ka];y=j[ma];u=m.x-k.x;A=o.x-k.x;I=m.y-k.y;H=o.y-k.y;B=m.z-k.z;W=o.z-k.z;D=p.u-t.u;R=y.u-t.u;L=p.v-t.v;Q=y.v-t.v;qa=1/(D*
+Q-R*L);ea.set((Q*u-L*A)*qa,(Q*I-L*H)*qa,(Q*B-L*W)*qa);e.set((D*A-R*u)*qa,(D*H-R*I)*qa,(D*W-R*B)*qa);ra[wa].addSelf(ea);ra[ua].addSelf(ea);ra[pa].addSelf(ea);ga[wa].addSelf(e);ga[ua].addSelf(e);ga[pa].addSelf(e)}var d,c,f,g,h,j,k,m,o,t,p,y,u,A,I,H,B,W,D,R,L,Q,qa,la,ra=[],ga=[],ea=new THREE.Vector3,e=new THREE.Vector3,oa=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){ra[d]=new THREE.Vector3;ga[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
+this.faces[d];j=this.faceVertexUvs[0][d];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 da=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Aa.copy(h.vertexNormals[f]);g=h[da[f]];la=ra[g];oa.copy(la);oa.subSelf(Aa.multiplyScalar(Aa.dot(la))).normalize();Da.cross(h.vertexNormals[f],la);g=Da.dot(ga[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(oa.x,
 oa.y,oa.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
 if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
-{radius:b}},computeEdgeFaces:function(){function b(m,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,p){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[p]=1;m[o].array.push(p)}else if(m[o].set[p]===undefined){m[o].set[p]=1;m[o].array.push(p)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
+{radius:b}},computeEdgeFaces:function(){function b(m,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,t){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[t]=1;m[o].array.push(t)}else if(m[o].set[t]===undefined){m[o].set[t]=1;m[o].array.push(t)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
 g=b(j.a,j.d);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.c,j.d);d(k,g,c)}}c=0;for(f=this.edges.length;c<f;c++){j=this.edges[c];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 d(u,A,F,J,B,U,C){u=(F-u)*0.5;J=(J-A)*0.5;return(2*(A-F)+u+J)*C+(-3*(A-F)-2*u-J)*U+u*B+A}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,o,p,t,y;this.initFromArray=function(u){this.points=[];for(var A=0;A<u.length;A++)this.points[A]={x:u[A][0],y:u[A][1],z:u[A][2]}};this.getPoint=function(u){g=(this.points.length-1)*u;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;o=this.points[c[0]];p=this.points[c[1]];
-t=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(o.x,p.x,t.x,y.x,j,k,m);f.y=d(o.y,p.y,t.y,y.y,j,k,m);f.z=d(o.z,p.z,t.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var u,A,F=this.points.length,J=[];for(u=0;u<F;u++){A=this.points[u];J[u]=[A.x,A.y,A.z]}return J};this.getLength=function(u){var A,F,J=A=A=0,B=new THREE.Vector3,U=new THREE.Vector3,C=[],V=0;C[0]=0;u||(u=100);F=this.points.length*u;B.copy(this.points[0]);for(u=1;u<F;u++){A=u/F;position=this.getPoint(A);U.copy(position);
-V+=U.distanceTo(B);B.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=J){C[A]=V;J=A}}C[C.length]=V;return{chunks:C,total:V}};this.reparametrizeByArcLength=function(u){var A,F,J,B,U,C,V=[],O=new THREE.Vector3,M=this.getLength();V.push(O.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){F=M.chunks[A]-M.chunks[A-1];C=Math.ceil(u*F/M.total);B=(A-1)/(this.points.length-1);U=A/(this.points.length-1);for(F=1;F<C-1;F++){J=B+F*(1/C)*(U-B);position=this.getPoint(J);V.push(O.copy(position).clone())}V.push(O.copy(this.points[A]).clone())}this.points=
-V}};THREE.Edge=function(b,d,c,f){this.vertices=[b,d];this.vertexIndices=[c,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||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.Spline=function(b){function d(u,A,I,H,B,W,D){u=(I-u)*0.5;H=(H-A)*0.5;return(2*(A-I)+u+H)*D+(-3*(A-I)-2*u-H)*W+u*B+A}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,o,t,p,y;this.initFromArray=function(u){this.points=[];for(var A=0;A<u.length;A++)this.points[A]={x:u[A][0],y:u[A][1],z:u[A][2]}};this.getPoint=function(u){g=(this.points.length-1)*u;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;o=this.points[c[0]];t=this.points[c[1]];
+p=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(o.x,t.x,p.x,y.x,j,k,m);f.y=d(o.y,t.y,p.y,y.y,j,k,m);f.z=d(o.z,t.z,p.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var u,A,I=this.points.length,H=[];for(u=0;u<I;u++){A=this.points[u];H[u]=[A.x,A.y,A.z]}return H};this.getLength=function(u){var A,I,H=A=A=0,B=new THREE.Vector3,W=new THREE.Vector3,D=[],R=0;D[0]=0;u||(u=100);I=this.points.length*u;B.copy(this.points[0]);for(u=1;u<I;u++){A=u/I;position=this.getPoint(A);W.copy(position);
+R+=W.distanceTo(B);B.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=H){D[A]=R;H=A}}D[D.length]=R;return{chunks:D,total:R}};this.reparametrizeByArcLength=function(u){var A,I,H,B,W,D,R=[],L=new THREE.Vector3,Q=this.getLength();R.push(L.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){I=Q.chunks[A]-Q.chunks[A-1];D=Math.ceil(u*I/Q.total);B=(A-1)/(this.points.length-1);W=A/(this.points.length-1);for(I=1;I<D-1;I++){H=B+I*(1/D)*(W-B);position=this.getPoint(H);R.push(L.copy(position).clone())}R.push(L.copy(this.points[A]).clone())}this.points=
+R}};THREE.Edge=function(b,d,c,f){this.vertices=[b,d];this.vertexIndices=[c,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
@@ -122,13 +122,13 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
 !1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.ShadowVolume=function(b,d){if(b instanceof THREE.Mesh){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this)}else THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,c,f,g,h,j,k,m,o,p,t,y,u,A=new THREE.Geometry;A.vertices=this.geometry.vertices;f=A.faces=this.geometry.faces;var F=A.egdes=this.geometry.edges,J=A.edgeFaces=[];g=0;var B=[];b=0;for(d=f.length;b<d;b++){c=f[b];B.push(g);g+=c instanceof THREE.Face3?3:4;c.vertexNormals[0]=c.normal;c.vertexNormals[1]=c.normal;c.vertexNormals[2]=c.normal;if(c instanceof THREE.Face4)c.vertexNormals[3]=
-c.normal}b=0;for(d=F.length;b<d;b++){k=F[b];c=k.faces[0];f=k.faces[1];g=k.faceIndices[0];h=k.faceIndices[1];j=k.vertexIndices[0];k=k.vertexIndices[1];if(c.a===j){m="a";p=B[g]+0}else if(c.b===j){m="b";p=B[g]+1}else if(c.c===j){m="c";p=B[g]+2}else if(c.d===j){m="d";p=B[g]+3}if(c.a===k){m+="a";t=B[g]+0}else if(c.b===k){m+="b";t=B[g]+1}else if(c.c===k){m+="c";t=B[g]+2}else if(c.d===k){m+="d";t=B[g]+3}if(f.a===j){o="a";y=B[h]+0}else if(f.b===j){o="b";y=B[h]+1}else if(f.c===j){o="c";y=B[h]+2}else if(f.d===
-j){o="d";y=B[h]+3}if(f.a===k){o+="a";u=B[h]+0}else if(f.b===k){o+="b";u=B[h]+1}else if(f.c===k){o+="c";u=B[h]+2}else if(f.d===k){o+="d";u=B[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(p>t){c=p;p=t;t=c}}else if(p<t){c=p;p=t;t=c}if(o==="ac"||o==="ad"||o==="ca"||o==="da"){if(y>u){c=y;y=u;u=c}}else if(y<u){c=y;y=u;u=c}c=new THREE.Face4(p,t,y,u);c.normal.set(1,0,0);J.push(c)}this.geometry=A}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,o,p,t=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
-for(k=0;k<o;k++){p=b[j[t[k]]];d.push(new THREE.Vertex(p.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,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,d,c){var f,g,h,j,k,m,o,p,t,y,u,A,F,J=0,B=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(A=0;A<f;A++){h=d[B[A]];k=b[h];for(F=0;F<g;F++){j=c[B[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){J++;if(J===1){o=k;p=m;t=h;y=j;u=B[A]}if(J===2){u+=B[A];return u==="ad"||u==="ac"?{faces:[d,c],vertices:[o,p,m,k],indices:[t,
-y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[o,k,m,p],indices:[t,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,c,f,g,h,j,k,m,o,t,p,y,u,A=new THREE.Geometry;A.vertices=this.geometry.vertices;f=A.faces=this.geometry.faces;var I=A.egdes=this.geometry.edges,H=A.edgeFaces=[];g=0;var B=[];b=0;for(d=f.length;b<d;b++){c=f[b];B.push(g);g+=c instanceof THREE.Face3?3:4;c.vertexNormals[0]=c.normal;c.vertexNormals[1]=c.normal;c.vertexNormals[2]=c.normal;if(c instanceof THREE.Face4)c.vertexNormals[3]=
+c.normal}b=0;for(d=I.length;b<d;b++){k=I[b];c=k.faces[0];f=k.faces[1];g=k.faceIndices[0];h=k.faceIndices[1];j=k.vertexIndices[0];k=k.vertexIndices[1];if(c.a===j){m="a";t=B[g]+0}else if(c.b===j){m="b";t=B[g]+1}else if(c.c===j){m="c";t=B[g]+2}else if(c.d===j){m="d";t=B[g]+3}if(c.a===k){m+="a";p=B[g]+0}else if(c.b===k){m+="b";p=B[g]+1}else if(c.c===k){m+="c";p=B[g]+2}else if(c.d===k){m+="d";p=B[g]+3}if(f.a===j){o="a";y=B[h]+0}else if(f.b===j){o="b";y=B[h]+1}else if(f.c===j){o="c";y=B[h]+2}else if(f.d===
+j){o="d";y=B[h]+3}if(f.a===k){o+="a";u=B[h]+0}else if(f.b===k){o+="b";u=B[h]+1}else if(f.c===k){o+="c";u=B[h]+2}else if(f.d===k){o+="d";u=B[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(t>p){c=t;t=p;p=c}}else if(t<p){c=t;t=p;p=c}if(o==="ac"||o==="ad"||o==="ca"||o==="da"){if(y>u){c=y;y=u;u=c}}else if(y<u){c=y;y=u;u=c}c=new THREE.Face4(t,p,y,u);c.normal.set(1,0,0);H.push(c)}this.geometry=A}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,o,t,p=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
+for(k=0;k<o;k++){t=b[j[p[k]]];d.push(new THREE.Vertex(t.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,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,d,c){var f,g,h,j,k,m,o,t,p,y,u,A,I,H=0,B=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(A=0;A<f;A++){h=d[B[A]];k=b[h];for(I=0;I<g;I++){j=c[B[I]];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){H++;if(H===1){o=k;t=m;p=h;y=j;u=B[A]}if(H===2){u+=B[A];return u==="ad"||u==="ac"?{faces:[d,c],vertices:[o,t,m,k],indices:[p,
+y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[o,k,m,t],indices:[p,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);
@@ -138,57 +138,57 @@ THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)th
 THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
 THREE.Projector=function(){function b(){var ea=m[k]=m[k]||new THREE.RenderableVertex;k++;return ea}function d(ea,e){return e.z-ea.z}function c(ea,e){var oa=0,Da=1,Aa=ea.z+ea.w,da=e.z+e.w,fa=-ea.z+ea.w,wa=-e.z+e.w;if(Aa>=0&&da>=0&&fa>=0&&wa>=0)return!0;else if(Aa<0&&da<0||fa<0&&wa<0)return!1;else{if(Aa<0)oa=Math.max(oa,Aa/(Aa-da));else da<0&&(Da=Math.min(Da,Aa/(Aa-da)));if(fa<0)oa=Math.max(oa,fa/(fa-wa));else wa<0&&(Da=Math.min(Da,fa/(fa-wa)));if(Da<oa)return!1;else{ea.lerpSelf(e,oa);e.lerpSelf(ea,
-1-Da);return!0}}}var f,g,h=[],j,k,m=[],o,p,t=[],y,u=[],A,F,J=[],B,U,C=[],V=new THREE.Vector4,O=new THREE.Vector4,M=new THREE.Matrix4,va=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,ga=new THREE.Vector4;this.projectVector=function(ea,e){M.multiply(e.projectionMatrix,e.matrixWorldInverse);M.multiplyVector3(ea);return ea};this.unprojectVector=function(ea,e){M.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
-M.multiplyVector3(ea);return ea};this.projectObjects=function(ea,e,oa){e=[];var Da,Aa,da;g=0;Aa=ea.objects;ea=0;for(Da=Aa.length;ea<Da;ea++){da=Aa[ea];var fa;if(!(fa=!da.visible))if(fa=da instanceof THREE.Mesh){a:{fa=void 0;for(var wa=da.matrixWorld,ta=-da.geometry.boundingSphere.radius*Math.max(da.scale.x,Math.max(da.scale.y,da.scale.z)),pa=0;pa<6;pa++){fa=la[pa].x*wa.n14+la[pa].y*wa.n24+la[pa].z*wa.n34+la[pa].w;if(fa<=ta){fa=!1;break a}}fa=!0}fa=!fa}if(!fa){fa=h[g]=h[g]||new THREE.RenderableObject;
-g++;f=fa;V.copy(da.position);M.multiplyVector3(V);f.object=da;f.z=V.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ea,e,oa){var Da=[],Aa=e.near,da=e.far,fa,wa,ta,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta,R,S,P;U=F=y=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ea.update(undefined,!1,e);M.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);la[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);la[2].set(M.n41+M.n21,M.n42+M.n22,
-M.n43+M.n23,M.n44+M.n24);la[3].set(M.n41-M.n21,M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);la[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);la[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for(fa=0;fa<6;fa++){ja=la[fa];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(ea,e,!0);ea=0;for(fa=ja.length;ea<fa;ea++){ha=ja[ea].object;if(ha.visible){Ja=ha.matrixWorld;Xa=ha.matrixRotationWorld;Za=ha.materials;Ta=ha.overdraw;k=0;if(ha instanceof THREE.Mesh){R=ha.geometry;
-pa=R.vertices;S=R.faces;R=R.faceVertexUvs;wa=0;for(ta=pa.length;wa<ta;wa++){j=b();j.positionWorld.copy(pa[wa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);M.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Aa&&j.positionScreen.z<da}pa=0;for(wa=S.length;pa<wa;pa++){ta=S[pa];if(ta instanceof THREE.Face3){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];if(ca.visible&&ka.visible&&ma.visible&&
-(ha.doubleSided||ha.flipSided!=(ma.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(ma.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0)){Fa=t[p]=t[p]||new THREE.RenderableFace3;p++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ta instanceof THREE.Face4){ca=m[ta.a];ka=m[ta.b];ma=m[ta.c];Fa=m[ta.d];if(ca.visible&&ka.visible&&ma.visible&&Fa.visible&&(ha.doubleSided||ha.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
-(ka.positionScreen.y-ca.positionScreen.y)-(Fa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-ma.positionScreen.x)*(Fa.positionScreen.y-ma.positionScreen.y)-(ka.positionScreen.y-ma.positionScreen.y)*(Fa.positionScreen.x-ma.positionScreen.x)<0))){P=u[y]=u[y]||new THREE.RenderableFace4;y++;o=P;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(ta.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(ta.centroid);
-Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);M.multiplyVector3(o.centroidScreen);ma=ta.vertexNormals;ca=0;for(ka=ma.length;ca<ka;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(ma[ca]);Xa.multiplyVector3(Fa)}ca=0;for(ka=R.length;ca<ka;ca++)if(P=R[ca][pa]){ma=0;for(Fa=P.length;ma<Fa;ma++)o.uvs[ca][ma]=P[ma]}o.meshMaterials=Za;o.faceMaterials=ta.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(ha instanceof THREE.Line){va.multiply(M,Ja);pa=ha.geometry.vertices;
-ca=b();ca.positionScreen.copy(pa[0].position);va.multiplyVector4(ca.positionScreen);wa=1;for(ta=pa.length;wa<ta;wa++){ca=b();ca.positionScreen.copy(pa[wa].position);va.multiplyVector4(ca.positionScreen);ka=m[k-2];qa.copy(ca.positionScreen);ga.copy(ka.positionScreen);if(c(qa,ga)){qa.multiplyScalar(1/qa.w);ga.multiplyScalar(1/ga.w);Ja=J[F]=J[F]||new THREE.RenderableLine;F++;A=Ja;A.v1.positionScreen.copy(qa);A.v2.positionScreen.copy(ga);A.z=Math.max(qa.z,ga.z);A.materials=ha.materials;Da.push(A)}}}else if(ha instanceof
-THREE.Particle){O.set(ha.matrixWorld.n14,ha.matrixWorld.n24,ha.matrixWorld.n34,1);M.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){Ja=C[U]=C[U]||new THREE.RenderableParticle;U++;B=Ja;B.x=O.x/O.w;B.y=O.y/O.w;B.z=O.z;B.rotation=ha.rotation.z;B.scale.x=ha.scale.x*Math.abs(B.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));B.scale.y=ha.scale.y*Math.abs(B.y-(O.y+e.projectionMatrix.n22)/(O.w+e.projectionMatrix.n24));B.materials=ha.materials;Da.push(B)}}}}oa&&Da.sort(d);return Da}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,o,p,t,y,u,A,F;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){y=b[m];if(y instanceof THREE.RenderableParticle){A=y.x*g+g;F=y.y*h+h;p=0;for(t=y.material.length;p<t;p++){u=y.material[p];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=F+"px"}}}}}};
-THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)t.globalAlpha=A=Ga}function d(Ga){if(F!=Ga){switch(Ga){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}F=Ga}}function c(Ga){if(J!=Ga)t.strokeStyle=J=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,p,t=j.getContext("2d"),y=new THREE.Color(0),u=0,A=
-1,F=0,J=null,B=null,U=null,C=null,V=null,O,M,va,la,qa=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ea,e,oa,Da,Aa,da,fa,wa,ta,pa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,ha=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,R,S,P,Ba,La,n,D,x=new THREE.Rectangle,v=new THREE.Rectangle,z=new THREE.Rectangle,Q=!1,K=new THREE.Color,G=new THREE.Color,T=new THREE.Color,H=new THREE.Color,I=new THREE.Vector3,L,Z,Y,ra,Ka,Ca,Ha=16;L=document.createElement("canvas");L.width=L.height=
-2;Z=L.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);ra=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,xa){k=Ga;m=xa;o=k/2;p=m/2;j.width=k;j.height=m;x.set(-o,-p,o,p);A=1;F=0;V=C=U=B=J=null};this.setClearColor=function(Ga,xa){y=Ga;u=xa};
-this.setClearColorHex=function(Ga,xa){y.setHex(Ga);u=xa};this.clear=function(){t.setTransform(1,0,0,-1,o,p);if(!v.isEmpty()){v.inflate(1);v.minSelf(x);if(y.hex==0&&u==0)t.clearRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());else{d(THREE.NormalBlending);b(1);t.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";t.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight())}v.empty()}};this.render=function(Ga,xa){function Ea(W){var na,ia,$,ua=W.lights;G.setRGB(0,
-0,0);T.setRGB(0,0,0);H.setRGB(0,0,0);W=0;for(na=ua.length;W<na;W++){ia=ua[W];$=ia.color;if(ia instanceof THREE.AmbientLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}else if(ia instanceof THREE.DirectionalLight){T.r+=$.r;T.g+=$.g;T.b+=$.b}else if(ia instanceof THREE.PointLight){H.r+=$.r;H.g+=$.g;H.b+=$.b}}}function za(W,na,ia,$){var ua,sa,ya,X,Ia=W.lights;W=0;for(ua=Ia.length;W<ua;W++){sa=Ia[W];ya=sa.color;if(sa instanceof THREE.DirectionalLight){X=ia.dot(sa.position);if(!(X<=0)){X*=sa.intensity;$.r+=ya.r*X;$.g+=
-ya.g*X;$.b+=ya.b*X}}else if(sa instanceof THREE.PointLight){X=ia.dot(I.sub(sa.position,na).normalize());if(!(X<=0)){X*=sa.distance==0?1:1-Math.min(na.distanceTo(sa.position)/sa.distance,1);if(X!=0){X*=sa.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(W,na,ia){b(ia.opacity);d(ia.blending);var $,ua,sa,ya,X,Ia;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map){ya=ia.map.image;X=ya.width>>1;Ia=ya.height>>1;ia=na.scale.x*o;sa=na.scale.y*p;$=ia*X;ua=sa*Ia;z.set(W.x-$,W.y-ua,W.x+$,W.y+
-ua);if(x.instersects(z)){t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale(ia,-sa);t.translate(-X,-Ia);t.drawImage(ya,0,0);t.restore()}}}else if(ia instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;ua=na.scale.y*p;z.set(W.x-$,W.y-ua,W.x+$,W.y+ua);if(x.instersects(z)){c(ia.color.__styleString);sa=ia.color.__styleString;if(B!=sa)t.fillStyle=B=sa;t.save();t.translate(W.x,W.y);t.rotate(-na.rotation);t.scale($,ua);ia.program(t);t.restore()}}}function E(W,na,ia,$){b($.opacity);d($.blending);
-t.beginPath();t.moveTo(W.positionScreen.x,W.positionScreen.y);t.lineTo(na.positionScreen.x,na.positionScreen.y);t.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;W=$.linewidth;if(U!=W)t.lineWidth=U=W;W=$.linecap;if(C!=W)t.lineCap=C=W;W=$.linejoin;if(V!=W)t.lineJoin=V=W;c(ma.__styleString);t.stroke();z.inflate($.linewidth*2)}}function aa(W,na,ia,$,ua,sa,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ea=W.positionScreen.x;e=W.positionScreen.y;
-oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;ab(ea,e,oa,Da,Aa,da);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){R=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){W=xa.matrixWorldInverse;I.copy(ya.vertexNormalsWorld[0]);S=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;P=-(I.x*W.n21+I.y*W.n22+
-I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[1]);Ba=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;La=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;I.copy(ya.vertexNormalsWorld[2]);n=(I.x*W.n11+I.y*W.n12+I.z*W.n13)*0.5+0.5;D=-(I.x*W.n21+I.y*W.n22+I.z*W.n23)*0.5+0.5;cb(ea,e,oa,Da,Aa,da,X.envMap.image,S,P,Ba,La,n,D)}}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){if(X.map.mapping instanceof
-THREE.UVMapping){R=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,R[$].u,R[$].v,R[ua].u,R[ua].v,R[sa].u,R[sa].v)}d(THREE.SubtractiveBlending)}if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=ha.r=G.r;Fa.g=ja.g=ha.g=G.g;Fa.b=ja.b=ha.b=G.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],ha);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*
-0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
-xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa(ia.positionScreen.z,Xa,Za);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
-Qa(ma.__styleString)}}function w(W,na,ia,$,ua,sa,ya,X,Ia){f.data.vertices+=4;f.data.faces++;b(X.opacity);d(X.blending);if(X.map||X.envMap){aa(W,na,$,0,1,3,ya,X,Ia);aa(ua,ia,sa,1,2,3,ya,X,Ia)}else{ea=W.positionScreen.x;e=W.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;fa=$.positionScreen.x;wa=$.positionScreen.y;ta=ua.positionScreen.x;pa=ua.positionScreen.y;ca=sa.positionScreen.x;ka=sa.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ea,
-e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshLambertMaterial)if(Q)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ja.r=ha.r=Ja.r=G.r;Fa.g=ja.g=ha.g=Ja.g=G.g;Fa.b=ja.b=ha.b=Ja.b=G.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v4.positionWorld,ya.vertexNormalsWorld[3],
-ha);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}else{K.r=G.r;K.g=G.g;K.b=G.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ea,e,oa,
+1-Da);return!0}}}var f,g,h=[],j,k,m=[],o,t,p=[],y,u=[],A,I,H=[],B,W,D=[],R=new THREE.Vector4,L=new THREE.Vector4,Q=new THREE.Matrix4,qa=new THREE.Matrix4,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ra=new THREE.Vector4,ga=new THREE.Vector4;this.projectVector=function(ea,e){Q.multiply(e.projectionMatrix,e.matrixWorldInverse);Q.multiplyVector3(ea);return ea};this.unprojectVector=function(ea,e){Q.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
+Q.multiplyVector3(ea);return ea};this.projectObjects=function(ea,e,oa){e=[];var Da,Aa,da;g=0;Aa=ea.objects;ea=0;for(Da=Aa.length;ea<Da;ea++){da=Aa[ea];var fa;if(!(fa=!da.visible))if(fa=da instanceof THREE.Mesh){a:{fa=void 0;for(var wa=da.matrixWorld,ua=-da.geometry.boundingSphere.radius*Math.max(da.scale.x,Math.max(da.scale.y,da.scale.z)),pa=0;pa<6;pa++){fa=la[pa].x*wa.n14+la[pa].y*wa.n24+la[pa].z*wa.n34+la[pa].w;if(fa<=ua){fa=!1;break a}}fa=!0}fa=!fa}if(!fa){fa=h[g]=h[g]||new THREE.RenderableObject;
+g++;f=fa;R.copy(da.position);Q.multiplyVector3(R);f.object=da;f.z=R.z;e.push(f)}}oa&&e.sort(d);return e};this.projectScene=function(ea,e,oa){var Da=[],Aa=e.near,da=e.far,fa,wa,ua,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta,S,T,O;W=I=y=t=0;e.matrixAutoUpdate&&e.update(undefined,!0);ea.update(undefined,!1,e);Q.multiply(e.projectionMatrix,e.matrixWorldInverse);la[0].set(Q.n41-Q.n11,Q.n42-Q.n12,Q.n43-Q.n13,Q.n44-Q.n14);la[1].set(Q.n41+Q.n11,Q.n42+Q.n12,Q.n43+Q.n13,Q.n44+Q.n14);la[2].set(Q.n41+Q.n21,Q.n42+Q.n22,
+Q.n43+Q.n23,Q.n44+Q.n24);la[3].set(Q.n41-Q.n21,Q.n42-Q.n22,Q.n43-Q.n23,Q.n44-Q.n24);la[4].set(Q.n41-Q.n31,Q.n42-Q.n32,Q.n43-Q.n33,Q.n44-Q.n34);la[5].set(Q.n41+Q.n31,Q.n42+Q.n32,Q.n43+Q.n33,Q.n44+Q.n34);for(fa=0;fa<6;fa++){ja=la[fa];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(ea,e,!0);ea=0;for(fa=ja.length;ea<fa;ea++){ha=ja[ea].object;if(ha.visible){Ja=ha.matrixWorld;Xa=ha.matrixRotationWorld;Za=ha.materials;Ta=ha.overdraw;k=0;if(ha instanceof THREE.Mesh){S=ha.geometry;
+pa=S.vertices;T=S.faces;S=S.faceVertexUvs;wa=0;for(ua=pa.length;wa<ua;wa++){j=b();j.positionWorld.copy(pa[wa].position);Ja.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);Q.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Aa&&j.positionScreen.z<da}pa=0;for(wa=T.length;pa<wa;pa++){ua=T[pa];if(ua instanceof THREE.Face3){ca=m[ua.a];ka=m[ua.b];ma=m[ua.c];if(ca.visible&&ka.visible&&ma.visible&&
+(ha.doubleSided||ha.flipSided!=(ma.positionScreen.x-ca.positionScreen.x)*(ka.positionScreen.y-ca.positionScreen.y)-(ma.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0)){Fa=p[t]=p[t]||new THREE.RenderableFace3;t++;o=Fa;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma)}else continue}else if(ua instanceof THREE.Face4){ca=m[ua.a];ka=m[ua.b];ma=m[ua.c];Fa=m[ua.d];if(ca.visible&&ka.visible&&ma.visible&&Fa.visible&&(ha.doubleSided||ha.flipSided!=((Fa.positionScreen.x-ca.positionScreen.x)*
+(ka.positionScreen.y-ca.positionScreen.y)-(Fa.positionScreen.y-ca.positionScreen.y)*(ka.positionScreen.x-ca.positionScreen.x)<0||(ka.positionScreen.x-ma.positionScreen.x)*(Fa.positionScreen.y-ma.positionScreen.y)-(ka.positionScreen.y-ma.positionScreen.y)*(Fa.positionScreen.x-ma.positionScreen.x)<0))){O=u[y]=u[y]||new THREE.RenderableFace4;y++;o=O;o.v1.copy(ca);o.v2.copy(ka);o.v3.copy(ma);o.v4.copy(Fa)}else continue}o.normalWorld.copy(ua.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(ua.centroid);
+Ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);Q.multiplyVector3(o.centroidScreen);ma=ua.vertexNormals;ca=0;for(ka=ma.length;ca<ka;ca++){Fa=o.vertexNormalsWorld[ca];Fa.copy(ma[ca]);Xa.multiplyVector3(Fa)}ca=0;for(ka=S.length;ca<ka;ca++)if(O=S[ca][pa]){ma=0;for(Fa=O.length;ma<Fa;ma++)o.uvs[ca][ma]=O[ma]}o.meshMaterials=Za;o.faceMaterials=ua.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Da.push(o)}}else if(ha instanceof THREE.Line){qa.multiply(Q,Ja);pa=ha.geometry.vertices;
+ca=b();ca.positionScreen.copy(pa[0].position);qa.multiplyVector4(ca.positionScreen);wa=1;for(ua=pa.length;wa<ua;wa++){ca=b();ca.positionScreen.copy(pa[wa].position);qa.multiplyVector4(ca.positionScreen);ka=m[k-2];ra.copy(ca.positionScreen);ga.copy(ka.positionScreen);if(c(ra,ga)){ra.multiplyScalar(1/ra.w);ga.multiplyScalar(1/ga.w);Ja=H[I]=H[I]||new THREE.RenderableLine;I++;A=Ja;A.v1.positionScreen.copy(ra);A.v2.positionScreen.copy(ga);A.z=Math.max(ra.z,ga.z);A.materials=ha.materials;Da.push(A)}}}else if(ha instanceof
+THREE.Particle){L.set(ha.matrixWorld.n14,ha.matrixWorld.n24,ha.matrixWorld.n34,1);Q.multiplyVector4(L);L.z/=L.w;if(L.z>0&&L.z<1){Ja=D[W]=D[W]||new THREE.RenderableParticle;W++;B=Ja;B.x=L.x/L.w;B.y=L.y/L.w;B.z=L.z;B.rotation=ha.rotation.z;B.scale.x=ha.scale.x*Math.abs(B.x-(L.x+e.projectionMatrix.n11)/(L.w+e.projectionMatrix.n14));B.scale.y=ha.scale.y*Math.abs(B.y-(L.y+e.projectionMatrix.n22)/(L.w+e.projectionMatrix.n24));B.materials=ha.materials;Da.push(B)}}}}oa&&Da.sort(d);return Da}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,o,t,p,y,u,A,I;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){y=b[m];if(y instanceof THREE.RenderableParticle){A=y.x*g+g;I=y.y*h+h;t=0;for(p=y.material.length;t<p;t++){u=y.material[t];if(u instanceof THREE.ParticleDOMMaterial){u=u.domElement;u.style.left=A+"px";u.style.top=I+"px"}}}}}};
+THREE.CanvasRenderer=function(){function b(Ga){if(A!=Ga)p.globalAlpha=A=Ga}function d(Ga){if(I!=Ga){switch(Ga){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}I=Ga}}function c(Ga){if(H!=Ga)p.strokeStyle=H=Ga}var f=this,g=null,h=new THREE.Projector,j=document.createElement("canvas"),k,m,o,t,p=j.getContext("2d"),y=new THREE.Color(0),u=0,A=
+1,I=0,H=null,B=null,W=null,D=null,R=null,L,Q,qa,la,ra=new THREE.RenderableVertex,ga=new THREE.RenderableVertex,ea,e,oa,Da,Aa,da,fa,wa,ua,pa,ca,ka,ma=new THREE.Color,Fa=new THREE.Color,ja=new THREE.Color,ha=new THREE.Color,Ja=new THREE.Color,Xa,Za,Ta,S,T,O,Ba,La,n,C,x=new THREE.Rectangle,v=new THREE.Rectangle,z=new THREE.Rectangle,P=!1,K=new THREE.Color,F=new THREE.Color,U=new THREE.Color,G=new THREE.Color,J=new THREE.Vector3,M,Z,Y,sa,Ka,Ca,Ha=16;M=document.createElement("canvas");M.width=M.height=
+2;Z=M.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);Y=Z.getImageData(0,0,2,2);sa=Y.data;Ka=document.createElement("canvas");Ka.width=Ka.height=Ha;Ca=Ka.getContext("2d");Ca.translate(-Ha/2,-Ha/2);Ca.scale(Ha,Ha);Ha--;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setSize=function(Ga,xa){k=Ga;m=xa;o=k/2;t=m/2;j.width=k;j.height=m;x.set(-o,-t,o,t);A=1;I=0;R=D=W=B=H=null};this.setClearColor=function(Ga,xa){y=Ga;u=xa};
+this.setClearColorHex=function(Ga,xa){y.setHex(Ga);u=xa};this.clear=function(){p.setTransform(1,0,0,-1,o,t);if(!v.isEmpty()){v.inflate(1);v.minSelf(x);if(y.hex==0&&u==0)p.clearRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());else{d(THREE.NormalBlending);b(1);p.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+u+")";p.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight())}v.empty()}};this.render=function(Ga,xa){function Ea(V){var na,ia,$,va=V.lights;F.setRGB(0,
+0,0);U.setRGB(0,0,0);G.setRGB(0,0,0);V=0;for(na=va.length;V<na;V++){ia=va[V];$=ia.color;if(ia instanceof THREE.AmbientLight){F.r+=$.r;F.g+=$.g;F.b+=$.b}else if(ia instanceof THREE.DirectionalLight){U.r+=$.r;U.g+=$.g;U.b+=$.b}else if(ia instanceof THREE.PointLight){G.r+=$.r;G.g+=$.g;G.b+=$.b}}}function za(V,na,ia,$){var va,ta,ya,X,Ia=V.lights;V=0;for(va=Ia.length;V<va;V++){ta=Ia[V];ya=ta.color;if(ta instanceof THREE.DirectionalLight){X=ia.dot(ta.position);if(!(X<=0)){X*=ta.intensity;$.r+=ya.r*X;$.g+=
+ya.g*X;$.b+=ya.b*X}}else if(ta instanceof THREE.PointLight){X=ia.dot(J.sub(ta.position,na).normalize());if(!(X<=0)){X*=ta.distance==0?1:1-Math.min(na.distanceTo(ta.position)/ta.distance,1);if(X!=0){X*=ta.intensity;$.r+=ya.r*X;$.g+=ya.g*X;$.b+=ya.b*X}}}}}function Ua(V,na,ia){b(ia.opacity);d(ia.blending);var $,va,ta,ya,X,Ia;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map){ya=ia.map.image;X=ya.width>>1;Ia=ya.height>>1;ia=na.scale.x*o;ta=na.scale.y*t;$=ia*X;va=ta*Ia;z.set(V.x-$,V.y-va,V.x+$,V.y+
+va);if(x.instersects(z)){p.save();p.translate(V.x,V.y);p.rotate(-na.rotation);p.scale(ia,-ta);p.translate(-X,-Ia);p.drawImage(ya,0,0);p.restore()}}}else if(ia instanceof THREE.ParticleCanvasMaterial){$=na.scale.x*o;va=na.scale.y*t;z.set(V.x-$,V.y-va,V.x+$,V.y+va);if(x.instersects(z)){c(ia.color.__styleString);ta=ia.color.__styleString;if(B!=ta)p.fillStyle=B=ta;p.save();p.translate(V.x,V.y);p.rotate(-na.rotation);p.scale($,va);ia.program(p);p.restore()}}}function E(V,na,ia,$){b($.opacity);d($.blending);
+p.beginPath();p.moveTo(V.positionScreen.x,V.positionScreen.y);p.lineTo(na.positionScreen.x,na.positionScreen.y);p.closePath();if($ instanceof THREE.LineBasicMaterial){ma.__styleString=$.color.__styleString;V=$.linewidth;if(W!=V)p.lineWidth=W=V;V=$.linecap;if(D!=V)p.lineCap=D=V;V=$.linejoin;if(R!=V)p.lineJoin=R=V;c(ma.__styleString);p.stroke();z.inflate($.linewidth*2)}}function aa(V,na,ia,$,va,ta,ya,X,Ia){f.data.vertices+=3;f.data.faces++;b(X.opacity);d(X.blending);ea=V.positionScreen.x;e=V.positionScreen.y;
+oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;ab(ea,e,oa,Da,Aa,da);if(X instanceof THREE.MeshBasicMaterial)if(X.map){if(X.map.mapping instanceof THREE.UVMapping){S=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,S[$].u,S[$].v,S[va].u,S[va].v,S[ta].u,S[ta].v)}}else if(X.envMap){if(X.envMap.mapping instanceof THREE.SphericalReflectionMapping){V=xa.matrixWorldInverse;J.copy(ya.vertexNormalsWorld[0]);T=(J.x*V.n11+J.y*V.n12+J.z*V.n13)*0.5+0.5;O=-(J.x*V.n21+J.y*V.n22+
+J.z*V.n23)*0.5+0.5;J.copy(ya.vertexNormalsWorld[1]);Ba=(J.x*V.n11+J.y*V.n12+J.z*V.n13)*0.5+0.5;La=-(J.x*V.n21+J.y*V.n22+J.z*V.n23)*0.5+0.5;J.copy(ya.vertexNormalsWorld[2]);n=(J.x*V.n11+J.y*V.n12+J.z*V.n13)*0.5+0.5;C=-(J.x*V.n21+J.y*V.n22+J.z*V.n23)*0.5+0.5;cb(ea,e,oa,Da,Aa,da,X.envMap.image,T,O,Ba,La,n,C)}}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){if(X.map.mapping instanceof
+THREE.UVMapping){S=ya.uvs[0];cb(ea,e,oa,Da,Aa,da,X.map.image,S[$].u,S[$].v,S[va].u,S[va].v,S[ta].u,S[ta].v)}d(THREE.SubtractiveBlending)}if(P)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==3){Fa.r=ja.r=ha.r=F.r;Fa.g=ja.g=ha.g=F.g;Fa.b=ja.b=ha.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],ha);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*
+0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else{K.r=F.r;K.g=F.g;K.b=F.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=
+xa.near;Za=xa.far;Fa.r=Fa.g=Fa.b=1-Wa(V.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa(ia.positionScreen.z,Xa,Za);Ja.r=(ja.r+ha.r)*0.5;Ja.g=(ja.g+ha.g)*0.5;Ja.b=(ja.b+ha.b)*0.5;Ta=hb(Fa,ja,ha,Ja);cb(ea,e,oa,Da,Aa,da,Ta,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):
+Qa(ma.__styleString)}}function w(V,na,ia,$,va,ta,ya,X,Ia){f.data.vertices+=4;f.data.faces++;b(X.opacity);d(X.blending);if(X.map||X.envMap){aa(V,na,$,0,1,3,ya,X,Ia);aa(va,ia,ta,1,2,3,ya,X,Ia)}else{ea=V.positionScreen.x;e=V.positionScreen.y;oa=na.positionScreen.x;Da=na.positionScreen.y;Aa=ia.positionScreen.x;da=ia.positionScreen.y;fa=$.positionScreen.x;wa=$.positionScreen.y;ua=va.positionScreen.x;pa=va.positionScreen.y;ca=ta.positionScreen.x;ka=ta.positionScreen.y;if(X instanceof THREE.MeshBasicMaterial){fb(ea,
+e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshLambertMaterial)if(P)if(!X.wireframe&&X.shading==THREE.SmoothShading&&ya.vertexNormalsWorld.length==4){Fa.r=ja.r=ha.r=Ja.r=F.r;Fa.g=ja.g=ha.g=Ja.g=F.g;Fa.b=ja.b=ha.b=Ja.b=F.b;za(Ia,ya.v1.positionWorld,ya.vertexNormalsWorld[0],Fa);za(Ia,ya.v2.positionWorld,ya.vertexNormalsWorld[1],ja);za(Ia,ya.v4.positionWorld,ya.vertexNormalsWorld[3],
+ha);za(Ia,ya.v3.positionWorld,ya.vertexNormalsWorld[2],Ja);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ua,pa,Aa,da,ca,ka);cb(ua,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}else{K.r=F.r;K.g=F.g;K.b=F.b;za(Ia,ya.centroidWorld,ya.normalWorld,K);ma.r=X.color.r*K.r;ma.g=X.color.g*K.g;ma.b=X.color.b*K.b;ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else{fb(ea,e,oa,
 Da,Aa,da,fa,wa);X.wireframe?Oa(X.color.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(X.color.__styleString)}else if(X instanceof THREE.MeshNormalMaterial){ma.r=$a(ya.normalWorld.x);ma.g=$a(ya.normalWorld.y);ma.b=$a(ya.normalWorld.z);ma.updateStyleString();fb(ea,e,oa,Da,Aa,da,fa,wa);X.wireframe?Oa(ma.__styleString,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):Qa(ma.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){Xa=xa.near;Za=xa.far;Fa.r=
-Fa.g=Fa.b=1-Wa(W.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ia.positionScreen.z,Xa,Za);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ta,pa,Aa,da,ca,ka);cb(ta,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(W,na,ia,$,ua,sa){t.beginPath();t.moveTo(W,na);t.lineTo(ia,$);t.lineTo(ua,sa);t.lineTo(W,na);t.closePath()}function fb(W,na,ia,$,ua,sa,ya,X){t.beginPath();t.moveTo(W,na);t.lineTo(ia,
-$);t.lineTo(ua,sa);t.lineTo(ya,X);t.lineTo(W,na);t.closePath()}function Oa(W,na,ia,$){if(U!=na)t.lineWidth=U=na;if(C!=ia)t.lineCap=C=ia;if(V!=$)t.lineJoin=V=$;c(W);t.stroke();z.inflate(na*2)}function Qa(W){if(B!=W)t.fillStyle=B=W;t.fill()}function cb(W,na,ia,$,ua,sa,ya,X,Ia,Ya,eb,Sa,kb){var gb,db;gb=ya.width-1;db=ya.height-1;X*=gb;Ia*=db;Ya*=gb;eb*=db;Sa*=gb;kb*=db;ia-=W;$-=na;ua-=W;sa-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ia-eb*ua)*db;eb=(kb*$-eb*sa)*db;ia=(Ya*ua-
-Sa*ia)*db;$=(Ya*sa-Sa*$)*db;W=W-gb*X-ia*Ia;na=na-eb*X-$*Ia;t.save();t.transform(gb,eb,ia,$,W,na);t.clip();t.drawImage(ya,0,0);t.restore()}}function hb(W,na,ia,$){var ua=~~(W.r*255),sa=~~(W.g*255);W=~~(W.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ia.r*255),Ya=~~(ia.g*255);ia=~~(ia.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);ra[0]=ua<0?0:ua>255?255:ua;ra[1]=sa<0?0:sa>255?255:sa;ra[2]=W<0?0:W>255?255:W;ra[4]=ya<0?0:ya>255?255:ya;ra[5]=X<0?0:X>255?255:X;ra[6]=na<0?
-0:na>255?255:na;ra[8]=Ia<0?0:Ia>255?255:Ia;ra[9]=Ya<0?0:Ya>255?255:Ya;ra[10]=ia<0?0:ia>255?255:ia;ra[12]=eb<0?0:eb>255?255:eb;ra[13]=Sa<0?0:Sa>255?255:Sa;ra[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(L,0,0);return Ka}function Wa(W,na,ia){W=(W-na)/(ia-na);return W*W*(3-2*W)}function $a(W){W=(W+1)*0.5;return W<0?0:W>1?1:W}function Ma(W,na){var ia=na.x-W.x,$=na.y-W.y,ua=1/Math.sqrt(ia*ia+$*$);ia*=ua;$*=ua;na.x+=ia;na.y+=$;W.x-=ia;W.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
-t.setTransform(1,0,0,-1,o,p);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(Q=Ga.lights.length>0)&&Ea(Ga);bb=0;for(Va=g.length;bb<Va;bb++){N=g[bb];z.empty();if(N instanceof THREE.RenderableParticle){O=N;O.x*=o;O.y*=p;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(O,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){O=N.v1;M=N.v2;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;z.addPoint(O.positionScreen.x,
-O.positionScreen.y);z.addPoint(M.positionScreen.x,M.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&E(O,M,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){O=N.v1;M=N.v2;va=N.v3;O.positionScreen.x*=o;O.positionScreen.y*=p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,va.positionScreen);Ma(va.positionScreen,O.positionScreen)}z.add3Points(O.positionScreen.x,
-O.positionScreen.y,M.positionScreen.x,M.positionScreen.y,va.positionScreen.x,va.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(O,M,va,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){O=N.v1;M=N.v2;va=N.v3;la=N.v4;O.positionScreen.x*=o;O.positionScreen.y*=
-p;M.positionScreen.x*=o;M.positionScreen.y*=p;va.positionScreen.x*=o;va.positionScreen.y*=p;la.positionScreen.x*=o;la.positionScreen.y*=p;qa.positionScreen.copy(M.positionScreen);ga.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(O.positionScreen,M.positionScreen);Ma(M.positionScreen,la.positionScreen);Ma(la.positionScreen,O.positionScreen);Ma(va.positionScreen,qa.positionScreen);Ma(va.positionScreen,ga.positionScreen)}z.addPoint(O.positionScreen.x,O.positionScreen.y);z.addPoint(M.positionScreen.x,
-M.positionScreen.y);z.addPoint(va.positionScreen.x,va.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&w(O,M,va,la,qa,ga,N,Pa,Ga)}else Pa.opacity!=0&&w(O,M,va,la,qa,ga,N,Pa,Ga)}}}v.addRectangle(z)}t.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(fa,wa,ta){var pa,ca,ka,ma;pa=0;for(ca=fa.lights.length;pa<ca;pa++){ka=fa.lights[pa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){ga.sub(ka.position,wa.centroidWorld);ga.normalize();ma=wa.normalWorld.dot(ga)*ka.intensity;if(ma>0){ta.r+=ka.color.r*ma;ta.g+=ka.color.g*ma;ta.b+=ka.color.b*ma}}}}function d(fa,wa,
-ta,pa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)V.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(C){O.r=M.r;O.g=M.g;O.b=M.b;b(ka,pa,O);V.r=ca.color.r*O.r;V.g=ca.color.g*O.g;V.b=ca.color.b*O.b;V.updateStyleString()}else V.__styleString=
-ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){qa=1-ca.__2near/(ca.__farPlusNear-pa.z*ca.__farMinusNear);V.setRGB(qa,qa,qa)}else ca instanceof THREE.MeshNormalMaterial&&V.setRGB(g(pa.normalWorld.x),g(pa.normalWorld.y),g(pa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
-"fill: "+V.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(fa,wa,ta,pa,ca,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ta.positionScreen.x+","+ta.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(C){O.r=
-M.r;O.g=M.g;O.b=M.b;b(ma,ca,O);V.r=ka.color.r*O.r;V.g=ka.color.g*O.g;V.b=ka.color.b*O.b;V.updateStyleString()}else V.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){qa=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);V.setRGB(qa,qa,qa)}else ka instanceof THREE.MeshNormalMaterial&&V.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
-"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+V.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(fa){if(ea[fa]==null){ea[fa]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&ea[fa].setAttribute("shape-rendering","crispEdges")}return ea[fa]}function g(fa){return fa<0?Math.min((1+fa)*0.5,0.5):0.5+Math.min(fa*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
-m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,t,y,u,A,F,J,B=new THREE.Rectangle,U=new THREE.Rectangle,C=!1,V=new THREE.Color(16777215),O=new THREE.Color(16777215),M=new THREE.Color(0),va=new THREE.Color(0),la=new THREE.Color(0),qa,ga=new THREE.Vector3,ea=[],e=[],oa,Da,Aa,da=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(fa){switch(fa){case "high":da=1;break;case "low":da=0}};this.setSize=function(fa,
-wa){o=fa;p=wa;t=o/2;y=p/2;m.setAttribute("viewBox",-t+" "+-y+" "+o+" "+p);m.setAttribute("width",o);m.setAttribute("height",p);B.set(-t,-y,t,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(fa,wa){var ta,pa,ca,ka,ma,Fa,ja,ha;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(fa,wa,this.sortElements);Aa=Da=0;if(C=fa.lights.length>0){ja=fa.lights;M.setRGB(0,0,0);va.setRGB(0,0,0);la.setRGB(0,0,0);ta=0;for(pa=ja.length;ta<
-pa;ta++){ca=ja[ta];ka=ca.color;if(ca instanceof THREE.AmbientLight){M.r+=ka.r;M.g+=ka.g;M.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){va.r+=ka.r;va.g+=ka.g;va.b+=ka.b}else if(ca instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}ta=0;for(pa=j.length;ta<pa;ta++){ja=j[ta];U.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=t;u.y*=-y;ca=0;for(ka=ja.materials.length;ca<ka;)ca++}else if(ja instanceof THREE.RenderableLine){u=ja.v1;A=ja.v2;u.positionScreen.x*=t;u.positionScreen.y*=
--y;A.positionScreen.x*=t;A.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.materials.length;ca<ka;)if((ha=ja.materials[ca++])&&ha.opacity!=0){ma=u;Fa=A;var Ja=Aa++;if(e[Ja]==null){e[Ja]=document.createElementNS("http://www.w3.org/2000/svg","line");da==0&&e[Ja].setAttribute("shape-rendering","crispEdges")}oa=e[Ja];oa.setAttribute("x1",ma.positionScreen.x);oa.setAttribute("y1",ma.positionScreen.y);
-oa.setAttribute("x2",Fa.positionScreen.x);oa.setAttribute("y2",Fa.positionScreen.y);if(ha instanceof THREE.LineBasicMaterial){V.__styleString=ha.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+V.__styleString+"; stroke-width: "+ha.linewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.linecap+"; stroke-linejoin: "+ha.linejoin);m.appendChild(oa)}}}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;A=ja.v2;F=ja.v3;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=
-t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&d(u,A,F,ja,ha,fa)}else ha&&ha.opacity!=0&&d(u,A,F,ja,ha,fa)}}}else if(ja instanceof
-THREE.RenderableFace4){u=ja.v1;A=ja.v2;F=ja.v3;J=ja.v4;u.positionScreen.x*=t;u.positionScreen.y*=-y;A.positionScreen.x*=t;A.positionScreen.y*=-y;F.positionScreen.x*=t;F.positionScreen.y*=-y;J.positionScreen.x*=t;J.positionScreen.y*=-y;U.addPoint(u.positionScreen.x,u.positionScreen.y);U.addPoint(A.positionScreen.x,A.positionScreen.y);U.addPoint(F.positionScreen.x,F.positionScreen.y);U.addPoint(J.positionScreen.x,J.positionScreen.y);if(B.instersects(U)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=
-ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&c(u,A,F,J,ja,ha,fa)}else ha&&ha.opacity!=0&&c(u,A,F,J,ja,ha,fa)}}}}}};
+Fa.g=Fa.b=1-Wa(V.positionScreen.z,Xa,Za);ja.r=ja.g=ja.b=1-Wa(na.positionScreen.z,Xa,Za);ha.r=ha.g=ha.b=1-Wa($.positionScreen.z,Xa,Za);Ja.r=Ja.g=Ja.b=1-Wa(ia.positionScreen.z,Xa,Za);Ta=hb(Fa,ja,ha,Ja);ab(ea,e,oa,Da,fa,wa);cb(ea,e,oa,Da,fa,wa,Ta,0,0,1,0,0,1);ab(ua,pa,Aa,da,ca,ka);cb(ua,pa,Aa,da,ca,ka,Ta,1,0,1,1,0,1)}}}function ab(V,na,ia,$,va,ta){p.beginPath();p.moveTo(V,na);p.lineTo(ia,$);p.lineTo(va,ta);p.lineTo(V,na);p.closePath()}function fb(V,na,ia,$,va,ta,ya,X){p.beginPath();p.moveTo(V,na);p.lineTo(ia,
+$);p.lineTo(va,ta);p.lineTo(ya,X);p.lineTo(V,na);p.closePath()}function Oa(V,na,ia,$){if(W!=na)p.lineWidth=W=na;if(D!=ia)p.lineCap=D=ia;if(R!=$)p.lineJoin=R=$;c(V);p.stroke();z.inflate(na*2)}function Qa(V){if(B!=V)p.fillStyle=B=V;p.fill()}function cb(V,na,ia,$,va,ta,ya,X,Ia,Ya,eb,Sa,kb){var gb,db;gb=ya.width-1;db=ya.height-1;X*=gb;Ia*=db;Ya*=gb;eb*=db;Sa*=gb;kb*=db;ia-=V;$-=na;va-=V;ta-=na;Ya-=X;eb-=Ia;Sa-=X;kb-=Ia;gb=Ya*kb-Sa*eb;if(gb!=0){db=1/gb;gb=(kb*ia-eb*va)*db;eb=(kb*$-eb*ta)*db;ia=(Ya*va-
+Sa*ia)*db;$=(Ya*ta-Sa*$)*db;V=V-gb*X-ia*Ia;na=na-eb*X-$*Ia;p.save();p.transform(gb,eb,ia,$,V,na);p.clip();p.drawImage(ya,0,0);p.restore()}}function hb(V,na,ia,$){var va=~~(V.r*255),ta=~~(V.g*255);V=~~(V.b*255);var ya=~~(na.r*255),X=~~(na.g*255);na=~~(na.b*255);var Ia=~~(ia.r*255),Ya=~~(ia.g*255);ia=~~(ia.b*255);var eb=~~($.r*255),Sa=~~($.g*255);$=~~($.b*255);sa[0]=va<0?0:va>255?255:va;sa[1]=ta<0?0:ta>255?255:ta;sa[2]=V<0?0:V>255?255:V;sa[4]=ya<0?0:ya>255?255:ya;sa[5]=X<0?0:X>255?255:X;sa[6]=na<0?
+0:na>255?255:na;sa[8]=Ia<0?0:Ia>255?255:Ia;sa[9]=Ya<0?0:Ya>255?255:Ya;sa[10]=ia<0?0:ia>255?255:ia;sa[12]=eb<0?0:eb>255?255:eb;sa[13]=Sa<0?0:Sa>255?255:Sa;sa[14]=$<0?0:$>255?255:$;Z.putImageData(Y,0,0);Ca.drawImage(M,0,0);return Ka}function Wa(V,na,ia){V=(V-na)/(ia-na);return V*V*(3-2*V)}function $a(V){V=(V+1)*0.5;return V<0?0:V>1?1:V}function Ma(V,na){var ia=na.x-V.x,$=na.y-V.y,va=1/Math.sqrt(ia*ia+$*$);ia*=va;$*=va;na.x+=ia;na.y+=$;V.x-=ia;V.y-=$}var bb,Va,N,Na,Ra,ib,jb,Pa;this.autoClear?this.clear():
+p.setTransform(1,0,0,-1,o,t);f.data.vertices=0;f.data.faces=0;g=h.projectScene(Ga,xa,this.sortElements);(P=Ga.lights.length>0)&&Ea(Ga);bb=0;for(Va=g.length;bb<Va;bb++){N=g[bb];z.empty();if(N instanceof THREE.RenderableParticle){L=N;L.x*=o;L.y*=t;Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&Ua(L,N,Pa,Ga)}}else if(N instanceof THREE.RenderableLine){L=N.v1;Q=N.v2;L.positionScreen.x*=o;L.positionScreen.y*=t;Q.positionScreen.x*=o;Q.positionScreen.y*=t;z.addPoint(L.positionScreen.x,
+L.positionScreen.y);z.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.materials.length;Na<Ra;){Pa=N.materials[Na++];Pa.opacity!=0&&E(L,Q,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace3){L=N.v1;Q=N.v2;qa=N.v3;L.positionScreen.x*=o;L.positionScreen.y*=t;Q.positionScreen.x*=o;Q.positionScreen.y*=t;qa.positionScreen.x*=o;qa.positionScreen.y*=t;if(N.overdraw){Ma(L.positionScreen,Q.positionScreen);Ma(Q.positionScreen,qa.positionScreen);Ma(qa.positionScreen,L.positionScreen)}z.add3Points(L.positionScreen.x,
+L.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y,qa.positionScreen.x,qa.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&aa(L,Q,qa,0,1,2,N,Pa,Ga)}else Pa.opacity!=0&&aa(L,Q,qa,0,1,2,N,Pa,Ga)}}}else if(N instanceof THREE.RenderableFace4){L=N.v1;Q=N.v2;qa=N.v3;la=N.v4;L.positionScreen.x*=o;L.positionScreen.y*=
+t;Q.positionScreen.x*=o;Q.positionScreen.y*=t;qa.positionScreen.x*=o;qa.positionScreen.y*=t;la.positionScreen.x*=o;la.positionScreen.y*=t;ra.positionScreen.copy(Q.positionScreen);ga.positionScreen.copy(la.positionScreen);if(N.overdraw){Ma(L.positionScreen,Q.positionScreen);Ma(Q.positionScreen,la.positionScreen);Ma(la.positionScreen,L.positionScreen);Ma(qa.positionScreen,ra.positionScreen);Ma(qa.positionScreen,ga.positionScreen)}z.addPoint(L.positionScreen.x,L.positionScreen.y);z.addPoint(Q.positionScreen.x,
+Q.positionScreen.y);z.addPoint(qa.positionScreen.x,qa.positionScreen.y);z.addPoint(la.positionScreen.x,la.positionScreen.y);if(x.instersects(z)){Na=0;for(Ra=N.meshMaterials.length;Na<Ra;){Pa=N.meshMaterials[Na++];if(Pa instanceof THREE.MeshFaceMaterial){ib=0;for(jb=N.faceMaterials.length;ib<jb;)(Pa=N.faceMaterials[ib++])&&Pa.opacity!=0&&w(L,Q,qa,la,ra,ga,N,Pa,Ga)}else Pa.opacity!=0&&w(L,Q,qa,la,ra,ga,N,Pa,Ga)}}}v.addRectangle(z)}p.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(fa,wa,ua){var pa,ca,ka,ma;pa=0;for(ca=fa.lights.length;pa<ca;pa++){ka=fa.lights[pa];if(ka instanceof THREE.DirectionalLight){ma=wa.normalWorld.dot(ka.position)*ka.intensity;if(ma>0){ua.r+=ka.color.r*ma;ua.g+=ka.color.g*ma;ua.b+=ka.color.b*ma}}else if(ka instanceof THREE.PointLight){ga.sub(ka.position,wa.centroidWorld);ga.normalize();ma=wa.normalWorld.dot(ga)*ka.intensity;if(ma>0){ua.r+=ka.color.r*ma;ua.g+=ka.color.g*ma;ua.b+=ka.color.b*ma}}}}function d(fa,wa,
+ua,pa,ca,ka){h.data.vertices+=3;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(ca instanceof THREE.MeshBasicMaterial)R.__styleString=ca.color.__styleString;else if(ca instanceof THREE.MeshLambertMaterial)if(D){L.r=Q.r;L.g=Q.g;L.b=Q.b;b(ka,pa,L);R.r=ca.color.r*L.r;R.g=ca.color.g*L.g;R.b=ca.color.b*L.b;R.updateStyleString()}else R.__styleString=
+ca.color.__styleString;else if(ca instanceof THREE.MeshDepthMaterial){ra=1-ca.__2near/(ca.__farPlusNear-pa.z*ca.__farMinusNear);R.setRGB(ra,ra,ra)}else ca instanceof THREE.MeshNormalMaterial&&R.setRGB(g(pa.normalWorld.x),g(pa.normalWorld.y),g(pa.normalWorld.z));ca.wireframe?oa.setAttribute("style","fill: none; stroke: "+R.__styleString+"; stroke-width: "+ca.wireframeLinewidth+"; stroke-opacity: "+ca.opacity+"; stroke-linecap: "+ca.wireframeLinecap+"; stroke-linejoin: "+ca.wireframeLinejoin):oa.setAttribute("style",
+"fill: "+R.__styleString+"; fill-opacity: "+ca.opacity);m.appendChild(oa)}function c(fa,wa,ua,pa,ca,ka,ma){h.data.vertices+=4;h.data.faces++;oa=f(Da++);oa.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+wa.positionScreen.x+" "+wa.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ka instanceof THREE.MeshBasicMaterial)R.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshLambertMaterial)if(D){L.r=
+Q.r;L.g=Q.g;L.b=Q.b;b(ma,ca,L);R.r=ka.color.r*L.r;R.g=ka.color.g*L.g;R.b=ka.color.b*L.b;R.updateStyleString()}else R.__styleString=ka.color.__styleString;else if(ka instanceof THREE.MeshDepthMaterial){ra=1-ka.__2near/(ka.__farPlusNear-ca.z*ka.__farMinusNear);R.setRGB(ra,ra,ra)}else ka instanceof THREE.MeshNormalMaterial&&R.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));ka.wireframe?oa.setAttribute("style","fill: none; stroke: "+R.__styleString+"; stroke-width: "+ka.wireframeLinewidth+
+"; stroke-opacity: "+ka.opacity+"; stroke-linecap: "+ka.wireframeLinecap+"; stroke-linejoin: "+ka.wireframeLinejoin):oa.setAttribute("style","fill: "+R.__styleString+"; fill-opacity: "+ka.opacity);m.appendChild(oa)}function f(fa){if(ea[fa]==null){ea[fa]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&ea[fa].setAttribute("shape-rendering","crispEdges")}return ea[fa]}function g(fa){return fa<0?Math.min((1+fa)*0.5,0.5):0.5+Math.min(fa*0.5,0.5)}var h=this,j=null,k=new THREE.Projector,
+m=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,p,y,u,A,I,H,B=new THREE.Rectangle,W=new THREE.Rectangle,D=!1,R=new THREE.Color(16777215),L=new THREE.Color(16777215),Q=new THREE.Color(0),qa=new THREE.Color(0),la=new THREE.Color(0),ra,ga=new THREE.Vector3,ea=[],e=[],oa,Da,Aa,da=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(fa){switch(fa){case "high":da=1;break;case "low":da=0}};this.setSize=function(fa,
+wa){o=fa;t=wa;p=o/2;y=t/2;m.setAttribute("viewBox",-p+" "+-y+" "+o+" "+t);m.setAttribute("width",o);m.setAttribute("height",t);B.set(-p,-y,p,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(fa,wa){var ua,pa,ca,ka,ma,Fa,ja,ha;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;j=k.projectScene(fa,wa,this.sortElements);Aa=Da=0;if(D=fa.lights.length>0){ja=fa.lights;Q.setRGB(0,0,0);qa.setRGB(0,0,0);la.setRGB(0,0,0);ua=0;for(pa=ja.length;ua<
+pa;ua++){ca=ja[ua];ka=ca.color;if(ca instanceof THREE.AmbientLight){Q.r+=ka.r;Q.g+=ka.g;Q.b+=ka.b}else if(ca instanceof THREE.DirectionalLight){qa.r+=ka.r;qa.g+=ka.g;qa.b+=ka.b}else if(ca instanceof THREE.PointLight){la.r+=ka.r;la.g+=ka.g;la.b+=ka.b}}}ua=0;for(pa=j.length;ua<pa;ua++){ja=j[ua];W.empty();if(ja instanceof THREE.RenderableParticle){u=ja;u.x*=p;u.y*=-y;ca=0;for(ka=ja.materials.length;ca<ka;)ca++}else if(ja instanceof THREE.RenderableLine){u=ja.v1;A=ja.v2;u.positionScreen.x*=p;u.positionScreen.y*=
+-y;A.positionScreen.x*=p;A.positionScreen.y*=-y;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);if(B.instersects(W)){ca=0;for(ka=ja.materials.length;ca<ka;)if((ha=ja.materials[ca++])&&ha.opacity!=0){ma=u;Fa=A;var Ja=Aa++;if(e[Ja]==null){e[Ja]=document.createElementNS("http://www.w3.org/2000/svg","line");da==0&&e[Ja].setAttribute("shape-rendering","crispEdges")}oa=e[Ja];oa.setAttribute("x1",ma.positionScreen.x);oa.setAttribute("y1",ma.positionScreen.y);
+oa.setAttribute("x2",Fa.positionScreen.x);oa.setAttribute("y2",Fa.positionScreen.y);if(ha instanceof THREE.LineBasicMaterial){R.__styleString=ha.color.__styleString;oa.setAttribute("style","fill: none; stroke: "+R.__styleString+"; stroke-width: "+ha.linewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.linecap+"; stroke-linejoin: "+ha.linejoin);m.appendChild(oa)}}}}else if(ja instanceof THREE.RenderableFace3){u=ja.v1;A=ja.v2;I=ja.v3;u.positionScreen.x*=p;u.positionScreen.y*=-y;A.positionScreen.x*=
+p;A.positionScreen.y*=-y;I.positionScreen.x*=p;I.positionScreen.y*=-y;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);W.addPoint(I.positionScreen.x,I.positionScreen.y);if(B.instersects(W)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&d(u,A,I,ja,ha,fa)}else ha&&ha.opacity!=0&&d(u,A,I,ja,ha,fa)}}}else if(ja instanceof
+THREE.RenderableFace4){u=ja.v1;A=ja.v2;I=ja.v3;H=ja.v4;u.positionScreen.x*=p;u.positionScreen.y*=-y;A.positionScreen.x*=p;A.positionScreen.y*=-y;I.positionScreen.x*=p;I.positionScreen.y*=-y;H.positionScreen.x*=p;H.positionScreen.y*=-y;W.addPoint(u.positionScreen.x,u.positionScreen.y);W.addPoint(A.positionScreen.x,A.positionScreen.y);W.addPoint(I.positionScreen.x,I.positionScreen.y);W.addPoint(H.positionScreen.x,H.positionScreen.y);if(B.instersects(W)){ca=0;for(ka=ja.meshMaterials.length;ca<ka;){ha=
+ja.meshMaterials[ca++];if(ha instanceof THREE.MeshFaceMaterial){ma=0;for(Fa=ja.faceMaterials.length;ma<Fa;)(ha=ja.faceMaterials[ma++])&&ha.opacity!=0&&c(u,A,I,H,ja,ha,fa)}else ha&&ha.opacity!=0&&c(u,A,I,H,ja,ha,fa)}}}}}};
 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",
@@ -219,120 +219,120 @@ THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.Shade
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function d(n,D,x){var v,z,Q,K=n.vertices,G=K.length,T=n.colors,H=T.length,I=n.__vertexArray,L=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,ra=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(v=0;v<G;v++){z=K[v].position;Ta.copy(z);Ja.multiplyVector3(Ta);Z[v]=[Ta.z,v]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(v=0;v<G;v++){z=K[Z[v][1]].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}for(v=0;v<H;v++){Q=v*3;color=T[Z[v][1]];L[Q]=color.r;
-L[Q+1]=color.g;L[Q+2]=color.b}}else{if(Y)for(v=0;v<G;v++){z=K[v].position;Q=v*3;I[Q]=z.x;I[Q+1]=z.y;I[Q+2]=z.z}if(ra)for(v=0;v<H;v++){color=T[v];Q=v*3;L[Q]=color.r;L[Q+1]=color.g;L[Q+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,D)}if(ra||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,L,D)}}function c(n,D,x,v,z){v.program||ea.initMaterial(v,D,x,z);var Q=v.program,K=Q.uniforms,G=v.uniforms;
-if(Q!=Aa){e.useProgram(Q);Aa=Q}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(x&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial||v.fog)){G.fogColor.value=x.color;if(x instanceof THREE.Fog){G.fogNear.value=x.near;G.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)G.fogDensity.value=x.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
-v.lights){var T,H,I=0,L=0,Z=0,Y,ra,Ka,Ca,Ha=R,Ga=Ha.directional.colors,xa=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,E=0,aa=0;x=H=Ca=0;for(T=D.length;x<T;x++){H=D[x];Y=H.color;ra=H.position;Ka=H.intensity;Ca=H.distance;if(H instanceof THREE.AmbientLight){I+=Y.r;L+=Y.g;Z+=Y.b}else if(H instanceof THREE.DirectionalLight){Ca=E*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;xa[Ca]=ra.x;xa[Ca+1]=ra.y;xa[Ca+2]=ra.z;E+=1}else if(H instanceof THREE.PointLight){H=
-aa*3;Ea[H]=Y.r*Ka;Ea[H+1]=Y.g*Ka;Ea[H+2]=Y.b*Ka;za[H]=ra.x;za[H+1]=ra.y;za[H+2]=ra.z;Ua[aa]=Ca;aa+=1}}for(x=E*3;x<Ga.length;x++)Ga[x]=0;for(x=aa*3;x<Ea.length;x++)Ea[x]=0;Ha.point.length=aa;Ha.directional.length=E;Ha.ambient[0]=I;Ha.ambient[1]=L;Ha.ambient[2]=Z;x=R;G.enableLighting.value=x.directional.length+x.point.length;G.ambientLightColor.value=x.ambient;G.directionalLightColor.value=x.directional.colors;G.directionalLightDirection.value=x.directional.positions;G.pointLightColor.value=x.point.colors;
-G.pointLightPosition.value=x.point.positions;G.pointLightDistance.value=x.point.distances}if(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial){G.diffuse.value=v.color;G.opacity.value=v.opacity;G.map.texture=v.map;G.lightMap.texture=v.lightMap;G.envMap.texture=v.envMap;G.reflectivity.value=v.reflectivity;G.refractionRatio.value=v.refractionRatio;G.combine.value=v.combine;G.useRefract.value=v.envMap&&v.envMap.mapping instanceof THREE.CubeRefractionMapping}if(v instanceof
-THREE.LineBasicMaterial){G.diffuse.value=v.color;G.opacity.value=v.opacity}else if(v instanceof THREE.ParticleBasicMaterial){G.psColor.value=v.color;G.opacity.value=v.opacity;G.size.value=v.size;G.scale.value=oa.height/2;G.map.texture=v.map}else if(v instanceof THREE.MeshPhongMaterial){G.ambient.value=v.ambient;G.specular.value=v.specular;G.shininess.value=v.shininess}else if(v instanceof THREE.MeshDepthMaterial){G.mNear.value=n.near;G.mFar.value=n.far;G.opacity.value=v.opacity}else if(v instanceof
-THREE.MeshNormalMaterial)G.opacity.value=v.opacity;for(var w in G)if(L=Q.uniforms[w]){T=G[w];I=T.type;x=T.value;if(I=="i")e.uniform1i(L,x);else if(I=="f")e.uniform1f(L,x);else if(I=="fv1")e.uniform1fv(L,x);else if(I=="fv")e.uniform3fv(L,x);else if(I=="v2")e.uniform2f(L,x.x,x.y);else if(I=="v3")e.uniform3f(L,x.x,x.y,x.z);else if(I=="v4")e.uniform4f(L,x.x,x.y,x.z,x.w);else if(I=="c")e.uniform3f(L,x.r,x.g,x.b);else if(I=="t"){e.uniform1i(L,x);if(T=T.texture)if(T.image instanceof Array&&T.image.length==
-6){if(T.image.length==6){if(T.needsUpdate){if(T.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,e.RGBA,e.UNSIGNED_BYTE,T.image[I])}else{T.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube);for(I=0;I<6;++I)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,T.image[I]);T.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,T,T.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
-null);T.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,T.image.__webglTextureCube)}}else M(T,x)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,z._normalMatrixArray);(v instanceof THREE.MeshShaderMaterial||v instanceof THREE.MeshPhongMaterial||v.envMap)&&K.cameraPosition!==null&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(v instanceof THREE.MeshShaderMaterial||v.envMap||v.skinning)&&K.objectMatrix!==
-null&&e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshShaderMaterial||v.skinning)&&K.viewMatrix!==null&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(v instanceof THREE.ShadowVolumeDynamicMaterial){n=G.directionalLightDirection.value;n[0]=-D[1].position.x;n[1]=-D[1].position.y;n[2]=-D[1].position.z;e.uniform3fv(K.directionalLightDirection,n);e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);
-e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(v.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,z.boneMatrices)}return Q}function f(n,D,x,v,z,Q){if(v.opacity!=0){var K;n=c(n,D,x,v,Q).attributes;if(!v.morphTargets&&n.position>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}else{D=v.program.attributes;if(Q.morphTargetBase!==-1){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[Q.morphTargetBase]);
-e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0)}else if(D.position>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0)}if(Q.morphTargetForcedOrder.length){x=0;for(var G=Q.morphTargetForcedOrder,T=Q.morphTargetInfluences;x<v.numSupportedMorphTargets&&x<G.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[G[x]]);e.vertexAttribPointer(D["morphTarget"+x],3,e.FLOAT,!1,0,0);Q.__webglMorphTargetInfluences[x]=T[G[x]];x++}}else{G=[];var H=
--1,I=0;T=Q.morphTargetInfluences;var L,Z=T.length;x=0;for(Q.morphTargetBase!==-1&&(G[Q.morphTargetBase]=!0);x<v.numSupportedMorphTargets;){for(L=0;L<Z;L++)if(!G[L]&&T[L]>H){I=L;H=T[I]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[I]);e.vertexAttribPointer(D["morphTarget"+x],3,e.FLOAT,!1,0,0);Q.__webglMorphTargetInfluences[x]=H;G[I]=1;H=-1;x++}}v.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(v.program.uniforms.morphTargetInfluences,Q.__webglMorphTargetInfluences)}if(v.attributes)for(K in v.attributes)if(n[K]>=
-0){D=v.attributes[K];e.bindBuffer(e.ARRAY_BUFFER,D.buffer);e.vertexAttribPointer(n[K],D.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,
+THREE.WebGLRenderer=function(b){function d(n,C,x){var v,z,P,K=n.vertices,F=K.length,U=n.colors,G=U.length,J=n.__vertexArray,M=n.__colorArray,Z=n.__sortArray,Y=n.__dirtyVertices,sa=n.__dirtyColors;if(x.sortParticles){Ja.multiplySelf(x.matrixWorld);for(v=0;v<F;v++){z=K[v].position;Ta.copy(z);Ja.multiplyVector3(Ta);Z[v]=[Ta.z,v]}Z.sort(function(Ka,Ca){return Ca[0]-Ka[0]});for(v=0;v<F;v++){z=K[Z[v][1]].position;P=v*3;J[P]=z.x;J[P+1]=z.y;J[P+2]=z.z}for(v=0;v<G;v++){P=v*3;color=U[Z[v][1]];M[P]=color.r;
+M[P+1]=color.g;M[P+2]=color.b}}else{if(Y)for(v=0;v<F;v++){z=K[v].position;P=v*3;J[P]=z.x;J[P+1]=z.y;J[P+2]=z.z}if(sa)for(v=0;v<G;v++){color=U[v];P=v*3;M[P]=color.r;M[P+1]=color.g;M[P+2]=color.b}}if(Y||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,J,C)}if(sa||x.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,M,C)}}function c(n,C,x,v,z){v.program||ea.initMaterial(v,C,x,z);var P=v.program,K=P.uniforms,F=v.uniforms;
+if(P!=Aa){e.useProgram(P);Aa=P}e.uniformMatrix4fv(K.projectionMatrix,!1,Xa);if(x&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial||v.fog)){F.fogColor.value=x.color;if(x instanceof THREE.Fog){F.fogNear.value=x.near;F.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)F.fogDensity.value=x.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
+v.lights){var U,G,J=0,M=0,Z=0,Y,sa,Ka,Ca,Ha=S,Ga=Ha.directional.colors,xa=Ha.directional.positions,Ea=Ha.point.colors,za=Ha.point.positions,Ua=Ha.point.distances,E=0,aa=0;x=G=Ca=0;for(U=C.length;x<U;x++){G=C[x];Y=G.color;sa=G.position;Ka=G.intensity;Ca=G.distance;if(G instanceof THREE.AmbientLight){J+=Y.r;M+=Y.g;Z+=Y.b}else if(G instanceof THREE.DirectionalLight){Ca=E*3;Ga[Ca]=Y.r*Ka;Ga[Ca+1]=Y.g*Ka;Ga[Ca+2]=Y.b*Ka;xa[Ca]=sa.x;xa[Ca+1]=sa.y;xa[Ca+2]=sa.z;E+=1}else if(G instanceof THREE.PointLight){G=
+aa*3;Ea[G]=Y.r*Ka;Ea[G+1]=Y.g*Ka;Ea[G+2]=Y.b*Ka;za[G]=sa.x;za[G+1]=sa.y;za[G+2]=sa.z;Ua[aa]=Ca;aa+=1}}for(x=E*3;x<Ga.length;x++)Ga[x]=0;for(x=aa*3;x<Ea.length;x++)Ea[x]=0;Ha.point.length=aa;Ha.directional.length=E;Ha.ambient[0]=J;Ha.ambient[1]=M;Ha.ambient[2]=Z;x=S;F.enableLighting.value=x.directional.length+x.point.length;F.ambientLightColor.value=x.ambient;F.directionalLightColor.value=x.directional.colors;F.directionalLightDirection.value=x.directional.positions;F.pointLightColor.value=x.point.colors;
+F.pointLightPosition.value=x.point.positions;F.pointLightDistance.value=x.point.distances}if(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial){F.diffuse.value=v.color;F.opacity.value=v.opacity;F.map.texture=v.map;F.lightMap.texture=v.lightMap;F.envMap.texture=v.envMap;F.reflectivity.value=v.reflectivity;F.refractionRatio.value=v.refractionRatio;F.combine.value=v.combine;F.useRefract.value=v.envMap&&v.envMap.mapping instanceof THREE.CubeRefractionMapping}if(v instanceof
+THREE.LineBasicMaterial){F.diffuse.value=v.color;F.opacity.value=v.opacity}else if(v instanceof THREE.ParticleBasicMaterial){F.psColor.value=v.color;F.opacity.value=v.opacity;F.size.value=v.size;F.scale.value=oa.height/2;F.map.texture=v.map}else if(v instanceof THREE.MeshPhongMaterial){F.ambient.value=v.ambient;F.specular.value=v.specular;F.shininess.value=v.shininess}else if(v instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=v.opacity}else if(v instanceof
+THREE.MeshNormalMaterial)F.opacity.value=v.opacity;for(var w in F)if(M=P.uniforms[w]){U=F[w];J=U.type;x=U.value;if(J=="i")e.uniform1i(M,x);else if(J=="f")e.uniform1f(M,x);else if(J=="fv1")e.uniform1fv(M,x);else if(J=="fv")e.uniform3fv(M,x);else if(J=="v2")e.uniform2f(M,x.x,x.y);else if(J=="v3")e.uniform3f(M,x.x,x.y,x.z);else if(J=="v4")e.uniform4f(M,x.x,x.y,x.z,x.w);else if(J=="c")e.uniform3f(M,x.r,x.g,x.b);else if(J=="t"){e.uniform1i(M,x);if(U=U.texture)if(U.image instanceof Array&&U.image.length==
+6){if(U.image.length==6){if(U.needsUpdate){if(U.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,U.image.__webglTextureCube);for(J=0;J<6;++J)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,0,0,e.RGBA,e.UNSIGNED_BYTE,U.image[J])}else{U.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,U.image.__webglTextureCube);for(J=0;J<6;++J)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,U.image[J]);U.__webglInit=!0}L(e.TEXTURE_CUBE_MAP,U,U.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
+null);U.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,U.image.__webglTextureCube)}}else Q(U,x)}}e.uniformMatrix4fv(K.modelViewMatrix,!1,z._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,!1,z._normalMatrixArray);(v instanceof THREE.MeshShaderMaterial||v instanceof THREE.MeshPhongMaterial||v.envMap)&&K.cameraPosition!==null&&e.uniform3f(K.cameraPosition,n.position.x,n.position.y,n.position.z);(v instanceof THREE.MeshShaderMaterial||v.envMap||v.skinning)&&K.objectMatrix!==
+null&&e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshShaderMaterial||v.skinning)&&K.viewMatrix!==null&&e.uniformMatrix4fv(K.viewMatrix,!1,Za);if(v instanceof THREE.ShadowVolumeDynamicMaterial){n=F.directionalLightDirection.value;n[0]=-C[1].position.x;n[1]=-C[1].position.y;n[2]=-C[1].position.z;e.uniform3fv(K.directionalLightDirection,n);e.uniformMatrix4fv(K.objectMatrix,!1,z._objectMatrixArray);
+e.uniformMatrix4fv(K.viewMatrix,!1,Za)}if(v.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,!1,Za);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,z.boneMatrices)}return P}function f(n,C,x,v,z,P){if(v.opacity!=0){var K;n=c(n,C,x,v,P).attributes;if(!v.morphTargets&&n.position>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}else{C=v.program.attributes;if(P.morphTargetBase!==-1){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[P.morphTargetBase]);
+e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0)}else if(C.position>=0){e.bindBuffer(e.ARRAY_BUFFER,z.__webglVertexBuffer);e.vertexAttribPointer(C.position,3,e.FLOAT,!1,0,0)}if(P.morphTargetForcedOrder.length){x=0;for(var F=P.morphTargetForcedOrder,U=P.morphTargetInfluences;x<v.numSupportedMorphTargets&&x<F.length;){e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[F[x]]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[x]=U[F[x]];x++}}else{F=[];var G=
+-1,J=0;U=P.morphTargetInfluences;var M,Z=U.length;x=0;for(P.morphTargetBase!==-1&&(F[P.morphTargetBase]=!0);x<v.numSupportedMorphTargets;){for(M=0;M<Z;M++)if(!F[M]&&U[M]>G){J=M;G=U[J]}e.bindBuffer(e.ARRAY_BUFFER,z.__webglMorphTargetsBuffers[J]);e.vertexAttribPointer(C["morphTarget"+x],3,e.FLOAT,!1,0,0);P.__webglMorphTargetInfluences[x]=G;F[J]=1;G=-1;x++}}v.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(v.program.uniforms.morphTargetInfluences,P.__webglMorphTargetInfluences)}if(v.attributes)for(K in v.attributes)if(n[K]>=
+0){C=v.attributes[K];e.bindBuffer(e.ARRAY_BUFFER,C.buffer);e.vertexAttribPointer(n[K],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(v.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(Q instanceof THREE.Mesh){if(v.wireframe){e.lineWidth(v.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)}ea.data.vertices+=z.__webglFaceCount;ea.data.faces+=z.__webglFaceCount/3;ea.data.drawCalls++}else if(Q instanceof THREE.Line){Q=Q.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(Q,0,z.__webglLineCount);ea.data.drawCalls++}else if(Q instanceof THREE.ParticleSystem){e.drawArrays(e.POINTS,0,z.__webglParticleCount);
-ea.data.drawCalls++}else if(Q instanceof THREE.Ribbon){e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount);ea.data.drawCalls++}}}function g(n,D,x){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(D.attributes.position);e.vertexAttribPointer(D.attributes.position,3,e.FLOAT,
-!1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(x==THREE.FlatShading){var v,z,Q,K,G,T,H,I,L,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;v=x[Z];z=x[Z+1];Q=x[Z+2];K=x[Z+3];T=x[Z+4];I=x[Z+5];G=x[Z+6];H=x[Z+7];L=x[Z+8];v=(v+K+G)/3;z=(z+T+H)/3;Q=(Q+I+L)/3;x[Z]=v;x[Z+1]=z;x[Z+2]=Q;x[Z+3]=v;x[Z+4]=z;x[Z+5]=Q;x[Z+6]=v;x[Z+7]=z;x[Z+8]=Q}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.normal);e.vertexAttribPointer(D.attributes.normal,
-3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ta!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ta=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ca=n}}function k(n){ha[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ha[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ha[2].set(n.n41+n.n21,n.n42+n.n22,
-n.n43+n.n23,n.n44+n.n24);ha[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ha[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ha[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var D;for(n=0;n<6;n++){D=ha[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=n.matrixWorld,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++){n=ha[v].x*D.n14+ha[v].y*D.n24+ha[v].z*D.n34+ha[v].w;if(n<=x)return!1}return!0}function o(n,
-D){n.list[n.count]=D;n.count+=1}function p(n){var D,x,v=n.object,z=n.opaque,Q=n.transparent;Q.count=0;n=z.count=0;for(D=v.materials.length;n<D;n++){x=v.materials[n];x.transparent?o(Q,x):o(z,x)}}function t(n){var D,x,v,z,Q=n.object,K=n.buffer,G=n.opaque,T=n.transparent;T.count=0;n=G.count=0;for(v=Q.materials.length;n<v;n++){D=Q.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(x=K.materials.length;D<x;D++)(z=K.materials[D])&&(z.transparent?o(T,z):o(G,z))}else(z=D)&&(z.transparent?o(T,z):
-o(G,z))}}function y(n,D){return D.z-n.z}function u(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 D,x=n.lights.length,v,z=n.lights,Q=[],K,G,T,H,I,L=n.__webglShadowVolumes.length;for(D=0;D<x;D++){v=n.lights[D];if(v instanceof THREE.DirectionalLight&&v.castShadow){Q[0]=
--v.position.x;Q[1]=-v.position.y;Q[2]=-v.position.z;for(I=0;I<L;I++){v=n.__webglShadowVolumes[I].object;K=n.__webglShadowVolumes[I].buffer;G=v.materials[0];G.program||ea.initMaterial(G,z,undefined,v);G=G.program;T=G.uniforms;H=G.attributes;if(Aa!==G){e.useProgram(G);Aa=G;e.uniformMatrix4fv(T.projectionMatrix,!1,Xa);e.uniformMatrix4fv(T.viewMatrix,!1,Za);e.uniform3fv(T.directionalLightDirection,Q)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(T.objectMatrix,!1,v._objectMatrixArray);
-e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(H.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(H.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__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);pa="";Aa=S.program;e.useProgram(S.program);e.uniformMatrix4fv(S.projectionLocation,!1,Xa);e.uniform1f(S.darknessLocation,S.darkness);e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.vertexAttribPointer(S.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(S.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,S.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,
-0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function A(n,D){var x,v,z;x=_sprite.attributes;var Q=_sprite.uniforms,K=ja/Fa,G,T=[],H=Fa*0.5,I=ja*0.5,L=!0;e.useProgram(_sprite.program);Aa=_sprite.program;pa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}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(Q.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(Q.map,0);x=0;for(v=n.__webglSprites.length;x<v;x++){z=n.__webglSprites[x];if(z.useScreenCoordinates)z.z=-z.position.z;else{z._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray);z.z=-z._modelViewMatrix.n34}}n.__webglSprites.sort(y);x=0;for(v=n.__webglSprites.length;x<
-v;x++){z=n.__webglSprites[x];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(Q.useScreenCoordinates,1);e.uniform3f(Q.screenPosition,(z.position.x-H)/H,(I-z.position.y)/I,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(Q.useScreenCoordinates,0);e.uniform1i(Q.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(Q.modelViewMatrix,!1,z._modelViewMatrixArray)}G=z.map.image.width/(z.affectedByDistance?1:ja);T[0]=G*K*z.scale.x;T[1]=
-G*z.scale.y;e.uniform2f(Q.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(Q.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(Q.alignment,z.alignment.x,z.alignment.y);e.uniform1f(Q.opacity,z.opacity);e.uniform1f(Q.rotation,z.rotation);e.uniform2fv(Q.scale,T);if(z.mergeWith3D&&!L){e.enable(e.DEPTH_TEST);L=!0}else if(!z.mergeWith3D&&L){e.disable(e.DEPTH_TEST);L=!1}V(z.blending);M(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function F(n,
-D){var x,v,z=n.__webglLensFlares.length,Q,K,G,T=new THREE.Vector3,H=ja/Fa,I=Fa*0.5,L=ja*0.5,Z=16/ja,Y=[Z*H,Z],ra=[1,1,0],Ka=[1,1],Ca=P.uniforms;x=P.attributes;e.useProgram(P.program);Aa=P.program;pa="";if(!Ba){e.enableVertexAttribArray(P.attributes.vertex);e.enableVertexAttribArray(P.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,P.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,
-P.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,P.occlusionTexture);e.activeTexture(e.TEXTURE1);for(v=0;v<z;v++){x=n.__webglLensFlares[v].object;T.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);D.matrixWorldInverse.multiplyVector3(T);D.projectionMatrix.multiplyVector3(T);ra[0]=T.x;ra[1]=T.y;ra[2]=T.z;Ka[0]=ra[0]*I+I;Ka[1]=ra[1]*L+L;if(P.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,P.tempTexture);
-e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.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,P.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,P.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=
-ra[0];x.positionScreen.y=ra[1];x.positionScreen.z=ra[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);Q=0;for(K=x.lensFlares.length;Q<K;Q++){G=x.lensFlares[Q];if(G.opacity>0.0010&&G.scale>0.0010){ra[0]=G.x;ra[1]=G.y;ra[2]=G.z;Z=G.size*G.scale/ja;Y[0]=Z*H;Y[1]=Z;e.uniform3fv(Ca.screenPosition,ra);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,G.rotation);e.uniform1f(Ca.opacity,G.opacity);V(G.blending);M(G.texture,1);e.drawElements(e.TRIANGLES,
-6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function J(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var D,x,v,z,Q;if(n instanceof THREE.Mesh){x=n.geometry;for(D in x.geometryGroups){v=x.geometryGroups[D];Q=!1;for(z in v.__webglCustomAttributes)if(v.__webglCustomAttributes[z].needsUpdate){Q=!0;break}if(x.__dirtyVertices||
-x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||Q){Q=e.DYNAMIC_DRAW;var K=void 0,G=void 0,T=void 0,H=void 0;T=void 0;var I=void 0,L=void 0,Z=void 0,Y=void 0,ra=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,za=void 0,Ua=void 0;L=void 0;Z=void 0;H=void 0;Y=void 0;H=void 0;var E=void 0,aa=void 0;L=void 0;E=void 0;aa=void 0;var w=void 0,ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;
-E=void 0;aa=void 0;w=void 0;H=void 0;Y=void 0;I=void 0;T=void 0;T=void 0;E=void 0;aa=void 0;w=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,N=0,Na=0;aa=E=0;var Ra=v.__vertexArray,ib=v.__uvArray,jb=v.__uv2Array,Pa=v.__normalArray,W=v.__tangentArray,na=v.__colorArray,ia=v.__skinVertexAArray,$=v.__skinVertexBArray,ua=v.__skinIndexArray,sa=v.__skinWeightArray,ya=v.__morphTargetsArrays,X=v.__webglCustomAttributes;w=void 0;var Ia=v.__faceArray,Ya=v.__lineArray,eb=v.__needsSmoothNormals;
-Ka=v.__vertexColorType;ra=v.__uvType;Ca=v.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=v.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=
-0;X[fb].offsetSrc=0}K=0;for(G=vb.length;K<G;K++){T=vb[K];H=yb[T];wb&&(Ha=wb[T]);xb&&(Ga=xb[T]);T=H.vertexNormals;I=H.normal;L=H.vertexColors;Z=H.color;Y=H.vertexTangents;if(H instanceof THREE.Face3){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||
-w.boundTo==="vertices"){w.array[E+0]=w.value[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+1];w.array[E+2]=w.value[aa+2];w.offsetSrc+=3}w.offset+=3}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c]}else if(w.boundTo==="faces"){xa=w.value[aa];
+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(P instanceof THREE.Mesh){if(v.wireframe){e.lineWidth(v.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)}ea.data.vertices+=z.__webglFaceCount;ea.data.faces+=z.__webglFaceCount/3;ea.data.drawCalls++}else if(P instanceof THREE.Line){P=P.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(P,0,z.__webglLineCount);ea.data.drawCalls++}else if(P instanceof THREE.ParticleSystem){e.drawArrays(e.POINTS,0,z.__webglParticleCount);
+ea.data.drawCalls++}else if(P instanceof THREE.Ribbon){e.drawArrays(e.TRIANGLE_STRIP,0,z.__webglVertexCount);ea.data.drawCalls++}}}function g(n,C,x){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(x==THREE.FlatShading){var v,z,P,K,F,U,G,J,M,Z,Y=n.count*3;for(Z=0;Z<Y;Z+=9){x=n.normalArray;v=x[Z];z=x[Z+1];P=x[Z+2];K=x[Z+3];U=x[Z+4];J=x[Z+5];F=x[Z+6];G=x[Z+7];M=x[Z+8];v=(v+K+F)/3;z=(z+U+G)/3;P=(P+J+M)/3;x[Z]=v;x[Z+1]=z;x[Z+2]=P;x[Z+3]=v;x[Z+4]=z;x[Z+5]=P;x[Z+6]=v;x[Z+7]=z;x[Z+8]=P}}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(wa!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=n.doubleSided}if(ua!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ua=n.flipSided}}function j(n){if(ca!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ca=n}}function k(n){ha[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);ha[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);ha[2].set(n.n41+n.n21,n.n42+n.n22,
+n.n43+n.n23,n.n44+n.n24);ha[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);ha[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);ha[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=ha[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,x=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++){n=ha[v].x*C.n14+ha[v].y*C.n24+ha[v].z*C.n34+ha[v].w;if(n<=x)return!1}return!0}function o(n,
+C){n.list[n.count]=C;n.count+=1}function t(n){var C,x,v=n.object,z=n.opaque,P=n.transparent;P.count=0;n=z.count=0;for(C=v.materials.length;n<C;n++){x=v.materials[n];x.transparent?o(P,x):o(z,x)}}function p(n){var C,x,v,z,P=n.object,K=n.buffer,F=n.opaque,U=n.transparent;U.count=0;n=F.count=0;for(v=P.materials.length;n<v;n++){C=P.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(x=K.materials.length;C<x;C++)(z=K.materials[C])&&(z.transparent?o(U,z):o(F,z))}else(z=C)&&(z.transparent?o(U,z):
+o(F,z))}}function y(n,C){return C.z-n.z}function u(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,x=n.lights.length,v,z=n.lights,P=[],K,F,U,G,J,M=n.__webglShadowVolumes.length;for(C=0;C<x;C++){v=n.lights[C];if(v instanceof THREE.DirectionalLight&&v.castShadow){P[0]=
+-v.position.x;P[1]=-v.position.y;P[2]=-v.position.z;for(J=0;J<M;J++){v=n.__webglShadowVolumes[J].object;K=n.__webglShadowVolumes[J].buffer;F=v.materials[0];F.program||ea.initMaterial(F,z,undefined,v);F=F.program;U=F.uniforms;G=F.attributes;if(Aa!==F){e.useProgram(F);Aa=F;e.uniformMatrix4fv(U.projectionMatrix,!1,Xa);e.uniformMatrix4fv(U.viewMatrix,!1,Za);e.uniform3fv(U.directionalLightDirection,P)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(U.objectMatrix,!1,v._objectMatrixArray);
+e.bindBuffer(e.ARRAY_BUFFER,K.__webglVertexBuffer);e.vertexAttribPointer(G.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,K.__webglNormalBuffer);e.vertexAttribPointer(G.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,K.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,K.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,K.__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);pa="";Aa=T.program;e.useProgram(T.program);e.uniformMatrix4fv(T.projectionLocation,!1,Xa);e.uniform1f(T.darknessLocation,T.darkness);e.bindBuffer(e.ARRAY_BUFFER,T.vertexBuffer);e.vertexAttribPointer(T.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(T.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,T.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,
+0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function A(n,C){var x,v,z;x=_sprite.attributes;var P=_sprite.uniforms,K=ja/Fa,F,U=[],G=Fa*0.5,J=ja*0.5,M=!0;e.useProgram(_sprite.program);Aa=_sprite.program;pa="";if(!La){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);La=!0}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(P.projectionMatrix,!1,Xa);e.activeTexture(e.TEXTURE0);e.uniform1i(P.map,0);x=0;for(v=n.__webglSprites.length;x<v;x++){z=n.__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}}n.__webglSprites.sort(y);x=0;for(v=n.__webglSprites.length;x<
+v;x++){z=n.__webglSprites[x];if(z.material===undefined&&z.map&&z.map.image&&z.map.image.width){if(z.useScreenCoordinates){e.uniform1i(P.useScreenCoordinates,1);e.uniform3f(P.screenPosition,(z.position.x-G)/G,(J-z.position.y)/J,Math.max(0,Math.min(1,z.position.z)))}else{e.uniform1i(P.useScreenCoordinates,0);e.uniform1i(P.affectedByDistance,z.affectedByDistance?1:0);e.uniformMatrix4fv(P.modelViewMatrix,!1,z._modelViewMatrixArray)}F=z.map.image.width/(z.affectedByDistance?1:ja);U[0]=F*K*z.scale.x;U[1]=
+F*z.scale.y;e.uniform2f(P.uvScale,z.uvScale.x,z.uvScale.y);e.uniform2f(P.uvOffset,z.uvOffset.x,z.uvOffset.y);e.uniform2f(P.alignment,z.alignment.x,z.alignment.y);e.uniform1f(P.opacity,z.opacity);e.uniform1f(P.rotation,z.rotation);e.uniform2fv(P.scale,U);if(z.mergeWith3D&&!M){e.enable(e.DEPTH_TEST);M=!0}else if(!z.mergeWith3D&&M){e.disable(e.DEPTH_TEST);M=!1}R(z.blending);Q(z.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function I(n,
+C){var x,v,z=n.__webglLensFlares.length,P,K,F,U=new THREE.Vector3,G=ja/Fa,J=Fa*0.5,M=ja*0.5,Z=16/ja,Y=[Z*G,Z],sa=[1,1,0],Ka=[1,1],Ca=O.uniforms;x=O.attributes;e.useProgram(O.program);Aa=O.program;pa="";if(!Ba){e.enableVertexAttribArray(O.attributes.vertex);e.enableVertexAttribArray(O.attributes.uv);Ba=!0}e.uniform1i(Ca.occlusionMap,0);e.uniform1i(Ca.map,1);e.bindBuffer(e.ARRAY_BUFFER,O.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,
+O.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,O.occlusionTexture);e.activeTexture(e.TEXTURE1);for(v=0;v<z;v++){x=n.__webglLensFlares[v].object;U.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);C.matrixWorldInverse.multiplyVector3(U);C.projectionMatrix.multiplyVector3(U);sa[0]=U.x;sa[1]=U.y;sa[2]=U.z;Ka[0]=sa[0]*J+J;Ka[1]=sa[1]*M+M;if(O.hasVertexTexture||Ka[0]>0&&Ka[0]<Fa&&Ka[1]>0&&Ka[1]<ja){e.bindTexture(e.TEXTURE_2D,O.tempTexture);
+e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,0);e.uniform2fv(Ca.scale,Y);e.uniform3fv(Ca.screenPosition,sa);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,O.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ca.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,O.tempTexture);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);x.positionScreen.x=
+sa[0];x.positionScreen.y=sa[1];x.positionScreen.z=sa[2];x.customUpdateCallback?x.customUpdateCallback(x):x.updateLensFlares();e.uniform1i(Ca.renderType,2);e.enable(e.BLEND);P=0;for(K=x.lensFlares.length;P<K;P++){F=x.lensFlares[P];if(F.opacity>0.0010&&F.scale>0.0010){sa[0]=F.x;sa[1]=F.y;sa[2]=F.z;Z=F.size*F.scale/ja;Y[0]=Z*G;Y[1]=Z;e.uniform3fv(Ca.screenPosition,sa);e.uniform2fv(Ca.scale,Y);e.uniform1f(Ca.rotation,F.rotation);e.uniform1f(Ca.opacity,F.opacity);R(F.blending);Q(F.texture,1);e.drawElements(e.TRIANGLES,
+6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(fa)}function H(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function B(n){var C,x,v,z,P;if(n instanceof THREE.Mesh){x=n.geometry;for(C in x.geometryGroups){v=x.geometryGroups[C];P=!1;for(z in v.__webglCustomAttributes)if(v.__webglCustomAttributes[z].needsUpdate){P=!0;break}if(x.__dirtyVertices||
+x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents||P){P=e.DYNAMIC_DRAW;var K=void 0,F=void 0,U=void 0,G=void 0;U=void 0;var J=void 0,M=void 0,Z=void 0,Y=void 0,sa=void 0,Ka=void 0,Ca=void 0,Ha=void 0,Ga=void 0,xa=void 0,Ea=void 0,za=void 0,Ua=void 0;M=void 0;Z=void 0;G=void 0;Y=void 0;G=void 0;var E=void 0,aa=void 0;M=void 0;E=void 0;aa=void 0;var w=void 0,ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;E=void 0;aa=void 0;w=void 0;ab=void 0;
+E=void 0;aa=void 0;w=void 0;G=void 0;Y=void 0;J=void 0;U=void 0;U=void 0;E=void 0;aa=void 0;w=void 0;var fb=void 0,Oa=0,Qa=0,cb=0,hb=0,Wa=0,$a=0,Ma=0,bb=0,Va=0,N=0,Na=0;aa=E=0;var Ra=v.__vertexArray,ib=v.__uvArray,jb=v.__uv2Array,Pa=v.__normalArray,V=v.__tangentArray,na=v.__colorArray,ia=v.__skinVertexAArray,$=v.__skinVertexBArray,va=v.__skinIndexArray,ta=v.__skinWeightArray,ya=v.__morphTargetsArrays,X=v.__webglCustomAttributes;w=void 0;var Ia=v.__faceArray,Ya=v.__lineArray,eb=v.__needsSmoothNormals;
+Ka=v.__vertexColorType;sa=v.__uvType;Ca=v.__normalType;var Sa=n.geometry,kb=Sa.__dirtyVertices,gb=Sa.__dirtyElements,db=Sa.__dirtyUvs,rb=Sa.__dirtyNormals,sb=Sa.__dirtyTangents,tb=Sa.__dirtyColors,ub=Sa.__dirtyMorphTargets,nb=Sa.vertices,vb=v.faces,yb=Sa.faces,wb=Sa.faceVertexUvs[0],xb=Sa.faceVertexUvs[1],ob=Sa.skinVerticesA,pb=Sa.skinVerticesB,qb=Sa.skinIndices,lb=Sa.skinWeights,mb=n instanceof THREE.ShadowVolume?Sa.edgeFaces:undefined;morphTargets=Sa.morphTargets;if(X)for(fb in X){X[fb].offset=
+0;X[fb].offsetSrc=0}K=0;for(F=vb.length;K<F;K++){U=vb[K];G=yb[U];wb&&(Ha=wb[U]);xb&&(Ga=xb[U]);U=G.vertexNormals;J=G.normal;M=G.vertexColors;Z=G.color;Y=G.vertexTangents;if(G instanceof THREE.Face3){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Qa+=9}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||
+w.boundTo==="vertices"){w.array[E+0]=w.value[G.a];w.array[E+1]=w.value[G.b];w.array[E+2]=w.value[G.c]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+1];w.array[E+2]=w.value[aa+2];w.offsetSrc+=3}w.offset+=3}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[G.a];Ea=w.value[G.b];za=w.value[G.c]}else if(w.boundTo==="faces"){xa=w.value[aa];
 Ea=w.value[aa];za=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];w.offsetSrc+=3}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.offset+=6}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b}else{w.array[E+0]=xa.x;
-w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+8]=za.z}w.offset+=9}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.offset+=12}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;
-za=morphTargets[E].vertices[H.c].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z}Na+=9}if(lb.length){E=lb[H.a];aa=lb[H.b];w=lb[H.c];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=
-w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;E=pb[H.a];aa=pb[H.b];w=pb[H.c];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;N+=12}if(tb&&Ka){if(L.length==3&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2]}else aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;
-na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){L=Y[0];Z=Y[1];H=Y[2];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;Ma+=12}if(rb&&Ca)if(T.length==3&&eb)for(Y=0;Y<3;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ha[Y];ib[cb]=
-T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<3;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(H instanceof THREE.Face4){if(kb){xa=nb[H.a].position;Ea=nb[H.b].position;za=nb[H.c].position;Ua=nb[H.d].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;
-Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[E+0]=w.value[H.a];w.array[E+1]=w.value[H.b];w.array[E+2]=w.value[H.c];w.array[E+2]=w.value[H.d]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+
-1];w.array[E+2]=w.value[aa+2];w.array[E+2]=w.value[aa+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[H.a];Ea=w.value[H.b];za=w.value[H.c];Ua=w.value[H.d]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];Ua=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];Ua=w.value[aa+3];w.offsetSrc+=4}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+
+w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+8]=za.z}w.offset+=9}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.offset+=12}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[G.a].position;Ea=morphTargets[E].vertices[G.b].position;
+za=morphTargets[E].vertices[G.c].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z}Na+=9}if(lb.length){E=lb[G.a];aa=lb[G.b];w=lb[G.c];ta[N]=E.x;ta[N+1]=E.y;ta[N+2]=E.z;ta[N+3]=E.w;ta[N+4]=aa.x;ta[N+5]=aa.y;ta[N+6]=aa.z;ta[N+7]=aa.w;ta[N+8]=w.x;ta[N+9]=w.y;ta[N+10]=w.z;ta[N+11]=w.w;E=qb[G.a];aa=qb[G.b];w=qb[G.c];va[N]=E.x;va[N+1]=E.y;va[N+2]=E.z;va[N+3]=E.w;va[N+4]=aa.x;va[N+5]=aa.y;va[N+6]=aa.z;va[N+7]=aa.w;va[N+8]=
+w.x;va[N+9]=w.y;va[N+10]=w.z;va[N+11]=w.w;E=ob[G.a];aa=ob[G.b];w=ob[G.c];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;E=pb[G.a];aa=pb[G.b];w=pb[G.c];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;N+=12}if(tb&&Ka){if(M.length==3&&Ka==THREE.VertexColors){G=M[0];E=M[1];aa=M[2]}else aa=E=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;
+na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;Va+=9}if(sb&&Sa.hasTangents){M=Y[0];Z=Y[1];G=Y[2];V[Ma]=M.x;V[Ma+1]=M.y;V[Ma+2]=M.z;V[Ma+3]=M.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;Ma+=12}if(rb&&Ca)if(U.length==3&&eb)for(Y=0;Y<3;Y++){J=U[Y];Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}else for(Y=0;Y<3;Y++){Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}if(db&&Ha!==undefined&&sa)for(Y=0;Y<3;Y++){U=Ha[Y];ib[cb]=
+U.u;ib[cb+1]=U.v;cb+=2}if(db&&Ga!==undefined&&sa)for(Y=0;Y<3;Y++){U=Ga[Y];jb[hb]=U.u;jb[hb+1]=U.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+2;Wa+=3;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+2;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;bb+=6;Oa+=3}}else if(G instanceof THREE.Face4){if(kb){xa=nb[G.a].position;Ea=nb[G.b].position;za=nb[G.c].position;Ua=nb[G.d].position;Ra[Qa]=xa.x;Ra[Qa+1]=xa.y;Ra[Qa+2]=xa.z;Ra[Qa+3]=Ea.x;Ra[Qa+4]=Ea.y;Ra[Qa+5]=Ea.z;Ra[Qa+6]=za.x;Ra[Qa+7]=za.y;Ra[Qa+8]=za.z;Ra[Qa+9]=Ua.x;
+Ra[Qa+10]=Ua.y;Ra[Qa+11]=Ua.z;Qa+=12}if(X)for(fb in X){w=X[fb];if(w.needsUpdate){E=w.offset;aa=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[E+0]=w.value[G.a];w.array[E+1]=w.value[G.b];w.array[E+2]=w.value[G.c];w.array[E+2]=w.value[G.d]}else if(w.boundTo==="faces"){w.array[E+0]=w.value[aa];w.array[E+1]=w.value[aa];w.array[E+2]=w.value[aa];w.array[E+2]=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[E+0]=w.value[aa+0];w.array[E+1]=w.value[aa+
+1];w.array[E+2]=w.value[aa+2];w.array[E+2]=w.value[aa+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||w.boundTo==="vertices"){xa=w.value[G.a];Ea=w.value[G.b];za=w.value[G.c];Ua=w.value[G.d]}else if(w.boundTo==="faces"){xa=w.value[aa];Ea=w.value[aa];za=w.value[aa];Ua=w.value[aa];w.offsetSrc++}else if(w.boundTo==="faceVertices"){xa=w.value[aa+0];Ea=w.value[aa+1];za=w.value[aa+2];Ua=w.value[aa+3];w.offsetSrc+=4}if(w.size===2){w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=Ea.x;w.array[E+
 3]=Ea.y;w.array[E+4]=za.x;w.array[E+5]=za.y;w.array[E+6]=Ua.x;w.array[E+7]=Ua.y;w.offset+=8}else if(w.size===3){if(w.type==="c"){w.array[E+0]=xa.r;w.array[E+1]=xa.g;w.array[E+2]=xa.b;w.array[E+3]=Ea.r;w.array[E+4]=Ea.g;w.array[E+5]=Ea.b;w.array[E+6]=za.r;w.array[E+7]=za.g;w.array[E+8]=za.b;w.array[E+9]=Ua.r;w.array[E+10]=Ua.g;w.array[E+11]=Ua.b}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=Ea.x;w.array[E+4]=Ea.y;w.array[E+5]=Ea.z;w.array[E+6]=za.x;w.array[E+7]=za.y;w.array[E+
-8]=za.z;w.array[E+9]=Ua.x;w.array[E+10]=Ua.y;w.array[E+11]=Ua.z}w.offset+=12}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.array[E+12]=Ua.x;w.array[E+13]=Ua.y;w.array[E+14]=Ua.z;w.array[E+15]=Ua.w;w.offset+=16}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[H.a].position;Ea=morphTargets[E].vertices[H.b].position;
-za=morphTargets[E].vertices[H.c].position;Ua=morphTargets[E].vertices[H.d].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z;w[Na+9]=Ua.x;w[Na+10]=Ua.y;w[Na+11]=Ua.z}Na+=12}if(lb.length){E=lb[H.a];aa=lb[H.b];w=lb[H.c];ab=lb[H.d];sa[N]=E.x;sa[N+1]=E.y;sa[N+2]=E.z;sa[N+3]=E.w;sa[N+4]=aa.x;sa[N+5]=aa.y;sa[N+6]=aa.z;sa[N+7]=aa.w;sa[N+8]=w.x;sa[N+9]=w.y;sa[N+10]=w.z;sa[N+11]=w.w;sa[N+12]=ab.x;sa[N+13]=ab.y;sa[N+14]=ab.z;
-sa[N+15]=ab.w;E=qb[H.a];aa=qb[H.b];w=qb[H.c];ab=qb[H.d];ua[N]=E.x;ua[N+1]=E.y;ua[N+2]=E.z;ua[N+3]=E.w;ua[N+4]=aa.x;ua[N+5]=aa.y;ua[N+6]=aa.z;ua[N+7]=aa.w;ua[N+8]=w.x;ua[N+9]=w.y;ua[N+10]=w.z;ua[N+11]=w.w;ua[N+12]=ab.x;ua[N+13]=ab.y;ua[N+14]=ab.z;ua[N+15]=ab.w;E=ob[H.a];aa=ob[H.b];w=ob[H.c];ab=ob[H.d];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;ia[N+12]=ab.x;ia[N+13]=ab.y;ia[N+14]=ab.z;ia[N+15]=1;E=pb[H.a];
-aa=pb[H.b];w=pb[H.c];H=pb[H.d];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;$[N+12]=H.x;$[N+13]=H.y;$[N+14]=H.z;$[N+15]=1;N+=16}if(tb&&Ka){if(L.length==4&&Ka==THREE.VertexColors){H=L[0];E=L[1];aa=L[2];L=L[3]}else L=aa=E=H=Z;na[Va]=H.r;na[Va+1]=H.g;na[Va+2]=H.b;na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=L.r;na[Va+10]=L.g;na[Va+11]=L.b;Va+=12}if(sb&&Sa.hasTangents){L=Y[0];
-Z=Y[1];H=Y[2];Y=Y[3];W[Ma]=L.x;W[Ma+1]=L.y;W[Ma+2]=L.z;W[Ma+3]=L.w;W[Ma+4]=Z.x;W[Ma+5]=Z.y;W[Ma+6]=Z.z;W[Ma+7]=Z.w;W[Ma+8]=H.x;W[Ma+9]=H.y;W[Ma+10]=H.z;W[Ma+11]=H.w;W[Ma+12]=Y.x;W[Ma+13]=Y.y;W[Ma+14]=Y.z;W[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(T.length==4&&eb)for(Y=0;Y<4;Y++){I=T[Y];Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=I.x;Pa[$a+1]=I.y;Pa[$a+2]=I.z;$a+=3}if(db&&Ha!==undefined&&ra)for(Y=0;Y<4;Y++){T=Ha[Y];ib[cb]=T.u;ib[cb+1]=T.v;cb+=2}if(db&&Ga!==undefined&&ra)for(Y=0;Y<
-4;Y++){T=Ga[Y];jb[hb]=T.u;jb[hb+1]=T.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=8;Oa+=4}}}if(mb){K=0;for(G=mb.length;K<G;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,Q)}if(X)for(fb in X){w=
-X[fb];if(w.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,w.buffer);e.bufferData(e.ARRAY_BUFFER,w.array,Q);w.needsUpdate=!1}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){e.bindBuffer(e.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[E]);e.bufferData(e.ARRAY_BUFFER,ya[E],Q)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,Q)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,Q)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
-v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,W,Q)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,Q)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,Q)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,Q);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,Q)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);
-e.bufferData(e.ARRAY_BUFFER,ia,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ua,Q);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,sa,Q)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||
-x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,D)}}x.__dirtyVertices=
-!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;Q=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ca;G++){ra=Ka[G].position;z=G*3;Ha[z]=ra.x;Ha[z+1]=ra.y;Ha[z+2]=ra.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,D)}if(Ga){for(G=0;G<Q;G++){color=v[G];z=G*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
-n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,D)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function U(n){function D(Z){var Y=[];x=0;for(v=Z.length;x<v;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,v,z,Q,K,G,T,H,I={},L=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};
-z=0;for(Q=n.faces.length;z<Q;z++){K=n.faces[z];G=K.materials;T=D(G);I[T]==undefined&&(I[T]={hash:T,counter:0});H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[H].vertices+K>65535){I[T].counter+=1;H=I[T].hash+"_"+I[T].counter;n.geometryGroups[H]==undefined&&(n.geometryGroups[H]={faces:[],materials:G,vertices:0,numMorphTargets:L})}n.geometryGroups[H].faces.push(z);
-n.geometryGroups[H].vertices+=K}}function C(n,D,x){n.push({buffer:D,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function V(n){if(n!=pa){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)}pa=n}}function O(n,D,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(D.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(D.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(D.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,qa(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,qa(D.minFilter))}}function M(n,D){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+D);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function va(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,ga(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,
+8]=za.z;w.array[E+9]=Ua.x;w.array[E+10]=Ua.y;w.array[E+11]=Ua.z}w.offset+=12}else{w.array[E+0]=xa.x;w.array[E+1]=xa.y;w.array[E+2]=xa.z;w.array[E+3]=xa.w;w.array[E+4]=Ea.x;w.array[E+5]=Ea.y;w.array[E+6]=Ea.z;w.array[E+7]=Ea.w;w.array[E+8]=za.x;w.array[E+9]=za.y;w.array[E+10]=za.z;w.array[E+11]=za.w;w.array[E+12]=Ua.x;w.array[E+13]=Ua.y;w.array[E+14]=Ua.z;w.array[E+15]=Ua.w;w.offset+=16}}}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){xa=morphTargets[E].vertices[G.a].position;Ea=morphTargets[E].vertices[G.b].position;
+za=morphTargets[E].vertices[G.c].position;Ua=morphTargets[E].vertices[G.d].position;w=ya[E];w[Na+0]=xa.x;w[Na+1]=xa.y;w[Na+2]=xa.z;w[Na+3]=Ea.x;w[Na+4]=Ea.y;w[Na+5]=Ea.z;w[Na+6]=za.x;w[Na+7]=za.y;w[Na+8]=za.z;w[Na+9]=Ua.x;w[Na+10]=Ua.y;w[Na+11]=Ua.z}Na+=12}if(lb.length){E=lb[G.a];aa=lb[G.b];w=lb[G.c];ab=lb[G.d];ta[N]=E.x;ta[N+1]=E.y;ta[N+2]=E.z;ta[N+3]=E.w;ta[N+4]=aa.x;ta[N+5]=aa.y;ta[N+6]=aa.z;ta[N+7]=aa.w;ta[N+8]=w.x;ta[N+9]=w.y;ta[N+10]=w.z;ta[N+11]=w.w;ta[N+12]=ab.x;ta[N+13]=ab.y;ta[N+14]=ab.z;
+ta[N+15]=ab.w;E=qb[G.a];aa=qb[G.b];w=qb[G.c];ab=qb[G.d];va[N]=E.x;va[N+1]=E.y;va[N+2]=E.z;va[N+3]=E.w;va[N+4]=aa.x;va[N+5]=aa.y;va[N+6]=aa.z;va[N+7]=aa.w;va[N+8]=w.x;va[N+9]=w.y;va[N+10]=w.z;va[N+11]=w.w;va[N+12]=ab.x;va[N+13]=ab.y;va[N+14]=ab.z;va[N+15]=ab.w;E=ob[G.a];aa=ob[G.b];w=ob[G.c];ab=ob[G.d];ia[N]=E.x;ia[N+1]=E.y;ia[N+2]=E.z;ia[N+3]=1;ia[N+4]=aa.x;ia[N+5]=aa.y;ia[N+6]=aa.z;ia[N+7]=1;ia[N+8]=w.x;ia[N+9]=w.y;ia[N+10]=w.z;ia[N+11]=1;ia[N+12]=ab.x;ia[N+13]=ab.y;ia[N+14]=ab.z;ia[N+15]=1;E=pb[G.a];
+aa=pb[G.b];w=pb[G.c];G=pb[G.d];$[N]=E.x;$[N+1]=E.y;$[N+2]=E.z;$[N+3]=1;$[N+4]=aa.x;$[N+5]=aa.y;$[N+6]=aa.z;$[N+7]=1;$[N+8]=w.x;$[N+9]=w.y;$[N+10]=w.z;$[N+11]=1;$[N+12]=G.x;$[N+13]=G.y;$[N+14]=G.z;$[N+15]=1;N+=16}if(tb&&Ka){if(M.length==4&&Ka==THREE.VertexColors){G=M[0];E=M[1];aa=M[2];M=M[3]}else M=aa=E=G=Z;na[Va]=G.r;na[Va+1]=G.g;na[Va+2]=G.b;na[Va+3]=E.r;na[Va+4]=E.g;na[Va+5]=E.b;na[Va+6]=aa.r;na[Va+7]=aa.g;na[Va+8]=aa.b;na[Va+9]=M.r;na[Va+10]=M.g;na[Va+11]=M.b;Va+=12}if(sb&&Sa.hasTangents){M=Y[0];
+Z=Y[1];G=Y[2];Y=Y[3];V[Ma]=M.x;V[Ma+1]=M.y;V[Ma+2]=M.z;V[Ma+3]=M.w;V[Ma+4]=Z.x;V[Ma+5]=Z.y;V[Ma+6]=Z.z;V[Ma+7]=Z.w;V[Ma+8]=G.x;V[Ma+9]=G.y;V[Ma+10]=G.z;V[Ma+11]=G.w;V[Ma+12]=Y.x;V[Ma+13]=Y.y;V[Ma+14]=Y.z;V[Ma+15]=Y.w;Ma+=16}if(rb&&Ca)if(U.length==4&&eb)for(Y=0;Y<4;Y++){J=U[Y];Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}else for(Y=0;Y<4;Y++){Pa[$a]=J.x;Pa[$a+1]=J.y;Pa[$a+2]=J.z;$a+=3}if(db&&Ha!==undefined&&sa)for(Y=0;Y<4;Y++){U=Ha[Y];ib[cb]=U.u;ib[cb+1]=U.v;cb+=2}if(db&&Ga!==undefined&&sa)for(Y=0;Y<
+4;Y++){U=Ga[Y];jb[hb]=U.u;jb[hb+1]=U.v;hb+=2}if(gb){Ia[Wa]=Oa;Ia[Wa+1]=Oa+1;Ia[Wa+2]=Oa+3;Ia[Wa+3]=Oa+1;Ia[Wa+4]=Oa+2;Ia[Wa+5]=Oa+3;Wa+=6;Ya[bb]=Oa;Ya[bb+1]=Oa+1;Ya[bb+2]=Oa;Ya[bb+3]=Oa+3;Ya[bb+4]=Oa+1;Ya[bb+5]=Oa+2;Ya[bb+6]=Oa+2;Ya[bb+7]=Oa+3;bb+=8;Oa+=4}}}if(mb){K=0;for(F=mb.length;K<F;K++){Ia[Wa]=mb[K].a;Ia[Wa+1]=mb[K].b;Ia[Wa+2]=mb[K].c;Ia[Wa+3]=mb[K].a;Ia[Wa+4]=mb[K].c;Ia[Wa+5]=mb[K].d;Wa+=6}}if(kb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,P)}if(X)for(fb in X){w=
+X[fb];if(w.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,w.buffer);e.bufferData(e.ARRAY_BUFFER,w.array,P);w.needsUpdate=!1}}if(ub){E=0;for(aa=morphTargets.length;E<aa;E++){e.bindBuffer(e.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[E]);e.bufferData(e.ARRAY_BUFFER,ya[E],P)}}if(tb&&Va>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,na,P)}if(rb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,P)}if(sb&&Sa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
+v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,V,P)}if(db&&cb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,P)}if(db&&hb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,jb,P)}if(gb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,P);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ya,P)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);
+e.bufferData(e.ARRAY_BUFFER,ia,P);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,$,P);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,va,P);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ta,P)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){x=n.geometry;if(x.__dirtyVertices||
+x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;P=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){sa=Ka[F].position;z=F*3;Ha[z]=sa.x;Ha[z+1]=sa.y;Ha[z+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<P;F++){color=v[F];z=F*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=
+!1;x.__dirtyColors=!1}else if(n instanceof THREE.Line){x=n.geometry;if(x.__dirtyVertices||x.__dirtyColors){n=x;C=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ca=Ka.length;P=v.length;Ha=n.__vertexArray;K=n.__colorArray;Ga=n.__dirtyColors;if(n.__dirtyVertices){for(F=0;F<Ca;F++){sa=Ka[F].position;z=F*3;Ha[z]=sa.x;Ha[z+1]=sa.y;Ha[z+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ha,C)}if(Ga){for(F=0;F<P;F++){color=v[F];z=F*3;K[z]=color.r;K[z+1]=color.g;K[z+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
+n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,C)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){x=n.geometry;(x.__dirtyVertices||x.__dirtyColors||n.sortParticles)&&d(x,e.DYNAMIC_DRAW,n);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function W(n){function C(Z){var Y=[];x=0;for(v=Z.length;x<v;x++)Z[x]==undefined?Y.push("undefined"):Y.push(Z[x].id);return Y.join("_")}var x,v,z,P,K,F,U,G,J={},M=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};
+z=0;for(P=n.faces.length;z<P;z++){K=n.faces[z];F=K.materials;U=C(F);J[U]==undefined&&(J[U]={hash:U,counter:0});G=J[U].hash+"_"+J[U].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:M});K=K instanceof THREE.Face3?3:4;if(n.geometryGroups[G].vertices+K>65535){J[U].counter+=1;G=J[U].hash+"_"+J[U].counter;n.geometryGroups[G]==undefined&&(n.geometryGroups[G]={faces:[],materials:F,vertices:0,numMorphTargets:M})}n.geometryGroups[G].faces.push(z);
+n.geometryGroups[G].vertices+=K}}function D(n,C,x){n.push({buffer:C,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(n){if(n!=pa){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)}pa=n}}function L(n,C,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,ga(C.wrapS));e.texParameteri(n,e.TEXTURE_WRAP_T,ga(C.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(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,ra(C.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ra(C.minFilter))}}function Q(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}L(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 qa(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,ga(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,
 ga(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,ga(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ga(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,ga(n.format),n.width,n.height,0,ga(n.format),ga(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 D,x;if(n){D=n.__webglFramebuffer;x=n.width;n=n.height}else{D=null;x=Fa;n=ja}if(D!=da){e.bindFramebuffer(e.FRAMEBUFFER,D);e.viewport(ka,ma,x,n);da=D}}function la(n,D){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(x=e.createShader(e.VERTEX_SHADER));e.shaderSource(x,D);e.compileShader(x);if(!e.getShaderParameter(x,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(x));console.error(D);return null}return x}function qa(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
+null)}var C,x;if(n){C=n.__webglFramebuffer;x=n.width;n=n.height}else{C=null;x=Fa;n=ja}if(C!=da){e.bindFramebuffer(e.FRAMEBUFFER,C);e.viewport(ka,ma,x,n);da=C}}function la(n,C){var x;if(n=="fragment")x=e.createShader(e.FRAGMENT_SHADER);else n=="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 ra(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
 default:return e.LINEAR}}function ga(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 ea=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,da=null,fa=!0,wa=null,ta=null,pa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,R={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
-antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,D,x,v){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:v})))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(D.r,D.g,D.b,x)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var S={};S.vertices=new Float32Array(12);
-S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-20;S.vertices[1]=-20;S.vertices[2]=-1;S.vertices[3]=20;S.vertices[4]=-20;S.vertices[5]=-1;S.vertices[6]=20;S.vertices[7]=20;S.vertices[8]=-1;S.vertices[9]=-20;S.vertices[10]=20;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=e.createBuffer();S.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,S.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-S.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,S.faces,e.STATIC_DRAW);S.program=e.createProgram();e.attachShader(S.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(S.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(S.program);S.vertexLocation=e.getAttribLocation(S.program,"position");S.projectionLocation=e.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=e.getUniformLocation(S.program,"darkness")}var P={};P.vertices=
-new Float32Array(16);P.faces=new Uint16Array(6);b=0;P.vertices[b++]=-1;P.vertices[b++]=-1;P.vertices[b++]=0;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=1;P.vertices[b++]=-1;P.vertices[b++]=1;P.vertices[b++]=0;P.vertices[b++]=1;b=0;P.faces[b++]=0;P.faces[b++]=1;P.faces[b++]=2;P.faces[b++]=0;P.faces[b++]=2;P.faces[b++]=3;P.vertexBuffer=e.createBuffer();P.elementBuffer=e.createBuffer();
-P.tempTexture=e.createTexture();P.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,P.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,P.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,P.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,P.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,P.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,P.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){P.hasVertexTexture=!1;P.program=e.createProgram();e.attachShader(P.program,la("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(P.program,la("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{P.hasVertexTexture=!0;P.program=e.createProgram();e.attachShader(P.program,la("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(P.program,la("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(P.program);P.attributes={};P.uniforms=
-{};P.attributes.vertex=e.getAttribLocation(P.program,"position");P.attributes.uv=e.getAttribLocation(P.program,"UV");P.uniforms.renderType=e.getUniformLocation(P.program,"renderType");P.uniforms.map=e.getUniformLocation(P.program,"map");P.uniforms.occlusionMap=e.getUniformLocation(P.program,"occlusionMap");P.uniforms.opacity=e.getUniformLocation(P.program,"opacity");P.uniforms.scale=e.getUniformLocation(P.program,"scale");P.uniforms.rotation=e.getUniformLocation(P.program,"rotation");P.uniforms.screenPosition=
-e.getUniformLocation(P.program,"screenPosition");var Ba=!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++]=
+var ea=this,e,oa=document.createElement("canvas"),Da=[],Aa=null,da=null,fa=!0,wa=null,ua=null,pa=null,ca=null,ka=0,ma=0,Fa=0,ja=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ja=new THREE.Matrix4,Xa=new Float32Array(16),Za=new Float32Array(16),Ta=new THREE.Vector4,S={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};stencil=b.stencil!==undefined?b.stencil:!0;
+antialias=b.antialias!==undefined?b.antialias:!1;clearColor=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0);clearAlpha=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,x,v){try{if(!(e=oa.getContext("experimental-webgl",{antialias:n,stencil:v})))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)})(antialias,clearColor,clearAlpha,stencil);this.context=e;if(stencil){var T={};T.vertices=new Float32Array(12);
+T.faces=new Uint16Array(6);T.darkness=0.5;T.vertices[0]=-20;T.vertices[1]=-20;T.vertices[2]=-1;T.vertices[3]=20;T.vertices[4]=-20;T.vertices[5]=-1;T.vertices[6]=20;T.vertices[7]=20;T.vertices[8]=-1;T.vertices[9]=-20;T.vertices[10]=20;T.vertices[11]=-1;T.faces[0]=0;T.faces[1]=1;T.faces[2]=2;T.faces[3]=0;T.faces[4]=2;T.faces[5]=3;T.vertexBuffer=e.createBuffer();T.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,T.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,T.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
+T.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,T.faces,e.STATIC_DRAW);T.program=e.createProgram();e.attachShader(T.program,la("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(T.program,la("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(T.program);T.vertexLocation=e.getAttribLocation(T.program,"position");T.projectionLocation=e.getUniformLocation(T.program,"projectionMatrix");T.darknessLocation=e.getUniformLocation(T.program,"darkness")}var O={};O.vertices=
+new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=e.createBuffer();O.elementBuffer=e.createBuffer();
+O.tempTexture=e.createTexture();O.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,O.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,O.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,O.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,O.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,O.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,O.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){O.hasVertexTexture=!1;O.program=e.createProgram();e.attachShader(O.program,la("fragment",THREE.ShaderLib.lensFlare.fragmentShader));e.attachShader(O.program,la("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{O.hasVertexTexture=!0;O.program=e.createProgram();e.attachShader(O.program,la("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(O.program,la("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(O.program);O.attributes={};O.uniforms=
+{};O.attributes.vertex=e.getAttribLocation(O.program,"position");O.attributes.uv=e.getAttribLocation(O.program,"UV");O.uniforms.renderType=e.getUniformLocation(O.program,"renderType");O.uniforms.map=e.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=e.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=e.getUniformLocation(O.program,"opacity");O.uniforms.scale=e.getUniformLocation(O.program,"scale");O.uniforms.rotation=e.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=
+e.getUniformLocation(O.program,"screenPosition");var Ba=!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,la("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,la("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 La=!1;this.setSize=function(n,D){oa.width=n;oa.height=D;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,D,x,v){ka=n;ma=D;Fa=x;ja=v;e.viewport(ka,ma,Fa,
-ja)};this.setScissor=function(n,D,x,v){e.scissor(n,D,x,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=n;e.depthMask(n)};this.setClearColorHex=function(n,D){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.b,D)};this.setClearColor=function(n,D){e.clearColor(n.r,n.g,n.b,D)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){S.darkness=
-n};this.getContext=function(){return e};this.initMaterial=function(n,D,x,v){var z,Q,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof THREE.MeshPhongMaterial)K="phong";else if(n instanceof THREE.LineBasicMaterial)K="basic";else n instanceof
-THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var G=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(G.uniforms);n.vertexShader=G.vertexShader;n.fragmentShader=G.fragmentShader}var T,H,I;T=I=G=0;for(H=D.length;T<H;T++){Q=D[T];Q instanceof THREE.DirectionalLight&&I++;Q instanceof THREE.PointLight&&G++}if(G+I<=4)D=I;else{D=Math.ceil(4*I/(G+I));G=4-D}Q={directional:D,point:G};I=50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)I=v.bones.length;var L;a:{T=n.fragmentShader;H=n.vertexShader;
-G=n.uniforms;D=n.attributes;x={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:x,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:Q.directional,maxPointLights:Q.point,maxBones:I};var Z;Q=[];if(K)Q.push(K);else{Q.push(T);Q.push(H)}for(Z in x){Q.push(Z);Q.push(x[Z])}K=Q.join();Z=0;for(Q=Da.length;Z<Q;Z++)if(Da[Z].code==K){L=Da[Z].program;break a}Z=e.createProgram();prefix_fragment=
+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 La=!1;this.setSize=function(n,C){oa.width=n;oa.height=C;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(n,C,x,v){ka=n;ma=C;Fa=x;ja=v;e.viewport(ka,ma,Fa,
+ja)};this.setScissor=function(n,C,x,v){e.scissor(n,C,x,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){fa=n;e.depthMask(n)};this.setClearColorHex=function(n,C){var x=new THREE.Color(n);e.clearColor(x.r,x.g,x.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){T.darkness=
+n};this.getContext=function(){return e};this.initMaterial=function(n,C,x,v){var z,P,K;if(n instanceof THREE.MeshDepthMaterial)K="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)K="shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)K="normal";else if(n instanceof THREE.MeshBasicMaterial)K="basic";else if(n instanceof THREE.MeshLambertMaterial)K="lambert";else if(n instanceof THREE.MeshPhongMaterial)K="phong";else if(n instanceof THREE.LineBasicMaterial)K="basic";else n instanceof
+THREE.ParticleBasicMaterial&&(K="particle_basic");if(K){var F=THREE.ShaderLib[K];n.uniforms=THREE.UniformsUtils.clone(F.uniforms);n.vertexShader=F.vertexShader;n.fragmentShader=F.fragmentShader}var U,G,J;U=J=F=0;for(G=C.length;U<G;U++){P=C[U];P instanceof THREE.DirectionalLight&&J++;P instanceof THREE.PointLight&&F++}if(F+J<=4)C=J;else{C=Math.ceil(4*J/(F+J));F=4-C}P={directional:C,point:F};J=50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)J=v.bones.length;var M;a:{U=n.fragmentShader;G=n.vertexShader;
+F=n.uniforms;C=n.attributes;x={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:x,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:P.directional,maxPointLights:P.point,maxBones:J};var Z;P=[];if(K)P.push(K);else{P.push(U);P.push(G)}for(Z in x){P.push(Z);P.push(x[Z])}K=P.join();Z=0;for(P=Da.length;Z<P;Z++)if(Da[Z].code==K){M=Da[Z].program;break a}Z=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(Z,la("fragment",prefix_fragment+T));e.attachShader(Z,la("vertex",prefix_vertex+H));e.linkProgram(Z);e.getProgramParameter(Z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Z.uniforms={};Z.attributes={};var Y;T=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Y in G)T.push(Y);
-Y=T;G=0;for(T=Y.length;G<T;G++){H=Y[G];Z.uniforms[H]=e.getUniformLocation(Z,H)}T=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)T.push("morphTarget"+Y);for(L in D)T.push(L);L=T;Y=0;for(D=L.length;Y<D;Y++){x=L[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});L=Z}n.program=L;L=n.program.attributes;e.enableVertexAttribArray(L.position);L.color>=0&&e.enableVertexAttribArray(L.color);L.normal>=
-0&&e.enableVertexAttribArray(L.normal);L.tangent>=0&&e.enableVertexAttribArray(L.tangent);if(n.skinning&&L.skinVertexA>=0&&L.skinVertexB>=0&&L.skinIndex>=0&&L.skinWeight>=0){e.enableVertexAttribArray(L.skinVertexA);e.enableVertexAttribArray(L.skinVertexB);e.enableVertexAttribArray(L.skinIndex);e.enableVertexAttribArray(L.skinWeight)}for(z in n.attributes)L[z]>=0&&e.enableVertexAttribArray(L[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(L.morphTarget0>=0){e.enableVertexAttribArray(L.morphTarget0);
-n.numSupportedMorphTargets++}if(L.morphTarget1>=0){e.enableVertexAttribArray(L.morphTarget1);n.numSupportedMorphTargets++}if(L.morphTarget2>=0){e.enableVertexAttribArray(L.morphTarget2);n.numSupportedMorphTargets++}if(L.morphTarget3>=0){e.enableVertexAttribArray(L.morphTarget3);n.numSupportedMorphTargets++}if(L.morphTarget4>=0){e.enableVertexAttribArray(L.morphTarget4);n.numSupportedMorphTargets++}if(L.morphTarget5>=0){e.enableVertexAttribArray(L.morphTarget5);n.numSupportedMorphTargets++}if(L.morphTarget6>=
-0){e.enableVertexAttribArray(L.morphTarget6);n.numSupportedMorphTargets++}if(L.morphTarget7>=0){e.enableVertexAttribArray(L.morphTarget7);n.numSupportedMorphTargets++}v.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)v.__webglMorphTargetInfluences[n]=0}};this.render=function(n,D,x,v){var z,Q,K,G,T,H,I,L,Z=n.lights,Y=n.fog;ea.data.vertices=0;ea.data.faces=0;ea.data.drawCalls=0;D.matrixAutoUpdate&&D.update(undefined,!0);n.update(undefined,!1,
-D);D.matrixWorldInverse.flattenToArray(Za);D.projectionMatrix.flattenToArray(Xa);Ja.multiply(D.projectionMatrix,D.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);va(x);(this.autoClear||v)&&this.clear();T=n.__webglObjects.length;for(v=0;v<T;v++){z=n.__webglObjects[v];I=z.object;if(I.visible)if(!(I instanceof THREE.Mesh)||m(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);t(z);z.render=!0;if(this.sortObjects){Ta.copy(I.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=
-!1}this.sortObjects&&n.__webglObjects.sort(y);H=n.__webglObjectsImmediate.length;for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);J(I,D);p(z)}}V(THREE.NormalBlending);for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.opaque;h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.opaque;
-h(I);for(z=0;z<K.count;z++){G=K.list[z];j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}for(v=0;v<T;v++){z=n.__webglObjects[v];if(z.render){I=z.object;L=z.buffer;K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);f(D,Z,Y,G,L,I)}}}for(v=0;v<H;v++){z=n.__webglObjectsImmediate[v];I=z.object;if(I.visible){K=z.transparent;h(I);for(z=0;z<K.count;z++){G=K.list[z];V(G.blending);j(G.depthTest);Q=c(D,Z,Y,G,I);I.render(function(ra){g(ra,Q,G.shading)})}}}n.__webglSprites.length&&
-A(n,D);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&u(n);n.__webglLensFlares.length&&F(n,D);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(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var D=
-n.__objectsAdded[0],x=n,v=void 0,z=void 0,Q=void 0;if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){z=D.geometry;z.geometryGroups==undefined&&U(z);for(v in z.geometryGroups){Q=z.geometryGroups[v];if(!Q.__webglVertexBuffer){var K=Q;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=
-e.createBuffer();K.__webglTangentBuffer=e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var G=void 0,T=void 0;K.__webglMorphTargetsBuffers=[];G=0;for(T=
-K.numMorphTargets;G<T;G++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=Q;G=D;var H=void 0,I=void 0,L=void 0;L=void 0;var Z=void 0,Y=void 0,ra=void 0,Ka=ra=T=0;I=void 0;L=void 0;var Ca=void 0;H=void 0;I=void 0;Z=G.geometry;Ca=Z.faces;Y=K.faces;H=0;for(I=Y.length;H<I;H++){L=Y[H];L=Ca[L];if(L instanceof THREE.Face3){T+=3;ra+=1;Ka+=3}else if(L instanceof THREE.Face4){T+=4;ra+=2;Ka+=4}}H=K;I=G;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;L=[];Ca=0;for(Y=I.materials.length;Ca<Y;Ca++){Ha=
-I.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=H.materials.length;Ha<l;Ha++)(Ga=H.materials[Ha])&&L.push(Ga)}else(Ga=Ha)&&L.push(Ga)}H=L;a:{I=void 0;Ca=void 0;Y=H.length;for(I=0;I<Y;I++){Ca=H[I];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){I=!0;break a}}I=!1}a:{Ca=H;Y=void 0;L=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){L=Ca[Y];if(!(L instanceof THREE.MeshBasicMaterial&&!L.envMap||L instanceof THREE.MeshDepthMaterial)){Ca=L&&L.shading!=undefined&&L.shading==THREE.SmoothShading?
-THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;L=void 0;Ha=H.length;for(Y=0;Y<Ha;Y++){L=H[Y];if(L.vertexColors){L=L.vertexColors;break a}}L=!1}K.__vertexArray=new Float32Array(T*3);if(Ca)K.__normalArray=new Float32Array(T*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(T*4);if(L)K.__colorArray=new Float32Array(T*3);if(I){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(T*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(T*
-2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){K.__skinVertexAArray=new Float32Array(T*4);K.__skinVertexBArray=new Float32Array(T*4);K.__skinIndexArray=new Float32Array(T*4);K.__skinWeightArray=new Float32Array(T*4)}K.__faceArray=new Uint16Array(ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ka*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];Z=0;for(Y=K.numMorphTargets;Z<Y;Z++)K.__morphTargetsArrays.push(new Float32Array(T*3))}K.__needsSmoothNormals=
-Ca==THREE.SmoothShading;K.__uvType=I;K.__vertexColorType=L;K.__normalType=Ca;K.__webglFaceCount=ra*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=H.length;Z<Y;Z++)if(H[Z].attributes){K.__webglCustomAttributes={};for(a in H[Z].attributes){I=H[Z].attributes[a];if(!I.__webglInitialized||I.createUniqueBuffers){I.__webglInitialized=!0;ra=1;if(I.type==="v2")ra=2;else if(I.type==="v3")ra=3;else if(I.type==="v4")ra=4;else I.type==="c"&&(ra=3);I.size=ra;I.needsUpdate=
-!0;I.array=new Float32Array(T*ra);I.buffer=e.createBuffer();I.buffer.belongsToAttribute=a}K.__webglCustomAttributes[a]=I}}z.__dirtyVertices=!0;z.__dirtyMorphTargets=!0;z.__dirtyElements=!0;z.__dirtyUvs=!0;z.__dirtyNormals=!0;z.__dirtyTangents=!0;z.__dirtyColors=!0}D instanceof THREE.ShadowVolume?C(x.__webglShadowVolumes,Q,D):C(x.__webglObjects,Q,D)}}else if(D instanceof THREE.LensFlare)C(x.__webglLensFlares,undefined,D);else if(D instanceof THREE.Ribbon){z=D.geometry;if(!z.__webglVertexBuffer){v=
-z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__webglVertexCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.Line){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*
-3);v.__webglLineCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(D instanceof THREE.ParticleSystem){z=D.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;Q=v.vertices.length;v.__vertexArray=new Float32Array(Q*3);v.__colorArray=new Float32Array(Q*3);v.__sortArray=[];v.__webglParticleCount=Q;z.__dirtyVertices=!0;z.__dirtyColors=!0}C(x.__webglObjects,z,D)}else if(THREE.MarchingCubes!==undefined&&D instanceof
-THREE.MarchingCubes)x.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],count:0}});else D instanceof THREE.Sprite&&x.__webglSprites.push(D);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];x=n;z=void 0;v=void 0;if(D instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){v=x.__webglObjects[z].object;if(D==v){x.__webglObjects.splice(z,1);break}}else if(D instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){v=
-x.__webglSprites[z];if(D==v){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}D=0;for(x=n.__webglObjects.length;D<x;D++)B(n.__webglObjects[D].object,n);D=0;for(x=n.__webglShadowVolumes.length;D<x;D++)B(n.__webglShadowVolumes[D].object,n);D=0;for(x=n.__webglLensFlares.length;D<x;D++)B(n.__webglLensFlares[D].object,n)};this.setFaceCulling=function(n,D){if(n){!D||D=="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.attachShader(Z,la("fragment",prefix_fragment+U));e.attachShader(Z,la("vertex",prefix_vertex+G));e.linkProgram(Z);e.getProgramParameter(Z,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(Z,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");Z.uniforms={};Z.attributes={};var Y;U=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Y in F)U.push(Y);
+Y=U;F=0;for(U=Y.length;F<U;F++){G=Y[F];Z.uniforms[G]=e.getUniformLocation(Z,G)}U=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Y=0;Y<x.maxMorphTargets;Y++)U.push("morphTarget"+Y);for(M in C)U.push(M);M=U;Y=0;for(C=M.length;Y<C;Y++){x=M[Y];Z.attributes[x]=e.getAttribLocation(Z,x)}Da.push({program:Z,code:K});M=Z}n.program=M;M=n.program.attributes;e.enableVertexAttribArray(M.position);M.color>=0&&e.enableVertexAttribArray(M.color);M.normal>=
+0&&e.enableVertexAttribArray(M.normal);M.tangent>=0&&e.enableVertexAttribArray(M.tangent);if(n.skinning&&M.skinVertexA>=0&&M.skinVertexB>=0&&M.skinIndex>=0&&M.skinWeight>=0){e.enableVertexAttribArray(M.skinVertexA);e.enableVertexAttribArray(M.skinVertexB);e.enableVertexAttribArray(M.skinIndex);e.enableVertexAttribArray(M.skinWeight)}for(z in n.attributes)M[z]>=0&&e.enableVertexAttribArray(M[z]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(M.morphTarget0>=0){e.enableVertexAttribArray(M.morphTarget0);
+n.numSupportedMorphTargets++}if(M.morphTarget1>=0){e.enableVertexAttribArray(M.morphTarget1);n.numSupportedMorphTargets++}if(M.morphTarget2>=0){e.enableVertexAttribArray(M.morphTarget2);n.numSupportedMorphTargets++}if(M.morphTarget3>=0){e.enableVertexAttribArray(M.morphTarget3);n.numSupportedMorphTargets++}if(M.morphTarget4>=0){e.enableVertexAttribArray(M.morphTarget4);n.numSupportedMorphTargets++}if(M.morphTarget5>=0){e.enableVertexAttribArray(M.morphTarget5);n.numSupportedMorphTargets++}if(M.morphTarget6>=
+0){e.enableVertexAttribArray(M.morphTarget6);n.numSupportedMorphTargets++}if(M.morphTarget7>=0){e.enableVertexAttribArray(M.morphTarget7);n.numSupportedMorphTargets++}v.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(z=this.maxMorphTargets;n<z;n++)v.__webglMorphTargetInfluences[n]=0}};this.render=function(n,C,x,v){var z,P,K,F,U,G,J,M,Z=n.lights,Y=n.fog;ea.data.vertices=0;ea.data.faces=0;ea.data.drawCalls=0;C.matrixAutoUpdate&&C.update(undefined,!0);n.update(undefined,!1,
+C);C.matrixWorldInverse.flattenToArray(Za);C.projectionMatrix.flattenToArray(Xa);Ja.multiply(C.projectionMatrix,C.matrixWorldInverse);k(Ja);this.initWebGLObjects(n);qa(x);(this.autoClear||v)&&this.clear();U=n.__webglObjects.length;for(v=0;v<U;v++){z=n.__webglObjects[v];J=z.object;if(J.visible)if(!(J instanceof THREE.Mesh)||m(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);H(J,C);p(z);z.render=!0;if(this.sortObjects){Ta.copy(J.position);Ja.multiplyVector3(Ta);z.z=Ta.z}}else z.render=!1;else z.render=
+!1}this.sortObjects&&n.__webglObjects.sort(y);G=n.__webglObjectsImmediate.length;for(v=0;v<G;v++){z=n.__webglObjectsImmediate[v];J=z.object;if(J.visible){J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray);H(J,C);t(z)}}R(THREE.NormalBlending);for(v=0;v<U;v++){z=n.__webglObjects[v];if(z.render){J=z.object;M=z.buffer;K=z.opaque;h(J);for(z=0;z<K.count;z++){F=K.list[z];j(F.depthTest);f(C,Z,Y,F,M,J)}}}for(v=0;v<G;v++){z=n.__webglObjectsImmediate[v];J=z.object;if(J.visible){K=z.opaque;
+h(J);for(z=0;z<K.count;z++){F=K.list[z];j(F.depthTest);P=c(C,Z,Y,F,J);J.render(function(sa){g(sa,P,F.shading)})}}}for(v=0;v<U;v++){z=n.__webglObjects[v];if(z.render){J=z.object;M=z.buffer;K=z.transparent;h(J);for(z=0;z<K.count;z++){F=K.list[z];R(F.blending);j(F.depthTest);f(C,Z,Y,F,M,J)}}}for(v=0;v<G;v++){z=n.__webglObjectsImmediate[v];J=z.object;if(J.visible){K=z.transparent;h(J);for(z=0;z<K.count;z++){F=K.list[z];R(F.blending);j(F.depthTest);P=c(C,Z,Y,F,J);J.render(function(sa){g(sa,P,F.shading)})}}}n.__webglSprites.length&&
+A(n,C);stencil&&n.__webglShadowVolumes.length&&n.lights.length&&u(n);n.__webglLensFlares.length&&I(n,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(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=[]}for(;n.__objectsAdded.length;){var C=
+n.__objectsAdded[0],x=n,v=void 0,z=void 0,P=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(v in z.geometryGroups){P=z.geometryGroups[v];if(!P.__webglVertexBuffer){var K=P;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=
+e.createBuffer();K.__webglTangentBuffer=e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var F=void 0,U=void 0;K.__webglMorphTargetsBuffers=[];F=0;for(U=
+K.numMorphTargets;F<U;F++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=P;F=C;var G=void 0,J=void 0,M=void 0;M=void 0;var Z=void 0,Y=void 0,sa=void 0,Ka=sa=U=0;J=void 0;M=void 0;var Ca=void 0;G=void 0;J=void 0;Z=F.geometry;Ca=Z.faces;Y=K.faces;G=0;for(J=Y.length;G<J;G++){M=Y[G];M=Ca[M];if(M instanceof THREE.Face3){U+=3;sa+=1;Ka+=3}else if(M instanceof THREE.Face4){U+=4;sa+=2;Ka+=4}}G=K;J=F;Ca=void 0;Y=void 0;var Ha=void 0,Ga=void 0;Ha=void 0;M=[];Ca=0;for(Y=J.materials.length;Ca<Y;Ca++){Ha=
+J.materials[Ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=G.materials.length;Ha<l;Ha++)(Ga=G.materials[Ha])&&M.push(Ga)}else(Ga=Ha)&&M.push(Ga)}G=M;a:{J=void 0;Ca=void 0;Y=G.length;for(J=0;J<Y;J++){Ca=G[J];if(Ca.map||Ca.lightMap||Ca instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{Ca=G;Y=void 0;M=void 0;Ha=Ca.length;for(Y=0;Y<Ha;Y++){M=Ca[Y];if(!(M instanceof THREE.MeshBasicMaterial&&!M.envMap||M instanceof THREE.MeshDepthMaterial)){Ca=M&&M.shading!=undefined&&M.shading==THREE.SmoothShading?
+THREE.SmoothShading:THREE.FlatShading;break a}}Ca=!1}a:{Y=void 0;M=void 0;Ha=G.length;for(Y=0;Y<Ha;Y++){M=G[Y];if(M.vertexColors){M=M.vertexColors;break a}}M=!1}K.__vertexArray=new Float32Array(U*3);if(Ca)K.__normalArray=new Float32Array(U*3);if(Z.hasTangents)K.__tangentArray=new Float32Array(U*4);if(M)K.__colorArray=new Float32Array(U*3);if(J){if(Z.faceUvs.length>0||Z.faceVertexUvs.length>0)K.__uvArray=new Float32Array(U*2);if(Z.faceUvs.length>1||Z.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(U*
+2)}if(F.geometry.skinWeights.length&&F.geometry.skinIndices.length){K.__skinVertexAArray=new Float32Array(U*4);K.__skinVertexBArray=new Float32Array(U*4);K.__skinIndexArray=new Float32Array(U*4);K.__skinWeightArray=new Float32Array(U*4)}K.__faceArray=new Uint16Array(sa*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(Ka*2);if(K.numMorphTargets){K.__morphTargetsArrays=[];Z=0;for(Y=K.numMorphTargets;Z<Y;Z++)K.__morphTargetsArrays.push(new Float32Array(U*3))}K.__needsSmoothNormals=
+Ca==THREE.SmoothShading;K.__uvType=J;K.__vertexColorType=M;K.__normalType=Ca;K.__webglFaceCount=sa*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0);K.__webglLineCount=Ka*2;Z=0;for(Y=G.length;Z<Y;Z++)if(G[Z].attributes){K.__webglCustomAttributes={};for(a in G[Z].attributes){J=G[Z].attributes[a];if(!J.__webglInitialized||J.createUniqueBuffers){J.__webglInitialized=!0;sa=1;if(J.type==="v2")sa=2;else if(J.type==="v3")sa=3;else if(J.type==="v4")sa=4;else J.type==="c"&&(sa=3);J.size=sa;J.needsUpdate=
+!0;J.array=new Float32Array(U*sa);J.buffer=e.createBuffer();J.buffer.belongsToAttribute=a}K.__webglCustomAttributes[a]=J}}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?D(x.__webglShadowVolumes,P,C):D(x.__webglObjects,P,C)}}else if(C instanceof THREE.LensFlare)D(x.__webglLensFlares,undefined,C);else if(C instanceof THREE.Ribbon){z=C.geometry;if(!z.__webglVertexBuffer){v=
+z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;P=v.vertices.length;v.__vertexArray=new Float32Array(P*3);v.__colorArray=new Float32Array(P*3);v.__webglVertexCount=P;z.__dirtyVertices=!0;z.__dirtyColors=!0}D(x.__webglObjects,z,C)}else if(C instanceof THREE.Line){z=C.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;P=v.vertices.length;v.__vertexArray=new Float32Array(P*3);v.__colorArray=new Float32Array(P*
+3);v.__webglLineCount=P;z.__dirtyVertices=!0;z.__dirtyColors=!0}D(x.__webglObjects,z,C)}else if(C instanceof THREE.ParticleSystem){z=C.geometry;if(!z.__webglVertexBuffer){v=z;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=z;P=v.vertices.length;v.__vertexArray=new Float32Array(P*3);v.__colorArray=new Float32Array(P*3);v.__sortArray=[];v.__webglParticleCount=P;z.__dirtyVertices=!0;z.__dirtyColors=!0}D(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);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];x=n;z=void 0;v=void 0;if(C instanceof THREE.Mesh)for(z=x.__webglObjects.length-1;z>=0;z--){v=x.__webglObjects[z].object;if(C==v){x.__webglObjects.splice(z,1);break}}else if(C instanceof THREE.Sprite)for(z=x.__webglSprites.length-1;z>=0;z--){v=
+x.__webglSprites[z];if(C==v){x.__webglSprites.splice(z,1);break}}n.__objectsRemoved.splice(0,1)}C=0;for(x=n.__webglObjects.length;C<x;C++)B(n.__webglObjects[C].object,n);C=0;for(x=n.__webglShadowVolumes.length;C<x;C++)B(n.__webglShadowVolumes[C].object,n);C=0;for(x=n.__webglLensFlares.length;C<x;C++)B(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,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
 undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
@@ -342,24 +342,24 @@ THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.AnimationHandler=function(){var b=[],d={},c={};c.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};c.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};c.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};c.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[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 m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++){var o=g.hierarchy[h].keys[j].morphTargets[m];k[o]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var p=
-{};for(o in k){for(m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++)if(g.hierarchy[h].keys[j].morphTargets[m]===o){p[o]=g.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===g.hierarchy[h].keys[j].morphTargets.length&&(p[o]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=p}}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 o=g.hierarchy[h].keys[j].morphTargets[m];k[o]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var t=
+{};for(o in k){for(m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++)if(g.hierarchy[h].keys[j].morphTargets[m]===o){t[o]=g.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===g.hierarchy[h].keys[j].morphTargets.length&&(t[o]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=t}}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}};c.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};c.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)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(b,d,c,f){this.root=b;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=d!==undefined?d:0;var c,f=this.hierarchy.length,g;for(c=0;c<f;c++){g=this.hierarchy[c];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[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.scl=this.getNextKeyWith("scl",c,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 d=["pos","rot","scl"],c,f,g,h,j,k,m,o,p=this.data.JIT.hierarchy,t,y;this.currentTime+=b*this.timeScale;y=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,A=this.hierarchy.length;u<A;u++){b=this.hierarchy[u];m=b.animationCache;if(this.JITCompile&&p[u][o]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=p[u][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
-!1}else{b.matrix=p[u][o];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++){c=d[F];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(t<y)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(c,u,1);k.time<t;){j=k;k=this.getNextKeyWith(c,u,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,u,k.index+1)}while(k.time<
-t)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.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 d=["pos","rot","scl"],c,f,g,h,j,k,m,o,t=this.data.JIT.hierarchy,p,y;this.currentTime+=b*this.timeScale;y=this.currentTime;p=this.currentTime%=this.data.length;o=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,A=this.hierarchy.length;u<A;u++){b=this.hierarchy[u];m=b.animationCache;if(this.JITCompile&&t[u][o]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=t[u][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
+!1}else{b.matrix=t[u][o];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 I=0;I<3;I++){c=d[I];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(p<y)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(c,u,1);k.time<p;){j=k;k=this.getNextKeyWith(c,u,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,u,k.index+1)}while(k.time<
+p)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(p-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.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",u,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.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(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&p[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u<this.hierarchy.length;u++)p[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+"rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&t[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u<this.hierarchy.length;u++)t[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var c=[],f=[],g,h,j,k,m,o;g=(b.length-1)*d;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>b.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];k=b[c[1]];m=b[c[2]];o=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],m[0],o[0],g,c,j);f[1]=this.interpolate(h[1],k[1],m[1],o[1],g,c,j);f[2]=this.interpolate(h[2],k[2],m[2],o[2],g,c,j);return f};
 THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d)*0.5;return(2*(d-c)+b+f)*j+(-3*(d-c)-2*b-f)*h+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]};
-var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,o=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var p=0,t=j.length;p<t;p++){var y=new THREE.Vertex(j[p].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}p=0;for(t=m.length;p<t;p++){j=m[p];var u,A,F=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)u=new THREE.Face3(j.a+f,j.b+f,j.c+
-f);else j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);c=0;for(h=F.length;c<h;c++){A=F[c];u.vertexNormals.push(A.clone())}u.color.copy(j.color);c=0;for(h=y.length;c<h;c++){A=y[c];u.vertexColors.push(A.clone())}u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}p=0;for(t=g.length;p<t;p++){f=g[p];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));o.push(k)}}};
+var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,o=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var t=0,p=j.length;t<p;t++){var y=new THREE.Vertex(j[t].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}t=0;for(p=m.length;t<p;t++){j=m[t];var u,A,I=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)u=new THREE.Face3(j.a+f,j.b+f,j.c+
+f);else j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);c=0;for(h=I.length;c<h;c++){A=I[c];u.vertexNormals.push(A.clone())}u.color.copy(j.color);c=0;for(h=y.length;c<h;c++){A=y[c];u.vertexColors.push(A.clone())}u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}t=0;for(p=g.length;t<p;t++){f=g[t];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));o.push(k)}}};
 THREE.ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=new THREE.Texture(f,d);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.src=b;return g},loadTextureCube:function(b,d,c){var f,g=[],h=new THREE.Texture(g,d);d=g.loadCount=0;for(f=b.length;d<f;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)};g[d].src=b[d]}return h}};
 THREE.SceneUtils={addMesh:function(b,d,c,f,g,h,j,k,m,o){d=new THREE.Mesh(d,o);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=m;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,1,null,!0),c);b.addObject(d);
 return d},addPanoramaCube:function(b,d,c){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,f,!0),
@@ -385,15 +385,15 @@ this.activeLook||(f=0);this.lon+=this.mouseX*f;this.lookVertical&&(this.lat-=thi
 (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;c=this.target.position;g=this.position;c.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=g.y+100*Math.cos(this.phi);c.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,
 this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(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,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
-THREE.PathCamera=function(b){function d(o,p,t,y){var u={name:t,fps:0.6,length:y,hierarchy:[]},A,F=p.getControlPointsArray(),J=p.getLength(),B=F.length,U=0;A=B-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:y,pos:F[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<B-1;A++){U=y*J.chunks[A]/J.total;p.keys[A]={time:U,pos:F[A]}}u.hierarchy[0]=p;THREE.AnimationHandler.add(u);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,p){var t,
-y,u=new THREE.Geometry;for(t=0;t<o.points.length*p;t++){y=t/(o.points.length*p);y=o.getPoint(y);u.vertices[t]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(o,p){var t=c(p,10),y=c(p,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,u);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new THREE.Sphere(1,
-16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(y,u);t.position.copy(p.points[i]);t.updateMatrix();o.addChild(t)}}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=
+THREE.PathCamera=function(b){function d(o,t,p,y){var u={name:p,fps:0.6,length:y,hierarchy:[]},A,I=t.getControlPointsArray(),H=t.getLength(),B=I.length,W=0;A=B-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:I[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:I[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<B-1;A++){W=y*H.chunks[A]/H.total;t.keys[A]={time:W,pos:I[A]}}u.hierarchy[0]=t;THREE.AnimationHandler.add(u);return new THREE.Animation(o,p,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,t){var p,
+y,u=new THREE.Geometry;for(p=0;p<o.points.length*t;p++){y=p/(o.points.length*t);y=o.getPoint(y);u.vertices[p]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return u}function f(o,t){var p=c(t,10),y=c(t,10),u=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(p,u);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new THREE.Sphere(1,
+16,8);u=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){p=new THREE.Mesh(y,u);p.position.copy(t.points[i]);p.updateMatrix();o.addChild(p)}}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(o,p,t){var y,u;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;u=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[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,o,p,t)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+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(o,t,p){var y,u;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;u=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[0];y=this.horizontalAngleMap.srcRange;u=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(u[1]-u[0])/(y[1]-y[0])+u[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,o,t,p)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.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 THREE.Cube(10,10,20),m=new THREE.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=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=
-d(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(o,p){return function(){p.apply(o,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;
+d(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(o,t){return function(){t.apply(o,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
 b.autoForward;if(b.domElement!==undefined)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(c){if(typeof this[c.type]=="function")this[c.type](c)};this.keydown=function(c){if(!c.altKey){switch(c.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
@@ -404,91 +404,91 @@ this.rollSpeed;this.translateX(this.moveVector.x*c);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-c+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",d(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",d(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",d(this,this.mouseup),!1);window.addEventListener("keydown",d(this,this.keydown),!1);window.addEventListener("keyup",d(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,p=0,t=0,y=0,u=0,A=0,F=window.innerWidth/2,J=window.innerHeight/2;this.update=
-function(){var B=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=B;this.delta=(B-this.lastUpdate)/1E3;this.lastUpdate=B;if(this.mouseLook){B=this.delta*this.lookSpeed;this.rotateHorizontally(B*u);this.rotateVertically(B*A)}B=this.delta*this.movementSpeed;this.translateZ(B*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(B*t);this.translateY(B*y);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
+THREE.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,t=0,p=0,y=0,u=0,A=0,I=window.innerWidth/2,H=window.innerHeight/2;this.update=
+function(){var B=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=B;this.delta=(B-this.lastUpdate)/1E3;this.lastUpdate=B;if(this.mouseLook){B=this.delta*this.lookSpeed;this.rotateHorizontally(B*u);this.rotateVertically(B*A)}B=this.delta*this.movementSpeed;this.translateZ(B*(t>0||this.autoForward&&!(t<0)?1:t));this.translateX(B*p);this.translateY(B*y);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
 this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(B){this.position.x+=this.matrix.n11*B;this.position.y+=this.matrix.n21*B;this.position.z+=this.matrix.n31*B};this.translateY=function(B){this.position.x+=this.matrix.n12*B;this.position.y+=this.matrix.n22*B;this.position.z+=this.matrix.n32*B};this.translateZ=function(B){this.position.x-=this.matrix.n13*B;this.position.y-=
 this.matrix.n23*B;this.position.z-=this.matrix.n33*B};this.rotateHorizontally=function(B){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(B);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(B){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(B);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(B){B.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(B){u=(B.clientX-F)/window.innerWidth;A=(B.clientY-J)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(B){switch(B.keyCode){case 38:case 87:p=1;break;case 37:case 65:t=-1;break;
-case 40:case 83:p=-1;break;case 39:case 68:t=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:y=1;break;case 70:y=-1}},!1);this.domElement.addEventListener("keyup",function(B){switch(B.keyCode){case 38:case 87:p=0;break;case 37:case 65:t=0;break;case 40:case 83:p=0;break;case 39:case 68:t=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+function(B){u=(B.clientX-I)/window.innerWidth;A=(B.clientY-H)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:t=1;break;case 2:t=-1}},!1);this.domElement.addEventListener("mouseup",function(B){B.preventDefault();B.stopPropagation();switch(B.button){case 0:t=0;break;case 2:t=0}},!1);this.domElement.addEventListener("keydown",function(B){switch(B.keyCode){case 38:case 87:t=1;break;case 37:case 65:p=-1;break;
+case 40:case 83:t=-1;break;case 39:case 68:p=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:y=1;break;case 70:y=-1}},!1);this.domElement.addEventListener("keyup",function(B){switch(B.keyCode){case 38:case 87:t=0;break;case 37:case 65:p=0;break;case 40:case 83:t=0;break;case 39:case 68:p=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(J,B,U,C,V,O,M,va){var la,qa,ga=f||1,ea=g||1,e=V/2,oa=O/2,Da=p.vertices.length;if(J=="x"&&B=="y"||J=="y"&&B=="x")la="z";else if(J=="x"&&B=="z"||J=="z"&&B=="x"){la="y";ea=h||1}else if(J=="z"&&B=="y"||J=="y"&&B=="z"){la="x";ga=h||1}var Aa=ga+1,da=ea+1;V/=ga;var fa=O/ea;for(qa=0;qa<da;qa++)for(O=0;O<Aa;O++){var wa=new THREE.Vector3;wa[J]=(O*V-e)*U;wa[B]=(qa*fa-oa)*C;wa[la]=M;p.vertices.push(new THREE.Vertex(wa))}for(qa=0;qa<ea;qa++)for(O=0;O<ga;O++){p.faces.push(new THREE.Face4(O+
-Aa*qa+Da,O+Aa*(qa+1)+Da,O+1+Aa*(qa+1)+Da,O+1+Aa*qa+Da,null,null,va));p.faceVertexUvs[0].push([new THREE.UV(O/ga,qa/ea),new THREE.UV(O/ga,(qa+1)/ea),new THREE.UV((O+1)/ga,(qa+1)/ea),new THREE.UV((O+1)/ga,qa/ea)])}}THREE.Geometry.call(this);var p=this,t=b/2,y=d/2,u=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)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&&o("z","y",1*k,-1,c,d,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,t,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,d,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,d,-u,this.materials[5]);(function(){for(var J=[],B=[],U=0,C=p.vertices.length;U<C;U++){for(var V=p.vertices[U],O=!1,M=0,va=J.length;M<va;M++){var la=
-J[M];if(V.position.x==la.position.x&&V.position.y==la.position.y&&V.position.z==la.position.z){B[U]=M;O=!0;break}}if(!O){B[U]=J.length;J.push(new THREE.Vertex(V.position.clone()))}}U=0;for(C=p.faces.length;U<C;U++){V=p.faces[U];V.a=B[V.a];V.b=B[V.b];V.c=B[V.c];V.d=B[V.d]}p.vertices=J})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
-THREE.Cylinder=function(b,d,c,f,g,h){function j(y,u,A){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,u,A)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,p=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-p);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,p);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(c>0){j(0,0,-p-(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(d>0){j(0,0,p+(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++){d=[];c=this.faces[m];g=this.vertices[c.a];h=this.vertices[c.b];p=this.vertices[c.c];var t=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
-f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/f));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
-THREE.Icosahedron=function(b){function d(t,y,u){var A=Math.sqrt(t*t+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(t/A,y/A,u/A)))-1}function c(t,y,u,A){A.faces.push(new THREE.Face3(t,y,u))}function f(t,y){var u=g.vertices[t].position,A=g.vertices[y].position;return d((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
-1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(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),o=f(h.faces[k].b,h.faces[k].c),p=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,p,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
-p,o,j);c(m,o,p,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
+THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(H,B,W,D,R,L,Q,qa){var la,ra,ga=f||1,ea=g||1,e=R/2,oa=L/2,Da=t.vertices.length;if(H=="x"&&B=="y"||H=="y"&&B=="x")la="z";else if(H=="x"&&B=="z"||H=="z"&&B=="x"){la="y";ea=h||1}else if(H=="z"&&B=="y"||H=="y"&&B=="z"){la="x";ga=h||1}var Aa=ga+1,da=ea+1;R/=ga;var fa=L/ea;for(ra=0;ra<da;ra++)for(L=0;L<Aa;L++){var wa=new THREE.Vector3;wa[H]=(L*R-e)*W;wa[B]=(ra*fa-oa)*D;wa[la]=Q;t.vertices.push(new THREE.Vertex(wa))}for(ra=0;ra<ea;ra++)for(L=0;L<ga;L++){t.faces.push(new THREE.Face4(L+
+Aa*ra+Da,L+Aa*(ra+1)+Da,L+1+Aa*(ra+1)+Da,L+1+Aa*ra+Da,null,null,qa));t.faceVertexUvs[0].push([new THREE.UV(L/ga,ra/ea),new THREE.UV(L/ga,(ra+1)/ea),new THREE.UV((L+1)/ga,(ra+1)/ea),new THREE.UV((L+1)/ga,ra/ea)])}}THREE.Geometry.call(this);var t=this,p=b/2,y=d/2,u=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)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 I in m)this.sides[I]!=
+undefined&&(this.sides[I]=m[I]);this.sides.px&&o("z","y",1*k,-1,c,d,-p,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,p,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,d,u,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,d,-u,this.materials[5]);(function(){for(var H=[],B=[],W=0,D=t.vertices.length;W<D;W++){for(var R=t.vertices[W],L=!1,Q=0,qa=H.length;Q<qa;Q++){var la=
+H[Q];if(R.position.x==la.position.x&&R.position.y==la.position.y&&R.position.z==la.position.z){B[W]=Q;L=!0;break}}if(!L){B[W]=H.length;H.push(new THREE.Vertex(R.position.clone()))}}W=0;for(D=t.faces.length;W<D;W++){R=t.faces[W];R.a=B[R.a];R.b=B[R.b];R.c=B[R.c];R.d=B[R.d]}t.vertices=H})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
+THREE.Cylinder=function(b,d,c,f,g,h){function j(y,u,A){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,u,A)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,t=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-t);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,t);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(c>0){j(0,0,-t-(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(d>0){j(0,0,t+(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++){d=[];c=this.faces[m];g=this.vertices[c.a];h=this.vertices[c.b];t=this.vertices[c.c];var p=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/o,0.5+t.position.z/
+f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/f));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
+THREE.Icosahedron=function(b){function d(p,y,u){var A=Math.sqrt(p*p+y*y+u*u);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(p/A,y/A,u/A)))-1}function c(p,y,u,A){A.faces.push(new THREE.Face3(p,y,u))}function f(p,y){var u=g.vertices[p].position,A=g.vertices[y].position;return d((u.x+A.x)/2,(u.y+A.y)/2,(u.z+A.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
+1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(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),o=f(h.faces[k].b,h.faces[k].c),t=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,t,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
+t,o,j);c(m,o,t,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
 THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.0010;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[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-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
 THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),o=[],p=0;for(f=0;f<h;f++){var t=2*f/h,y=m*Math.sin(t*g);t=m*Math.cos(t*g);(c==0||c==j)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,y)))-1);o.push(p)}d.push(o)}var u,A,F;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){o=f==h-1;j=d[c][o?0:f+1];k=d[c][o?h-1:f];m=d[c-1][o?h-1:f];o=d[c-
-1][o?0:f+1];y=c/(g-1);u=(c-1)/(g-1);A=(f+1)/h;t=f/h;p=new THREE.UV(1-A,y);y=new THREE.UV(1-t,y);t=new THREE.UV(1-t,u);var J=new THREE.UV(1-A,u);if(c<d.length-1){u=this.vertices[j].position.clone();A=this.vertices[k].position.clone();F=this.vertices[m].position.clone();u.normalize();A.normalize();F.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([p,y,t])}if(c>1){u=this.vertices[j].position.clone();
-A=this.vertices[m].position.clone();F=this.vertices[o].position.clone();u.normalize();A.normalize();F.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([p,t,J])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),o=[],t=0;for(f=0;f<h;f++){var p=2*f/h,y=m*Math.sin(p*g);p=m*Math.cos(p*g);(c==0||c==j)&&f>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,y)))-1);o.push(t)}d.push(o)}var u,A,I;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){o=f==h-1;j=d[c][o?0:f+1];k=d[c][o?h-1:f];m=d[c-1][o?h-1:f];o=d[c-
+1][o?0:f+1];y=c/(g-1);u=(c-1)/(g-1);A=(f+1)/h;p=f/h;t=new THREE.UV(1-A,y);y=new THREE.UV(1-p,y);p=new THREE.UV(1-p,u);var H=new THREE.UV(1-A,u);if(c<d.length-1){u=this.vertices[j].position.clone();A=this.vertices[k].position.clone();I=this.vertices[m].position.clone();u.normalize();A.normalize();I.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([t,y,p])}if(c>1){u=this.vertices[j].position.clone();
+A=this.vertices[m].position.clone();I=this.vertices[o].position.clone();u.normalize();A.normalize();I.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([t,p,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
 THREE.Torus=function(b,d,c,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/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([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c=
 1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;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()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
-THREE.TorusKnot=function(b,d,c,f,g,h,j){function k(t,y,u,A,F,J){y=u/A*t;u=Math.cos(y);return new THREE.Vector3(F*(2+u)*0.5*Math.cos(t),F*(2+u)*Math.sin(t)*0.5,J*F*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=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(d=0;d<this.segmentsT;++d){var m=
+THREE.TorusKnot=function(b,d,c,f,g,h,j){function k(p,y,u,A,I,H){y=u/A*p;u=Math.cos(y);return new THREE.Vector3(I*(2+u)*0.5*Math.cos(p),I*(2+u)*Math.sin(p)*0.5,H*I*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=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(d=0;d<this.segmentsT;++d){var m=
 b/this.segmentsR*2*this.p*Math.PI;j=d/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);c.x=m.x-g.x;c.y=m.y-g.y;c.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(c,f);f.cross(h,c);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][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(d=
-0;d<this.segmentsT;++d){f=(b+1)%this.segmentsR;h=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);m=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,f,h));this.faceVertexUvs[0].push([j,m,o,p])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+0;d<this.segmentsT;++d){f=(b+1)%this.segmentsR;h=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);m=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT),t=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,f,h));this.faceVertexUvs[0].push([j,m,o,t])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
 THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.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 d="Loaded ";d+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,d,c){b.materials=[];for(var f=0;f<d.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],c)]},createMaterial:function(b,d){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,m){var o=new Image;o.onload=function(){if(!c(this.width)||!c(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),t=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=p;k.image.height=t;k.image.getContext("2d").drawImage(this,0,0,p,t)}else k.image=this;k.needsUpdate=!0};o.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==
+this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,d,c){b.materials=[];for(var f=0;f<d.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],c)]},createMaterial:function(b,d){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,m){var o=new Image;o.onload=function(){if(!c(this.width)||!c(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),p=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=t;k.image.height=p;k.image.getContext("2d").drawImage(this,0,0,t,p)}else k.image=this;k.needsUpdate=!0};o.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||b.opacity<1)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&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+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&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+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 d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry;this.init_materials(f,b.materials,c);(function(){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var g,h,j,k,m,o,p,t,y,u,A,F,J,B,U,C=b.faces;u=b.vertices;var V=b.normals,O=b.colors;o=b.scale!==undefined?b.scale:1;var M=0;for(g=0;g<b.uvs.length;g++)b.uvs[g].length&&M++;for(g=0;g<M;g++){f.faceUvs[g]=[];f.faceVertexUvs[g]=[]}k=0;for(m=u.length;k<m;){p=new THREE.Vertex;p.position.x=u[k++]/
-o;p.position.y=u[k++]/o;p.position.z=u[k++]/o;f.vertices.push(p)}k=0;for(m=C.length;k<m;){u=C[k++];o=u&1;j=u&2;g=u&4;h=u&8;t=u&16;p=u&32;A=u&64;u&=128;if(o){F=new THREE.Face4;F.a=C[k++];F.b=C[k++];F.c=C[k++];F.d=C[k++];o=4}else{F=new THREE.Face3;F.a=C[k++];F.b=C[k++];F.c=C[k++];o=3}if(j){j=C[k++];F.materials=f.materials[j]}j=f.faces.length;if(g)for(g=0;g<M;g++){J=b.uvs[g];y=C[k++];U=J[y*2];y=J[y*2+1];f.faceUvs[g][j]=new THREE.UV(U,y)}if(h)for(g=0;g<M;g++){J=b.uvs[g];B=[];for(h=0;h<o;h++){y=C[k++];
-U=J[y*2];y=J[y*2+1];B[h]=new THREE.UV(U,y)}f.faceVertexUvs[g][j]=B}if(t){t=C[k++]*3;h=new THREE.Vector3;h.x=V[t++];h.y=V[t++];h.z=V[t];F.normal=h}if(p)for(g=0;g<o;g++){t=C[k++]*3;h=new THREE.Vector3;h.x=V[t++];h.y=V[t++];h.z=V[t];F.vertexNormals.push(h)}if(A){p=C[k++];p=new THREE.Color(O[p]);F.color=p}if(u)for(g=0;g<o;g++){p=C[k++];p=new THREE.Color(O[p]);F.vertexColors.push(p)}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,o;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;o=b.morphTargets[g].vertices;
-j=0;for(k=o.length;j<k;j+=3)m.push(new THREE.Vertex(new THREE.Vector3(o[j],o[j+1],o[j+2])))}}if(b.morphColors!==undefined){var p;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=[];m=f.morphColors[g].colors;o=b.morphColors[g].colors;j=0;for(k=o.length;j<k;j+=3){p=new THREE.Color(16755200);p.setRGB(o[j],o[j+1],o[j+2]);m.push(p)}}}})();(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();d(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.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry,g=b.scale!==undefined?b.scale:1;this.init_materials(f,b.materials,c);(function(h){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var j,k,m,o,t,p,y,u,A,I,H,B,W,D,R=b.faces;p=b.vertices;var L=b.normals,Q=b.colors,qa=0;for(j=0;j<b.uvs.length;j++)b.uvs[j].length&&qa++;for(j=0;j<qa;j++){f.faceUvs[j]=[];f.faceVertexUvs[j]=[]}o=0;for(t=p.length;o<t;){y=new THREE.Vertex;y.position.x=p[o++]/
+h;y.position.y=p[o++]/h;y.position.z=p[o++]/h;f.vertices.push(y)}o=0;for(t=R.length;o<t;){h=R[o++];p=h&1;m=h&2;j=h&4;k=h&8;u=h&16;y=h&32;I=h&64;h&=128;if(p){H=new THREE.Face4;H.a=R[o++];H.b=R[o++];H.c=R[o++];H.d=R[o++];p=4}else{H=new THREE.Face3;H.a=R[o++];H.b=R[o++];H.c=R[o++];p=3}if(m){m=R[o++];H.materials=f.materials[m]}m=f.faces.length;if(j)for(j=0;j<qa;j++){B=b.uvs[j];A=R[o++];D=B[A*2];A=B[A*2+1];f.faceUvs[j][m]=new THREE.UV(D,A)}if(k)for(j=0;j<qa;j++){B=b.uvs[j];W=[];for(k=0;k<p;k++){A=R[o++];
+D=B[A*2];A=B[A*2+1];W[k]=new THREE.UV(D,A)}f.faceVertexUvs[j][m]=W}if(u){u=R[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];H.normal=k}if(y)for(j=0;j<p;j++){u=R[o++]*3;k=new THREE.Vector3;k.x=L[u++];k.y=L[u++];k.z=L[u];H.vertexNormals.push(k)}if(I){y=R[o++];y=new THREE.Color(Q[y]);H.color=y}if(h)for(j=0;j<p;j++){y=R[o++];y=new THREE.Color(Q[y]);H.vertexColors.push(y)}f.faces.push(H)}}})(g);(function(){var h,j,k,m;if(b.skinWeights){h=0;for(j=b.skinWeights.length;h<j;h+=2){k=b.skinWeights[h];
+m=b.skinWeights[h+1];f.skinWeights.push(new THREE.Vector4(k,m,0,0))}}if(b.skinIndices){h=0;for(j=b.skinIndices.length;h<j;h+=2){k=b.skinIndices[h];m=b.skinIndices[h+1];f.skinIndices.push(new THREE.Vector4(k,m,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(h){if(b.morphTargets!==undefined){var j,k,m,o,t,p,y,u,A;j=0;for(k=b.morphTargets.length;j<k;j++){f.morphTargets[j]={};f.morphTargets[j].name=b.morphTargets[j].name;f.morphTargets[j].vertices=[];u=f.morphTargets[j].vertices;A=b.morphTargets[j].vertices;
+m=0;for(o=A.length;m<o;m+=3){t=A[m]/h;p=A[m+1]/h;y=A[m+2]/h;u.push(new THREE.Vertex(new THREE.Vector3(t,p,y)))}}}if(b.morphColors!==undefined){j=0;for(k=b.morphColors.length;j<k;j++){f.morphColors[j]={};f.morphColors[j].name=b.morphColors[j].name;f.morphColors[j].colors=[];o=f.morphColors[j].colors;t=b.morphColors[j].colors;h=0;for(m=t.length;h<m;h+=3){p=new THREE.Color(16755200);p.setRGB(t[h],t[h+1],t[h+2]);o.push(p)}}}})(g);(function(){if(b.edges!==undefined){var h,j,k;for(h=0;h<b.edges.length;h+=
+2){j=b.edges[h];k=b.edges[h+1];f.edges.push(new THREE.Edge(f.vertices[j],f.vertices[k],j,k))}}})();f.computeCentroids();f.computeFaceNormals();f.computeEdgeFaces();d(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 d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
 d.postMessage(b)},loadAjaxBuffers:function(b,d,c,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,c,g,d):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,d,c,f){var g=function(h){function j(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2),n=p(R,S+3),D=(n<<1&255|La>>7)-127;P|=(La&127)<<16|Ba<<8;if(P==0&&D==-127)return 0;return(1-2*(n>>7))*(1+P*Math.pow(2,-23))*Math.pow(2,D)}function k(R,S){var P=p(R,S),Ba=p(R,S+1),La=p(R,S+2);return(p(R,S+3)<<24)+(La<<16)+(Ba<<8)+P}function m(R,S){var P=p(R,S);return(p(R,S+1)<<8)+P}function o(R,S){var P=p(R,S);return P>127?P-256:P}function p(R,
-S){return R.charCodeAt(S)&255}function t(R){var S,P,Ba;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);R=m(b,R+la);THREE.BinaryLoader.prototype.f3(B,S,P,Ba,R)}function y(R){var S,P,Ba,La,n,D;S=k(b,R);P=k(b,R+M);Ba=k(b,R+va);La=m(b,R+la);n=k(b,R+qa);D=k(b,R+ga);R=k(b,R+ea);THREE.BinaryLoader.prototype.f3n(B,V,S,P,Ba,La,n,D,R)}function u(R){var S,P,Ba,La;S=k(b,R);P=k(b,R+e);Ba=k(b,R+oa);La=k(b,R+Da);R=m(b,R+Aa);THREE.BinaryLoader.prototype.f4(B,S,P,Ba,La,R)}function A(R){var S,P,Ba,La,n,D,x,v;S=k(b,R);P=k(b,R+e);
-Ba=k(b,R+oa);La=k(b,R+Da);n=m(b,R+Aa);D=k(b,R+da);x=k(b,R+fa);v=k(b,R+wa);R=k(b,R+ta);THREE.BinaryLoader.prototype.f4n(B,V,S,P,Ba,La,n,D,x,v,R)}function F(R){var S,P;S=k(b,R);P=k(b,R+pa);R=k(b,R+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[R*2],O[R*2+1])}function J(R){var S,P,Ba;S=k(b,R);P=k(b,R+ka);Ba=k(b,R+ma);R=k(b,R+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],O[S*2],O[S*2+1],O[P*2],O[P*2+1],O[Ba*2],O[Ba*2+1],O[R*2],O[R*2+1])}var B=this,
-U=0,C,V=[],O=[],M,va,la,qa,ga,ea,e,oa,Da,Aa,da,fa,wa,ta,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);C={signature:b.substr(U,8),header_bytes:p(b,U+8),vertex_coordinate_bytes:p(b,U+9),normal_coordinate_bytes:p(b,U+10),uv_coordinate_bytes:p(b,U+11),vertex_index_bytes:p(b,U+12),normal_index_bytes:p(b,U+13),uv_index_bytes:p(b,U+14),material_index_bytes:p(b,U+15),nvertices:k(b,U+16),nnormals:k(b,U+16+4),nuvs:k(b,U+16+8),ntri_flat:k(b,U+16+12),
-ntri_smooth:k(b,U+16+16),ntri_flat_uv:k(b,U+16+20),ntri_smooth_uv:k(b,U+16+24),nquad_flat:k(b,U+16+28),nquad_smooth:k(b,U+16+32),nquad_flat_uv:k(b,U+16+36),nquad_smooth_uv:k(b,U+16+40)};U+=C.header_bytes;M=C.vertex_index_bytes;va=C.vertex_index_bytes*2;la=C.vertex_index_bytes*3;qa=C.vertex_index_bytes*3+C.material_index_bytes;ga=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;ea=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;e=C.vertex_index_bytes;oa=C.vertex_index_bytes*
-2;Da=C.vertex_index_bytes*3;Aa=C.vertex_index_bytes*4;da=C.vertex_index_bytes*4+C.material_index_bytes;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;wa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ta=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;pa=C.uv_index_bytes;ca=C.uv_index_bytes*2;ka=C.uv_index_bytes;ma=C.uv_index_bytes*2;Fa=C.uv_index_bytes*3;h=C.vertex_index_bytes*3+C.material_index_bytes;Ta=C.vertex_index_bytes*4+C.material_index_bytes;
-ja=C.ntri_flat*h;ha=C.ntri_smooth*(h+C.normal_index_bytes*3);Ja=C.ntri_flat_uv*(h+C.uv_index_bytes*3);Xa=C.ntri_smooth_uv*(h+C.normal_index_bytes*3+C.uv_index_bytes*3);Za=C.nquad_flat*Ta;h=C.nquad_smooth*(Ta+C.normal_index_bytes*4);Ta=C.nquad_flat_uv*(Ta+C.uv_index_bytes*4);U+=function(R){for(var S,P,Ba,La=C.vertex_coordinate_bytes*3,n=R+C.nvertices*La;R<n;R+=La){S=j(b,R);P=j(b,R+C.vertex_coordinate_bytes);Ba=j(b,R+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,S,P,Ba)}return C.nvertices*
-La}(U);U+=function(R){for(var S,P,Ba,La=C.normal_coordinate_bytes*3,n=R+C.nnormals*La;R<n;R+=La){S=o(b,R);P=o(b,R+C.normal_coordinate_bytes);Ba=o(b,R+C.normal_coordinate_bytes*2);V.push(S/127,P/127,Ba/127)}return C.nnormals*La}(U);U+=function(R){for(var S,P,Ba=C.uv_coordinate_bytes*2,La=R+C.nuvs*Ba;R<La;R+=Ba){S=j(b,R);P=j(b,R+C.uv_coordinate_bytes);O.push(S,P)}return C.nuvs*Ba}(U);ja=U+ja;ha=ja+ha;Ja=ha+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,
-Ba=P+C.uv_index_bytes*3,La=R+C.ntri_flat_uv*Ba;for(S=R;S<La;S+=Ba){t(S);F(S+P)}return La-R})(ha);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=P+C.uv_index_bytes*3,La=R+C.ntri_smooth_uv*Ba;for(S=R;S<La;S+=Ba){y(S);F(S+P)}return La-R})(Ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_flat_uv*Ba;for(S=R;S<La;S+=Ba){u(S);J(S+P)}return La-R})(h);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+
-C.normal_index_bytes*4,Ba=P+C.uv_index_bytes*4,La=R+C.nquad_smooth_uv*Ba;for(S=R;S<La;S+=Ba){A(S);J(S+P)}return La-R})(Ta);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes,Ba=R+C.ntri_flat*P;for(S=R;S<Ba;S+=P)t(S);return Ba-R})(U);(function(R){var S,P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,Ba=R+C.ntri_smooth*P;for(S=R;S<Ba;S+=P)y(S);return Ba-R})(ja);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes,Ba=R+C.nquad_flat*P;for(S=R;S<Ba;S+=
-P)u(S);return Ba-R})(Xa);(function(R){var S,P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,Ba=R+C.nquad_smooth*P;for(S=R;S<Ba;S+=P)A(S);return Ba-R})(Za);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,
-c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var o=d[k*3],p=d[k*3+1];k=d[k*3+2];var t=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(t,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,p){j=b.materials[j];var t=d[m*3],y=d[m*3+1];m=d[m*3+2];var u=d[o*3],A=d[o*3+1];o=d[o*3+2];var F=d[p*3],J=d[p*3+1];p=d[p*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*
-3],d[k*3+1],d[k*3+2]),new THREE.Vector3(t,y,m),new THREE.Vector3(u,A,o),new THREE.Vector3(F,J,p)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(S,T){var O=t(S,T),Ba=t(S,T+1),La=t(S,T+2),n=t(S,T+3),C=(n<<1&255|La>>7)-127;O|=(La&127)<<16|Ba<<8;if(O==0&&C==-127)return 0;return(1-2*(n>>7))*(1+O*Math.pow(2,-23))*Math.pow(2,C)}function k(S,T){var O=t(S,T),Ba=t(S,T+1),La=t(S,T+2);return(t(S,T+3)<<24)+(La<<16)+(Ba<<8)+O}function m(S,T){var O=t(S,T);return(t(S,T+1)<<8)+O}function o(S,T){var O=t(S,T);return O>127?O-256:O}function t(S,
+T){return S.charCodeAt(T)&255}function p(S){var T,O,Ba;T=k(b,S);O=k(b,S+Q);Ba=k(b,S+qa);S=m(b,S+la);THREE.BinaryLoader.prototype.f3(B,T,O,Ba,S)}function y(S){var T,O,Ba,La,n,C;T=k(b,S);O=k(b,S+Q);Ba=k(b,S+qa);La=m(b,S+la);n=k(b,S+ra);C=k(b,S+ga);S=k(b,S+ea);THREE.BinaryLoader.prototype.f3n(B,R,T,O,Ba,La,n,C,S)}function u(S){var T,O,Ba,La;T=k(b,S);O=k(b,S+e);Ba=k(b,S+oa);La=k(b,S+Da);S=m(b,S+Aa);THREE.BinaryLoader.prototype.f4(B,T,O,Ba,La,S)}function A(S){var T,O,Ba,La,n,C,x,v;T=k(b,S);O=k(b,S+e);
+Ba=k(b,S+oa);La=k(b,S+Da);n=m(b,S+Aa);C=k(b,S+da);x=k(b,S+fa);v=k(b,S+wa);S=k(b,S+ua);THREE.BinaryLoader.prototype.f4n(B,R,T,O,Ba,La,n,C,x,v,S)}function I(S){var T,O;T=k(b,S);O=k(b,S+pa);S=k(b,S+ca);THREE.BinaryLoader.prototype.uv3(B.faceVertexUvs[0],L[T*2],L[T*2+1],L[O*2],L[O*2+1],L[S*2],L[S*2+1])}function H(S){var T,O,Ba;T=k(b,S);O=k(b,S+ka);Ba=k(b,S+ma);S=k(b,S+Fa);THREE.BinaryLoader.prototype.uv4(B.faceVertexUvs[0],L[T*2],L[T*2+1],L[O*2],L[O*2+1],L[Ba*2],L[Ba*2+1],L[S*2],L[S*2+1])}var B=this,
+W=0,D,R=[],L=[],Q,qa,la,ra,ga,ea,e,oa,Da,Aa,da,fa,wa,ua,pa,ca,ka,ma,Fa,ja,ha,Ja,Xa,Za,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(B,f,h);D={signature:b.substr(W,8),header_bytes:t(b,W+8),vertex_coordinate_bytes:t(b,W+9),normal_coordinate_bytes:t(b,W+10),uv_coordinate_bytes:t(b,W+11),vertex_index_bytes:t(b,W+12),normal_index_bytes:t(b,W+13),uv_index_bytes:t(b,W+14),material_index_bytes:t(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+=D.header_bytes;Q=D.vertex_index_bytes;qa=D.vertex_index_bytes*2;la=D.vertex_index_bytes*3;ra=D.vertex_index_bytes*3+D.material_index_bytes;ga=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;ea=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;e=D.vertex_index_bytes;oa=D.vertex_index_bytes*
+2;Da=D.vertex_index_bytes*3;Aa=D.vertex_index_bytes*4;da=D.vertex_index_bytes*4+D.material_index_bytes;fa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;wa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ua=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;pa=D.uv_index_bytes;ca=D.uv_index_bytes*2;ka=D.uv_index_bytes;ma=D.uv_index_bytes*2;Fa=D.uv_index_bytes*3;h=D.vertex_index_bytes*3+D.material_index_bytes;Ta=D.vertex_index_bytes*4+D.material_index_bytes;
+ja=D.ntri_flat*h;ha=D.ntri_smooth*(h+D.normal_index_bytes*3);Ja=D.ntri_flat_uv*(h+D.uv_index_bytes*3);Xa=D.ntri_smooth_uv*(h+D.normal_index_bytes*3+D.uv_index_bytes*3);Za=D.nquad_flat*Ta;h=D.nquad_smooth*(Ta+D.normal_index_bytes*4);Ta=D.nquad_flat_uv*(Ta+D.uv_index_bytes*4);W+=function(S){for(var T,O,Ba,La=D.vertex_coordinate_bytes*3,n=S+D.nvertices*La;S<n;S+=La){T=j(b,S);O=j(b,S+D.vertex_coordinate_bytes);Ba=j(b,S+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(B,T,O,Ba)}return D.nvertices*
+La}(W);W+=function(S){for(var T,O,Ba,La=D.normal_coordinate_bytes*3,n=S+D.nnormals*La;S<n;S+=La){T=o(b,S);O=o(b,S+D.normal_coordinate_bytes);Ba=o(b,S+D.normal_coordinate_bytes*2);R.push(T/127,O/127,Ba/127)}return D.nnormals*La}(W);W+=function(S){for(var T,O,Ba=D.uv_coordinate_bytes*2,La=S+D.nuvs*Ba;S<La;S+=Ba){T=j(b,S);O=j(b,S+D.uv_coordinate_bytes);L.push(T,O)}return D.nuvs*Ba}(W);ja=W+ja;ha=ja+ha;Ja=ha+Ja;Xa=Ja+Xa;Za=Xa+Za;h=Za+h;Ta=h+Ta;(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes,
+Ba=O+D.uv_index_bytes*3,La=S+D.ntri_flat_uv*Ba;for(T=S;T<La;T+=Ba){p(T);I(T+O)}return La-S})(ha);(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Ba=O+D.uv_index_bytes*3,La=S+D.ntri_smooth_uv*Ba;for(T=S;T<La;T+=Ba){y(T);I(T+O)}return La-S})(Ja);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes,Ba=O+D.uv_index_bytes*4,La=S+D.nquad_flat_uv*Ba;for(T=S;T<La;T+=Ba){u(T);H(T+O)}return La-S})(h);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes+
+D.normal_index_bytes*4,Ba=O+D.uv_index_bytes*4,La=S+D.nquad_smooth_uv*Ba;for(T=S;T<La;T+=Ba){A(T);H(T+O)}return La-S})(Ta);(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes,Ba=S+D.ntri_flat*O;for(T=S;T<Ba;T+=O)p(T);return Ba-S})(W);(function(S){var T,O=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Ba=S+D.ntri_smooth*O;for(T=S;T<Ba;T+=O)y(T);return Ba-S})(ja);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes,Ba=S+D.nquad_flat*O;for(T=S;T<Ba;T+=
+O)u(T);return Ba-S})(Xa);(function(S){var T,O=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Ba=S+D.nquad_smooth*O;for(T=S;T<Ba;T+=O)A(T);return Ba-S})(Za);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,
+c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var o=d[k*3],t=d[k*3+1];k=d[k*3+2];var p=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(o,t,k),new THREE.Vector3(p,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,t){j=b.materials[j];var p=d[m*3],y=d[m*3+1];m=d[m*3+2];var u=d[o*3],A=d[o*3+1];o=d[o*3+2];var I=d[t*3],H=d[t*3+1];t=d[t*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*
+3],d[k*3+1],d[k*3+2]),new THREE.Vector3(p,y,m),new THREE.Vector3(u,A,o),new THREE.Vector3(I,H,t)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,m));b.push(o)}};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(pa,ca){return ca=="relativeToHTML"?pa:g+"/"+pa}function k(){for(u in ga.objects)if(!da.objects[u]){U=ga.objects[u];if(U.geometry!==undefined){if(M=da.geometries[U.geometry]){qa=[];for(ta=0;ta<U.materials.length;ta++)qa[ta]=da.materials[U.materials[ta]];C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;qa.length==0&&(qa[0]=
-new THREE.MeshFaceMaterial);qa.length>1&&(qa=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,qa);object.name=u;object.position.set(C[0],C[1],C[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=U.visible;da.scene.addObject(object);da.objects[u]=object;if(U.meshCollider){var pa=THREE.CollisionUtils.MeshColliderWBox(object);da.scene.collisions.colliders.push(pa)}if(U.castsShadow){pa=
-new THREE.ShadowVolume(M);da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}U.trigger&&U.trigger.toLowerCase()!="none"&&(da.triggers[object.name]={type:U.trigger,object:U})}}else{C=U.position;r=U.rotation;q=U.quaternion;s=U.scale;q=0;object=new THREE.Object3D;object.name=u;object.position.set(C[0],C[1],C[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=U.visible!==undefined?U.visible:!1;da.scene.addObject(object);da.objects[u]=object;da.empties[u]=object}}}function m(pa){return function(ca){da.geometries[pa]=ca;k();e-=1;c.onLoadComplete();p()}}function o(pa){return function(ca){da.geometries[pa]=ca}}function p(){c.callbackProgress({totalModels:Da,totalTextures:Aa,loadedModels:Da-e,loadedTextures:Aa-oa},da);c.onLoadProgress();e==0&&oa==0&&d(da)}var t,y,u,A,F,J,B,U,C,V,O,M,va,la,qa,ga,ea,e,oa,Da,Aa,da;ga=h.data;h=new THREE.BinaryLoader;
-ea=new THREE.JSONLoader;oa=e=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var fa=!1;for(u in ga.objects){U=ga.objects[u];if(U.meshCollider){fa=!0;break}}if(fa)da.scene.collisions=new THREE.CollisionSystem;if(ga.transform){fa=ga.transform.position;V=ga.transform.rotation;var wa=ga.transform.scale;fa&&da.scene.position.set(fa[0],fa[1],fa[2]);V&&da.scene.rotation.set(V[0],V[1],V[2]);wa&&da.scene.scale.set(wa[0],wa[1],
-wa[2]);(fa||V||wa)&&da.scene.updateMatrix()}fa=function(){oa-=1;p();c.onLoadComplete()};for(F in ga.cameras){V=ga.cameras[F];if(V.type=="perspective")va=new THREE.Camera(V.fov,V.aspect,V.near,V.far);else if(V.type=="ortho"){va=new THREE.Camera;va.projectionMatrix=THREE.Matrix4.makeOrtho(V.left,V.right,V.top,V.bottom,V.near,V.far)}C=V.position;V=V.target;va.position.set(C[0],C[1],C[2]);va.target.position.set(V[0],V[1],V[2]);da.cameras[F]=va}for(A in ga.lights){F=ga.lights[A];va=F.color!==undefined?
-F.color:16777215;V=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){C=F.direction;light=new THREE.DirectionalLight(va,V);light.position.set(C[0],C[1],C[2]);light.position.normalize()}else if(F.type=="point"){C=F.position;light=new THREE.PointLight(va,V);light.position.set(C[0],C[1],C[2])}da.scene.addLight(light);da.lights[A]=light}for(J in ga.fogs){A=ga.fogs[J];if(A.type=="linear")la=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,A.density));V=A.color;la.color.setRGB(V[0],
-V[1],V[2]);da.fogs[J]=la}if(da.cameras&&ga.defaults.camera)da.currentCamera=da.cameras[ga.defaults.camera];if(da.fogs&&ga.defaults.fog)da.scene.fog=da.fogs[ga.defaults.fog];V=ga.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(V[0],V[1],V[2]);da.bgColorAlpha=ga.defaults.bgalpha;for(t in ga.geometries){J=ga.geometries[t];if(J.type=="bin_mesh"||J.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Da=e;for(t in ga.geometries){J=ga.geometries[t];if(J.type=="cube"){M=new THREE.Cube(J.width,J.height,
-J.depth,J.segmentsWidth,J.segmentsHeight,J.segmentsDepth,null,J.flipped,J.sides);da.geometries[t]=M}else if(J.type=="plane"){M=new THREE.Plane(J.width,J.height,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="sphere"){M=new THREE.Sphere(J.radius,J.segmentsWidth,J.segmentsHeight);da.geometries[t]=M}else if(J.type=="cylinder"){M=new THREE.Cylinder(J.numSegs,J.topRad,J.botRad,J.height,J.topOffset,J.botOffset);da.geometries[t]=M}else if(J.type=="torus"){M=new THREE.Torus(J.radius,
-J.tube,J.segmentsR,J.segmentsT);da.geometries[t]=M}else if(J.type=="icosahedron"){M=new THREE.Icosahedron(J.subdivisions);da.geometries[t]=M}else if(J.type=="bin_mesh")h.load({model:j(J.url,ga.urlBaseType),callback:m(t)});else if(J.type=="ascii_mesh")ea.load({model:j(J.url,ga.urlBaseType),callback:m(t)});else if(J.type=="embedded_mesh")(J=ga.embeds[J.id])&&ea.createModel(J,o(t),"")}for(B in ga.textures){t=ga.textures[B];if(t.url instanceof Array){oa+=t.url.length;for(h=0;h<t.url.length;h++)c.onLoadStart()}else{oa+=
-1;c.onLoadStart()}}Aa=oa;for(B in ga.textures){t=ga.textures[B];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){h=[];for(var ta=0;ta<t.url.length;ta++)h[ta]=j(t.url[ta],ga.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,t.mapping,fa)}else{h=THREE.ImageUtils.loadTexture(j(t.url,ga.urlBaseType),t.mapping,fa);if(THREE[t.minFilter]!=undefined)h.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)h.magFilter=THREE[t.magFilter]}da.textures[B]=
-h}for(y in ga.materials){B=ga.materials[y];for(O in B.parameters)if(O=="envMap"||O=="map"||O=="lightMap")B.parameters[O]=da.textures[B.parameters[O]];else if(O=="shading")B.parameters[O]=B.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")B.parameters[O]=THREE[B.parameters[O]]?THREE[B.parameters[O]]:THREE.NormalBlending;else if(O=="combine")B.parameters[O]=B.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(O=="vertexColors")if(B.parameters[O]==
-"face")B.parameters[O]=THREE.FaceColors;else if(B.parameters[O])B.parameters[O]=THREE.VertexColors;if(B.parameters.opacity!==undefined&&B.parameters.opacity<1)B.parameters.transparent=!0;B=new THREE[B.type](B.parameters);da.materials[y]=B}k();c.callbackSync(da)}}};
+THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(pa,ca){return ca=="relativeToHTML"?pa:g+"/"+pa}function k(){for(u in ga.objects)if(!da.objects[u]){W=ga.objects[u];if(W.geometry!==undefined){if(Q=da.geometries[W.geometry]){ra=[];for(ua=0;ua<W.materials.length;ua++)ra[ua]=da.materials[W.materials[ua]];D=W.position;r=W.rotation;q=W.quaternion;s=W.scale;q=0;ra.length==0&&(ra[0]=
+new THREE.MeshFaceMaterial);ra.length>1&&(ra=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,ra);object.name=u;object.position.set(D[0],D[1],D[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;da.scene.addObject(object);da.objects[u]=object;if(W.meshCollider){var pa=THREE.CollisionUtils.MeshColliderWBox(object);da.scene.collisions.colliders.push(pa)}if(W.castsShadow){pa=
+new THREE.ShadowVolume(Q);da.scene.addChild(pa);pa.position=object.position;pa.rotation=object.rotation;pa.scale=object.scale}W.trigger&&W.trigger.toLowerCase()!="none"&&(da.triggers[object.name]={type:W.trigger,object:W})}}else{D=W.position;r=W.rotation;q=W.quaternion;s=W.scale;q=0;object=new THREE.Object3D;object.name=u;object.position.set(D[0],D[1],D[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!==undefined?W.visible:!1;da.scene.addObject(object);da.objects[u]=object;da.empties[u]=object}}}function m(pa){return function(ca){da.geometries[pa]=ca;k();e-=1;c.onLoadComplete();t()}}function o(pa){return function(ca){da.geometries[pa]=ca}}function t(){c.callbackProgress({totalModels:Da,totalTextures:Aa,loadedModels:Da-e,loadedTextures:Aa-oa},da);c.onLoadProgress();e==0&&oa==0&&d(da)}var p,y,u,A,I,H,B,W,D,R,L,Q,qa,la,ra,ga,ea,e,oa,Da,Aa,da;ga=h.data;h=new THREE.BinaryLoader;
+ea=new THREE.JSONLoader;oa=e=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var fa=!1;for(u in ga.objects){W=ga.objects[u];if(W.meshCollider){fa=!0;break}}if(fa)da.scene.collisions=new THREE.CollisionSystem;if(ga.transform){fa=ga.transform.position;R=ga.transform.rotation;var wa=ga.transform.scale;fa&&da.scene.position.set(fa[0],fa[1],fa[2]);R&&da.scene.rotation.set(R[0],R[1],R[2]);wa&&da.scene.scale.set(wa[0],wa[1],
+wa[2]);(fa||R||wa)&&da.scene.updateMatrix()}fa=function(){oa-=1;t();c.onLoadComplete()};for(I in ga.cameras){R=ga.cameras[I];if(R.type=="perspective")qa=new THREE.Camera(R.fov,R.aspect,R.near,R.far);else if(R.type=="ortho"){qa=new THREE.Camera;qa.projectionMatrix=THREE.Matrix4.makeOrtho(R.left,R.right,R.top,R.bottom,R.near,R.far)}D=R.position;R=R.target;qa.position.set(D[0],D[1],D[2]);qa.target.position.set(R[0],R[1],R[2]);da.cameras[I]=qa}for(A in ga.lights){I=ga.lights[A];qa=I.color!==undefined?
+I.color:16777215;R=I.intensity!==undefined?I.intensity:1;if(I.type=="directional"){D=I.direction;light=new THREE.DirectionalLight(qa,R);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(I.type=="point"){D=I.position;light=new THREE.PointLight(qa,R);light.position.set(D[0],D[1],D[2])}da.scene.addLight(light);da.lights[A]=light}for(H in ga.fogs){A=ga.fogs[H];if(A.type=="linear")la=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(la=new THREE.FogExp2(0,A.density));R=A.color;la.color.setRGB(R[0],
+R[1],R[2]);da.fogs[H]=la}if(da.cameras&&ga.defaults.camera)da.currentCamera=da.cameras[ga.defaults.camera];if(da.fogs&&ga.defaults.fog)da.scene.fog=da.fogs[ga.defaults.fog];R=ga.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(R[0],R[1],R[2]);da.bgColorAlpha=ga.defaults.bgalpha;for(p in ga.geometries){H=ga.geometries[p];if(H.type=="bin_mesh"||H.type=="ascii_mesh"){e+=1;c.onLoadStart()}}Da=e;for(p in ga.geometries){H=ga.geometries[p];if(H.type=="cube"){Q=new THREE.Cube(H.width,H.height,
+H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides);da.geometries[p]=Q}else if(H.type=="plane"){Q=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);da.geometries[p]=Q}else if(H.type=="sphere"){Q=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);da.geometries[p]=Q}else if(H.type=="cylinder"){Q=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);da.geometries[p]=Q}else if(H.type=="torus"){Q=new THREE.Torus(H.radius,
+H.tube,H.segmentsR,H.segmentsT);da.geometries[p]=Q}else if(H.type=="icosahedron"){Q=new THREE.Icosahedron(H.subdivisions);da.geometries[p]=Q}else if(H.type=="bin_mesh")h.load({model:j(H.url,ga.urlBaseType),callback:m(p)});else if(H.type=="ascii_mesh")ea.load({model:j(H.url,ga.urlBaseType),callback:m(p)});else if(H.type=="embedded_mesh")(H=ga.embeds[H.id])&&ea.createModel(H,o(p),"")}for(B in ga.textures){p=ga.textures[B];if(p.url instanceof Array){oa+=p.url.length;for(h=0;h<p.url.length;h++)c.onLoadStart()}else{oa+=
+1;c.onLoadStart()}}Aa=oa;for(B in ga.textures){p=ga.textures[B];if(p.mapping!=undefined&&THREE[p.mapping]!=undefined)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){h=[];for(var ua=0;ua<p.url.length;ua++)h[ua]=j(p.url[ua],ga.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,p.mapping,fa)}else{h=THREE.ImageUtils.loadTexture(j(p.url,ga.urlBaseType),p.mapping,fa);if(THREE[p.minFilter]!=undefined)h.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=undefined)h.magFilter=THREE[p.magFilter]}da.textures[B]=
+h}for(y in ga.materials){B=ga.materials[y];for(L in B.parameters)if(L=="envMap"||L=="map"||L=="lightMap")B.parameters[L]=da.textures[B.parameters[L]];else if(L=="shading")B.parameters[L]=B.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")B.parameters[L]=THREE[B.parameters[L]]?THREE[B.parameters[L]]:THREE.NormalBlending;else if(L=="combine")B.parameters[L]=B.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(B.parameters[L]==
+"face")B.parameters[L]=THREE.FaceColors;else if(B.parameters[L])B.parameters[L]=THREE.VertexColors;if(B.parameters.opacity!==undefined&&B.parameters.opacity<1)B.parameters.transparent=!0;B=new THREE[B.type](B.parameters);da.materials[y]=B}k();c.callbackSync(da)}}};
 THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(c){this.isolation=80;this.size=c;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(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(p[c],p[c+3],j);g[h+1]=this.lerp(p[c+1],p[c+4],j);g[h+2]=this.lerp(p[c+2],p[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
-2]=o;f=c+this.yd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,p,t){j=(j-p)/(t-p);p=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
-this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,o=h+this.yd,p=h+this.zd,t=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,A=m+this.yd+this.zd,F=0,J=this.field[h],B=this.field[m],U=this.field[o],C=this.field[t],V=this.field[p],O=this.field[y],M=this.field[u],va=this.field[A];J<j&&(F|=1);B<j&&(F|=2);U<j&&(F|=8);C<j&&(F|=4);V<j&&(F|=16);O<j&&(F|=32);M<j&&(F|=128);va<j&&(F|=64);var la=THREE.edgeTable[F];if(la==0)return 0;
-var qa=this.delta,ga=c+qa,ea=f+qa;qa=g+qa;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,J,B)}if(la&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,j,ga,f,g,B,C)}if(la&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ea,g,U,C)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,J,U)}if(la&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,
-12,j,c,f,qa,V,O)}if(la&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,ga,f,qa,O,va)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ea,qa,M,va)}if(la&128){this.compNorm(p);this.compNorm(u);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,qa,V,M)}if(la&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,J,V)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
-ga,f,g,B,O)}if(la&1024){this.compNorm(t);this.compNorm(A);this.VIntZ(t*3,this.vlist,this.nlist,30,j,ga,ea,g,C,va)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ea,g,U,M)}F<<=4;for(j=h=0;THREE.triTable[F+j]!=-1;){c=F+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(t[c],t[c+3],j);g[h+1]=this.lerp(t[c+1],t[c+4],j);g[h+2]=this.lerp(t[c+2],t[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
+2]=o;f=c+this.yd*3;g[h]=this.lerp(t[c],t[f],j);g[h+1]=this.lerp(t[c+1],t[f+1],j);g[h+2]=this.lerp(t[c+2],t[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,t,p){j=(j-t)/(p-t);t=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(t[c],t[f],j);g[h+1]=this.lerp(t[c+1],t[f+1],j);g[h+2]=this.lerp(t[c+2],t[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
+this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,o=h+this.yd,t=h+this.zd,p=m+this.yd,y=m+this.zd,u=h+this.yd+this.zd,A=m+this.yd+this.zd,I=0,H=this.field[h],B=this.field[m],W=this.field[o],D=this.field[p],R=this.field[t],L=this.field[y],Q=this.field[u],qa=this.field[A];H<j&&(I|=1);B<j&&(I|=2);W<j&&(I|=8);D<j&&(I|=4);R<j&&(I|=16);L<j&&(I|=32);Q<j&&(I|=128);qa<j&&(I|=64);var la=THREE.edgeTable[I];if(la==0)return 0;
+var ra=this.delta,ga=c+ra,ea=f+ra;ra=g+ra;if(la&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,H,B)}if(la&2){this.compNorm(m);this.compNorm(p);this.VIntY(m*3,this.vlist,this.nlist,3,j,ga,f,g,B,D)}if(la&4){this.compNorm(o);this.compNorm(p);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ea,g,W,D)}if(la&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,H,W)}if(la&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,
+12,j,c,f,ra,R,L)}if(la&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,j,ga,f,ra,L,qa)}if(la&64){this.compNorm(u);this.compNorm(A);this.VIntX(u*3,this.vlist,this.nlist,18,j,c,ea,ra,Q,qa)}if(la&128){this.compNorm(t);this.compNorm(u);this.VIntY(t*3,this.vlist,this.nlist,21,j,c,f,ra,R,Q)}if(la&256){this.compNorm(h);this.compNorm(t);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,H,R)}if(la&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,
+ga,f,g,B,L)}if(la&1024){this.compNorm(p);this.compNorm(A);this.VIntZ(p*3,this.vlist,this.nlist,30,j,ga,ea,g,D,qa)}if(la&2048){this.compNorm(o);this.compNorm(u);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ea,g,W,Q)}I<<=4;for(j=h=0;THREE.triTable[I+j]!=-1;){c=I+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+
 1]=c[g+1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[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(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,p=c*this.size,t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&
-(o=this.size-1);var u=Math.floor(p-k);u<1&&(u=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-1);for(var A,F,J,B,U,C;t<m;t++){p=this.size2*t;F=t/this.size-g;U=F*F;for(F=y;F<o;F++){J=p+this.size*F;A=F/this.size-f;C=A*A;for(A=u;A<k;A++){B=A/this.size-c;B=h/(1.0E-6+B*B+C+U)-j;B>0&&(this.field[J+A]+=B)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,p=this.yd,t=this.zd,y=this.field,u=o*Math.sqrt(c/f);u>o&&(u=o);for(g=0;g<u;g++){h=g/o;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){m=g+h*p;for(j=
-0;j<o;j++)y[t*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,o,p=this.size,t=this.yd,y=this.zd,u=this.field,A=p*Math.sqrt(c/f);A>p&&(A=p);for(h=0;h<A;h++){g=h/p;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*t;for(g=0;g<p;g++){o=m+g;for(j=0;j<p;j++)u[y*j+o]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){o=m+h*yd;
-for(g=0;g<size;g++)field[o+g]+=k}}}};this.reset=function(){var c;for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var f,g,h,j,k,m,o,p,t,y=this.size-2;for(j=1;j<y;j++){t=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){p=t+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=p+g;this.polygonize(k,m,o,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry,
-g=[];this.render(function(h){var j,k,m,o,p,t,y,u;for(j=0;j<h.count;j++){y=j*3;p=y+1;u=y+2;k=h.positionArray[y];m=h.positionArray[p];o=h.positionArray[u];t=new THREE.Vector3(k,m,o);k=h.normalArray[y];m=h.normalArray[p];o=h.normalArray[u];y=new THREE.Vector3(k,m,o);y.normalize();p=new THREE.Vertex(t);f.vertices.push(p);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;p=y+1;u=y+2;t=g[y];k=g[p];m=g[u];y=new THREE.Face3(y,p,u,[t,k,m]);f.faces.push(y)}c+=nfaces;h.count=0});return f};this.init(b)};
+!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(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,t=c*this.size,p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&
+(o=this.size-1);var u=Math.floor(t-k);u<1&&(u=1);k=Math.floor(t+k);k>this.size-1&&(k=this.size-1);for(var A,I,H,B,W,D;p<m;p++){t=this.size2*p;I=p/this.size-g;W=I*I;for(I=y;I<o;I++){H=t+this.size*I;A=I/this.size-f;D=A*A;for(A=u;A<k;A++){B=A/this.size-c;B=h/(1.0E-6+B*B+D+W)-j;B>0&&(this.field[H+A]+=B)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,t=this.yd,p=this.zd,y=this.field,u=o*Math.sqrt(c/f);u>o&&(u=o);for(g=0;g<u;g++){h=g/o;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){m=g+h*t;for(j=
+0;j<o;j++)y[p*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,o,t=this.size,p=this.yd,y=this.zd,u=this.field,A=t*Math.sqrt(c/f);A>t&&(A=t);for(h=0;h<A;h++){g=h/t;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*p;for(g=0;g<t;g++){o=m+g;for(j=0;j<t;j++)u[y*j+o]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){o=m+h*yd;
+for(g=0;g<size;g++)field[o+g]+=k}}}};this.reset=function(){var c;for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var f,g,h,j,k,m,o,t,p,y=this.size-2;for(j=1;j<y;j++){p=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){t=p+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=t+g;this.polygonize(k,m,o,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry,
+g=[];this.render(function(h){var j,k,m,o,t,p,y,u;for(j=0;j<h.count;j++){y=j*3;t=y+1;u=y+2;k=h.positionArray[y];m=h.positionArray[t];o=h.positionArray[u];p=new THREE.Vector3(k,m,o);k=h.normalArray[y];m=h.normalArray[t];o=h.normalArray[u];y=new THREE.Vector3(k,m,o);y.normalize();t=new THREE.Vertex(p);f.vertices.push(t);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;t=y+1;u=y+2;p=g[y];k=g[t];m=g[u];y=new THREE.Face3(y,t,u,[p,k,m]);f.faces.push(y)}c+=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,

+ 133 - 133
build/custom/ThreeExtras.js

@@ -1,28 +1,28 @@
 // ThreeExtras.js r39 - http://github.com/mrdoob/three.js
-THREE.AnimationHandler=function(){var a=[],d={},b={};b.update=function(c){for(var f=0;f<a.length;f++)a[f].update(c)};b.addToUpdate=function(c){a.indexOf(c)===-1&&a.push(c)};b.removeFromUpdate=function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)};b.add=function(c){d[c.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+c.name+" already exists in library. Overwriting.");d[c.name]=c;if(c.initialized!==!0){for(var f=0;f<c.hierarchy.length;f++){for(var g=0;g<c.hierarchy[f].keys.length;g++){if(c.hierarchy[f].keys[g].time<
-0)c.hierarchy[f].keys[g].time=0;if(c.hierarchy[f].keys[g].rot!==undefined&&!(c.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var h=c.hierarchy[f].keys[g].rot;c.hierarchy[f].keys[g].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(c.hierarchy[f].keys[0].morphTargets!==undefined){h={};for(g=0;g<c.hierarchy[f].keys.length;g++)for(var j=0;j<c.hierarchy[f].keys[g].morphTargets.length;j++){var l=c.hierarchy[f].keys[g].morphTargets[j];h[l]=-1}c.hierarchy[f].usedMorphTargets=h;for(g=0;g<c.hierarchy[f].keys.length;g++){var k=
-{};for(l in h){for(j=0;j<c.hierarchy[f].keys[g].morphTargets.length;j++)if(c.hierarchy[f].keys[g].morphTargets[j]===l){k[l]=c.hierarchy[f].keys[g].morphTargetsInfluences[j];break}j===c.hierarchy[f].keys[g].morphTargets.length&&(k[l]=0)}c.hierarchy[f].keys[g].morphTargetsInfluences=k}}for(g=1;g<c.hierarchy[f].keys.length;g++)if(c.hierarchy[f].keys[g].time===c.hierarchy[f].keys[g-1].time){c.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<c.hierarchy[f].keys.length;g++)c.hierarchy[f].keys[g].index=g}g=parseInt(c.length*
-c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(f=0;f<c.hierarchy.length;f++)c.JIT.hierarchy.push(Array(g));c.initialized=!0}};b.get=function(c){if(typeof c==="string")if(d[c])return d[c];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+c);return null}};b.parse=function(c){var f=[];if(c instanceof THREE.SkinnedMesh)for(var g=0;g<c.bones.length;g++)f.push(c.bones[g]);else e(c,f);return f};var e=function(c,f){f.push(c);for(var g=0;g<c.children.length;g++)e(c.children[g],f)};b.LINEAR=
-0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,d,b,e){this.root=a;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=d!==undefined?d:0;var b,e=this.hierarchy.length,c;for(b=0;b<e;b++){c=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)c.useQuaternion=!0;c.matrixAutoUpdate=!0;if(c.animationCache===undefined){c.animationCache={};c.animationCache.prevKey={pos:0,rot:0,scl:0};c.animationCache.nextKey={pos:0,rot:0,scl:0};c.animationCache.originalMatrix=
-c instanceof THREE.Bone?c.skinMatrix:c.matrix}var f=c.animationCache.prevKey;c=c.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];c.pos=this.getNextKeyWith("pos",b,1);c.rot=this.getNextKeyWith("rot",b,1);c.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var d=0;d<a.length;d++)a[d].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var d=0;d<f.hierarchy.length;d++){for(var g=0;g<f.hierarchy[d].keys.length;g++){if(f.hierarchy[d].keys[g].time<
+0)f.hierarchy[d].keys[g].time=0;if(f.hierarchy[d].keys[g].rot!==undefined&&!(f.hierarchy[d].keys[g].rot instanceof THREE.Quaternion)){var h=f.hierarchy[d].keys[g].rot;f.hierarchy[d].keys[g].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(f.hierarchy[d].keys[0].morphTargets!==undefined){h={};for(g=0;g<f.hierarchy[d].keys.length;g++)for(var j=0;j<f.hierarchy[d].keys[g].morphTargets.length;j++){var l=f.hierarchy[d].keys[g].morphTargets[j];h[l]=-1}f.hierarchy[d].usedMorphTargets=h;for(g=0;g<f.hierarchy[d].keys.length;g++){var k=
+{};for(l in h){for(j=0;j<f.hierarchy[d].keys[g].morphTargets.length;j++)if(f.hierarchy[d].keys[g].morphTargets[j]===l){k[l]=f.hierarchy[d].keys[g].morphTargetsInfluences[j];break}j===f.hierarchy[d].keys[g].morphTargets.length&&(k[l]=0)}f.hierarchy[d].keys[g].morphTargetsInfluences=k}}for(g=1;g<f.hierarchy[d].keys.length;g++)if(f.hierarchy[d].keys[g].time===f.hierarchy[d].keys[g-1].time){f.hierarchy[d].keys.splice(g,1);g--}for(g=1;g<f.hierarchy[d].keys.length;g++)f.hierarchy[d].keys[g].index=g}g=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(d=0;d<f.hierarchy.length;d++)f.JIT.hierarchy.push(Array(g));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var d=[];if(f instanceof THREE.SkinnedMesh)for(var g=0;g<f.bones.length;g++)d.push(f.bones[g]);else e(f,d);return d};var e=function(f,d){d.push(f);for(var g=0;g<f.children.length;g++)e(f.children[g],d)};b.LINEAR=
+0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,e=this.hierarchy.length,f;for(b=0;b<e;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var d=f.animationCache.prevKey;f=f.animationCache.nextKey;d.pos=this.data.hierarchy[b].keys[0];d.rot=this.data.hierarchy[b].keys[0];d.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,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 a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var d=["pos","rot","scl"],b,e,c,f,g,h,j,l,k=this.data.JIT.hierarchy,m,p;this.currentTime+=a*this.timeScale;p=this.currentTime;m=this.currentTime%=this.data.length;l=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,y=this.hierarchy.length;o<y;o++){a=this.hierarchy[o];j=a.animationCache;if(this.JITCompile&&k[o][l]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=k[o][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=k[o][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var x=0;x<3;x++){b=d[x];g=j.prevKey[b];h=j.nextKey[b];if(h.time<=p){if(m<p)if(this.loop){g=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(b,o,1);h.time<m;){g=h;h=this.getNextKeyWith(b,o,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(b,o,h.index+1)}while(h.time<
-m)}j.prevKey[b]=g;j.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(h.time-g.time);c=g[b];f=h[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=c[0]+(f[0]-c[0])*e;b.y=c[1]+(f[1]-c[1])*e;b.z=c[2]+(f[2]-c[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",o,g.index-1).pos;this.points[1]=c;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos;e=e*0.33+0.33;c=this.interpolateCatmullRom(this.points,e);b.x=c[0];b.y=c[1];b.z=c[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
-"rot")THREE.Quaternion.slerp(c,f,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=c[0]+(f[0]-c[0])*e;b.y=c[1]+(f[1]-c[1])*e;b.z=c[2]+(f[2]-c[2])*e}}}}if(this.JITCompile&&k[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,d){var b=[],e=[],c,f,g,h,j,l;c=(a.length-1)*d;f=Math.floor(c);c-=f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];j=a[b[2]];l=a[b[3]];b=c*c;g=c*b;e[0]=this.interpolate(f[0],h[0],j[0],l[0],c,b,g);e[1]=this.interpolate(f[1],h[1],j[1],l[1],c,b,g);e[2]=this.interpolate(f[2],h[2],j[2],l[2],c,b,g);return e};
-THREE.Animation.prototype.interpolate=function(a,d,b,e,c,f,g){a=(b-a)*0.5;e=(e-d)*0.5;return(2*(d-b)+a+e)*g+(-3*(d-b)-2*a-e)*f+a*c+d};THREE.Animation.prototype.getNextKeyWith=function(a,d,b){var e=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[d].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,d,b){var e=this.data.hierarchy[d].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[d].keys[e.length-1]};
-var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,e=a.vertices.length,c=b?d.geometry:d,f=a.vertices,g=c.vertices,h=a.faces,j=c.faces,l=a.faceVertexUvs[0];c=c.faceVertexUvs[0];b&&d.matrixAutoUpdate&&d.updateMatrix();for(var k=0,m=g.length;k<m;k++){var p=new THREE.Vertex(g[k].position.clone());b&&d.matrix.multiplyVector3(p.position);f.push(p)}k=0;for(m=j.length;k<m;k++){g=j[k];var o,y,x=g.vertexNormals;p=g.vertexColors;if(g instanceof THREE.Face3)o=new THREE.Face3(g.a+e,g.b+e,g.c+
-e);else g instanceof THREE.Face4&&(o=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));o.normal.copy(g.normal);b=0;for(f=x.length;b<f;b++){y=x[b];o.vertexNormals.push(y.clone())}o.color.copy(g.color);b=0;for(f=p.length;b<f;b++){y=p[b];o.vertexColors.push(y.clone())}o.materials=g.materials.slice();o.centroid.copy(g.centroid);h.push(o)}k=0;for(m=c.length;k<m;k++){e=c[k];h=[];b=0;for(f=e.length;b<f;b++)h.push(new THREE.UV(e[b].u,e[b].v));l.push(h)}}};
-THREE.ImageUtils={loadTexture:function(a,d,b){var e=new Image,c=new THREE.Texture(e,d);e.onload=function(){c.needsUpdate=!0;b&&b(this)};e.src=a;return c},loadTextureCube:function(a,d,b){var e,c=[],f=new THREE.Texture(c,d);d=c.loadCount=0;for(e=a.length;d<e;++d){c[d]=new Image;c[d].onload=function(){c.loadCount+=1;if(c.loadCount==6)f.needsUpdate=!0;b&&b(this)};c[d].src=a[d]}return f}};
-THREE.SceneUtils={addMesh:function(a,d,b,e,c,f,g,h,j,l){d=new THREE.Mesh(d,l);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=e;d.position.y=c;d.position.z=f;d.rotation.x=g;d.rotation.y=h;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,1,null,!0),b);a.addObject(d);
-return d},addPanoramaCube:function(a,d,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,e,!0),
-new THREE.MeshFaceMaterial);a.addObject(d);return d},addPanoramaCubePlanes:function(a,d,b){var e=d/2;d=new THREE.Plane(d,d);var c=Math.PI,f=Math.PI/2;THREE.SceneUtils.addMesh(a,d,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));THREE.SceneUtils.addMesh(a,d,1,-e,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));THREE.SceneUtils.addMesh(a,d,1,e,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));THREE.SceneUtils.addMesh(a,d,1,0,e,0,f,
-0,c,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));THREE.SceneUtils.addMesh(a,d,1,0,-e,0,-f,0,c,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,d){THREE.SceneUtils.traverseHierarchy(a,function(b){b.visible=d})},traverseHierarchy:function(a,d){var b,e,c=a.children.length;for(e=0;e<c;e++){b=a.children[e];d(b);THREE.SceneUtils.traverseHierarchy(b,d)}}};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,d,g,h,j,l,k=this.data.JIT.hierarchy,m,p;this.currentTime+=a*this.timeScale;p=this.currentTime;m=this.currentTime%=this.data.length;l=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,v=this.hierarchy.length;n<v;n++){a=this.hierarchy[n];j=a.animationCache;if(this.JITCompile&&k[n][l]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=k[n][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=k[n][l];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var A=0;A<3;A++){b=c[A];g=j.prevKey[b];h=j.nextKey[b];if(h.time<=p){if(m<p)if(this.loop){g=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<m;){g=h;h=this.getNextKeyWith(b,n,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(b,n,h.index+1)}while(h.time<
+m)}j.prevKey[b]=g;j.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(h.time-g.time);f=g[b];d=h[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+n);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(d[0]-f[0])*e;b.y=f[1]+(d[1]-f[1])*e;b.z=f[2]+(d[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=f;this.points[2]=d;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
+"rot")THREE.Quaternion.slerp(f,d,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(d[0]-f[0])*e;b.y=f[1]+(d[1]-f[1])*e;b.z=f[2]+(d[2]-f[2])*e}}}}if(this.JITCompile&&k[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)k[n][l]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,d,g,h,j,l;f=(a.length-1)*c;d=Math.floor(f);f-=d;b[0]=d==0?d:d-1;b[1]=d;b[2]=d>a.length-2?d:d+1;b[3]=d>a.length-3?d:d+2;d=a[b[0]];h=a[b[1]];j=a[b[2]];l=a[b[3]];b=f*f;g=f*b;e[0]=this.interpolate(d[0],h[0],j[0],l[0],f,b,g);e[1]=this.interpolate(d[1],h[1],j[1],l[1],f,b,g);e[2]=this.interpolate(d[2],h[2],j[2],l[2],f,b,g);return e};
+THREE.Animation.prototype.interpolate=function(a,c,b,e,f,d,g){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*g+(-3*(c-b)-2*a-e)*d+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,d=a.vertices,g=f.vertices,h=a.faces,j=f.faces,l=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var k=0,m=g.length;k<m;k++){var p=new THREE.Vertex(g[k].position.clone());b&&c.matrix.multiplyVector3(p.position);d.push(p)}k=0;for(m=j.length;k<m;k++){g=j[k];var n,v,A=g.vertexNormals;p=g.vertexColors;if(g instanceof THREE.Face3)n=new THREE.Face3(g.a+e,g.b+e,g.c+
+e);else g instanceof THREE.Face4&&(n=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));n.normal.copy(g.normal);b=0;for(d=A.length;b<d;b++){v=A[b];n.vertexNormals.push(v.clone())}n.color.copy(g.color);b=0;for(d=p.length;b<d;b++){v=p[b];n.vertexColors.push(v.clone())}n.materials=g.materials.slice();n.centroid.copy(g.centroid);h.push(n)}k=0;for(m=f.length;k<m;k++){e=f[k];h=[];b=0;for(d=e.length;b<d;b++)h.push(new THREE.UV(e[b].u,e[b].v));l.push(h)}}};
+THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],d=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)d.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return d}};
+THREE.SceneUtils={addMesh:function(a,c,b,e,f,d,g,h,j,l){c=new THREE.Mesh(c,l);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=d;c.rotation.x=g;c.rotation.y=h;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);
+return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new THREE.Cube(c,c,c,1,1,e,!0),
+new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new THREE.Plane(c,c);var f=Math.PI,d=Math.PI/2;THREE.SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));THREE.SceneUtils.addMesh(a,c,1,-e,0,0,0,d,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));THREE.SceneUtils.addMesh(a,c,1,e,0,0,0,-d,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));THREE.SceneUtils.addMesh(a,c,1,0,e,0,d,
+0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));THREE.SceneUtils.addMesh(a,c,1,0,-e,0,-d,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++){b=a.children[e];c(b);THREE.SceneUtils.traverseHierarchy(b,c)}}};
 THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
@@ -32,120 +32,120 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 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 d,b,e,c,f=2*Math.ceil(a*3)+1;f>25&&(f=25);c=(f-1)*0.5;b=Array(f);for(d=e=0;d<f;++d){b[d]=Math.exp(-((d-c)*(d-c))/(2*a*a));e+=b[d]}for(d=0;d<f;++d)b[d]/=e;return b}};
-THREE.QuakeCamera=function(a){function d(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;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,f,d=2*Math.ceil(a*3)+1;d>25&&(d=25);f=(d-1)*0.5;b=Array(d);for(c=e=0;c<d;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=b[c]}for(c=0;c<d;++c)b[c]/=e;return b}};
+THREE.QuakeCamera=function(a){function c(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;this.lastUpdate=(new Date).getTime();this.tdiff=0;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=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/
 1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var e=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(e+this.autoSpeedFactor));this.moveBackward&&this.translateZ(e);this.moveLeft&&this.translateX(-e);this.moveRight&&this.translateX(e);e=this.tdiff*this.lookSpeed;
-this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);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;b=this.target.position;var c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);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;b=this.target.position;c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,
-this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(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,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(a));this.target.position.addSelf(d.multiplyScalar(a))};
-THREE.PathCamera=function(a){function d(l,k,m,p){var o={name:m,fps:0.6,length:p,hierarchy:[]},y,x=k.getControlPointsArray(),v=k.getLength(),u=x.length,z=0;y=u-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:x[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[y]={time:p,pos:x[y],rot:[0,0,0,1],scl:[1,1,1]};for(y=1;y<u-1;y++){z=p*v.chunks[y]/v.total;k.keys[y]={time:z,pos:x[y]}}o.hierarchy[0]=k;THREE.AnimationHandler.add(o);return new THREE.Animation(l,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var m,
-p,o=new THREE.Geometry;for(m=0;m<l.points.length*k;m++){p=m/(l.points.length*k);p=l.getPoint(p);o.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return o}function e(l,k){var m=b(k,10),p=b(k,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,o);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);p=new THREE.Sphere(1,
-16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,o);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}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=
+this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);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;b=this.target.position;var f=this.position;b.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=f.y+100*Math.cos(this.phi);b.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);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;b=this.target.position;f=this.position;b.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=f.y+100*Math.cos(this.phi);b.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,
+this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
+THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
+THREE.PathCamera=function(a){function c(l,k,m,p){var n={name:m,fps:0.6,length:p,hierarchy:[]},v,A=k.getControlPointsArray(),w=k.getLength(),u=A.length,y=0;v=u-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:A[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[v]={time:p,pos:A[v],rot:[0,0,0,1],scl:[1,1,1]};for(v=1;v<u-1;v++){y=p*w.chunks[v]/w.total;k.keys[v]={time:y,pos:A[v]}}n.hierarchy[0]=k;THREE.AnimationHandler.add(n);return new THREE.Animation(l,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var m,
+p,n=new THREE.Geometry;for(m=0;m<l.points.length*k;m++){p=m/(l.points.length*k);p=l.getPoint(p);n.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return n}function e(l,k){var m=b(k,10),p=b(k,10),n=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,n);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);p=new THREE.Sphere(1,
+16,8);n=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,n);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}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,f=Math.PI/180;this.update=function(l,k,m){var p,o;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)*f;this.theta=this.lon*f;p=this.phi%c;this.phi=p>=0?p:p+c;p=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-p[0])*(o[1]-o[0])/(p[1]-p[0])+o[0];p=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(o[1]-o[0])/(p[1]-p[0])+o[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,m)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),h=new THREE.Cube(10,10,20),j=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,g);a.position.set(0,10,0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
-d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,k){return function(){k.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function d(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==undefined)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.autoForward!==undefined)this.autoForward=
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,d=Math.PI/180;this.update=function(l,k,m){var p,n;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%f;this.phi=p>=0?p:p+f;p=this.verticalAngleMap.srcRange;n=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-p[0])*(n[1]-n[0])/(p[1]-p[0])+n[0];p=this.horizontalAngleMap.srcRange;n=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(n[1]-n[0])/(p[1]-p[0])+n[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,m)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var g=new THREE.MeshLambertMaterial({color:65280}),h=new THREE.Cube(10,10,20),j=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,g);a.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(a)}else{this.animation=
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,k){return function(){k.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
+THREE.FlyCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==undefined)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.autoForward!==undefined)this.autoForward=
 a.autoForward;if(a.domElement!==undefined)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var e=this.getContainerDimensions(),c=e.size[0]/2,f=e.size[1]/2;this.moveState.yawLeft=-(b.clientX-e.offset[0]-c)/c;this.moveState.pitchDown=(b.clientY-
-e.offset[1]-f)/f;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook){this.mouseStatus--;this.moveState.yawLeft=this.moveState.pitchDown=0}else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;b=this.tdiff*this.movementSpeed;var e=this.tdiff*
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var e=this.getContainerDimensions(),f=e.size[0]/2,d=e.size[1]/2;this.moveState.yawLeft=-(b.clientX-e.offset[0]-f)/f;this.moveState.pitchDown=(b.clientY-
+e.offset[1]-d)/d;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook){this.mouseStatus--;this.moveState.yawLeft=this.moveState.pitchDown=0}else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;b=this.tdiff*this.movementSpeed;var e=this.tdiff*
 this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*e,this.rotationVector.y*e,this.rotationVector.z*e,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
-document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",d(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",d(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",d(this,this.mouseup),!1);window.addEventListener("keydown",d(this,this.keydown),!1);window.addEventListener("keyup",d(this,
+document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(a,d,b,e){THREE.Camera.call(this,a,d,b,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var c=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,j=!1,l=1,k=0,m=0,p=0,o=0,y=0,x=window.innerWidth/2,v=window.innerHeight/2;this.update=
-function(){var u=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=u;this.delta=(u-this.lastUpdate)/1E3;this.lastUpdate=u;if(this.mouseLook){u=this.delta*this.lookSpeed;this.rotateHorizontally(u*o);this.rotateVertically(u*y)}u=this.delta*this.movementSpeed;this.translateZ(u*(k>0||this.autoForward&&!(k<0)?1:k));this.translateX(u*m);this.translateY(u*p);j&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
-this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}g.copy(this.forward);f.set(0,1,0);c.cross(f,g).normalize();f.cross(g,c).normalize();this.matrix.n11=c.x;this.matrix.n12=f.x;this.matrix.n13=g.x;this.matrix.n21=c.y;this.matrix.n22=f.y;this.matrix.n23=g.y;this.matrix.n31=c.z;this.matrix.n32=f.z;this.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.matrix.multiplySelf(h);
+THREE.RollCamera=function(a,c,b,e){THREE.Camera.call(this,a,c,b,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Matrix4,j=!1,l=1,k=0,m=0,p=0,n=0,v=0,A=window.innerWidth/2,w=window.innerHeight/2;this.update=
+function(){var u=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=u;this.delta=(u-this.lastUpdate)/1E3;this.lastUpdate=u;if(this.mouseLook){u=this.delta*this.lookSpeed;this.rotateHorizontally(u*n);this.rotateVertically(u*v)}u=this.delta*this.movementSpeed;this.translateZ(u*(k>0||this.autoForward&&!(k<0)?1:k));this.translateX(u*m);this.translateY(u*p);j&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
+this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}g.copy(this.forward);d.set(0,1,0);f.cross(d,g).normalize();d.cross(g,f).normalize();this.matrix.n11=f.x;this.matrix.n12=d.x;this.matrix.n13=g.x;this.matrix.n21=f.y;this.matrix.n22=d.y;this.matrix.n23=g.y;this.matrix.n31=f.z;this.matrix.n32=d.z;this.matrix.n33=g.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.matrix.multiplySelf(h);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(u){this.position.x+=this.matrix.n11*u;this.position.y+=this.matrix.n21*u;this.position.z+=this.matrix.n31*u};this.translateY=function(u){this.position.x+=this.matrix.n12*u;this.position.y+=this.matrix.n22*u;this.position.z+=this.matrix.n32*u};this.translateZ=function(u){this.position.x-=this.matrix.n13*u;this.position.y-=
-this.matrix.n23*u;this.position.z-=this.matrix.n33*u};this.rotateHorizontally=function(u){c.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);c.multiplyScalar(u);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(u){f.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);f.multiplyScalar(u);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(u){u.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(u){o=(u.clientX-x)/window.innerWidth;y=(u.clientY-v)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=1;break;case 2:k=-1}},!1);this.domElement.addEventListener("mouseup",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=0;break;case 2:k=0}},!1);this.domElement.addEventListener("keydown",function(u){switch(u.keyCode){case 38:case 87:k=1;break;case 37:case 65:m=-1;break;
+this.matrix.n23*u;this.position.z-=this.matrix.n33*u};this.rotateHorizontally=function(u){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(u);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(u){d.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);d.multiplyScalar(u);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(u){u.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(u){n=(u.clientX-A)/window.innerWidth;v=(u.clientY-w)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=1;break;case 2:k=-1}},!1);this.domElement.addEventListener("mouseup",function(u){u.preventDefault();u.stopPropagation();switch(u.button){case 0:k=0;break;case 2:k=0}},!1);this.domElement.addEventListener("keydown",function(u){switch(u.keyCode){case 38:case 87:k=1;break;case 37:case 65:m=-1;break;
 case 40:case 83:k=-1;break;case 39:case 68:m=1;break;case 81:j=!0;l=1;break;case 69:j=!0;l=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(u){switch(u.keyCode){case 38:case 87:k=0;break;case 37:case 65:m=0;break;case 40:case 83:k=0;break;case 39:case 68:m=0;break;case 81:j=!1;break;case 69:j=!1;break;case 82:p=0;break;case 70:p=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.Cube=function(a,d,b,e,c,f,g,h,j){function l(v,u,z,n,A,B,G,K){var J,H,D=e||1,L=c||1,R=A/2,O=B/2,S=k.vertices.length;if(v=="x"&&u=="y"||v=="y"&&u=="x")J="z";else if(v=="x"&&u=="z"||v=="z"&&u=="x"){J="y";L=f||1}else if(v=="z"&&u=="y"||v=="y"&&u=="z"){J="x";D=f||1}var P=D+1,F=L+1;A/=D;var M=B/L;for(H=0;H<F;H++)for(B=0;B<P;B++){var Q=new THREE.Vector3;Q[v]=(B*A-R)*z;Q[u]=(H*M-O)*n;Q[J]=G;k.vertices.push(new THREE.Vertex(Q))}for(H=0;H<L;H++)for(B=0;B<D;B++){k.faces.push(new THREE.Face4(B+P*H+S,B+
-P*(H+1)+S,B+1+P*(H+1)+S,B+1+P*H+S,null,null,K));k.faceVertexUvs[0].push([new THREE.UV(B/D,H/L),new THREE.UV(B/D,(H+1)/L),new THREE.UV((B+1)/D,(H+1)/L),new THREE.UV((B+1)/D,H/L)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=d/2,o=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var x in j)this.sides[x]!=undefined&&(this.sides[x]=
-j[x]);this.sides.px&&l("z","y",1*h,-1,b,d,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,d,m,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,d,o,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,d,-o,this.materials[5]);(function(){for(var v=[],u=[],z=0,n=k.vertices.length;z<n;z++){for(var A=k.vertices[z],B=!1,G=0,K=v.length;G<K;G++){var J=v[G];if(A.position.x==J.position.x&&
-A.position.y==J.position.y&&A.position.z==J.position.z){u[z]=G;B=!0;break}}if(!B){u[z]=v.length;v.push(new THREE.Vertex(A.position.clone()))}}z=0;for(n=k.faces.length;z<n;z++){A=k.faces[z];A.a=u[A.a];A.b=u[A.b];A.c=u[A.c];A.d=u[A.d]}k.vertices=v})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
-THREE.Cylinder=function(a,d,b,e,c,f){function g(p,o,y){h.vertices.push(new THREE.Vertex(new THREE.Vector3(p,o,y)))}THREE.Geometry.call(this);var h=this,j,l=Math.PI*2,k=e/2;for(j=0;j<a;j++)g(Math.sin(l*j/a)*d,Math.cos(l*j/a)*d,-k);for(j=0;j<a;j++)g(Math.sin(l*j/a)*b,Math.cos(l*j/a)*b,k);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(b>0){g(0,0,-k-(f||0));for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(d>0){g(0,0,k+(c||0));
-for(j=a+a/2;j<2*a;j++)h.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j<a;j++){d=[];b=this.faces[j];c=this.vertices[b.a];f=this.vertices[b.b];k=this.vertices[b.c];var m=this.vertices[b.d];d.push(new THREE.UV(0.5+Math.atan2(c.position.x,c.position.y)/l,0.5+c.position.z/e));d.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));d.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/l,0.5+k.position.z/
-e));b instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/e));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
-THREE.Icosahedron=function(a){function d(m,p,o){var y=Math.sqrt(m*m+p*p+o*o);return c.vertices.push(new THREE.Vertex(new THREE.Vector3(m/y,p/y,o/y)))-1}function b(m,p,o,y){y.faces.push(new THREE.Face3(m,p,o))}function e(m,p){var o=c.vertices[m].position,y=c.vertices[p].position;return d((o.x+y.x)/2,(o.y+y.y)/2,(o.z+y.z)/2)}var c=this,f=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
-1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var h in f.faces){var j=e(f.faces[h].a,f.faces[h].b),l=e(f.faces[h].b,f.faces[h].c),k=e(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,g);b(f.faces[h].b,l,j,g);b(f.faces[h].c,
-k,l,g);b(j,l,k,g)}f.faces=g.faces}c.faces=f.faces;delete f;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
-THREE.Lathe=function(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;b=[];for(var e=[],c=[],f=[],g=(new THREE.Matrix4).setRotationZ(d),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+=d){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=f;j==0&&(f=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-d)/this.angle,(h+1)/a.length),new THREE.UV(1-(j-d)/this.angle,h/a.length)])}e=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
-THREE.Plane=function(a,d,b,e){THREE.Geometry.call(this);var c,f=a/2,g=d/2;b=b||1;e=e||1;var h=b+1,j=e+1;a/=b;var l=d/e;for(c=0;c<j;c++)for(d=0;d<h;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-f,-(c*l-g),0)));for(c=0;c<e;c++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+h*c,d+h*(c+1),d+1+h*(c+1),d+1+h*c));this.faceVertexUvs[0].push([new THREE.UV(d/b,c/e),new THREE.UV(d/b,(c+1)/e),new THREE.UV((d+1)/b,(c+1)/e),new THREE.UV((d+1)/b,c/e)])}this.computeCentroids();this.computeFaceNormals()};
+THREE.Cube=function(a,c,b,e,f,d,g,h,j){function l(w,u,y,o,z,B,I,K){var J,G,D=e||1,L=f||1,R=z/2,O=B/2,S=k.vertices.length;if(w=="x"&&u=="y"||w=="y"&&u=="x")J="z";else if(w=="x"&&u=="z"||w=="z"&&u=="x"){J="y";L=d||1}else if(w=="z"&&u=="y"||w=="y"&&u=="z"){J="x";D=d||1}var P=D+1,F=L+1;z/=D;var M=B/L;for(G=0;G<F;G++)for(B=0;B<P;B++){var Q=new THREE.Vector3;Q[w]=(B*z-R)*y;Q[u]=(G*M-O)*o;Q[J]=I;k.vertices.push(new THREE.Vertex(Q))}for(G=0;G<L;G++)for(B=0;B<D;B++){k.faces.push(new THREE.Face4(B+P*G+S,B+
+P*(G+1)+S,B+1+P*(G+1)+S,B+1+P*G+S,null,null,K));k.faceVertexUvs[0].push([new THREE.UV(B/D,G/L),new THREE.UV(B/D,(G+1)/L),new THREE.UV((B+1)/D,(G+1)/L),new THREE.UV((B+1)/D,G/L)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=c/2,n=b/2;h=h?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var A in j)this.sides[A]!=undefined&&(this.sides[A]=
+j[A]);this.sides.px&&l("z","y",1*h,-1,b,c,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,c,m,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,c,n,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,c,-n,this.materials[5]);(function(){for(var w=[],u=[],y=0,o=k.vertices.length;y<o;y++){for(var z=k.vertices[y],B=!1,I=0,K=w.length;I<K;I++){var J=w[I];if(z.position.x==J.position.x&&
+z.position.y==J.position.y&&z.position.z==J.position.z){u[y]=I;B=!0;break}}if(!B){u[y]=w.length;w.push(new THREE.Vertex(z.position.clone()))}}y=0;for(o=k.faces.length;y<o;y++){z=k.faces[y];z.a=u[z.a];z.b=u[z.b];z.c=u[z.c];z.d=u[z.d]}k.vertices=w})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
+THREE.Cylinder=function(a,c,b,e,f,d){function g(p,n,v){h.vertices.push(new THREE.Vertex(new THREE.Vector3(p,n,v)))}THREE.Geometry.call(this);var h=this,j,l=Math.PI*2,k=e/2;for(j=0;j<a;j++)g(Math.sin(l*j/a)*c,Math.cos(l*j/a)*c,-k);for(j=0;j<a;j++)g(Math.sin(l*j/a)*b,Math.cos(l*j/a)*b,k);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(b>0){g(0,0,-k-(d||0));for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(c>0){g(0,0,k+(f||0));
+for(j=a+a/2;j<2*a;j++)h.faces.push(new THREE.Face4(2*a+1,(2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a))}j=0;for(a=this.faces.length;j<a;j++){c=[];b=this.faces[j];f=this.vertices[b.a];d=this.vertices[b.b];k=this.vertices[b.c];var m=this.vertices[b.d];c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(d.position.x,d.position.y)/l,0.5+d.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/l,0.5+k.position.z/
+e));b instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
+THREE.Icosahedron=function(a){function c(m,p,n){var v=Math.sqrt(m*m+p*p+n*n);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(m/v,p/v,n/v)))-1}function b(m,p,n,v){v.faces.push(new THREE.Face3(m,p,n))}function e(m,p){var n=f.vertices[m].position,v=f.vertices[p].position;return c((n.x+v.x)/2,(n.y+v.y)/2,(n.z+v.z)/2)}var f=this,d=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
+1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-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),l=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,l,j,g);b(d.faces[h].c,
+k,l,g);b(j,l,k,g)}d.faces=g.faces}f.faces=d.faces;delete d;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
+THREE.Lathe=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;b=[];for(var e=[],f=[],d=[],g=(new THREE.Matrix4).setRotationZ(c),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+=c){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]));f[h]=this.vertices.length-1}else f=d;j==0&&(d=e);
+for(h=0;h<e.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[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-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(j-c)/this.angle,h/a.length)])}e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
+THREE.Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,d=a/2,g=c/2;b=b||1;e=e||1;var h=b+1,j=e+1;a/=b;var l=c/e;for(f=0;f<j;f++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-d,-(f*l-g),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+h*f,c+h*(f+1),c+1+h*(f+1),c+1+h*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
 THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
-THREE.Sphere=function(a,d,b){THREE.Geometry.call(this);var e,c=Math.PI,f=Math.max(3,d||8),g=Math.max(2,b||6);d=[];for(b=0;b<g+1;b++){e=b/g;var h=a*Math.cos(e*c),j=a*Math.sin(e*c),l=[],k=0;for(e=0;e<f;e++){var m=2*e/f,p=j*Math.sin(m*c);m=j*Math.cos(m*c);(b==0||b==g)&&e>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);l.push(k)}d.push(l)}var o,y,x;c=d.length;for(b=0;b<c;b++){f=d[b].length;if(b>0)for(e=0;e<f;e++){l=e==f-1;g=d[b][l?0:e+1];h=d[b][l?f-1:e];j=d[b-1][l?f-1:e];l=d[b-
-1][l?0:e+1];p=b/(c-1);o=(b-1)/(c-1);y=(e+1)/f;m=e/f;k=new THREE.UV(1-y,p);p=new THREE.UV(1-m,p);m=new THREE.UV(1-m,o);var v=new THREE.UV(1-y,o);if(b<d.length-1){o=this.vertices[g].position.clone();y=this.vertices[h].position.clone();x=this.vertices[j].position.clone();o.normalize();y.normalize();x.normalize();this.faces.push(new THREE.Face3(g,h,j,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)]));this.faceVertexUvs[0].push([k,p,m])}if(b>1){o=this.vertices[g].position.clone();
-y=this.vertices[j].position.clone();x=this.vertices[l].position.clone();o.normalize();y.normalize();x.normalize();this.faces.push(new THREE.Face3(g,j,l,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)]));this.faceVertexUvs[0].push([k,m,v])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
-THREE.Torus=function(a,d,b,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=d||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];for(d=0;d<=this.segmentsR;++d)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var c=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(c))*Math.cos(e),(this.radius+this.tube*Math.cos(c))*Math.sin(e),this.tube*Math.sin(c))));a.push([b/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(b=
-1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*d+b;c=(this.segmentsT+1)*d+b-1;var f=(this.segmentsT+1)*(d-1)+b-1,g=(this.segmentsT+1)*(d-1)+b;this.faces.push(new THREE.Face4(e,c,f,g));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
-THREE.TorusKnot=function(a,d,b,e,c,f,g){function h(m,p,o,y,x,v){p=o/y*m;o=Math.cos(p);return new THREE.Vector3(x*(2+o)*0.5*Math.cos(m),x*(2+o)*Math.sin(m)*0.5,v*x*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=d||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=c||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var j=
-a/this.segmentsR*2*this.p*Math.PI;g=d/this.segmentsT*2*Math.PI;c=h(j,g,this.q,this.p,this.radius,this.heightScale);j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=j.x-c.x;b.y=j.y-c.y;b.z=j.z-c.z;e.x=j.x+c.x;e.y=j.y+c.y;e.z=j.z+c.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);c.x+=j*e.x+g*f.x;c.y+=j*e.y+g*f.y;c.z+=j*e.z+g*f.z;this.grid[a][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z)))-1}}for(a=0;a<this.segmentsR;++a)for(d=
-0;d<this.segmentsT;++d){e=(a+1)%this.segmentsR;f=(d+1)%this.segmentsT;c=this.grid[a][d];b=this.grid[e][d];e=this.grid[e][f];f=this.grid[a][f];g=new THREE.UV(a/this.segmentsR,d/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,d/this.segmentsT);var l=new THREE.UV((a+1)/this.segmentsR,(d+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,b,e,f));this.faceVertexUvs[0].push([g,j,l,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
+THREE.Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,d=Math.max(3,c||8),g=Math.max(2,b||6);c=[];for(b=0;b<g+1;b++){e=b/g;var h=a*Math.cos(e*f),j=a*Math.sin(e*f),l=[],k=0;for(e=0;e<d;e++){var m=2*e/d,p=j*Math.sin(m*f);m=j*Math.cos(m*f);(b==0||b==g)&&e>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);l.push(k)}c.push(l)}var n,v,A;f=c.length;for(b=0;b<f;b++){d=c[b].length;if(b>0)for(e=0;e<d;e++){l=e==d-1;g=c[b][l?0:e+1];h=c[b][l?d-1:e];j=c[b-1][l?d-1:e];l=c[b-
+1][l?0:e+1];p=b/(f-1);n=(b-1)/(f-1);v=(e+1)/d;m=e/d;k=new THREE.UV(1-v,p);p=new THREE.UV(1-m,p);m=new THREE.UV(1-m,n);var w=new THREE.UV(1-v,n);if(b<c.length-1){n=this.vertices[g].position.clone();v=this.vertices[h].position.clone();A=this.vertices[j].position.clone();n.normalize();v.normalize();A.normalize();this.faces.push(new THREE.Face3(g,h,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z)]));this.faceVertexUvs[0].push([k,p,m])}if(b>1){n=this.vertices[g].position.clone();
+v=this.vertices[j].position.clone();A=this.vertices[l].position.clone();n.normalize();v.normalize();A.normalize();this.faces.push(new THREE.Face3(g,j,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z)]));this.faceVertexUvs[0].push([k,m,w])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
+THREE.Torus=function(a,c,b,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
+1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var d=(this.segmentsT+1)*(c-1)+b-1,g=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,d,g));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
+THREE.TorusKnot=function(a,c,b,e,f,d,g){function h(m,p,n,v,A,w){p=n/v*m;n=Math.cos(p);return new THREE.Vector3(A*(2+n)*0.5*Math.cos(m),A*(2+n)*Math.sin(m)*0.5,w*A*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=d||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;d=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var j=
+a/this.segmentsR*2*this.p*Math.PI;g=c/this.segmentsT*2*Math.PI;f=h(j,g,this.q,this.p,this.radius,this.heightScale);j=h(j+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=j.x-f.x;b.y=j.y-f.y;b.z=j.z-f.z;e.x=j.x+f.x;e.y=j.y+f.y;e.z=j.z+f.z;d.cross(b,e);e.cross(d,b);d.normalize();e.normalize();j=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=j*e.x+g*d.x;f.y+=j*e.y+g*d.y;f.z+=j*e.z+g*d.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
+0;c<this.segmentsT;++c){e=(a+1)%this.segmentsR;d=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[e][c];e=this.grid[e][d];d=this.grid[a][d];g=new THREE.UV(a/this.segmentsR,c/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,b,e,d));this.faceVertexUvs[0].push([g,j,l,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
 THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var d="Loaded ";d+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=d},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,d,b){a.materials=[];for(var e=0;e<d.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(d[e],b)]},createMaterial:function(a,d){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function e(h,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));h.image.width=k;h.image.height=m;h.image.getContext("2d").drawImage(this,0,0,k,m)}else h.image=this;h.needsUpdate=!0};l.src=j}var c,f,g;c="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")c="MeshPhongMaterial";else a.shading=="Basic"&&(c="MeshBasicMaterial");if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending==
-"Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==undefined||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==undefined)f.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&d){g=document.createElement("canvas");f.map=new THREE.Texture(g);f.map.sourceFile=a.mapDiffuse;e(f.map,d+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<
-16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=g;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&d){g=document.createElement("canvas");f.lightMap=new THREE.Texture(g);f.lightMap.sourceFile=a.mapLightmap;e(f.lightMap,d+"/"+a.mapLightmap)}return new THREE[c](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype.load=function(a){var d=this,b=a.model,e=a.callback,c=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(f){d.createModel(f.data,e,c);d.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,d,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var c,f,g,h,j,l,k,m,p,o,y,x,v,u,z,n=a.faces;o=a.vertices;var A=a.normals,B=a.colors;l=a.scale!==undefined?a.scale:1;var G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++){e.faceUvs[c]=[];e.faceVertexUvs[c]=[]}h=0;for(j=o.length;h<j;){k=new THREE.Vertex;k.position.x=o[h++]/
-l;k.position.y=o[h++]/l;k.position.z=o[h++]/l;e.vertices.push(k)}h=0;for(j=n.length;h<j;){o=n[h++];l=o&1;g=o&2;c=o&4;f=o&8;m=o&16;k=o&32;y=o&64;o&=128;if(l){x=new THREE.Face4;x.a=n[h++];x.b=n[h++];x.c=n[h++];x.d=n[h++];l=4}else{x=new THREE.Face3;x.a=n[h++];x.b=n[h++];x.c=n[h++];l=3}if(g){g=n[h++];x.materials=e.materials[g]}g=e.faces.length;if(c)for(c=0;c<G;c++){v=a.uvs[c];p=n[h++];z=v[p*2];p=v[p*2+1];e.faceUvs[c][g]=new THREE.UV(z,p)}if(f)for(c=0;c<G;c++){v=a.uvs[c];u=[];for(f=0;f<l;f++){p=n[h++];
-z=v[p*2];p=v[p*2+1];u[f]=new THREE.UV(z,p)}e.faceVertexUvs[c][g]=u}if(m){m=n[h++]*3;f=new THREE.Vector3;f.x=A[m++];f.y=A[m++];f.z=A[m];x.normal=f}if(k)for(c=0;c<l;c++){m=n[h++]*3;f=new THREE.Vector3;f.x=A[m++];f.y=A[m++];f.z=A[m];x.vertexNormals.push(f)}if(y){k=n[h++];k=new THREE.Color(B[k]);x.color=k}if(o)for(c=0;c<l;c++){k=n[h++];k=new THREE.Color(B[k]);x.vertexColors.push(k)}e.faces.push(x)}}})();(function(){var c,f,g,h;if(a.skinWeights){c=0;for(f=a.skinWeights.length;c<f;c+=2){g=a.skinWeights[c];
-h=a.skinWeights[c+1];e.skinWeights.push(new THREE.Vector4(g,h,0,0))}}if(a.skinIndices){c=0;for(f=a.skinIndices.length;c<f;c+=2){g=a.skinIndices[c];h=a.skinIndices[c+1];e.skinIndices.push(new THREE.Vector4(g,h,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var c,f,g,h,j,l;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];j=e.morphTargets[c].vertices;l=a.morphTargets[c].vertices;
-g=0;for(h=l.length;g<h;g+=3)j.push(new THREE.Vertex(new THREE.Vector3(l[g],l[g+1],l[g+2])))}}if(a.morphColors!==undefined){var k;c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];j=e.morphColors[c].colors;l=a.morphColors[c].colors;g=0;for(h=l.length;g<h;g+=3){k=new THREE.Color(16755200);k.setRGB(l[g],l[g+1],l[g+2]);j.push(k)}}}})();(function(){if(a.edges!==undefined){var c,f,g;for(c=0;c<a.edges.length;c+=2){f=a.edges[c];
-g=a.edges[c+1];e.edges.push(new THREE.Edge(e.vertices[f],e.vertices[g],f,g))}}})();e.computeCentroids();e.computeFaceNormals();e.computeEdgeFaces();d(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var d=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(d),c=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,c,e,f)};d.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
-d.postMessage(a)},loadAjaxBuffers:function(a,d,b,e,c,f){var g=new XMLHttpRequest,h=e+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,c,d):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(f){j==0&&(j=g.getResponseHeader("Content-Length"));f({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,d,b,e){var c=function(f){function g(t,w){var C=k(t,w),E=k(t,w+1),I=k(t,w+2),T=k(t,w+3),V=(T<<1&255|I>>7)-127;C|=(I&127)<<16|E<<8;if(C==0&&V==-127)return 0;return(1-2*(T>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function h(t,w){var C=k(t,w),E=k(t,w+1),I=k(t,w+2);return(k(t,w+3)<<24)+(I<<16)+(E<<8)+C}function j(t,w){var C=k(t,w);return(k(t,w+1)<<8)+C}function l(t,w){var C=k(t,w);return C>127?C-256:C}function k(t,
-w){return t.charCodeAt(w)&255}function m(t){var w,C,E;w=h(a,t);C=h(a,t+G);E=h(a,t+K);t=j(a,t+J);THREE.BinaryLoader.prototype.f3(u,w,C,E,t)}function p(t){var w,C,E,I,T,V;w=h(a,t);C=h(a,t+G);E=h(a,t+K);I=j(a,t+J);T=h(a,t+H);V=h(a,t+D);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(u,A,w,C,E,I,T,V,t)}function o(t){var w,C,E,I;w=h(a,t);C=h(a,t+R);E=h(a,t+O);I=h(a,t+S);t=j(a,t+P);THREE.BinaryLoader.prototype.f4(u,w,C,E,I,t)}function y(t){var w,C,E,I,T,V,ca,da;w=h(a,t);C=h(a,t+R);E=h(a,t+O);I=h(a,t+S);T=j(a,
-t+P);V=h(a,t+F);ca=h(a,t+M);da=h(a,t+Q);t=h(a,t+U);THREE.BinaryLoader.prototype.f4n(u,A,w,C,E,I,T,V,ca,da,t)}function x(t){var w,C;w=h(a,t);C=h(a,t+N);t=h(a,t+W);THREE.BinaryLoader.prototype.uv3(u.faceVertexUvs[0],B[w*2],B[w*2+1],B[C*2],B[C*2+1],B[t*2],B[t*2+1])}function v(t){var w,C,E;w=h(a,t);C=h(a,t+ea);E=h(a,t+fa);t=h(a,t+ga);THREE.BinaryLoader.prototype.uv4(u.faceVertexUvs[0],B[w*2],B[w*2+1],B[C*2],B[C*2+1],B[E*2],B[E*2+1],B[t*2],B[t*2+1])}var u=this,z=0,n,A=[],B=[],G,K,J,H,D,L,R,O,S,P,F,M,Q,
-U,N,W,ea,fa,ga,Y,Z,$,aa,ba,X;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u,e,f);n={signature:a.substr(z,8),header_bytes:k(a,z+8),vertex_coordinate_bytes:k(a,z+9),normal_coordinate_bytes:k(a,z+10),uv_coordinate_bytes:k(a,z+11),vertex_index_bytes:k(a,z+12),normal_index_bytes:k(a,z+13),uv_index_bytes:k(a,z+14),material_index_bytes:k(a,z+15),nvertices:h(a,z+16),nnormals:h(a,z+16+4),nuvs:h(a,z+16+8),ntri_flat:h(a,z+16+12),ntri_smooth:h(a,z+16+16),ntri_flat_uv:h(a,z+16+20),ntri_smooth_uv:h(a,
-z+16+24),nquad_flat:h(a,z+16+28),nquad_smooth:h(a,z+16+32),nquad_flat_uv:h(a,z+16+36),nquad_smooth_uv:h(a,z+16+40)};z+=n.header_bytes;G=n.vertex_index_bytes;K=n.vertex_index_bytes*2;J=n.vertex_index_bytes*3;H=n.vertex_index_bytes*3+n.material_index_bytes;D=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;L=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;R=n.vertex_index_bytes;O=n.vertex_index_bytes*2;S=n.vertex_index_bytes*3;P=n.vertex_index_bytes*4;F=n.vertex_index_bytes*
-4+n.material_index_bytes;M=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;Q=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;N=n.uv_index_bytes;W=n.uv_index_bytes*2;ea=n.uv_index_bytes;fa=n.uv_index_bytes*2;ga=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;X=n.vertex_index_bytes*4+n.material_index_bytes;Y=n.ntri_flat*f;Z=n.ntri_smooth*(f+n.normal_index_bytes*3);$=n.ntri_flat_uv*
-(f+n.uv_index_bytes*3);aa=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ba=n.nquad_flat*X;f=n.nquad_smooth*(X+n.normal_index_bytes*4);X=n.nquad_flat_uv*(X+n.uv_index_bytes*4);z+=function(t){for(var w,C,E,I=n.vertex_coordinate_bytes*3,T=t+n.nvertices*I;t<T;t+=I){w=g(a,t);C=g(a,t+n.vertex_coordinate_bytes);E=g(a,t+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(u,w,C,E)}return n.nvertices*I}(z);z+=function(t){for(var w,C,E,I=n.normal_coordinate_bytes*3,T=t+n.nnormals*I;t<
-T;t+=I){w=l(a,t);C=l(a,t+n.normal_coordinate_bytes);E=l(a,t+n.normal_coordinate_bytes*2);A.push(w/127,C/127,E/127)}return n.nnormals*I}(z);z+=function(t){for(var w,C,E=n.uv_coordinate_bytes*2,I=t+n.nuvs*E;t<I;t+=E){w=g(a,t);C=g(a,t+n.uv_coordinate_bytes);B.push(w,C)}return n.nuvs*E}(z);Y=z+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;f=ba+f;X=f+X;(function(t){var w,C=n.vertex_index_bytes*3+n.material_index_bytes,E=C+n.uv_index_bytes*3,I=t+n.ntri_flat_uv*E;for(w=t;w<I;w+=E){m(w);x(w+C)}return I-t})(Z);(function(t){var w,
-C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,E=C+n.uv_index_bytes*3,I=t+n.ntri_smooth_uv*E;for(w=t;w<I;w+=E){p(w);x(w+C)}return I-t})($);(function(t){var w,C=n.vertex_index_bytes*4+n.material_index_bytes,E=C+n.uv_index_bytes*4,I=t+n.nquad_flat_uv*E;for(w=t;w<I;w+=E){o(w);v(w+C)}return I-t})(f);(function(t){var w,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,E=C+n.uv_index_bytes*4,I=t+n.nquad_smooth_uv*E;for(w=t;w<I;w+=E){y(w);v(w+C)}return I-t})(X);
-(function(t){var w,C=n.vertex_index_bytes*3+n.material_index_bytes,E=t+n.ntri_flat*C;for(w=t;w<E;w+=C)m(w);return E-t})(z);(function(t){var w,C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,E=t+n.ntri_smooth*C;for(w=t;w<E;w+=C)p(w);return E-t})(Y);(function(t){var w,C=n.vertex_index_bytes*4+n.material_index_bytes,E=t+n.nquad_flat*C;for(w=t;w<E;w+=C)o(w);return E-t})(aa);(function(t){var w,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,E=t+n.nquad_smooth*
-C;for(w=t;w<E;w+=C)y(w);return E-t})(ba);this.computeCentroids();this.computeFaceNormals()};c.prototype=new THREE.Geometry;c.prototype.constructor=c;d(new c(b))},v:function(a,d,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(d,b,e)))},f3:function(a,d,b,e,c){a.faces.push(new THREE.Face3(d,b,e,null,null,a.materials[c]))},f4:function(a,d,b,e,c,f){a.faces.push(new THREE.Face4(d,b,e,c,null,null,a.materials[f]))},f3n:function(a,d,b,e,c,f,g,h,j){f=a.materials[f];var l=d[h*3],k=d[h*3+1];h=d[h*3+2];
-var m=d[j*3],p=d[j*3+1];j=d[j*3+2];a.faces.push(new THREE.Face3(b,e,c,[new THREE.Vector3(d[g*3],d[g*3+1],d[g*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(m,p,j)],null,f))},f4n:function(a,d,b,e,c,f,g,h,j,l,k){g=a.materials[g];var m=d[j*3],p=d[j*3+1];j=d[j*3+2];var o=d[l*3],y=d[l*3+1];l=d[l*3+2];var x=d[k*3],v=d[k*3+1];k=d[k*3+2];a.faces.push(new THREE.Face4(b,e,c,f,[new THREE.Vector3(d[h*3],d[h*3+1],d[h*3+2]),new THREE.Vector3(m,p,j),new THREE.Vector3(o,y,l),new THREE.Vector3(x,v,k)],null,g))},
-uv3:function(a,d,b,e,c,f,g){var h=[];h.push(new THREE.UV(d,b));h.push(new THREE.UV(e,c));h.push(new THREE.UV(f,g));a.push(h)},uv4:function(a,d,b,e,c,f,g,h,j){var l=[];l.push(new THREE.UV(d,b));l.push(new THREE.UV(e,c));l.push(new THREE.UV(f,g));l.push(new THREE.UV(h,j));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,d){var b=this,e=new Worker(a);e.postMessage(0);var c=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(f){function g(N,W){return W=="relativeToHTML"?N:c+"/"+N}function h(){for(o in D.objects)if(!F.objects[o]){z=D.objects[o];if(z.geometry!==undefined){if(G=F.geometries[z.geometry]){H=[];for(U=0;U<z.materials.length;U++)H[U]=F.materials[z.materials[U]];n=z.position;r=z.rotation;q=z.quaternion;s=z.scale;q=0;H.length==0&&(H[0]=new THREE.MeshFaceMaterial);
-H.length>1&&(H=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,H);object.name=o;object.position.set(n[0],n[1],n[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=z.visible;F.scene.addObject(object);F.objects[o]=object;if(z.meshCollider){var N=THREE.CollisionUtils.MeshColliderWBox(object);F.scene.collisions.colliders.push(N)}if(z.castsShadow){N=new THREE.ShadowVolume(G);F.scene.addChild(N);
-N.position=object.position;N.rotation=object.rotation;N.scale=object.scale}z.trigger&&z.trigger.toLowerCase()!="none"&&(F.triggers[object.name]={type:z.trigger,object:z})}}else{n=z.position;r=z.rotation;q=z.quaternion;s=z.scale;q=0;object=new THREE.Object3D;object.name=o;object.position.set(n[0],n[1],n[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=z.visible!==undefined?z.visible:
-!1;F.scene.addObject(object);F.objects[o]=object;F.empties[o]=object}}}function j(N){return function(W){F.geometries[N]=W;h();R-=1;b.onLoadComplete();k()}}function l(N){return function(W){F.geometries[N]=W}}function k(){b.callbackProgress({totalModels:S,totalTextures:P,loadedModels:S-R,loadedTextures:P-O},F);b.onLoadProgress();R==0&&O==0&&d(F)}var m,p,o,y,x,v,u,z,n,A,B,G,K,J,H,D,L,R,O,S,P,F;D=f.data;f=new THREE.BinaryLoader;L=new THREE.JSONLoader;O=R=0;F={scene:new THREE.Scene,geometries:{},materials:{},
-textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var M=!1;for(o in D.objects){z=D.objects[o];if(z.meshCollider){M=!0;break}}if(M)F.scene.collisions=new THREE.CollisionSystem;if(D.transform){M=D.transform.position;A=D.transform.rotation;var Q=D.transform.scale;M&&F.scene.position.set(M[0],M[1],M[2]);A&&F.scene.rotation.set(A[0],A[1],A[2]);Q&&F.scene.scale.set(Q[0],Q[1],Q[2]);(M||A||Q)&&F.scene.updateMatrix()}M=function(){O-=1;k();b.onLoadComplete()};for(x in D.cameras){A=
-D.cameras[x];if(A.type=="perspective")K=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far)}n=A.position;A=A.target;K.position.set(n[0],n[1],n[2]);K.target.position.set(A[0],A[1],A[2]);F.cameras[x]=K}for(y in D.lights){x=D.lights[y];K=x.color!==undefined?x.color:16777215;A=x.intensity!==undefined?x.intensity:1;if(x.type=="directional"){n=x.direction;light=new THREE.DirectionalLight(K,
-A);light.position.set(n[0],n[1],n[2]);light.position.normalize()}else if(x.type=="point"){n=x.position;light=new THREE.PointLight(K,A);light.position.set(n[0],n[1],n[2])}F.scene.addLight(light);F.lights[y]=light}for(v in D.fogs){y=D.fogs[v];if(y.type=="linear")J=new THREE.Fog(0,y.near,y.far);else y.type=="exp2"&&(J=new THREE.FogExp2(0,y.density));A=y.color;J.color.setRGB(A[0],A[1],A[2]);F.fogs[v]=J}if(F.cameras&&D.defaults.camera)F.currentCamera=F.cameras[D.defaults.camera];if(F.fogs&&D.defaults.fog)F.scene.fog=
-F.fogs[D.defaults.fog];A=D.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(A[0],A[1],A[2]);F.bgColorAlpha=D.defaults.bgalpha;for(m in D.geometries){v=D.geometries[m];if(v.type=="bin_mesh"||v.type=="ascii_mesh"){R+=1;b.onLoadStart()}}S=R;for(m in D.geometries){v=D.geometries[m];if(v.type=="cube"){G=new THREE.Cube(v.width,v.height,v.depth,v.segmentsWidth,v.segmentsHeight,v.segmentsDepth,null,v.flipped,v.sides);F.geometries[m]=G}else if(v.type=="plane"){G=new THREE.Plane(v.width,v.height,
-v.segmentsWidth,v.segmentsHeight);F.geometries[m]=G}else if(v.type=="sphere"){G=new THREE.Sphere(v.radius,v.segmentsWidth,v.segmentsHeight);F.geometries[m]=G}else if(v.type=="cylinder"){G=new THREE.Cylinder(v.numSegs,v.topRad,v.botRad,v.height,v.topOffset,v.botOffset);F.geometries[m]=G}else if(v.type=="torus"){G=new THREE.Torus(v.radius,v.tube,v.segmentsR,v.segmentsT);F.geometries[m]=G}else if(v.type=="icosahedron"){G=new THREE.Icosahedron(v.subdivisions);F.geometries[m]=G}else if(v.type=="bin_mesh")f.load({model:g(v.url,
-D.urlBaseType),callback:j(m)});else if(v.type=="ascii_mesh")L.load({model:g(v.url,D.urlBaseType),callback:j(m)});else if(v.type=="embedded_mesh")(v=D.embeds[v.id])&&L.createModel(v,l(m),"")}for(u in D.textures){m=D.textures[u];if(m.url instanceof Array){O+=m.url.length;for(f=0;f<m.url.length;f++)b.onLoadStart()}else{O+=1;b.onLoadStart()}}P=O;for(u in D.textures){m=D.textures[u];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){f=[];for(var U=
-0;U<m.url.length;U++)f[U]=g(m.url[U],D.urlBaseType);f=THREE.ImageUtils.loadTextureCube(f,m.mapping,M)}else{f=THREE.ImageUtils.loadTexture(g(m.url,D.urlBaseType),m.mapping,M);if(THREE[m.minFilter]!=undefined)f.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)f.magFilter=THREE[m.magFilter]}F.textures[u]=f}for(p in D.materials){u=D.materials[p];for(B in u.parameters)if(B=="envMap"||B=="map"||B=="lightMap")u.parameters[B]=F.textures[u.parameters[B]];else if(B=="shading")u.parameters[B]=u.parameters[B]==
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function e(h,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));h.image.width=k;h.image.height=m;h.image.getContext("2d").drawImage(this,0,0,k,m)}else h.image=this;h.needsUpdate=!0};l.src=j}var f,d,g;f="MeshLambertMaterial";d={color:15658734,opacity:1,map:null,lightMap:null,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.blending)if(a.blending=="Additive")d.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")d.blending=THREE.SubtractiveBlending;else if(a.blending==
+"Multiply")d.blending=THREE.MultiplyBlending;if(a.transparent!==undefined||a.opacity<1)d.transparent=a.transparent;if(a.depthTest!==undefined)d.depthTest=a.depthTest;if(a.vertexColors!==undefined)if(a.vertexColors=="face")d.vertexColors=THREE.FaceColors;else if(a.vertexColors)d.vertexColors=THREE.VertexColors;if(a.mapDiffuse&&c){g=document.createElement("canvas");d.map=new THREE.Texture(g);d.map.sourceFile=a.mapDiffuse;e(d.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*255<<
+16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;d.color=g;d.opacity=a.transparency}else if(a.DbgColor)d.color=a.DbgColor;if(a.mapLightmap&&c){g=document.createElement("canvas");d.lightMap=new THREE.Texture(g);d.lightMap.sourceFile=a.mapLightmap;e(d.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](d)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(d){c.createModel(d.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,f=a.scale!==undefined?a.scale:1;this.init_materials(e,a.materials,b);(function(d){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var g,h,j,l,k,m,p,n,v,A,w,u,y,o,z=a.faces;m=a.vertices;var B=a.normals,I=a.colors,K=0;for(g=0;g<a.uvs.length;g++)a.uvs[g].length&&K++;for(g=0;g<K;g++){e.faceUvs[g]=[];e.faceVertexUvs[g]=[]}l=0;for(k=m.length;l<k;){p=new THREE.Vertex;p.position.x=m[l++]/d;
+p.position.y=m[l++]/d;p.position.z=m[l++]/d;e.vertices.push(p)}l=0;for(k=z.length;l<k;){d=z[l++];m=d&1;j=d&2;g=d&4;h=d&8;n=d&16;p=d&32;A=d&64;d&=128;if(m){w=new THREE.Face4;w.a=z[l++];w.b=z[l++];w.c=z[l++];w.d=z[l++];m=4}else{w=new THREE.Face3;w.a=z[l++];w.b=z[l++];w.c=z[l++];m=3}if(j){j=z[l++];w.materials=e.materials[j]}j=e.faces.length;if(g)for(g=0;g<K;g++){u=a.uvs[g];v=z[l++];o=u[v*2];v=u[v*2+1];e.faceUvs[g][j]=new THREE.UV(o,v)}if(h)for(g=0;g<K;g++){u=a.uvs[g];y=[];for(h=0;h<m;h++){v=z[l++];o=
+u[v*2];v=u[v*2+1];y[h]=new THREE.UV(o,v)}e.faceVertexUvs[g][j]=y}if(n){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.normal=h}if(p)for(g=0;g<m;g++){n=z[l++]*3;h=new THREE.Vector3;h.x=B[n++];h.y=B[n++];h.z=B[n];w.vertexNormals.push(h)}if(A){p=z[l++];p=new THREE.Color(I[p]);w.color=p}if(d)for(g=0;g<m;g++){p=z[l++];p=new THREE.Color(I[p]);w.vertexColors.push(p)}e.faces.push(w)}}})(f);(function(){var d,g,h,j;if(a.skinWeights){d=0;for(g=a.skinWeights.length;d<g;d+=2){h=a.skinWeights[d];
+j=a.skinWeights[d+1];e.skinWeights.push(new THREE.Vector4(h,j,0,0))}}if(a.skinIndices){d=0;for(g=a.skinIndices.length;d<g;d+=2){h=a.skinIndices[d];j=a.skinIndices[d+1];e.skinIndices.push(new THREE.Vector4(h,j,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(d){if(a.morphTargets!==undefined){var g,h,j,l,k,m,p,n,v;g=0;for(h=a.morphTargets.length;g<h;g++){e.morphTargets[g]={};e.morphTargets[g].name=a.morphTargets[g].name;e.morphTargets[g].vertices=[];n=e.morphTargets[g].vertices;v=a.morphTargets[g].vertices;
+j=0;for(l=v.length;j<l;j+=3){k=v[j]/d;m=v[j+1]/d;p=v[j+2]/d;n.push(new THREE.Vertex(new THREE.Vector3(k,m,p)))}}}if(a.morphColors!==undefined){g=0;for(h=a.morphColors.length;g<h;g++){e.morphColors[g]={};e.morphColors[g].name=a.morphColors[g].name;e.morphColors[g].colors=[];l=e.morphColors[g].colors;k=a.morphColors[g].colors;d=0;for(j=k.length;d<j;d+=3){m=new THREE.Color(16755200);m.setRGB(k[d],k[d+1],k[d+2]);l.push(m)}}}})(f);(function(){if(a.edges!==undefined){var d,g,h;for(d=0;d<a.edges.length;d+=
+2){g=a.edges[d];h=a.edges[d+1];e.edges.push(new THREE.Edge(e.vertices[g],e.vertices[h],g,h))}}})();e.computeCentroids();e.computeFaceNormals();e.computeEdgeFaces();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var d=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,f,e,d)};c.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
+c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,d){var g=new XMLHttpRequest,h=e+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,f,c):alert("Couldn't load ["+h+"] ["+g.status+"]");else if(g.readyState==3){if(d){j==0&&(j=g.getResponseHeader("Content-Length"));d({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",h,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
+g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,e){var f=function(d){function g(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2),T=k(t,x+3),V=(T<<1&255|H>>7)-127;C|=(H&127)<<16|E<<8;if(C==0&&V==-127)return 0;return(1-2*(T>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function h(t,x){var C=k(t,x),E=k(t,x+1),H=k(t,x+2);return(k(t,x+3)<<24)+(H<<16)+(E<<8)+C}function j(t,x){var C=k(t,x);return(k(t,x+1)<<8)+C}function l(t,x){var C=k(t,x);return C>127?C-256:C}function k(t,
+x){return t.charCodeAt(x)&255}function m(t){var x,C,E;x=h(a,t);C=h(a,t+I);E=h(a,t+K);t=j(a,t+J);THREE.BinaryLoader.prototype.f3(u,x,C,E,t)}function p(t){var x,C,E,H,T,V;x=h(a,t);C=h(a,t+I);E=h(a,t+K);H=j(a,t+J);T=h(a,t+G);V=h(a,t+D);t=h(a,t+L);THREE.BinaryLoader.prototype.f3n(u,z,x,C,E,H,T,V,t)}function n(t){var x,C,E,H;x=h(a,t);C=h(a,t+R);E=h(a,t+O);H=h(a,t+S);t=j(a,t+P);THREE.BinaryLoader.prototype.f4(u,x,C,E,H,t)}function v(t){var x,C,E,H,T,V,ca,da;x=h(a,t);C=h(a,t+R);E=h(a,t+O);H=h(a,t+S);T=j(a,
+t+P);V=h(a,t+F);ca=h(a,t+M);da=h(a,t+Q);t=h(a,t+U);THREE.BinaryLoader.prototype.f4n(u,z,x,C,E,H,T,V,ca,da,t)}function A(t){var x,C;x=h(a,t);C=h(a,t+N);t=h(a,t+W);THREE.BinaryLoader.prototype.uv3(u.faceVertexUvs[0],B[x*2],B[x*2+1],B[C*2],B[C*2+1],B[t*2],B[t*2+1])}function w(t){var x,C,E;x=h(a,t);C=h(a,t+ea);E=h(a,t+fa);t=h(a,t+ga);THREE.BinaryLoader.prototype.uv4(u.faceVertexUvs[0],B[x*2],B[x*2+1],B[C*2],B[C*2+1],B[E*2],B[E*2+1],B[t*2],B[t*2+1])}var u=this,y=0,o,z=[],B=[],I,K,J,G,D,L,R,O,S,P,F,M,Q,
+U,N,W,ea,fa,ga,Y,Z,$,aa,ba,X;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u,e,d);o={signature:a.substr(y,8),header_bytes:k(a,y+8),vertex_coordinate_bytes:k(a,y+9),normal_coordinate_bytes:k(a,y+10),uv_coordinate_bytes:k(a,y+11),vertex_index_bytes:k(a,y+12),normal_index_bytes:k(a,y+13),uv_index_bytes:k(a,y+14),material_index_bytes:k(a,y+15),nvertices:h(a,y+16),nnormals:h(a,y+16+4),nuvs:h(a,y+16+8),ntri_flat:h(a,y+16+12),ntri_smooth:h(a,y+16+16),ntri_flat_uv:h(a,y+16+20),ntri_smooth_uv:h(a,
+y+16+24),nquad_flat:h(a,y+16+28),nquad_smooth:h(a,y+16+32),nquad_flat_uv:h(a,y+16+36),nquad_smooth_uv:h(a,y+16+40)};y+=o.header_bytes;I=o.vertex_index_bytes;K=o.vertex_index_bytes*2;J=o.vertex_index_bytes*3;G=o.vertex_index_bytes*3+o.material_index_bytes;D=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;L=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;R=o.vertex_index_bytes;O=o.vertex_index_bytes*2;S=o.vertex_index_bytes*3;P=o.vertex_index_bytes*4;F=o.vertex_index_bytes*
+4+o.material_index_bytes;M=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;Q=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;U=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;N=o.uv_index_bytes;W=o.uv_index_bytes*2;ea=o.uv_index_bytes;fa=o.uv_index_bytes*2;ga=o.uv_index_bytes*3;d=o.vertex_index_bytes*3+o.material_index_bytes;X=o.vertex_index_bytes*4+o.material_index_bytes;Y=o.ntri_flat*d;Z=o.ntri_smooth*(d+o.normal_index_bytes*3);$=o.ntri_flat_uv*
+(d+o.uv_index_bytes*3);aa=o.ntri_smooth_uv*(d+o.normal_index_bytes*3+o.uv_index_bytes*3);ba=o.nquad_flat*X;d=o.nquad_smooth*(X+o.normal_index_bytes*4);X=o.nquad_flat_uv*(X+o.uv_index_bytes*4);y+=function(t){for(var x,C,E,H=o.vertex_coordinate_bytes*3,T=t+o.nvertices*H;t<T;t+=H){x=g(a,t);C=g(a,t+o.vertex_coordinate_bytes);E=g(a,t+o.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(u,x,C,E)}return o.nvertices*H}(y);y+=function(t){for(var x,C,E,H=o.normal_coordinate_bytes*3,T=t+o.nnormals*H;t<
+T;t+=H){x=l(a,t);C=l(a,t+o.normal_coordinate_bytes);E=l(a,t+o.normal_coordinate_bytes*2);z.push(x/127,C/127,E/127)}return o.nnormals*H}(y);y+=function(t){for(var x,C,E=o.uv_coordinate_bytes*2,H=t+o.nuvs*E;t<H;t+=E){x=g(a,t);C=g(a,t+o.uv_coordinate_bytes);B.push(x,C)}return o.nuvs*E}(y);Y=y+Y;Z=Y+Z;$=Z+$;aa=$+aa;ba=aa+ba;d=ba+d;X=d+X;(function(t){var x,C=o.vertex_index_bytes*3+o.material_index_bytes,E=C+o.uv_index_bytes*3,H=t+o.ntri_flat_uv*E;for(x=t;x<H;x+=E){m(x);A(x+C)}return H-t})(Z);(function(t){var x,
+C=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,E=C+o.uv_index_bytes*3,H=t+o.ntri_smooth_uv*E;for(x=t;x<H;x+=E){p(x);A(x+C)}return H-t})($);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes,E=C+o.uv_index_bytes*4,H=t+o.nquad_flat_uv*E;for(x=t;x<H;x+=E){n(x);w(x+C)}return H-t})(d);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,E=C+o.uv_index_bytes*4,H=t+o.nquad_smooth_uv*E;for(x=t;x<H;x+=E){v(x);w(x+C)}return H-t})(X);
+(function(t){var x,C=o.vertex_index_bytes*3+o.material_index_bytes,E=t+o.ntri_flat*C;for(x=t;x<E;x+=C)m(x);return E-t})(y);(function(t){var x,C=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,E=t+o.ntri_smooth*C;for(x=t;x<E;x+=C)p(x);return E-t})(Y);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes,E=t+o.nquad_flat*C;for(x=t;x<E;x+=C)n(x);return E-t})(aa);(function(t){var x,C=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,E=t+o.nquad_smooth*
+C;for(x=t;x<E;x+=C)v(x);return E-t})(ba);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,d){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[d]))},f3n:function(a,c,b,e,f,d,g,h,j){d=a.materials[d];var l=c[h*3],k=c[h*3+1];h=c[h*3+2];
+var m=c[j*3],p=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(m,p,j)],null,d))},f4n:function(a,c,b,e,f,d,g,h,j,l,k){g=a.materials[g];var m=c[j*3],p=c[j*3+1];j=c[j*3+2];var n=c[l*3],v=c[l*3+1];l=c[l*3+2];var A=c[k*3],w=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face4(b,e,f,d,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,p,j),new THREE.Vector3(n,v,l),new THREE.Vector3(A,w,k)],null,g))},
+uv3:function(a,c,b,e,f,d,g){var h=[];h.push(new THREE.UV(c,b));h.push(new THREE.UV(e,f));h.push(new THREE.UV(d,g));a.push(h)},uv4:function(a,c,b,e,f,d,g,h,j){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(e,f));l.push(new THREE.UV(d,g));l.push(new THREE.UV(h,j));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(d){function g(N,W){return W=="relativeToHTML"?N:f+"/"+N}function h(){for(n in D.objects)if(!F.objects[n]){y=D.objects[n];if(y.geometry!==undefined){if(I=F.geometries[y.geometry]){G=[];for(U=0;U<y.materials.length;U++)G[U]=F.materials[y.materials[U]];o=y.position;r=y.rotation;q=y.quaternion;s=y.scale;q=0;G.length==0&&(G[0]=new THREE.MeshFaceMaterial);
+G.length>1&&(G=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(I,G);object.name=n;object.position.set(o[0],o[1],o[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=y.visible;F.scene.addObject(object);F.objects[n]=object;if(y.meshCollider){var N=THREE.CollisionUtils.MeshColliderWBox(object);F.scene.collisions.colliders.push(N)}if(y.castsShadow){N=new THREE.ShadowVolume(I);F.scene.addChild(N);
+N.position=object.position;N.rotation=object.rotation;N.scale=object.scale}y.trigger&&y.trigger.toLowerCase()!="none"&&(F.triggers[object.name]={type:y.trigger,object:y})}}else{o=y.position;r=y.rotation;q=y.quaternion;s=y.scale;q=0;object=new THREE.Object3D;object.name=n;object.position.set(o[0],o[1],o[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=y.visible!==undefined?y.visible:
+!1;F.scene.addObject(object);F.objects[n]=object;F.empties[n]=object}}}function j(N){return function(W){F.geometries[N]=W;h();R-=1;b.onLoadComplete();k()}}function l(N){return function(W){F.geometries[N]=W}}function k(){b.callbackProgress({totalModels:S,totalTextures:P,loadedModels:S-R,loadedTextures:P-O},F);b.onLoadProgress();R==0&&O==0&&c(F)}var m,p,n,v,A,w,u,y,o,z,B,I,K,J,G,D,L,R,O,S,P,F;D=d.data;d=new THREE.BinaryLoader;L=new THREE.JSONLoader;O=R=0;F={scene:new THREE.Scene,geometries:{},materials:{},
+textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var M=!1;for(n in D.objects){y=D.objects[n];if(y.meshCollider){M=!0;break}}if(M)F.scene.collisions=new THREE.CollisionSystem;if(D.transform){M=D.transform.position;z=D.transform.rotation;var Q=D.transform.scale;M&&F.scene.position.set(M[0],M[1],M[2]);z&&F.scene.rotation.set(z[0],z[1],z[2]);Q&&F.scene.scale.set(Q[0],Q[1],Q[2]);(M||z||Q)&&F.scene.updateMatrix()}M=function(){O-=1;k();b.onLoadComplete()};for(A in D.cameras){z=
+D.cameras[A];if(z.type=="perspective")K=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho"){K=new THREE.Camera;K.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far)}o=z.position;z=z.target;K.position.set(o[0],o[1],o[2]);K.target.position.set(z[0],z[1],z[2]);F.cameras[A]=K}for(v in D.lights){A=D.lights[v];K=A.color!==undefined?A.color:16777215;z=A.intensity!==undefined?A.intensity:1;if(A.type=="directional"){o=A.direction;light=new THREE.DirectionalLight(K,
+z);light.position.set(o[0],o[1],o[2]);light.position.normalize()}else if(A.type=="point"){o=A.position;light=new THREE.PointLight(K,z);light.position.set(o[0],o[1],o[2])}F.scene.addLight(light);F.lights[v]=light}for(w in D.fogs){v=D.fogs[w];if(v.type=="linear")J=new THREE.Fog(0,v.near,v.far);else v.type=="exp2"&&(J=new THREE.FogExp2(0,v.density));z=v.color;J.color.setRGB(z[0],z[1],z[2]);F.fogs[w]=J}if(F.cameras&&D.defaults.camera)F.currentCamera=F.cameras[D.defaults.camera];if(F.fogs&&D.defaults.fog)F.scene.fog=
+F.fogs[D.defaults.fog];z=D.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(z[0],z[1],z[2]);F.bgColorAlpha=D.defaults.bgalpha;for(m in D.geometries){w=D.geometries[m];if(w.type=="bin_mesh"||w.type=="ascii_mesh"){R+=1;b.onLoadStart()}}S=R;for(m in D.geometries){w=D.geometries[m];if(w.type=="cube"){I=new THREE.Cube(w.width,w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides);F.geometries[m]=I}else if(w.type=="plane"){I=new THREE.Plane(w.width,w.height,
+w.segmentsWidth,w.segmentsHeight);F.geometries[m]=I}else if(w.type=="sphere"){I=new THREE.Sphere(w.radius,w.segmentsWidth,w.segmentsHeight);F.geometries[m]=I}else if(w.type=="cylinder"){I=new THREE.Cylinder(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset);F.geometries[m]=I}else if(w.type=="torus"){I=new THREE.Torus(w.radius,w.tube,w.segmentsR,w.segmentsT);F.geometries[m]=I}else if(w.type=="icosahedron"){I=new THREE.Icosahedron(w.subdivisions);F.geometries[m]=I}else if(w.type=="bin_mesh")d.load({model:g(w.url,
+D.urlBaseType),callback:j(m)});else if(w.type=="ascii_mesh")L.load({model:g(w.url,D.urlBaseType),callback:j(m)});else if(w.type=="embedded_mesh")(w=D.embeds[w.id])&&L.createModel(w,l(m),"")}for(u in D.textures){m=D.textures[u];if(m.url instanceof Array){O+=m.url.length;for(d=0;d<m.url.length;d++)b.onLoadStart()}else{O+=1;b.onLoadStart()}}P=O;for(u in D.textures){m=D.textures[u];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){d=[];for(var U=
+0;U<m.url.length;U++)d[U]=g(m.url[U],D.urlBaseType);d=THREE.ImageUtils.loadTextureCube(d,m.mapping,M)}else{d=THREE.ImageUtils.loadTexture(g(m.url,D.urlBaseType),m.mapping,M);if(THREE[m.minFilter]!=undefined)d.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)d.magFilter=THREE[m.magFilter]}F.textures[u]=d}for(p in D.materials){u=D.materials[p];for(B in u.parameters)if(B=="envMap"||B=="map"||B=="lightMap")u.parameters[B]=F.textures[u.parameters[B]];else if(B=="shading")u.parameters[B]=u.parameters[B]==
 "flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")u.parameters[B]=THREE[u.parameters[B]]?THREE[u.parameters[B]]:THREE.NormalBlending;else if(B=="combine")u.parameters[B]=u.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(u.parameters[B]=="face")u.parameters[B]=THREE.FaceColors;else if(u.parameters[B])u.parameters[B]=THREE.VertexColors;if(u.parameters.opacity!==undefined&&u.parameters.opacity<1)u.parameters.transparent=!0;u=new THREE[u.type](u.parameters);
 F.materials[p]=u}h();b.callbackSync(F)}}};
-THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,c){return b+(e-b)*c};this.VIntX=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h+g*this.delta;e[f+1]=j;e[f+2]=l;c[f]=this.lerp(k[b],k[b+3],g);c[f+1]=this.lerp(k[b+1],k[b+4],g);c[f+2]=this.lerp(k[b+2],k[b+5],g)};this.VIntY=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h;e[f+1]=j+g*this.delta;e[f+
-2]=l;e=b+this.yd*3;c[f]=this.lerp(k[b],k[e],g);c[f+1]=this.lerp(k[b+1],k[e+1],g);c[f+2]=this.lerp(k[b+2],k[e+2],g)};this.VIntZ=function(b,e,c,f,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[f]=h;e[f+1]=j;e[f+2]=l+g*this.delta;e=b+this.zd*3;c[f]=this.lerp(k[b],k[e],g);c[f+1]=this.lerp(k[b+1],k[e+1],g);c[f+2]=this.lerp(k[b+2],k[e+2],g)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,c,f,g,h){var j=f+1,l=f+this.yd,k=f+this.zd,m=j+this.yd,p=j+this.zd,o=f+this.yd+this.zd,y=j+this.yd+this.zd,x=0,v=this.field[f],u=this.field[j],z=this.field[l],n=this.field[m],A=this.field[k],B=this.field[p],G=this.field[o],K=this.field[y];v<g&&(x|=1);u<g&&(x|=2);z<g&&(x|=8);n<g&&(x|=4);A<g&&(x|=16);B<g&&(x|=32);G<g&&(x|=128);K<g&&(x|=64);var J=THREE.edgeTable[x];if(J==0)return 0;
-var H=this.delta,D=b+H,L=e+H;H=c+H;if(J&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,g,b,e,c,v,u)}if(J&2){this.compNorm(j);this.compNorm(m);this.VIntY(j*3,this.vlist,this.nlist,3,g,D,e,c,u,n)}if(J&4){this.compNorm(l);this.compNorm(m);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,L,c,z,n)}if(J&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,g,b,e,c,v,z)}if(J&16){this.compNorm(k);this.compNorm(p);this.VIntX(k*3,this.vlist,this.nlist,12,g,b,e,H,
-A,B)}if(J&32){this.compNorm(p);this.compNorm(y);this.VIntY(p*3,this.vlist,this.nlist,15,g,D,e,H,B,K)}if(J&64){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,18,g,b,L,H,G,K)}if(J&128){this.compNorm(k);this.compNorm(o);this.VIntY(k*3,this.vlist,this.nlist,21,g,b,e,H,A,G)}if(J&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,g,b,e,c,v,A)}if(J&512){this.compNorm(j);this.compNorm(p);this.VIntZ(j*3,this.vlist,this.nlist,27,g,D,e,c,u,B)}if(J&1024){this.compNorm(m);
-this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,30,g,D,L,c,n,K)}if(J&2048){this.compNorm(l);this.compNorm(o);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,L,c,z,G)}x<<=4;for(g=f=0;THREE.triTable[x+g]!=-1;){b=x+g;e=b+1;c=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[c],h);g+=3;f++}return f};this.posnormtriv=function(b,e,c,f,g,h){var j=this.count*3;this.positionArray[j]=b[c];this.positionArray[j+1]=b[c+1];this.positionArray[j+2]=b[c+2];this.positionArray[j+
-3]=b[f];this.positionArray[j+4]=b[f+1];this.positionArray[j+5]=b[f+2];this.positionArray[j+6]=b[g];this.positionArray[j+7]=b[g+1];this.positionArray[j+8]=b[g+2];this.normalArray[j]=e[c];this.normalArray[j+1]=e[c+1];this.normalArray[j+2]=e[c+2];this.normalArray[j+3]=e[f];this.normalArray[j+4]=e[f+1];this.normalArray[j+5]=e[f+2];this.normalArray[j+6]=e[g];this.normalArray[j+7]=e[g+1];this.normalArray[j+8]=e[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,c,f,g){var h=this.size*Math.sqrt(f/g),j=c*this.size,l=e*this.size,k=b*this.size,m=Math.floor(j-h);m<1&&(m=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var y,x,v,u,z,n;m<j;m++){k=this.size2*m;x=m/this.size-c;z=x*x;for(x=p;x<l;x++){v=k+this.size*x;y=x/this.size-e;n=y*y;for(y=o;y<h;y++){u=y/this.size-b;u=f/(1.0E-6+u*u+n+z)-g;u>0&&(this.field[v+y]+=u)}}}};this.addPlaneX=function(b,e){var c,f,g,h,j,l=this.size,k=this.yd,m=this.zd,p=this.field,o=l*Math.sqrt(b/e);o>l&&(o=l);for(c=0;c<o;c++){f=c/l;f*=f;h=b/(1.0E-4+f)-e;if(h>0)for(f=0;f<l;f++){j=c+f*k;for(g=0;g<l;g++)p[m*g+j]+=h}}};this.addPlaneY=function(b,e){var c,f,
-g,h,j,l,k=this.size,m=this.yd,p=this.zd,o=this.field,y=k*Math.sqrt(b/e);y>k&&(y=k);for(f=0;f<y;f++){c=f/k;c*=c;h=b/(1.0E-4+c)-e;if(h>0){j=f*m;for(c=0;c<k;c++){l=j+c;for(g=0;g<k;g++)o[p*g+l]+=h}}}};this.addPlaneZ=function(b,e){var c,f,g,h,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(g=0;g<dist;g++){c=g/size;c*=c;h=b/(1.0E-4+c)-e;if(h>0){j=zd*g;for(f=0;f<size;f++){l=j+f*yd;for(c=0;c<size;c++)field[l+c]+=h}}}};this.reset=function(){var b;
-for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,c,f,g,h,j,l,k,m,p=this.size-2;for(g=1;g<p;g++){m=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=m+this.size*f;j=(f-this.halfsize)/this.halfsize;for(c=1;c<p;c++){h=(c-this.halfsize)/this.halfsize;e=k+c;this.polygonize(h,j,l,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry,c=[];this.render(function(f){var g,h,j,l,k,m,p,o;for(g=
-0;g<f.count;g++){p=g*3;k=p+1;o=p+2;h=f.positionArray[p];j=f.positionArray[k];l=f.positionArray[o];m=new THREE.Vector3(h,j,l);h=f.normalArray[p];j=f.normalArray[k];l=f.normalArray[o];p=new THREE.Vector3(h,j,l);p.normalize();k=new THREE.Vertex(m);e.vertices.push(k);c.push(p)}nfaces=f.count/3;for(g=0;g<nfaces;g++){p=(b+g)*3;k=p+1;o=p+2;m=c[p];h=c[k];j=c[o];p=new THREE.Face3(p,k,o,[m,h,j]);e.faces.push(p)}b+=nfaces;f.count=0});return e};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
+THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h+g*this.delta;e[d+1]=j;e[d+2]=l;f[d]=this.lerp(k[b],k[b+3],g);f[d+1]=this.lerp(k[b+1],k[b+4],g);f[d+2]=this.lerp(k[b+2],k[b+5],g)};this.VIntY=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h;e[d+1]=j+g*this.delta;e[d+
+2]=l;e=b+this.yd*3;f[d]=this.lerp(k[b],k[e],g);f[d+1]=this.lerp(k[b+1],k[e+1],g);f[d+2]=this.lerp(k[b+2],k[e+2],g)};this.VIntZ=function(b,e,f,d,g,h,j,l,k,m){g=(g-k)/(m-k);k=this.normal_cache;e[d]=h;e[d+1]=j;e[d+2]=l+g*this.delta;e=b+this.zd*3;f[d]=this.lerp(k[b],k[e],g);f[d+1]=this.lerp(k[b+1],k[e+1],g);f[d+2]=this.lerp(k[b+2],k[e+2],g)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,d,g,h){var j=d+1,l=d+this.yd,k=d+this.zd,m=j+this.yd,p=j+this.zd,n=d+this.yd+this.zd,v=j+this.yd+this.zd,A=0,w=this.field[d],u=this.field[j],y=this.field[l],o=this.field[m],z=this.field[k],B=this.field[p],I=this.field[n],K=this.field[v];w<g&&(A|=1);u<g&&(A|=2);y<g&&(A|=8);o<g&&(A|=4);z<g&&(A|=16);B<g&&(A|=32);I<g&&(A|=128);K<g&&(A|=64);var J=THREE.edgeTable[A];if(J==0)return 0;
+var G=this.delta,D=b+G,L=e+G;G=f+G;if(J&1){this.compNorm(d);this.compNorm(j);this.VIntX(d*3,this.vlist,this.nlist,0,g,b,e,f,w,u)}if(J&2){this.compNorm(j);this.compNorm(m);this.VIntY(j*3,this.vlist,this.nlist,3,g,D,e,f,u,o)}if(J&4){this.compNorm(l);this.compNorm(m);this.VIntX(l*3,this.vlist,this.nlist,6,g,b,L,f,y,o)}if(J&8){this.compNorm(d);this.compNorm(l);this.VIntY(d*3,this.vlist,this.nlist,9,g,b,e,f,w,y)}if(J&16){this.compNorm(k);this.compNorm(p);this.VIntX(k*3,this.vlist,this.nlist,12,g,b,e,G,
+z,B)}if(J&32){this.compNorm(p);this.compNorm(v);this.VIntY(p*3,this.vlist,this.nlist,15,g,D,e,G,B,K)}if(J&64){this.compNorm(n);this.compNorm(v);this.VIntX(n*3,this.vlist,this.nlist,18,g,b,L,G,I,K)}if(J&128){this.compNorm(k);this.compNorm(n);this.VIntY(k*3,this.vlist,this.nlist,21,g,b,e,G,z,I)}if(J&256){this.compNorm(d);this.compNorm(k);this.VIntZ(d*3,this.vlist,this.nlist,24,g,b,e,f,w,z)}if(J&512){this.compNorm(j);this.compNorm(p);this.VIntZ(j*3,this.vlist,this.nlist,27,g,D,e,f,u,B)}if(J&1024){this.compNorm(m);
+this.compNorm(v);this.VIntZ(m*3,this.vlist,this.nlist,30,g,D,L,f,o,K)}if(J&2048){this.compNorm(l);this.compNorm(n);this.VIntZ(l*3,this.vlist,this.nlist,33,g,b,L,f,y,I)}A<<=4;for(g=d=0;THREE.triTable[A+g]!=-1;){b=A+g;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],h);g+=3;d++}return d};this.posnormtriv=function(b,e,f,d,g,h){var j=this.count*3;this.positionArray[j]=b[f];this.positionArray[j+1]=b[f+1];this.positionArray[j+2]=b[f+2];this.positionArray[j+
+3]=b[d];this.positionArray[j+4]=b[d+1];this.positionArray[j+5]=b[d+2];this.positionArray[j+6]=b[g];this.positionArray[j+7]=b[g+1];this.positionArray[j+8]=b[g+2];this.normalArray[j]=e[f];this.normalArray[j+1]=e[f+1];this.normalArray[j+2]=e[f+2];this.normalArray[j+3]=e[d];this.normalArray[j+4]=e[d+1];this.normalArray[j+5]=e[d+2];this.normalArray[j+6]=e[g];this.normalArray[j+7]=e[g+1];this.normalArray[j+8]=e[g+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,d,g){var h=this.size*Math.sqrt(d/g),j=f*this.size,l=e*this.size,k=b*this.size,m=Math.floor(j-h);m<1&&(m=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var p=Math.floor(l-h);p<1&&(p=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
+h>this.size-1&&(h=this.size-1);for(var v,A,w,u,y,o;m<j;m++){k=this.size2*m;A=m/this.size-f;y=A*A;for(A=p;A<l;A++){w=k+this.size*A;v=A/this.size-e;o=v*v;for(v=n;v<h;v++){u=v/this.size-b;u=d/(1.0E-6+u*u+o+y)-g;u>0&&(this.field[w+v]+=u)}}}};this.addPlaneX=function(b,e){var f,d,g,h,j,l=this.size,k=this.yd,m=this.zd,p=this.field,n=l*Math.sqrt(b/e);n>l&&(n=l);for(f=0;f<n;f++){d=f/l;d*=d;h=b/(1.0E-4+d)-e;if(h>0)for(d=0;d<l;d++){j=f+d*k;for(g=0;g<l;g++)p[m*g+j]+=h}}};this.addPlaneY=function(b,e){var f,d,
+g,h,j,l,k=this.size,m=this.yd,p=this.zd,n=this.field,v=k*Math.sqrt(b/e);v>k&&(v=k);for(d=0;d<v;d++){f=d/k;f*=f;h=b/(1.0E-4+f)-e;if(h>0){j=d*m;for(f=0;f<k;f++){l=j+f;for(g=0;g<k;g++)n[p*g+l]+=h}}}};this.addPlaneZ=function(b,e){var f,d,g,h,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(g=0;g<dist;g++){f=g/size;f*=f;h=b/(1.0E-4+f)-e;if(h>0){j=zd*g;for(d=0;d<size;d++){l=j+d*yd;for(f=0;f<size;f++)field[l+f]+=h}}}};this.reset=function(){var b;
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,f,d,g,h,j,l,k,m,p=this.size-2;for(g=1;g<p;g++){m=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(d=1;d<p;d++){k=m+this.size*d;j=(d-this.halfsize)/this.halfsize;for(f=1;f<p;f++){h=(f-this.halfsize)/this.halfsize;e=k+f;this.polygonize(h,j,l,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry,f=[];this.render(function(d){var g,h,j,l,k,m,p,n;for(g=
+0;g<d.count;g++){p=g*3;k=p+1;n=p+2;h=d.positionArray[p];j=d.positionArray[k];l=d.positionArray[n];m=new THREE.Vector3(h,j,l);h=d.normalArray[p];j=d.normalArray[k];l=d.normalArray[n];p=new THREE.Vector3(h,j,l);p.normalize();k=new THREE.Vertex(m);e.vertices.push(k);f.push(p)}nfaces=d.count/3;for(g=0;g<nfaces;g++){p=(b+g)*3;k=p+1;n=p+2;m=f[p];h=f[k];j=f[n];p=new THREE.Face3(p,k,n,[m,h,j]);e.faces.push(p)}b+=nfaces;d.count=0});return e};this.init(a)};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,
@@ -171,20 +171,20 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
-THREE.Trident=function(a){function d(f){return new THREE.Mesh(new THREE.Cylinder(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:f}))}function b(f,g){var h=new THREE.Geometry;h.vertices=[new THREE.Vertex,new THREE.Vertex(f)];return new THREE.Line(h,new THREE.LineBasicMaterial({color:g}))}THREE.Object3D.call(this);var e=Math.PI/2,c;a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(c in THREE.Trident.defaultParams)a.hasOwnProperty(c)||(a[c]=THREE.Trident.defaultParams[c]);
-this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(b(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(b(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(b(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows){c=d(a.xAxisColor);c.rotation.y=-e;c.position.x=a.length;this.addChild(c);c=d(a.yAxisColor);c.rotation.x=e;c.position.y=a.length;this.addChild(c);c=d(a.zAxisColor);c.rotation.y=Math.PI;c.position.z=a.length;this.addChild(c)}};
-THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,d){this.point=a;this.normal=d};THREE.SphereCollider=function(a,d){this.center=a;this.radius=d;this.radiusSq=d*d};THREE.BoxCollider=function(a,d){this.min=a;this.max=d;this.dynamic=!0;this.normal=new THREE.Vector3};
-THREE.MeshCollider=function(a,d,b,e){this.vertices=a;this.faces=d;this.normals=b;this.box=e;this.numFaces=this.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var d,b,e,c,f=0;d=0;for(b=this.colliders.length;d<b;d++){c=this.colliders[d];e=this.rayCast(a,c);if(e<Number.MAX_VALUE){c.distance=e;e>f?this.hits.push(c):this.hits.unshift(c);f=e}}return this.hits};
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var d=this.rayCastAll(a);if(d.length==0)return null;for(var b=0;d[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,d[b]);if(e<Number.MAX_VALUE){d[b].distance=e;break}b++}if(b>d.length)return null;return d[b]};
-THREE.CollisionSystem.prototype.rayCast=function(a,d){if(d instanceof THREE.PlaneCollider)return this.rayPlane(a,d);else if(d instanceof THREE.SphereCollider)return this.raySphere(a,d);else if(d instanceof THREE.BoxCollider)return this.rayBox(a,d);else if(d instanceof THREE.MeshCollider&&d.box)return this.rayBox(a,d.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,d){for(var b=this.makeRayLocal(a,d.mesh),e=Number.MAX_VALUE,c=0;c<d.numFaces/3;c++){var f=c*3;f=this.rayTriangle(b,d.vertices[d.faces[f+0]],d.vertices[d.faces[f+1]],d.vertices[d.faces[f+2]],e,this.collisionNormal);if(f<e){e=f;d.normal.copy(this.collisionNormal);d.normal.normalize()}}return e};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,d,b,e,c,f){var g=THREE.CollisionSystem.__v1,h=THREE.CollisionSystem.__v2;f.set(0,0,0);g.sub(b,d);h.sub(e,b);f.cross(g,h);h=f.dot(a.direction);if(!(h<0))return Number.MAX_VALUE;g=f.dot(d)-f.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=h*c))return Number.MAX_VALUE;g/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(g);h.addSelf(a.origin);if(Math.abs(f.x)>Math.abs(f.y))if(Math.abs(f.x)>Math.abs(f.z)){a=h.y-d.y;f=b.y-
-d.y;c=e.y-d.y;h=h.z-d.z;b=b.z-d.z;e=e.z-d.z}else{a=h.x-d.x;f=b.x-d.x;c=e.x-d.x;h=h.y-d.y;b=b.y-d.y;e=e.y-d.y}else if(Math.abs(f.y)>Math.abs(f.z)){a=h.x-d.x;f=b.x-d.x;c=e.x-d.x;h=h.z-d.z;b=b.z-d.z;e=e.z-d.z}else{a=h.x-d.x;f=b.x-d.x;c=e.x-d.x;h=h.y-d.y;b=b.y-d.y;e=e.y-d.y}d=f*e-b*c;if(d==0)return Number.MAX_VALUE;d=1/d;e=(a*e-h*c)*d;if(!(e>=0))return Number.MAX_VALUE;d*=f*h-b*a;if(!(d>=0))return Number.MAX_VALUE;if(!(1-e-d>=0))return Number.MAX_VALUE;return g};
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,d){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(d.matrixWorld,b);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(a,d){var b;if(d.dynamic&&d.mesh&&d.mesh.matrixWorld)b=this.makeRayLocal(a,d.mesh);else{b=THREE.CollisionSystem.__r;b.origin.copy(a.origin);b.direction.copy(a.direction)}var e=0,c=0,f=0,g=0,h=0,j=0,l=!0;if(b.origin.x<d.min.x){e=d.min.x-b.origin.x;e/=b.direction.x;l=!1;g=-1}else if(b.origin.x>d.max.x){e=d.max.x-b.origin.x;e/=b.direction.x;l=!1;g=1}if(b.origin.y<d.min.y){c=d.min.y-b.origin.y;c/=b.direction.y;l=!1;h=-1}else if(b.origin.y>d.max.y){c=d.max.y-
-b.origin.y;c/=b.direction.y;l=!1;h=1}if(b.origin.z<d.min.z){f=d.min.z-b.origin.z;f/=b.direction.z;l=!1;j=-1}else if(b.origin.z>d.max.z){f=d.max.z-b.origin.z;f/=b.direction.z;l=!1;j=1}if(l)return-1;l=0;if(c>e){l=1;e=c}if(f>e){l=2;e=f}switch(l){case 0:h=b.origin.y+b.direction.y*e;if(h<d.min.y||h>d.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<d.min.z||b>d.max.z)return Number.MAX_VALUE;d.normal.set(g,0,0);break;case 1:g=b.origin.x+b.direction.x*e;if(g<d.min.x||g>d.max.x)return Number.MAX_VALUE;
-b=b.origin.z+b.direction.z*e;if(b<d.min.z||b>d.max.z)return Number.MAX_VALUE;d.normal.set(0,h,0);break;case 2:g=b.origin.x+b.direction.x*e;if(g<d.min.x||g>d.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*e;if(h<d.min.y||h>d.max.y)return Number.MAX_VALUE;d.normal.set(0,0,j)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,d){var b=a.direction.dot(d.normal),e=d.point.dot(d.normal);if(b<0)b=(e-a.origin.dot(d.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(a,d){var b=d.center.clone().subSelf(a.origin);if(b.lengthSq<d.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=d.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
-THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var d=a.geometry.boundingBox,b=new THREE.Vector3(d.x[0],d.y[0],d.z[0]);d=new THREE.Vector3(d.x[1],d.y[1],d.z[1]);b=new THREE.BoxCollider(b,d);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var d=THREE.CollisionUtils.MeshOBB(a);d.min.addSelf(a.position);d.max.addSelf(a.position);d.dynamic=!1;return d};
-THREE.CollisionUtils.MeshColliderWBox=function(a){for(var d=a.geometry.vertices,b=d.length,e=a.geometry.faces,c=e.length,f=[],g=[],h=[],j=0;j<b;j++)f.push(new THREE.Vector3(d[j].position.x,d[j].position.y,d[j].position.z));for(j=0;j<c;j++){g.push(e[j].a,e[j].b,e[j].c);h.push(new THREE.Vector3(e[j].normal.x,e[j].normal.y,e[j].normal.z))}d=new THREE.MeshCollider(f,g,h,THREE.CollisionUtils.MeshOBB(a));d.mesh=a;return d};
+THREE.Trident=function(a){function c(d){return new THREE.Mesh(new THREE.Cylinder(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:d}))}function b(d,g){var h=new THREE.Geometry;h.vertices=[new THREE.Vertex,new THREE.Vertex(d)];return new THREE.Line(h,new THREE.LineBasicMaterial({color:g}))}THREE.Object3D.call(this);var e=Math.PI/2,f;a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(f in THREE.Trident.defaultParams)a.hasOwnProperty(f)||(a[f]=THREE.Trident.defaultParams[f]);
+this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(b(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(b(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(b(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows){f=c(a.xAxisColor);f.rotation.y=-e;f.position.x=a.length;this.addChild(f);f=c(a.yAxisColor);f.rotation.x=e;f.position.y=a.length;this.addChild(f);f=c(a.zAxisColor);f.rotation.y=Math.PI;f.position.z=a.length;this.addChild(f)}};
+THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
+THREE.MeshCollider=function(a,c,b,e){this.vertices=a;this.faces=c;this.normals=b;this.box=e;this.numFaces=this.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,f,d=0;c=0;for(b=this.colliders.length;c<b;c++){f=this.colliders[c];e=this.rayCast(a,f);if(e<Number.MAX_VALUE){f.distance=e;e>d?this.hits.push(f):this.hits.unshift(f);d=e}}return this.hits};
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e<Number.MAX_VALUE){c[b].distance=e;break}b++}if(b>c.length)return null;return c[b]};
+THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,f=0;f<c.numFaces/3;f++){var d=f*3;d=this.rayTriangle(b,c.vertices[c.faces[d+0]],c.vertices[c.faces[d+1]],c.vertices[c.faces[d+2]],e,this.collisionNormal);if(d<e){e=d;c.normal.copy(this.collisionNormal);c.normal.normalize()}}return e};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,f,d){var g=THREE.CollisionSystem.__v1,h=THREE.CollisionSystem.__v2;d.set(0,0,0);g.sub(b,c);h.sub(e,b);d.cross(g,h);h=d.dot(a.direction);if(!(h<0))return Number.MAX_VALUE;g=d.dot(c)-d.dot(a.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=h*f))return Number.MAX_VALUE;g/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(g);h.addSelf(a.origin);if(Math.abs(d.x)>Math.abs(d.y))if(Math.abs(d.x)>Math.abs(d.z)){a=h.y-c.y;d=b.y-
+c.y;f=e.y-c.y;h=h.z-c.z;b=b.z-c.z;e=e.z-c.z}else{a=h.x-c.x;d=b.x-c.x;f=e.x-c.x;h=h.y-c.y;b=b.y-c.y;e=e.y-c.y}else if(Math.abs(d.y)>Math.abs(d.z)){a=h.x-c.x;d=b.x-c.x;f=e.x-c.x;h=h.z-c.z;b=b.z-c.z;e=e.z-c.z}else{a=h.x-c.x;d=b.x-c.x;f=e.x-c.x;h=h.y-c.y;b=b.y-c.y;e=e.y-c.y}c=d*e-b*f;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-h*f)*c;if(!(e>=0))return Number.MAX_VALUE;c*=d*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return g};
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;if(c.dynamic&&c.mesh&&c.mesh.matrixWorld)b=this.makeRayLocal(a,c.mesh);else{b=THREE.CollisionSystem.__r;b.origin.copy(a.origin);b.direction.copy(a.direction)}var e=0,f=0,d=0,g=0,h=0,j=0,l=!0;if(b.origin.x<c.min.x){e=c.min.x-b.origin.x;e/=b.direction.x;l=!1;g=-1}else if(b.origin.x>c.max.x){e=c.max.x-b.origin.x;e/=b.direction.x;l=!1;g=1}if(b.origin.y<c.min.y){f=c.min.y-b.origin.y;f/=b.direction.y;l=!1;h=-1}else if(b.origin.y>c.max.y){f=c.max.y-
+b.origin.y;f/=b.direction.y;l=!1;h=1}if(b.origin.z<c.min.z){d=c.min.z-b.origin.z;d/=b.direction.z;l=!1;j=-1}else if(b.origin.z>c.max.z){d=c.max.z-b.origin.z;d/=b.direction.z;l=!1;j=1}if(l)return-1;l=0;if(f>e){l=1;e=f}if(d>e){l=2;e=d}switch(l){case 0:h=b.origin.y+b.direction.y*e;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(g,0,0);break;case 1:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;
+b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:g=b.origin.x+b.direction.x*e;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*e;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,j)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
+THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=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]);b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
+THREE.CollisionUtils.MeshColliderWBox=function(a){for(var c=a.geometry.vertices,b=c.length,e=a.geometry.faces,f=e.length,d=[],g=[],h=[],j=0;j<b;j++)d.push(new THREE.Vector3(c[j].position.x,c[j].position.y,c[j].position.z));for(j=0;j<f;j++){g.push(e[j].a,e[j].b,e[j].c);h.push(new THREE.Vector3(e[j].normal.x,e[j].normal.y,e[j].normal.z))}c=new THREE.MeshCollider(d,g,h,THREE.CollisionUtils.MeshOBB(a));c.mesh=a;return c};

+ 12 - 9
src/extras/io/JSONLoader.js

@@ -45,21 +45,22 @@ THREE.JSONLoader.prototype.load = function ( parameters ) {
 THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path ) {
 
 	var scope = this,
-	geometry = new THREE.Geometry();
+	geometry = new THREE.Geometry(),
+	scale = ( json.scale !== undefined ) ? json.scale : 1.0;
 
 	this.init_materials( geometry, json.materials, texture_path );
 
-	parse();
+	init_model( scale );
 
 	init_skin();
-	init_morphing();
+	init_morphing( scale );
 	init_edges();
 
 	geometry.computeCentroids();
 	geometry.computeFaceNormals();
 	geometry.computeEdgeFaces();
 
-	function parse() {
+	function init_model( scale ) {
 
 		if ( json.version === undefined || json.version != 2 ) {
 
@@ -96,8 +97,6 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 		normals = json.normals,
 		colors = json.colors,
 
-		scale = ( json.scale !== undefined ) ? json.scale : 1.0,
-
 		nUvLayers = 0;
 
 		// disregard empty arrays
@@ -326,11 +325,11 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 	};
 
-	function init_morphing() {
+	function init_morphing( scale ) {
 
 		if ( json.morphTargets !== undefined ) {
 
-			var i, l, v, vl, dstVertices, srcVertices;
+			var i, l, v, vl, x, y, z, dstVertices, srcVertices;
 
 			for ( i = 0, l = json.morphTargets.length; i < l; i++ ) {
 
@@ -343,7 +342,11 @@ THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path
 
 				for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
 
-					dstVertices.push( new THREE.Vertex( new THREE.Vector3( srcVertices[ v ], srcVertices[ v + 1 ], srcVertices[ v + 2 ] ) ) );
+					x = srcVertices[ v ] / scale;
+					y = srcVertices[ v + 1 ] / scale;
+					z = srcVertices[ v + 2 ] / scale;
+
+					dstVertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
 
 				}