Преглед изворни кода

Made more examples working.

alteredq пре 14 година
родитељ
комит
3b6b3dc578

+ 256 - 253
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,g,h,j,k;if(b==0)d=e=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);k=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:d=k;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=k;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=k;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;this.b=g;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,h,g,k,j;if(b==0)d=e=h=0;else{g=Math.floor(a*6);k=a*6-g;a=b*(1-c);j=b*(1-c*k);c=b*(1-c*(1-k));switch(g){case 1:d=j;e=b;h=a;break;case 2:d=a;e=b;h=c;break;case 3:d=a;e=j;h=b;break;case 4:d=c;e=a;h=b;break;case 5:d=b;e=a;h=j;break;case 6:case 0:d=b;e=c;h=a}}this.r=d;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,c){this.set(a||0,c||0)};
 THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -12,76 +12,76 @@ this.length();a>0?this.multiplyScalar(1/a):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(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
 THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(J,F,K,z){z=z.clone().subSelf(F);K=K.clone().subSelf(F);var I=J.clone().subSelf(F);J=z.dot(z);F=z.dot(K);z=z.dot(I);var Q=K.dot(K);K=K.dot(I);I=1/(J*Q-F*F);Q=(Q*z-F*K)*I;J=(J*K-F*z)*I;return Q>0&&J>0&&Q+J<1}var b,d,e,g,h,j,k,o,t,x,
-y,q=a.geometry,A=q.vertices,H=[];b=0;for(d=q.faces.length;b<d;b++){e=q.faces[b];x=this.origin.clone();y=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(A[e.a].position.clone());h=k.multiplyVector3(A[e.b].position.clone());j=k.multiplyVector3(A[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(A[e.d].position.clone()):null;o=a.matrixRotationWorld.multiplyVector3(e.normal.clone());t=y.dot(o);if(t<0){o=o.dot((new THREE.Vector3).sub(g,x))/t;x=x.addSelf(y.multiplyScalar(o));
-if(e instanceof THREE.Face3){if(c(x,g,h,j)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};H.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,k)||c(x,h,j,k))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};H.push(e)}}}return H}};
-THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,o,t,x){j=!1;c=k;b=o;d=t;e=x;a()};this.addPoint=function(k,o){if(j){j=!1;c=k;b=o;d=k;e=o}else{c=c<k?c:k;b=b<o?b:o;d=d>k?d:k;e=e>o?e:o}a()};
-this.add3Points=function(k,o,t,x,y,q){if(j){j=!1;c=k<t?k<y?k:y:t<y?t:y;b=o<x?o<q?o:q:x<q?x:q;d=k>t?k>y?k:y:t>y?t:y;e=o>x?o>q?o:q:x>q?x:q}else{c=k<t?k<y?k<c?k:c:y<c?y:c:t<y?t<c?t:c:y<c?y:c;b=o<x?o<q?o<b?o:b:q<b?q:b:x<q?x<b?x:b:q<b?q:b;d=k>t?k>y?k>d?k:d:y>d?y:d:t>y?t>d?t:d:y>d?y:d;e=o>x?o>q?o>e?o:e:q>e?q:e:x>q?x>e?x:e:q>e?q:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
-d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d<k.getRight()?d:k.getRight();e=e<k.getBottom()?e:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=d=b=c=0;a()};this.isEmpty=function(){return j}};
+THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(h,g){return h.distance-g.distance});return e},intersectObject:function(a){function c(J,E,K,z){z=z.clone().subSelf(E);K=K.clone().subSelf(E);var I=J.clone().subSelf(E);J=z.dot(z);E=z.dot(K);z=z.dot(I);var P=K.dot(K);K=K.dot(I);I=1/(J*P-E*E);P=(P*z-E*K)*I;J=(J*K-E*z)*I;return P>0&&J>0&&P+J<1}var b,d,e,h,g,k,j,m,t,x,
+y,q=a.geometry,A=q.vertices,G=[];b=0;for(d=q.faces.length;b<d;b++){e=q.faces[b];x=this.origin.clone();y=this.direction.clone();j=a.matrixWorld;h=j.multiplyVector3(A[e.a].position.clone());g=j.multiplyVector3(A[e.b].position.clone());k=j.multiplyVector3(A[e.c].position.clone());j=e instanceof THREE.Face4?j.multiplyVector3(A[e.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(e.normal.clone());t=y.dot(m);if(t<0){m=m.dot((new THREE.Vector3).sub(h,x))/t;x=x.addSelf(y.multiplyScalar(m));
+if(e instanceof THREE.Face3){if(c(x,h,g,k)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}else if(e instanceof THREE.Face4&&(c(x,h,g,j)||c(x,g,k,j))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}}return G}};
+THREE.Rectangle=function(){function a(){h=d-c;g=e-b}var c,b,d,e,h,g,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return g};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(j,m,t,x){k=!1;c=j;b=m;d=t;e=x;a()};this.addPoint=function(j,m){if(k){k=!1;c=j;b=m;d=j;e=m}else{c=c<j?c:j;b=b<m?b:m;d=d>j?d:j;e=e>m?e:m}a()};
+this.add3Points=function(j,m,t,x,y,q){if(k){k=!1;c=j<t?j<y?j:y:t<y?t:y;b=m<x?m<q?m:q:x<q?x:q;d=j>t?j>y?j:y:t>y?t:y;e=m>x?m>q?m:q:x>q?x:q}else{c=j<t?j<y?j<c?j:c:y<c?y:c:t<y?t<c?t:c:y<c?y:c;b=m<x?m<q?m<b?m:b:q<b?q:b:x<q?x<b?x:b:q<b?q:b;d=j>t?j>y?j>d?j:d:y>d?y:d:t>y?t>d?t:d:y>d?y:d;e=m>x?m>q?m>e?m:e:q>e?q:e:x>q?x>e?x:e:q>e?q:e}a()};this.addRectangle=function(j){if(k){k=!1;c=j.getLeft();b=j.getTop();d=j.getRight();e=j.getBottom()}else{c=c<j.getLeft()?c:j.getLeft();b=b<j.getTop()?b:j.getTop();d=d>j.getRight()?
+d:j.getRight();e=e>j.getBottom()?e:j.getBottom()}a()};this.inflate=function(j){c-=j;b-=j;d+=j;e+=j;a()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();b=b>j.getTop()?b:j.getTop();d=d<j.getRight()?d:j.getRight();e=e<j.getBottom()?e:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(c,j.getLeft())>=0&&Math.min(e,j.getBottom())-Math.max(b,j.getTop())>=0};this.empty=function(){k=!0;e=d=b=c=0;a()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,o,t,x,y,q,A,H){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,o||0,t||1,x||0,y||0,q||0,A||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,o,t,x,y,q,A,H){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=o;this.n33=t;this.n34=x;this.n41=y;this.n42=q;this.n43=A;this.n44=H;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
+THREE.Matrix4=function(a,c,b,d,e,h,g,k,j,m,t,x,y,q,A,G){this.set(a||1,c||0,b||0,d||0,e||0,h||1,g||0,k||0,j||0,m||0,t||1,x||0,y||0,q||0,A||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,d,e,h,g,k,j,m,t,x,y,q,A,G){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=h;this.n23=g;this.n24=k;this.n31=j;this.n32=m;this.n33=t;this.n34=x;this.n41=y;this.n42=q;this.n43=A;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
+e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;d.cross(b,h).normalize();if(d.length()===0){h.x+=1.0E-4;d.cross(b,h).normalize()}e.cross(h,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=h.x;this.n21=d.y;this.n22=e.y;this.n23=h.y;this.n31=d.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
 d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,H=a.n42,J=a.n43,F=a.n44,K=c.n11,z=c.n12,I=c.n13,Q=c.n14,Z=c.n21,V=c.n22,
-f=c.n23,fa=c.n24,R=c.n31,W=c.n32,na=c.n33,N=c.n34;this.n11=b*K+d*Z+e*R;this.n12=b*z+d*V+e*W;this.n13=b*I+d*f+e*na;this.n14=b*Q+d*fa+e*N+g;this.n21=h*K+j*Z+k*R;this.n22=h*z+j*V+k*W;this.n23=h*I+j*f+k*na;this.n24=h*Q+j*fa+k*N+o;this.n31=t*K+x*Z+y*R;this.n32=t*z+x*V+y*W;this.n33=t*I+x*f+y*na;this.n34=t*Q+x*fa+y*N+q;this.n41=A*K+H*Z+J*R;this.n42=A*z+H*V+J*W;this.n43=A*I+H*f+J*na;this.n44=A*Q+H*fa+J*N+F;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,h=a.n14,g=a.n21,k=a.n22,j=a.n23,m=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,G=a.n42,J=a.n43,E=a.n44,K=c.n11,z=c.n12,I=c.n13,P=c.n14,Z=c.n21,W=c.n22,
+f=c.n23,S=c.n24,T=c.n31,ea=c.n32,oa=c.n33,$=c.n34;this.n11=b*K+d*Z+e*T;this.n12=b*z+d*W+e*ea;this.n13=b*I+d*f+e*oa;this.n14=b*P+d*S+e*$+h;this.n21=g*K+k*Z+j*T;this.n22=g*z+k*W+j*ea;this.n23=g*I+k*f+j*oa;this.n24=g*P+k*S+j*$+m;this.n31=t*K+x*Z+y*T;this.n32=t*z+x*W+y*ea;this.n33=t*I+x*f+y*oa;this.n34=t*P+x*S+y*$+q;this.n41=A*K+G*Z+J*T;this.n42=A*z+G*W+J*ea;this.n43=A*I+G*f+J*oa;this.n44=A*P+G*S+J*$+E;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,o=this.n32,t=this.n33,x=this.n34,y=this.n41,q=this.n42,A=this.n43,H=this.n44;return d*h*o*y-b*j*o*y-d*g*t*y+c*j*t*y+b*g*x*y-c*h*x*y-d*h*k*q+b*j*k*q+d*e*t*q-a*j*t*q-b*e*x*q+a*h*x*q+d*g*k*A-c*j*k*A-d*e*o*A+a*j*o*A+c*e*x*A-a*g*x*A-b*g*k*H+c*h*k*H+b*e*o*H-a*h*o*H-c*e*t*H+a*g*t*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,h=this.n22,g=this.n23,k=this.n24,j=this.n31,m=this.n32,t=this.n33,x=this.n34,y=this.n41,q=this.n42,A=this.n43,G=this.n44;return d*g*m*y-b*k*m*y-d*h*t*y+c*k*t*y+b*h*x*y-c*g*x*y-d*g*j*q+b*k*j*q+d*e*t*q-a*k*t*q-b*e*x*q+a*g*x*q+d*h*j*A-c*k*j*A-d*e*m*A+a*k*m*A+c*e*x*A-a*h*x*A-b*h*j*G+c*g*j*G+b*e*m*G-a*g*m*G-c*e*t*G+a*h*t*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,
-c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,g=a.x,h=a.y,j=a.z,k=e*g,o=e*h;this.set(k*
-g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,o*h+b,o*j-d*g,0,k*j-d*h,o*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c=
-a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var o=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(o+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+o);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
+c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,h=a.x,g=a.y,k=a.z,j=e*h,m=e*g;this.set(j*
+h+b,j*g-d*k,j*k+d*g,0,j*g+d*k,m*g+b,m*k-d*h,0,j*k-d*g,m*k+d*h,e*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var g=a*b,k=c*b;this.n11=e*h;this.n12=-e*d;this.n13=b;this.n21=k*h+a*d;this.n22=-k*d+a*h;this.n23=-c*e;this.n31=-g*h+c*d;this.n32=g*d+c*h;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var c=
+a.x,b=a.y,d=a.z,e=a.w,h=c+c,g=b+b,k=d+d;a=c*h;var j=c*g;c*=k;var m=b*g;b*=k;d*=k;h*=e;g*=e;e*=k;this.n11=1-(m+d);this.n12=j-e;this.n13=c+g;this.n21=j+e;this.n22=1-(a+d);this.n23=b-h;this.n31=c-g;this.n32=b+h;this.n33=1-(a+m);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,o=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,H=a.n42,J=a.n43,F=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*q*H-o*y*H+o*x*J-j*q*J-k*x*F+j*y*F;c.n12=g*y*H-e*q*H-g*x*J+d*q*J+e*x*F-d*y*F;c.n13=e*o*H-g*k*H+g*j*J-d*o*J-e*j*F+d*k*F;c.n14=g*k*x-e*o*x-g*j*y+d*o*y+e*j*q-d*k*q;c.n21=o*y*A-k*q*A-o*t*J+h*q*J+k*t*F-h*y*F;c.n22=e*q*A-g*y*A+g*t*J-b*q*J-e*t*F+b*y*F;c.n23=g*k*A-e*o*A-g*h*J+b*o*J+e*h*F-b*k*F;
-c.n24=e*o*t-g*k*t+g*h*y-b*o*y-e*h*q+b*k*q;c.n31=j*q*A-o*x*A+o*t*H-h*q*H-j*t*F+h*x*F;c.n32=g*x*A-d*q*A-g*t*H+b*q*H+d*t*F-b*x*F;c.n33=e*o*A-g*j*A+g*h*H-b*o*H-d*h*F+b*j*F;c.n34=g*j*t-d*o*t-g*h*x+b*o*x+d*h*q-b*j*q;c.n41=k*x*A-j*y*A-k*t*H+h*y*H+j*t*J-h*x*J;c.n42=d*y*A-e*x*A+e*t*H-b*y*H-d*t*J+b*x*J;c.n43=e*j*A-d*k*A-e*h*H+b*k*H+d*h*J-b*j*J;c.n44=d*k*t-e*j*t+e*h*x-b*k*x-d*h*y+b*j*y;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*o;b[7]=a*t;b[8]=a*x;return c};
-THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
-THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,o;h=new THREE.Matrix4;j=c-a;k=b-d;o=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((g+e)/o);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,h=a.n14,g=a.n21,k=a.n22,j=a.n23,m=a.n24,t=a.n31,x=a.n32,y=a.n33,q=a.n34,A=a.n41,G=a.n42,J=a.n43,E=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*q*G-m*y*G+m*x*J-k*q*J-j*x*E+k*y*E;c.n12=h*y*G-e*q*G-h*x*J+d*q*J+e*x*E-d*y*E;c.n13=e*m*G-h*j*G+h*k*J-d*m*J-e*k*E+d*j*E;c.n14=h*j*x-e*m*x-h*k*y+d*m*y+e*k*q-d*j*q;c.n21=m*y*A-j*q*A-m*t*J+g*q*J+j*t*E-g*y*E;c.n22=e*q*A-h*y*A+h*t*J-b*q*J-e*t*E+b*y*E;c.n23=h*j*A-e*m*A-h*g*J+b*m*J+e*g*E-b*j*E;
+c.n24=e*m*t-h*j*t+h*g*y-b*m*y-e*g*q+b*j*q;c.n31=k*q*A-m*x*A+m*t*G-g*q*G-k*t*E+g*x*E;c.n32=h*x*A-d*q*A-h*t*G+b*q*G+d*t*E-b*x*E;c.n33=e*m*A-h*k*A+h*g*G-b*m*G-d*g*E+b*k*E;c.n34=h*k*t-d*m*t-h*g*x+b*m*x+d*g*q-b*k*q;c.n41=j*x*A-k*y*A-j*t*G+g*y*G+k*t*J-g*x*J;c.n42=d*y*A-e*x*A+e*t*G-b*y*G-d*t*J+b*x*J;c.n43=e*k*A-d*j*A-e*g*G+b*j*G+d*g*J-b*k*J;c.n44=d*j*t-e*k*t+e*g*x-b*j*x-d*g*y+b*k*y;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*e;b[2]=a*h;b[3]=a*g;b[4]=a*k;b[5]=a*j;b[6]=a*m;b[7]=a*t;b[8]=a*x;return c};
+THREE.Matrix4.makeFrustum=function(a,c,b,d,e,h){var g;g=new THREE.Matrix4;g.n11=2*e/(c-a);g.n12=0;g.n13=(c+a)/(c-a);g.n14=0;g.n21=0;g.n22=2*e/(d-b);g.n23=(d+b)/(d-b);g.n24=0;g.n31=0;g.n32=0;g.n33=-(h+e)/(h-e);g.n34=-2*h*e/(h-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
+THREE.Matrix4.makeOrtho=function(a,c,b,d,e,h){var g,k,j,m;g=new THREE.Matrix4;k=c-a;j=b-d;m=h-e;g.n11=2/k;g.n12=0;g.n13=0;g.n14=-((c+a)/k);g.n21=0;g.n22=2/j;g.n23=0;g.n24=-((b+d)/j);g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-((h+e)/m);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
 c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,o=k*b+h*e-j*d,t=k*d+j*b-g*e,x=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=o*k+b*-g+t*-j-x*-h;c.y=t*k+b*-h+x*-g-o*-j;c.z=x*k+b*-j+o*-h-t*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,c,b,d,e,g,h){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(b);b=Math.sin(b);var g=a*c,k=d*e;this.w=g*h-k*b;this.x=g*b+k*h;this.y=d*c*h+a*e*b;this.z=a*e*h-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,h=a.x,g=a.y,k=a.z;a=a.w;this.x=c*a+e*h+b*k-d*g;this.y=b*a+e*g+d*h-c*k;this.z=d*a+e*k+c*g-b*h;this.w=e*a-c*h-b*g-d*k;return this},
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,h=this.x,g=this.y,k=this.z,j=this.w,m=j*b+g*e-k*d,t=j*d+k*b-h*e,x=j*e+h*d-g*b;b=-h*b-g*d-k*e;c.x=m*j+b*-h+t*-k-x*-g;c.y=t*j+b*-g+x*-h-m*-k;c.z=x*j+b*-k+m*-g-t*-h;return c}};
+THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var h=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*h)/g;d=Math.sin(d*h)/g;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,c,b,d,e,h){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,c,b,d,e,h,g){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
-b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||
-j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,h,g,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){h=this.faces[d];if(a&&h.vertexNormals.length){k.set(0,0,0);c=0;for(b=h.vertexNormals.length;c<b;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[h.a];b=this.vertices[h.b];g=this.vertices[h.c];k.sub(g.position,b.position);j.sub(c.position,b.position);k.crossSelf(j)}k.isZero()||
+k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
 this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);
-b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(N,xa,ta,qa,ua,la,ka){g=N.vertices[xa].position;h=N.vertices[ta].position;j=N.vertices[qa].position;k=e[ua];o=e[la];t=e[ka];x=h.x-g.x;y=j.x-g.x;q=h.y-g.y;A=j.y-g.y;H=h.z-g.z;J=j.z-g.z;F=o.u-k.u;K=t.u-k.u;z=o.v-k.v;I=t.v-k.v;Q=1/(F*I-K*
-z);f.set((I*x-z*y)*Q,(I*q-z*A)*Q,(I*H-z*J)*Q);fa.set((F*y-K*x)*Q,(F*A-K*q)*Q,(F*J-K*H)*Q);Z[xa].addSelf(f);Z[ta].addSelf(f);Z[qa].addSelf(f);V[xa].addSelf(fa);V[ta].addSelf(fa);V[qa].addSelf(fa)}var c,b,d,e,g,h,j,k,o,t,x,y,q,A,H,J,F,K,z,I,Q,Z=[],V=[],f=new THREE.Vector3,fa=new THREE.Vector3,R=new THREE.Vector3,W=new THREE.Vector3,na=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Z[c]=new THREE.Vector3;V[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.faceVertexUvs[c][0];
+b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a($,R,la,va,Da,fa,ia){h=$.vertices[R].position;g=$.vertices[la].position;k=$.vertices[va].position;j=e[Da];m=e[fa];t=e[ia];x=g.x-h.x;y=k.x-h.x;q=g.y-h.y;A=k.y-h.y;G=g.z-h.z;J=k.z-h.z;E=m.u-j.u;K=t.u-j.u;z=m.v-j.v;I=t.v-j.v;P=1/(E*I-K*z);
+f.set((I*x-z*y)*P,(I*q-z*A)*P,(I*G-z*J)*P);S.set((E*y-K*x)*P,(E*A-K*q)*P,(E*J-K*G)*P);Z[R].addSelf(f);Z[la].addSelf(f);Z[va].addSelf(f);W[R].addSelf(S);W[la].addSelf(S);W[va].addSelf(S)}var c,b,d,e,h,g,k,j,m,t,x,y,q,A,G,J,E,K,z,I,P,Z=[],W=[],f=new THREE.Vector3,S=new THREE.Vector3,T=new THREE.Vector3,ea=new THREE.Vector3,oa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){Z[c]=new THREE.Vector3;W[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){d=this.faces[c];e=this.faceVertexUvs[c][0];
 if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}c=
-0;for(b=this.vertices.length;c<b;c++){na.copy(this.vertices[c].normal);d=Z[c];R.copy(d);R.subSelf(na.multiplyScalar(na.dot(d))).normalize();W.cross(this.vertices[c].normal,d);d=W.dot(V[c]);d=d<0?-1:1;this.vertices[c].tangent.set(R.x,R.y,R.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;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]};
+0;for(b=this.vertices.length;c<b;c++){oa.copy(this.vertices[c].normal);d=Z[c];T.copy(d);T.subSelf(oa.multiplyScalar(oa.dot(d))).normalize();ea.cross(this.vertices[c].normal,d);d=ea.dot(W[c]);d=d<0?-1:1;this.vertices[c].tangent.set(T.x,T.y,T.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};
 for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=
 a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(a){function c(q,A,H,J,F,K,z){q=(H-q)*0.5;J=(J-A)*0.5;return(2*(A-H)+q+J)*z+(-3*(A-H)-2*q-J)*K+q*F+A}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,j,k,o,t,x,y;this.initFromArray=function(q){this.points=[];for(var A=0;A<q.length;A++)this.points[A]={x:q[A][0],y:q[A][1],z:q[A][2]}};this.getPoint=function(q){e=(this.points.length-1)*q;g=Math.floor(e);h=e-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;o=this.points[b[0]];t=this.points[b[1]];
-x=this.points[b[2]];y=this.points[b[3]];j=h*h;k=h*j;d.x=c(o.x,t.x,x.x,y.x,h,j,k);d.y=c(o.y,t.y,x.y,y.y,h,j,k);d.z=c(o.z,t.z,x.z,y.z,h,j,k);return d};this.getControlPointsArray=function(){var q,A,H=this.points.length,J=[];for(q=0;q<H;q++){A=this.points[q];J[q]=[A.x,A.y,A.z]}return J};this.getLength=function(q){var A,H,J=A=A=0,F=new THREE.Vector3,K=new THREE.Vector3,z=[],I=0;z[0]=0;q||(q=100);H=this.points.length*q;F.copy(this.points[0]);for(q=1;q<H;q++){A=q/H;position=this.getPoint(A);K.copy(position);
-I+=K.distanceTo(F);F.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=J){z[A]=I;J=A}}z[z.length]=I;return{chunks:z,total:I}};this.reparametrizeByArcLength=function(q){var A,H,J,F,K,z,I=[],Q=new THREE.Vector3,Z=this.getLength();I.push(Q.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){H=Z.chunks[A]-Z.chunks[A-1];z=Math.ceil(q*H/Z.total);F=(A-1)/(this.points.length-1);K=A/(this.points.length-1);for(H=1;H<z-1;H++){J=F+H*(1/z)*(K-F);position=this.getPoint(J);I.push(Q.copy(position).clone())}I.push(Q.copy(this.points[A]).clone())}this.points=
+THREE.Spline=function(a){function c(q,A,G,J,E,K,z){q=(G-q)*0.5;J=(J-A)*0.5;return(2*(A-G)+q+J)*z+(-3*(A-G)-2*q-J)*K+q*E+A}this.points=a;var b=[],d={x:0,y:0,z:0},e,h,g,k,j,m,t,x,y;this.initFromArray=function(q){this.points=[];for(var A=0;A<q.length;A++)this.points[A]={x:q[A][0],y:q[A][1],z:q[A][2]}};this.getPoint=function(q){e=(this.points.length-1)*q;h=Math.floor(e);g=e-h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>this.points.length-2?h:h+1;b[3]=h>this.points.length-3?h:h+2;m=this.points[b[0]];t=this.points[b[1]];
+x=this.points[b[2]];y=this.points[b[3]];k=g*g;j=g*k;d.x=c(m.x,t.x,x.x,y.x,g,k,j);d.y=c(m.y,t.y,x.y,y.y,g,k,j);d.z=c(m.z,t.z,x.z,y.z,g,k,j);return d};this.getControlPointsArray=function(){var q,A,G=this.points.length,J=[];for(q=0;q<G;q++){A=this.points[q];J[q]=[A.x,A.y,A.z]}return J};this.getLength=function(q){var A,G,J=A=A=0,E=new THREE.Vector3,K=new THREE.Vector3,z=[],I=0;z[0]=0;q||(q=100);G=this.points.length*q;E.copy(this.points[0]);for(q=1;q<G;q++){A=q/G;position=this.getPoint(A);K.copy(position);
+I+=K.distanceTo(E);E.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=J){z[A]=I;J=A}}z[z.length]=I;return{chunks:z,total:I}};this.reparametrizeByArcLength=function(q){var A,G,J,E,K,z,I=[],P=new THREE.Vector3,Z=this.getLength();I.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=Z.chunks[A]-Z.chunks[A-1];z=Math.ceil(q*G/Z.total);E=(A-1)/(this.points.length-1);K=A/(this.points.length-1);for(G=1;G<z-1;G++){J=E+G*(1/z)*(K-E);position=this.getPoint(J);I.push(P.copy(position).clone())}I.push(P.copy(this.points[A]).clone())}this.points=
 I}};
-THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<0)e.hierarchy[g].keys[h].time=
-0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(e.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<e.hierarchy[g].keys.length;h++)for(var k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++){var o=e.hierarchy[g].keys[h].morphTargets[k];j[o]=-1}e.hierarchy[g].usedMorphTargets=j;for(h=0;h<e.hierarchy[g].keys.length;h++){var t=
-{};for(o in j){for(k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++)if(e.hierarchy[g].keys[h].morphTargets[k]===o){t[o]=e.hierarchy[g].keys[h].morphTargetsInfluences[k];break}k===e.hierarchy[g].keys[h].morphTargets.length&&(t[o]=0)}e.hierarchy[g].keys[h].morphTargetsInfluences=t}}for(h=1;h<e.hierarchy[g].keys.length;h++)if(e.hierarchy[g].keys[h].time===e.hierarchy[g].keys[h-1].time){e.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<e.hierarchy[g].keys.length;h++)e.hierarchy[g].keys[h].index=h}h=parseInt(e.length*
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(g=0;g<e.hierarchy.length;g++)e.JIT.hierarchy.push(Array(h));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var g=[];if(e instanceof THREE.SkinnedMesh)for(var h=0;h<e.bones.length;h++)g.push(e.bones[h]);else d(e,g);return g};var d=function(e,g){g.push(e);for(var h=0;h<e.children.length;h++)d(e.children[h],g)};b.LINEAR=
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var h=0;h<a.length;h++)a[h].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var h=0;h<e.hierarchy.length;h++){for(var g=0;g<e.hierarchy[h].keys.length;g++){if(e.hierarchy[h].keys[g].time<0)e.hierarchy[h].keys[g].time=
+0;if(e.hierarchy[h].keys[g].rot!==undefined&&!(e.hierarchy[h].keys[g].rot instanceof THREE.Quaternion)){var k=e.hierarchy[h].keys[g].rot;e.hierarchy[h].keys[g].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(e.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(g=0;g<e.hierarchy[h].keys.length;g++)for(var j=0;j<e.hierarchy[h].keys[g].morphTargets.length;j++){var m=e.hierarchy[h].keys[g].morphTargets[j];k[m]=-1}e.hierarchy[h].usedMorphTargets=k;for(g=0;g<e.hierarchy[h].keys.length;g++){var t=
+{};for(m in k){for(j=0;j<e.hierarchy[h].keys[g].morphTargets.length;j++)if(e.hierarchy[h].keys[g].morphTargets[j]===m){t[m]=e.hierarchy[h].keys[g].morphTargetsInfluences[j];break}j===e.hierarchy[h].keys[g].morphTargets.length&&(t[m]=0)}e.hierarchy[h].keys[g].morphTargetsInfluences=t}}for(g=1;g<e.hierarchy[h].keys.length;g++)if(e.hierarchy[h].keys[g].time===e.hierarchy[h].keys[g-1].time){e.hierarchy[h].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[h].keys.length;g++)e.hierarchy[h].keys[g].index=g}g=parseInt(e.length*
+e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(h=0;h<e.hierarchy.length;h++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var h=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)h.push(e.bones[g]);else d(e,h);return h};var d=function(e,h){h.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],h)};b.LINEAR=
 0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){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=d!==undefined?d:!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,d=this.hierarchy.length,e;for(b=0;b<d;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
-e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+e instanceof THREE.Bone?e.skinMatrix:e.matrix}var h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.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 c=["pos","rot","scl"],b,d,e,g,h,j,k,o,t=this.data.JIT.hierarchy,x,y;this.currentTime+=a*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;o=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var q=0,A=this.hierarchy.length;q<A;q++){a=this.hierarchy[q];k=a.animationCache;if(this.JITCompile&&t[q][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=t[q][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=t[q][o];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 H=0;H<3;H++){b=c[H];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=y){if(x<y)if(this.loop){h=this.data.hierarchy[q].keys[0];for(j=this.getNextKeyWith(b,q,1);j.time<x;){h=j;j=this.getNextKeyWith(b,q,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,q,j.index+1)}while(j.time<
-x)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+q);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",q,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",q,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&t[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(q=0;q<this.hierarchy.length;q++)t[q][o]=this.hierarchy[q]instanceof THREE.Bone?this.hierarchy[q].skinMatrix.clone():this.hierarchy[q].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,o;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];o=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],o[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],o[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],o[2],e,b,h);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,h,g,k,j,m,t=this.data.JIT.hierarchy,x,y;this.currentTime+=a*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;m=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var q=0,A=this.hierarchy.length;q<A;q++){a=this.hierarchy[q];j=a.animationCache;if(this.JITCompile&&t[q][m]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=t[q][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=t[q][m];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 G=0;G<3;G++){b=c[G];g=j.prevKey[b];k=j.nextKey[b];if(k.time<=y){if(x<y)if(this.loop){g=this.data.hierarchy[q].keys[0];for(k=this.getNextKeyWith(b,q,1);k.time<x;){g=k;k=this.getNextKeyWith(b,q,k.index+1)}}else{this.stop();return}else{do{g=k;k=this.getNextKeyWith(b,q,k.index+1)}while(k.time<
+x)}j.prevKey[b]=g;j.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-g.time)/(k.time-g.time);e=g[b];h=k[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+q);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(h[0]-e[0])*d;b.y=e[1]+(h[1]-e[1])*d;b.z=e[2]+(h[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",q,g.index-1).pos;this.points[1]=e;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",q,k.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
+"rot")THREE.Quaternion.slerp(e,h,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(h[0]-e[0])*d;b.y=e[1]+(h[1]-e[1])*d;b.z=e[2]+(h[2]-e[2])*d}}}}if(this.JITCompile&&t[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(q=0;q<this.hierarchy.length;q++)t[q][m]=this.hierarchy[q]instanceof THREE.Bone?this.hierarchy[q].skinMatrix.clone():this.hierarchy[q].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,h,g,k,j,m;e=(a.length-1)*c;h=Math.floor(e);e-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];k=a[b[1]];j=a[b[2]];m=a[b[3]];b=e*e;g=e*b;d[0]=this.interpolate(h[0],k[0],j[0],m[0],e,b,g);d[1]=this.interpolate(h[1],k[1],j[1],m[1],e,b,g);d[2]=this.interpolate(h[2],k[2],j[2],m[2],e,b,g);return d};
+THREE.Animation.prototype.interpolate=function(a,c,b,d,e,h,g){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*g+(-3*(c-b)-2*a-d)*h+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=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+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||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(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
@@ -114,7 +114,7 @@ if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};
-THREE.Texture=function(a,c,b,d,e,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.Texture=function(a,c,b,d,e,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
@@ -126,12 +126,12 @@ this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,e,g,h,j;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){e=this.geometry.bones[b];g=e.pos;h=e.rotq;j=e.scl;d=this.addBone();d.name=e.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;j!==undefined?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){e=this.geometry.bones[b];
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,e,h,g,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){e=this.geometry.bones[b];h=e.pos;g=e.rotq;k=e.scl;d=this.addBone();d.name=e.name;d.position.set(h[0],h[1],h[2]);d.quaternion.set(g[0],g[1],g[2],g[3]);d.useQuaternion=!0;k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){e=this.geometry.bones[b];
 d=this.bones[b];e.parent===-1?this.addChild(d):this.bones[e.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
 THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
-d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[e].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
+d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[e].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
 THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.Sound=function(a,c,b,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)e=
 "audio/mpeg";else if(c.indexOf(".ogg")!==-1)e="audio/ogg";else c.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
@@ -144,54 +144,55 @@ THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function a(){var R=k[j]=k[j]||new THREE.RenderableVertex;j++;return R}function c(R,W){return W.z-R.z}function b(R,W){var na=0,N=1,xa=R.z+R.w,ta=W.z+W.w,qa=-R.z+R.w,ua=-W.z+W.w;if(xa>=0&&ta>=0&&qa>=0&&ua>=0)return!0;else if(xa<0&&ta<0||qa<0&&ua<0)return!1;else{if(xa<0)na=Math.max(na,xa/(xa-ta));else ta<0&&(N=Math.min(N,xa/(xa-ta)));if(qa<0)na=Math.max(na,qa/(qa-ua));else ua<0&&(N=Math.min(N,qa/(qa-ua)));if(N<na)return!1;else{R.lerpSelf(W,na);W.lerpSelf(R,1-N);return!0}}}
-var d,e,g=[],h,j,k=[],o,t,x=[],y,q,A=[],H,J,F=[],K=new THREE.Vector4,z=new THREE.Vector4,I=new THREE.Matrix4,Q=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Vector4,f=new THREE.Vector4,fa;this.projectVector=function(R,W){I.multiply(W.projectionMatrix,W.matrixWorldInverse);I.multiplyVector3(R);return R};this.unprojectVector=function(R,W){I.multiply(THREE.Matrix4.makeInvert(W.projectionMatrix),W.matrixWorld);
-I.multiplyVector3(R);return R};this.projectObjects=function(R,W,na){W=[];var N,xa,ta;e=0;xa=R.objects;R=0;for(N=xa.length;R<N;R++){ta=xa[R];var qa;if(!(qa=!ta.visible))if(qa=ta instanceof THREE.Mesh){a:{qa=void 0;for(var ua=ta.matrixWorld,la=-ta.geometry.boundingSphere.radius*Math.max(ta.scale.x,Math.max(ta.scale.y,ta.scale.z)),ka=0;ka<6;ka++){qa=Z[ka].x*ua.n14+Z[ka].y*ua.n24+Z[ka].z*ua.n34+Z[ka].w;if(qa<=la){qa=!1;break a}}qa=!0}qa=!qa}if(!qa){qa=g[e]=g[e]||new THREE.RenderableObject;e++;d=qa;K.copy(ta.position);
-I.multiplyVector3(K);d.object=ta;d.z=K.z;W.push(d)}}na&&W.sort(c);return W};this.projectScene=function(R,W,na){var N=[],xa=W.near,ta=W.far,qa,ua,la,ka,oa,pa,ea,da,sa,Ea,Y,ya,za,m;J=q=t=0;W.matrixAutoUpdate&&W.updateMatrix();R.update(undefined,!1,W);I.multiply(W.projectionMatrix,W.matrixWorldInverse);Z[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);Z[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);Z[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);Z[3].set(I.n41-I.n21,I.n42-
-I.n22,I.n43-I.n23,I.n44-I.n24);Z[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);Z[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(qa=0;qa<6;qa++){oa=Z[qa];oa.divideScalar(Math.sqrt(oa.x*oa.x+oa.y*oa.y+oa.z*oa.z))}oa=this.projectObjects(R,W,!0);R=0;for(qa=oa.length;R<qa;R++){pa=oa[R].object;if(pa.visible){ea=pa.matrixWorld;sa=pa.matrixRotationWorld;da=pa.materials;j=0;if(pa instanceof THREE.Mesh){Ea=pa.geometry;Y=Ea.vertices;ya=Ea.faces;ua=0;for(la=Y.length;ua<la;ua++){h=a();h.positionWorld.copy(Y[ua].position);
-ea.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);I.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>xa&&h.positionScreen.z<ta}ua=0;for(la=ya.length;ua<la;ua++){Y=ya[ua];if(Y instanceof THREE.Face3){ka=k[Y.a];za=k[Y.b];m=k[Y.c];if(ka.visible&&za.visible&&m.visible&&(pa.doubleSided||pa.flipSided!=(m.positionScreen.x-ka.positionScreen.x)*(za.positionScreen.y-ka.positionScreen.y)-(m.positionScreen.y-
-ka.positionScreen.y)*(za.positionScreen.x-ka.positionScreen.x)<0)){var D=x[t]=x[t]||new THREE.RenderableFace3;t++;o=D;o.v1.copy(ka);o.v2.copy(za);o.v3.copy(m);o.normalWorld.copy(Y.normal);sa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(Y.centroid);ea.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);I.multiplyVector3(o.centroidScreen);za=Y.vertexNormals;fa=o.vertexNormalsWorld;for(ka=0;ka<3;ka++){m=fa[ka];m.copy(za[ka]);sa.multiplyVector3(m)}if(ka=Ea.faceVertexUvs[0][ua]){o.uvs[0]=
-ka[0];o.uvs[1]=ka[1];o.uvs[2]=ka[2]}o.meshMaterials=da;o.faceMaterials=Y.materials;o.z=o.centroidScreen.z;N.push(o)}}}}else if(pa instanceof THREE.Line){Q.multiply(I,ea);Y=pa.geometry.vertices;ka=a();ka.positionScreen.copy(Y[0].position);Q.multiplyVector4(ka.positionScreen);ua=1;for(la=Y.length;ua<la;ua++){ka=a();ka.positionScreen.copy(Y[ua].position);Q.multiplyVector4(ka.positionScreen);za=k[j-2];V.copy(ka.positionScreen);f.copy(za.positionScreen);if(b(V,f)){V.multiplyScalar(1/V.w);f.multiplyScalar(1/
-f.w);ea=A[q]=A[q]||new THREE.RenderableLine;q++;y=ea;y.v1.positionScreen.copy(V);y.v2.positionScreen.copy(f);y.z=Math.max(V.z,f.z);y.materials=pa.materials;N.push(y)}}}else if(pa instanceof THREE.Particle){z.set(pa.position.x,pa.position.y,pa.position.z,1);I.multiplyVector4(z);z.z/=z.w;if(z.z>0&&z.z<1){ea=F[J]=F[J]||new THREE.RenderableParticle;J++;H=ea;H.x=z.x/z.w;H.y=z.y/z.w;H.z=z.z;H.rotation=pa.rotation.z;H.scale.x=pa.scale.x*Math.abs(H.x-(z.x+W.projectionMatrix.n11)/(z.w+W.projectionMatrix.n14));
-H.scale.y=pa.scale.y*Math.abs(H.y-(z.y+W.projectionMatrix.n22)/(z.w+W.projectionMatrix.n24));H.materials=pa.materials;N.push(H)}}}}na&&N.sort(c);return N}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,o,t,x,y,q,A,H;a=c.projectScene(h,j);k=0;for(o=a.length;k<o;k++){y=a[k];if(y instanceof THREE.RenderableParticle){A=y.x*e+e;H=y.y*g+g;t=0;for(x=y.material.length;t<x;t++){q=y.material[t];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=A+"px";q.style.top=H+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ca){if(y!=ca)o.globalAlpha=y=ca}function c(ca){if(q!=ca){switch(ca){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}q=ca}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,o=e.getContext("2d"),t=new THREE.Color(0),x=0,y=1,q=0,A=null,H=null,J=1,F,K,z,I,Q,Z,V,f,fa,R=new THREE.Color,
-W=new THREE.Color,na=new THREE.Color,N=new THREE.Color,xa=new THREE.Color,ta,qa,ua,la,ka,oa,pa,ea,da,sa=new THREE.Rectangle,Ea=new THREE.Rectangle,Y=new THREE.Rectangle,ya=!1,za=new THREE.Color,m=new THREE.Color,D=new THREE.Color,p=new THREE.Color,n=new THREE.Vector3,w,E,C,G,S,P,M=16;w=document.createElement("canvas");w.width=w.height=2;E=w.getContext("2d");E.fillStyle="rgba(0,0,0,1)";E.fillRect(0,0,2,2);C=E.getImageData(0,0,2,2);G=C.data;S=document.createElement("canvas");S.width=S.height=M;P=S.getContext("2d");
-P.translate(-M/2,-M/2);P.scale(M,M);M--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ca,va){g=ca;h=va;j=g/2;k=h/2;e.width=g;e.height=h;sa.set(-j,-k,j,k);y=1;q=0;H=A=null;J=1};this.setClearColor=function(ca,va){t=ca;x=va};this.setClearColorHex=function(ca,va){t.setHex(ca);x=va};this.clear=function(){o.setTransform(1,0,0,-1,j,k);if(!Ea.isEmpty()){Ea.inflate(1);Ea.minSelf(sa);if(t.hex==0&&x==0)o.clearRect(Ea.getX(),Ea.getY(),Ea.getWidth(),Ea.getHeight());
-else{c(THREE.NormalBlending);a(1);o.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+x+")";o.fillRect(Ea.getX(),Ea.getY(),Ea.getWidth(),Ea.getHeight())}Ea.empty()}};this.render=function(ca,va){function ha(L){var ga,X,B,T=L.lights;m.setRGB(0,0,0);D.setRGB(0,0,0);p.setRGB(0,0,0);L=0;for(ga=T.length;L<ga;L++){X=T[L];B=X.color;if(X instanceof THREE.AmbientLight){m.r+=B.r;m.g+=B.g;m.b+=B.b}else if(X instanceof THREE.DirectionalLight){D.r+=B.r;D.g+=B.g;D.b+=B.b}else if(X instanceof
-THREE.PointLight){p.r+=B.r;p.g+=B.g;p.b+=B.b}}}function wa(L,ga,X,B){var T,ja,Na,Pa,La=L.lights;L=0;for(T=La.length;L<T;L++){ja=La[L];Na=ja.color;Pa=ja.intensity;if(ja instanceof THREE.DirectionalLight){ja=X.dot(ja.position)*Pa;if(ja>0){B.r+=Na.r*ja;B.g+=Na.g*ja;B.b+=Na.b*ja}}else if(ja instanceof THREE.PointLight){n.sub(ja.position,ga);n.normalize();ja=X.dot(n)*Pa;if(ja>0){B.r+=Na.r*ja;B.g+=Na.g*ja;B.b+=Na.b*ja}}}}function ia(L,ga,X){if(X.opacity!=0){a(X.opacity);c(X.blending);var B,T,ja,Na,Pa,La;
-if(X instanceof THREE.ParticleBasicMaterial){if(X.map){Na=X.map.image;Pa=Na.width>>1;La=Na.height>>1;X=ga.scale.x*j;ja=ga.scale.y*k;B=X*Pa;T=ja*La;Y.set(L.x-B,L.y-T,L.x+B,L.y+T);if(sa.instersects(Y)){o.save();o.translate(L.x,L.y);o.rotate(-ga.rotation);o.scale(X,-ja);o.translate(-Pa,-La);o.drawImage(Na,0,0);o.restore()}}}else if(X instanceof THREE.ParticleCanvasMaterial){if(ya){za.r=m.r+D.r+p.r;za.g=m.g+D.g+p.g;za.b=m.b+D.b+p.b;R.r=X.color.r*za.r;R.g=X.color.g*za.g;R.b=X.color.b*za.b;R.updateStyleString()}else R.__styleString=
-X.color.__styleString;B=ga.scale.x*j;T=ga.scale.y*k;Y.set(L.x-B,L.y-T,L.x+B,L.y+T);if(sa.instersects(Y)){o.save();o.translate(L.x,L.y);o.rotate(-ga.rotation);o.scale(B,T);X.program(o,R);o.restore()}}}}function Ja(L,ga,X,B){if(B.opacity!=0){a(B.opacity);c(B.blending);o.beginPath();o.moveTo(L.positionScreen.x,L.positionScreen.y);o.lineTo(ga.positionScreen.x,ga.positionScreen.y);o.closePath();if(B instanceof THREE.LineBasicMaterial){R.__styleString=B.color.__styleString;L=B.linewidth;if(J!=L)o.lineWidth=
-J=L;L=R.__styleString;if(A!=L)o.strokeStyle=A=L;o.stroke();Y.inflate(B.linewidth*2)}}}function Ra(L,ga,X,B,T,ja){if(T.opacity!=0){a(T.opacity);c(T.blending);I=L.positionScreen.x;Q=L.positionScreen.y;Z=ga.positionScreen.x;V=ga.positionScreen.y;f=X.positionScreen.x;fa=X.positionScreen.y;o.beginPath();o.moveTo(I,Q);o.lineTo(Z,V);o.lineTo(f,fa);o.lineTo(I,Q);o.closePath();if(T instanceof THREE.MeshBasicMaterial)if(T.map)T.map.mapping instanceof THREE.UVMapping&&O(I,Q,Z,V,f,fa,T.map.image,B.uvs[0].u,B.uvs[0].v,
-B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(T.envMap){if(T.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=va.matrixWorldInverse;n.copy(B.vertexNormalsWorld[0]);la=(n.x*L.n11+n.y*L.n12+n.z*L.n13)*0.5+0.5;ka=-(n.x*L.n21+n.y*L.n22+n.z*L.n23)*0.5+0.5;n.copy(B.vertexNormalsWorld[1]);oa=(n.x*L.n11+n.y*L.n12+n.z*L.n13)*0.5+0.5;pa=-(n.x*L.n21+n.y*L.n22+n.z*L.n23)*0.5+0.5;n.copy(B.vertexNormalsWorld[2]);ea=(n.x*L.n11+n.y*L.n12+n.z*L.n13)*0.5+0.5;da=-(n.x*L.n21+n.y*L.n22+n.z*L.n23)*
-0.5+0.5;O(I,Q,Z,V,f,fa,T.envMap.image,la,ka,oa,pa,ea,da)}}else T.wireframe?ra(T.color.__styleString,T.wireframeLinewidth):Ga(T.color.__styleString);else if(T instanceof THREE.MeshLambertMaterial){if(T.map&&!T.wireframe){T.map.mapping instanceof THREE.UVMapping&&O(I,Q,Z,V,f,fa,T.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);c(THREE.SubtractiveBlending)}if(ya)if(!T.wireframe&&T.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){W.r=na.r=N.r=m.r;W.g=na.g=N.g=
-m.g;W.b=na.b=N.b=m.b;wa(ja,B.v1.positionWorld,B.vertexNormalsWorld[0],W);wa(ja,B.v2.positionWorld,B.vertexNormalsWorld[1],na);wa(ja,B.v3.positionWorld,B.vertexNormalsWorld[2],N);xa.r=(na.r+N.r)*0.5;xa.g=(na.g+N.g)*0.5;xa.b=(na.b+N.b)*0.5;ua=Oa(W,na,N,xa);O(I,Q,Z,V,f,fa,ua,0,0,1,0,0,1)}else{za.r=m.r;za.g=m.g;za.b=m.b;wa(ja,B.centroidWorld,B.normalWorld,za);R.r=T.color.r*za.r;R.g=T.color.g*za.g;R.b=T.color.b*za.b;R.updateStyleString();T.wireframe?ra(R.__styleString,T.wireframeLinewidth):Ga(R.__styleString)}else T.wireframe?
-ra(T.color.__styleString,T.wireframeLinewidth):Ga(T.color.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){ta=va.near;qa=va.far;W.r=W.g=W.b=1-Fa(L.positionScreen.z,ta,qa);na.r=na.g=na.b=1-Fa(ga.positionScreen.z,ta,qa);N.r=N.g=N.b=1-Fa(X.positionScreen.z,ta,qa);xa.r=(na.r+N.r)*0.5;xa.g=(na.g+N.g)*0.5;xa.b=(na.b+N.b)*0.5;ua=Oa(W,na,N,xa);O(I,Q,Z,V,f,fa,ua,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){R.r=Sa(B.normalWorld.x);R.g=Sa(B.normalWorld.y);R.b=Sa(B.normalWorld.z);R.updateStyleString();
-T.wireframe?ra(R.__styleString,T.wireframeLinewidth):Ga(R.__styleString)}}}function ra(L,ga){if(A!=L)o.strokeStyle=A=L;if(J!=ga)o.lineWidth=J=ga;o.stroke();Y.inflate(ga*2)}function Ga(L){if(H!=L)o.fillStyle=H=L;o.fill()}function O(L,ga,X,B,T,ja,Na,Pa,La,Ba,Ha,Ca,Ia){var Aa,Da;Aa=Na.width-1;Da=Na.height-1;Pa*=Aa;La*=Da;Ba*=Aa;Ha*=Da;Ca*=Aa;Ia*=Da;X-=L;B-=ga;T-=L;ja-=ga;Ba-=Pa;Ha-=La;Ca-=Pa;Ia-=La;Aa=Ba*Ia-Ca*Ha;if(Aa!=0){Da=1/Aa;Aa=(Ia*X-Ha*T)*Da;Ha=(Ia*B-Ha*ja)*Da;X=(Ba*T-Ca*X)*Da;B=(Ba*ja-Ca*B)*
-Da;L=L-Aa*Pa-X*La;ga=ga-Ha*Pa-B*La;o.save();o.transform(Aa,Ha,X,B,L,ga);o.clip();o.drawImage(Na,0,0);o.restore()}}function Oa(L,ga,X,B){var T=~~(L.r*255),ja=~~(L.g*255);L=~~(L.b*255);var Na=~~(ga.r*255),Pa=~~(ga.g*255);ga=~~(ga.b*255);var La=~~(X.r*255),Ba=~~(X.g*255);X=~~(X.b*255);var Ha=~~(B.r*255),Ca=~~(B.g*255);B=~~(B.b*255);G[0]=T<0?0:T>255?255:T;G[1]=ja<0?0:ja>255?255:ja;G[2]=L<0?0:L>255?255:L;G[4]=Na<0?0:Na>255?255:Na;G[5]=Pa<0?0:Pa>255?255:Pa;G[6]=ga<0?0:ga>255?255:ga;G[8]=La<0?0:La>255?255:
-La;G[9]=Ba<0?0:Ba>255?255:Ba;G[10]=X<0?0:X>255?255:X;G[12]=Ha<0?0:Ha>255?255:Ha;G[13]=Ca<0?0:Ca>255?255:Ca;G[14]=B<0?0:B>255?255:B;E.putImageData(C,0,0);P.drawImage(w,0,0);return S}function Fa(L,ga,X){L=(L-ga)/(X-ga);return L*L*(3-2*L)}function Sa(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function U(L,ga){var X=ga.x-L.x,B=ga.y-L.y,T=1/Math.sqrt(X*X+B*B);X*=T;B*=T;ga.x+=X;ga.y+=B;L.x-=X;L.y-=B}var $,aa,ma,Ka,Xa,Ma,Va,Qa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,j,k);b=d.projectScene(ca,va,this.sortElements);
-(ya=ca.lights.length>0)&&ha(ca);$=0;for(aa=b.length;$<aa;$++){ma=b[$];Y.empty();if(ma instanceof THREE.RenderableParticle){F=ma;F.x*=j;F.y*=k;Ka=0;for(Xa=ma.materials.length;Ka<Xa;Ka++)ia(F,ma,ma.materials[Ka],ca)}else if(ma instanceof THREE.RenderableLine){F=ma.v1;K=ma.v2;F.positionScreen.x*=j;F.positionScreen.y*=k;K.positionScreen.x*=j;K.positionScreen.y*=k;Y.addPoint(F.positionScreen.x,F.positionScreen.y);Y.addPoint(K.positionScreen.x,K.positionScreen.y);if(sa.instersects(Y)){Ka=0;for(Xa=ma.materials.length;Ka<
-Xa;)Ja(F,K,ma,ma.materials[Ka++],ca)}}else if(ma instanceof THREE.RenderableFace3){F=ma.v1;K=ma.v2;z=ma.v3;F.positionScreen.x*=j;F.positionScreen.y*=k;K.positionScreen.x*=j;K.positionScreen.y*=k;z.positionScreen.x*=j;z.positionScreen.y*=k;if(ma.overdraw){U(F.positionScreen,K.positionScreen);U(K.positionScreen,z.positionScreen);U(z.positionScreen,F.positionScreen)}Y.add3Points(F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(sa.instersects(Y)){Ka=
-0;for(Xa=ma.meshMaterials.length;Ka<Xa;){Qa=ma.meshMaterials[Ka++];if(Qa instanceof THREE.MeshFaceMaterial){Ma=0;for(Va=ma.faceMaterials.length;Ma<Va;)(Qa=ma.faceMaterials[Ma++])&&Ra(F,K,z,ma,Qa,ca)}else Ra(F,K,z,ma,Qa,ca)}}}Ea.addRectangle(Y)}o.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(la,ka,oa){var pa,ea,da,sa;pa=0;for(ea=la.lights.length;pa<ea;pa++){da=la.lights[pa];if(da instanceof THREE.DirectionalLight){sa=ka.normalWorld.dot(da.position)*da.intensity;if(sa>0){oa.r+=da.color.r*sa;oa.g+=da.color.g*sa;oa.b+=da.color.b*sa}}else if(da instanceof THREE.PointLight){fa.sub(da.position,ka.centroidWorld);fa.normalize();sa=ka.normalWorld.dot(fa)*da.intensity;if(sa>0){oa.r+=da.color.r*sa;oa.g+=da.color.g*sa;oa.b+=da.color.b*sa}}}}function c(la,ka,
-oa,pa,ea,da){N=d(xa++);N.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+"z");if(ea instanceof THREE.MeshBasicMaterial)z.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshLambertMaterial)if(K){I.r=Q.r;I.g=Q.g;I.b=Q.b;a(da,pa,I);z.r=ea.color.r*I.r;z.g=ea.color.g*I.g;z.b=ea.color.b*I.b;z.updateStyleString()}else z.__styleString=ea.color.__styleString;else if(ea instanceof
-THREE.MeshDepthMaterial){f=1-ea.__2near/(ea.__farPlusNear-pa.z*ea.__farMinusNear);z.setRGB(f,f,f)}else ea instanceof THREE.MeshNormalMaterial&&z.setRGB(e(pa.normalWorld.x),e(pa.normalWorld.y),e(pa.normalWorld.z));ea.wireframe?N.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ea.wireframeLinewidth+"; stroke-opacity: "+ea.opacity+"; stroke-linecap: "+ea.wireframeLinecap+"; stroke-linejoin: "+ea.wireframeLinejoin):N.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+
-ea.opacity);j.appendChild(N)}function b(la,ka,oa,pa,ea,da,sa){N=d(xa++);N.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(da instanceof THREE.MeshBasicMaterial)z.__styleString=da.color.__styleString;else if(da instanceof THREE.MeshLambertMaterial)if(K){I.r=Q.r;I.g=Q.g;I.b=Q.b;a(sa,ea,I);z.r=da.color.r*I.r;z.g=da.color.g*I.g;
-z.b=da.color.b*I.b;z.updateStyleString()}else z.__styleString=da.color.__styleString;else if(da instanceof THREE.MeshDepthMaterial){f=1-da.__2near/(da.__farPlusNear-ea.z*da.__farMinusNear);z.setRGB(f,f,f)}else da instanceof THREE.MeshNormalMaterial&&z.setRGB(e(ea.normalWorld.x),e(ea.normalWorld.y),e(ea.normalWorld.z));da.wireframe?N.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+da.wireframeLinewidth+"; stroke-opacity: "+da.opacity+"; stroke-linecap: "+da.wireframeLinecap+
-"; stroke-linejoin: "+da.wireframeLinejoin):N.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+da.opacity);j.appendChild(N)}function d(la){if(R[la]==null){R[la]=document.createElementNS("http://www.w3.org/2000/svg","path");ua==0&&R[la].setAttribute("shape-rendering","crispEdges")}return R[la]}function e(la){return la<0?Math.min((1+la)*0.5,0.5):0.5+Math.min(la*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,t,x,y,q,A,H,J=
-new THREE.Rectangle,F=new THREE.Rectangle,K=!1,z=new THREE.Color(16777215),I=new THREE.Color(16777215),Q=new THREE.Color(0),Z=new THREE.Color(0),V=new THREE.Color(0),f,fa=new THREE.Vector3,R=[],W=[],na=[],N,xa,ta,qa,ua=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(la){switch(la){case "high":ua=1;break;case "low":ua=0}};this.setSize=function(la,ka){k=la;o=ka;t=k/2;x=o/2;j.setAttribute("viewBox",-t+" "+-x+" "+k+" "+o);j.setAttribute("width",
-k);j.setAttribute("height",o);J.set(-t,-x,t,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(la,ka){var oa,pa,ea,da,sa,Ea,Y,ya;this.autoClear&&this.clear();g=h.projectScene(la,ka,this.sortElements);qa=ta=xa=0;if(K=la.lights.length>0){Y=la.lights;Q.setRGB(0,0,0);Z.setRGB(0,0,0);V.setRGB(0,0,0);oa=0;for(pa=Y.length;oa<pa;oa++){ea=Y[oa];da=ea.color;if(ea instanceof THREE.AmbientLight){Q.r+=da.r;Q.g+=da.g;Q.b+=da.b}else if(ea instanceof THREE.DirectionalLight){Z.r+=
-da.r;Z.g+=da.g;Z.b+=da.b}else if(ea instanceof THREE.PointLight){V.r+=da.r;V.g+=da.g;V.b+=da.b}}}oa=0;for(pa=g.length;oa<pa;oa++){Y=g[oa];F.empty();if(Y instanceof THREE.RenderableParticle){y=Y;y.x*=t;y.y*=-x;ea=0;for(da=Y.materials.length;ea<da;ea++)if(ya=Y.materials[ea]){sa=y;Ea=Y;var za=ta++;if(W[za]==null){W[za]=document.createElementNS("http://www.w3.org/2000/svg","circle");ua==0&&W[za].setAttribute("shape-rendering","crispEdges")}N=W[za];N.setAttribute("cx",sa.x);N.setAttribute("cy",sa.y);N.setAttribute("r",
-Ea.scale.x*t);if(ya instanceof THREE.ParticleCircleMaterial){if(K){I.r=Q.r+Z.r+V.r;I.g=Q.g+Z.g+V.g;I.b=Q.b+Z.b+V.b;z.r=ya.color.r*I.r;z.g=ya.color.g*I.g;z.b=ya.color.b*I.b;z.updateStyleString()}else z=ya.color;N.setAttribute("style","fill: "+z.__styleString)}j.appendChild(N)}}else if(Y instanceof THREE.RenderableLine){y=Y.v1;q=Y.v2;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(q.positionScreen.x,
-q.positionScreen.y);if(J.instersects(F)){ea=0;for(da=Y.materials.length;ea<da;)if(ya=Y.materials[ea++]){sa=y;Ea=q;za=qa++;if(na[za]==null){na[za]=document.createElementNS("http://www.w3.org/2000/svg","line");ua==0&&na[za].setAttribute("shape-rendering","crispEdges")}N=na[za];N.setAttribute("x1",sa.positionScreen.x);N.setAttribute("y1",sa.positionScreen.y);N.setAttribute("x2",Ea.positionScreen.x);N.setAttribute("y2",Ea.positionScreen.y);if(ya instanceof THREE.LineBasicMaterial){z.__styleString=ya.color.__styleString;
-N.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ya.linewidth+"; stroke-opacity: "+ya.opacity+"; stroke-linecap: "+ya.linecap+"; stroke-linejoin: "+ya.linejoin);j.appendChild(N)}}}}else if(Y instanceof THREE.RenderableFace3){y=Y.v1;q=Y.v2;A=Y.v3;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=t;A.positionScreen.y*=-x;F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(q.positionScreen.x,q.positionScreen.y);
-F.addPoint(A.positionScreen.x,A.positionScreen.y);if(J.instersects(F)){ea=0;for(da=Y.meshMaterials.length;ea<da;){ya=Y.meshMaterials[ea++];if(ya instanceof THREE.MeshFaceMaterial){sa=0;for(Ea=Y.faceMaterials.length;sa<Ea;)(ya=Y.faceMaterials[sa++])&&c(y,q,A,Y,ya,la)}else ya&&c(y,q,A,Y,ya,la)}}}else if(Y instanceof THREE.RenderableFace4){y=Y.v1;q=Y.v2;A=Y.v3;H=Y.v4;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=t;A.positionScreen.y*=-x;
-H.positionScreen.x*=t;H.positionScreen.y*=-x;F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(q.positionScreen.x,q.positionScreen.y);F.addPoint(A.positionScreen.x,A.positionScreen.y);F.addPoint(H.positionScreen.x,H.positionScreen.y);if(J.instersects(F)){ea=0;for(da=Y.meshMaterials.length;ea<da;){ya=Y.meshMaterials[ea++];if(ya instanceof THREE.MeshFaceMaterial){sa=0;for(Ea=Y.faceMaterials.length;sa<Ea;)(ya=Y.faceMaterials[sa++])&&b(y,q,A,H,Y,ya,la)}else ya&&b(y,q,A,H,Y,ya,la)}}}}}};
-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",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
-lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
+THREE.Projector=function(){function a(){var S=j[k]=j[k]||new THREE.RenderableVertex;k++;return S}function c(S,T){return T.z-S.z}function b(S,T){var ea=0,oa=1,$=S.z+S.w,R=T.z+T.w,la=-S.z+S.w,va=-T.z+T.w;if($>=0&&R>=0&&la>=0&&va>=0)return!0;else if($<0&&R<0||la<0&&va<0)return!1;else{if($<0)ea=Math.max(ea,$/($-R));else R<0&&(oa=Math.min(oa,$/($-R)));if(la<0)ea=Math.max(ea,la/(la-va));else va<0&&(oa=Math.min(oa,la/(la-va)));if(oa<ea)return!1;else{S.lerpSelf(T,ea);T.lerpSelf(S,1-oa);return!0}}}var d,e,
+h=[],g,k,j=[],m,t,x=[],y,q,A=[],G,J,E=[],K=new THREE.Vector4,z=new THREE.Vector4,I=new THREE.Matrix4,P=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],W=new THREE.Vector4,f=new THREE.Vector4;this.projectVector=function(S,T){I.multiply(T.projectionMatrix,T.matrixWorldInverse);I.multiplyVector3(S);return S};this.unprojectVector=function(S,T){I.multiply(THREE.Matrix4.makeInvert(T.projectionMatrix),T.matrixWorld);I.multiplyVector3(S);
+return S};this.projectObjects=function(S,T,ea){T=[];var oa,$,R;e=0;$=S.objects;S=0;for(oa=$.length;S<oa;S++){R=$[S];var la;if(!(la=!R.visible))if(la=R instanceof THREE.Mesh){a:{la=void 0;for(var va=R.matrixWorld,Da=-R.geometry.boundingSphere.radius*Math.max(R.scale.x,Math.max(R.scale.y,R.scale.z)),fa=0;fa<6;fa++){la=Z[fa].x*va.n14+Z[fa].y*va.n24+Z[fa].z*va.n34+Z[fa].w;if(la<=Da){la=!1;break a}}la=!0}la=!la}if(!la){la=h[e]=h[e]||new THREE.RenderableObject;e++;d=la;K.copy(R.position);I.multiplyVector3(K);
+d.object=R;d.z=K.z;T.push(d)}}ea&&T.sort(c);return T};this.projectScene=function(S,T,ea){var oa=[],$=T.near,R=T.far,la,va,Da,fa,ia,pa,ua,ha,aa,ja,Na,ma,qa,Fa,n,C,p;J=q=t=0;T.matrixAutoUpdate&&T.updateMatrix();S.update(undefined,!1,T);I.multiply(T.projectionMatrix,T.matrixWorldInverse);Z[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);Z[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);Z[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);Z[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,
+I.n44-I.n24);Z[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);Z[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(la=0;la<6;la++){aa=Z[la];aa.divideScalar(Math.sqrt(aa.x*aa.x+aa.y*aa.y+aa.z*aa.z))}aa=this.projectObjects(S,T,!0);S=0;for(la=aa.length;S<la;S++){ja=aa[S].object;if(ja.visible){Na=ja.matrixWorld;ma=ja.matrixRotationWorld;qa=ja.materials;Fa=ja.overdraw;k=0;if(ja instanceof THREE.Mesh){n=ja.geometry;fa=n.vertices;C=n.faces;n=n.faceVertexUvs;va=0;for(Da=fa.length;va<Da;va++){g=
+a();g.positionWorld.copy(fa[va].position);Na.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);I.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>$&&g.positionScreen.z<R}fa=0;for(va=C.length;fa<va;fa++){Da=C[fa];if(Da instanceof THREE.Face3){ia=j[Da.a];pa=j[Da.b];ua=j[Da.c];if(ia.visible&&pa.visible&&ua.visible&&(ja.doubleSided||ja.flipSided!=(ua.positionScreen.x-ia.positionScreen.x)*
+(pa.positionScreen.y-ia.positionScreen.y)-(ua.positionScreen.y-ia.positionScreen.y)*(pa.positionScreen.x-ia.positionScreen.x)<0)){ha=x[t]=x[t]||new THREE.RenderableFace3;t++;m=ha;m.v1.copy(ia);m.v2.copy(pa);m.v3.copy(ua);m.normalWorld.copy(Da.normal);ma.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Da.centroid);Na.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);I.multiplyVector3(m.centroidScreen);ua=Da.vertexNormals;ia=0;for(pa=ua.length;ia<pa;ia++){ha=m.vertexNormalsWorld[ia];
+ha.copy(ua[ia]);ma.multiplyVector3(ha)}ia=0;for(pa=n.length;ia<pa;ia++)if(p=n[ia][fa]){ua=0;for(ha=p.length;ua<ha;ua++)m.uvs[ia][ua]=p[ua]}m.meshMaterials=qa;m.faceMaterials=Da.materials;m.overdraw=Fa;m.z=m.centroidScreen.z;oa.push(m)}}}}else if(ja instanceof THREE.Line){P.multiply(I,Na);fa=ja.geometry.vertices;ia=a();ia.positionScreen.copy(fa[0].position);P.multiplyVector4(ia.positionScreen);va=1;for(Da=fa.length;va<Da;va++){ia=a();ia.positionScreen.copy(fa[va].position);P.multiplyVector4(ia.positionScreen);
+pa=j[k-2];W.copy(ia.positionScreen);f.copy(pa.positionScreen);if(b(W,f)){W.multiplyScalar(1/W.w);f.multiplyScalar(1/f.w);Na=A[q]=A[q]||new THREE.RenderableLine;q++;y=Na;y.v1.positionScreen.copy(W);y.v2.positionScreen.copy(f);y.z=Math.max(W.z,f.z);y.materials=ja.materials;oa.push(y)}}}else if(ja instanceof THREE.Particle){z.set(ja.position.x,ja.position.y,ja.position.z,1);I.multiplyVector4(z);z.z/=z.w;if(z.z>0&&z.z<1){Na=E[J]=E[J]||new THREE.RenderableParticle;J++;G=Na;G.x=z.x/z.w;G.y=z.y/z.w;G.z=
+z.z;G.rotation=ja.rotation.z;G.scale.x=ja.scale.x*Math.abs(G.x-(z.x+T.projectionMatrix.n11)/(z.w+T.projectionMatrix.n14));G.scale.y=ja.scale.y*Math.abs(G.y-(z.y+T.projectionMatrix.n22)/(z.w+T.projectionMatrix.n24));G.materials=ja.materials;oa.push(G)}}}}ea&&oa.sort(c);return oa}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,h;this.domElement=document.createElement("div");this.setSize=function(g,k){b=g;d=k;e=b/2;h=d/2};this.render=function(g,k){var j,m,t,x,y,q,A,G;a=c.projectScene(g,k);j=0;for(m=a.length;j<m;j++){y=a[j];if(y instanceof THREE.RenderableParticle){A=y.x*e+e;G=y.y*h+h;t=0;for(x=y.material.length;t<x;t++){q=y.material[t];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=A+"px";q.style.top=G+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(X){if(y!=X)m.globalAlpha=y=X}function c(X){if(q!=X){switch(X){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=X}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),h,g,k,j,m=e.getContext("2d"),t=new THREE.Color(0),x=0,y=1,q=0,A=null,G=null,J=1,E,K,z,I,P,Z,W,f,S,T,ea=new THREE.Color,
+oa=new THREE.Color,$=new THREE.Color,R=new THREE.Color,la=new THREE.Color,va,Da,fa,ia,pa,ua,ha,aa,ja,Na,ma=new THREE.Rectangle,qa=new THREE.Rectangle,Fa=new THREE.Rectangle,n=!1,C=new THREE.Color,p=new THREE.Color,o=new THREE.Color,w=new THREE.Color,B=new THREE.Vector3,D,H,U,N,M,na,xa=16;D=document.createElement("canvas");D.width=D.height=2;H=D.getContext("2d");H.fillStyle="rgba(0,0,0,1)";H.fillRect(0,0,2,2);U=H.getImageData(0,0,2,2);N=U.data;M=document.createElement("canvas");M.width=M.height=xa;
+na=M.getContext("2d");na.translate(-xa/2,-xa/2);na.scale(xa,xa);xa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(X,ra){h=X;g=ra;k=h/2;j=g/2;e.width=h;e.height=g;ma.set(-k,-j,k,j);y=1;q=0;G=A=null;J=1};this.setClearColor=function(X,ra){t=X;x=ra};this.setClearColorHex=function(X,ra){t.setHex(X);x=ra};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!qa.isEmpty()){qa.inflate(1);qa.minSelf(ma);if(t.hex==0&&x==0)m.clearRect(qa.getX(),qa.getY(),
+qa.getWidth(),qa.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+x+")";m.fillRect(qa.getX(),qa.getY(),qa.getWidth(),qa.getHeight())}qa.empty()}};this.render=function(X,ra){function ka(L){var F,Y,Q,ga=L.lights;p.setRGB(0,0,0);o.setRGB(0,0,0);w.setRGB(0,0,0);L=0;for(F=ga.length;L<F;L++){Y=ga[L];Q=Y.color;if(Y instanceof THREE.AmbientLight){p.r+=Q.r;p.g+=Q.g;p.b+=Q.b}else if(Y instanceof THREE.DirectionalLight){o.r+=
+Q.r;o.g+=Q.g;o.b+=Q.b}else if(Y instanceof THREE.PointLight){w.r+=Q.r;w.g+=Q.g;w.b+=Q.b}}}function Ea(L,F,Y,Q){var ga,ya,Ja,sa,za=L.lights;L=0;for(ga=za.length;L<ga;L++){ya=za[L];Ja=ya.color;sa=ya.intensity;if(ya instanceof THREE.DirectionalLight){ya=Y.dot(ya.position)*sa;if(ya>0){Q.r+=Ja.r*ya;Q.g+=Ja.g*ya;Q.b+=Ja.b*ya}}else if(ya instanceof THREE.PointLight){B.sub(ya.position,F);B.normalize();ya=Y.dot(B)*sa;if(ya>0){Q.r+=Ja.r*ya;Q.g+=Ja.g*ya;Q.b+=Ja.b*ya}}}}function Ra(L,F,Y){if(Y.opacity!=0){a(Y.opacity);
+c(Y.blending);var Q,ga,ya,Ja,sa,za;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map){Ja=Y.map.image;sa=Ja.width>>1;za=Ja.height>>1;Y=F.scale.x*k;ya=F.scale.y*j;Q=Y*sa;ga=ya*za;Fa.set(L.x-Q,L.y-ga,L.x+Q,L.y+ga);if(ma.instersects(Fa)){m.save();m.translate(L.x,L.y);m.rotate(-F.rotation);m.scale(Y,-ya);m.translate(-sa,-za);m.drawImage(Ja,0,0);m.restore()}}}else if(Y instanceof THREE.ParticleCanvasMaterial){if(n){C.r=p.r+o.r+w.r;C.g=p.g+o.g+w.g;C.b=p.b+o.b+w.b;ea.r=Y.color.r*C.r;ea.g=Y.color.g*C.g;
+ea.b=Y.color.b*C.b;ea.updateStyleString()}else ea.__styleString=Y.color.__styleString;Q=F.scale.x*k;ga=F.scale.y*j;Fa.set(L.x-Q,L.y-ga,L.x+Q,L.y+ga);if(ma.instersects(Fa)){m.save();m.translate(L.x,L.y);m.rotate(-F.rotation);m.scale(Q,ga);Y.program(m,ea);m.restore()}}}}function ta(L,F,Y,Q){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);m.beginPath();m.moveTo(L.positionScreen.x,L.positionScreen.y);m.lineTo(F.positionScreen.x,F.positionScreen.y);m.closePath();if(Q instanceof THREE.LineBasicMaterial){ea.__styleString=
+Q.color.__styleString;L=Q.linewidth;if(J!=L)m.lineWidth=J=L;L=ea.__styleString;if(A!=L)m.strokeStyle=A=L;m.stroke();Fa.inflate(Q.linewidth*2)}}}function La(L,F,Y,Q,ga,ya){if(ga.opacity!=0){a(ga.opacity);c(ga.blending);P=L.positionScreen.x;Z=L.positionScreen.y;W=F.positionScreen.x;f=F.positionScreen.y;S=Y.positionScreen.x;T=Y.positionScreen.y;m.beginPath();m.moveTo(P,Z);m.lineTo(W,f);m.lineTo(S,T);m.lineTo(P,Z);m.closePath();if(ga instanceof THREE.MeshBasicMaterial)if(ga.map){if(ga.map.mapping instanceof
+THREE.UVMapping){ia=Q.uvs[0];Ca(P,Z,W,f,S,T,ga.map.image,ia[0].u,ia[0].v,ia[1].u,ia[1].v,ia[2].u,ia[2].v)}}else if(ga.envMap){if(ga.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=ra.matrixWorldInverse;B.copy(Q.vertexNormalsWorld[0]);pa=(B.x*L.n11+B.y*L.n12+B.z*L.n13)*0.5+0.5;ua=-(B.x*L.n21+B.y*L.n22+B.z*L.n23)*0.5+0.5;B.copy(Q.vertexNormalsWorld[1]);ha=(B.x*L.n11+B.y*L.n12+B.z*L.n13)*0.5+0.5;aa=-(B.x*L.n21+B.y*L.n22+B.z*L.n23)*0.5+0.5;B.copy(Q.vertexNormalsWorld[2]);ja=(B.x*L.n11+B.y*
+L.n12+B.z*L.n13)*0.5+0.5;Na=-(B.x*L.n21+B.y*L.n22+B.z*L.n23)*0.5+0.5;Ca(P,Z,W,f,S,T,ga.envMap.image,pa,ua,ha,aa,ja,Na)}}else ga.wireframe?O(ga.color.__styleString,ga.wireframeLinewidth):Oa(ga.color.__styleString);else if(ga instanceof THREE.MeshLambertMaterial){if(ga.map&&!ga.wireframe){if(ga.map.mapping instanceof THREE.UVMapping){ia=Q.uvs[0];Ca(P,Z,W,f,S,T,ga.map.image,ia[0].u,ia[0].v,ia[1].u,ia[1].v,ia[2].u,ia[2].v)}c(THREE.SubtractiveBlending)}if(n)if(!ga.wireframe&&ga.shading==THREE.SmoothShading&&
+Q.vertexNormalsWorld.length==3){oa.r=$.r=R.r=p.r;oa.g=$.g=R.g=p.g;oa.b=$.b=R.b=p.b;Ea(ya,Q.v1.positionWorld,Q.vertexNormalsWorld[0],oa);Ea(ya,Q.v2.positionWorld,Q.vertexNormalsWorld[1],$);Ea(ya,Q.v3.positionWorld,Q.vertexNormalsWorld[2],R);la.r=($.r+R.r)*0.5;la.g=($.g+R.g)*0.5;la.b=($.b+R.b)*0.5;fa=Sa(oa,$,R,la);Ca(P,Z,W,f,S,T,fa,0,0,1,0,0,1)}else{C.r=p.r;C.g=p.g;C.b=p.b;Ea(ya,Q.centroidWorld,Q.normalWorld,C);ea.r=ga.color.r*C.r;ea.g=ga.color.g*C.g;ea.b=ga.color.b*C.b;ea.updateStyleString();ga.wireframe?
+O(ea.__styleString,ga.wireframeLinewidth):Oa(ea.__styleString)}else ga.wireframe?O(ga.color.__styleString,ga.wireframeLinewidth):Oa(ga.color.__styleString)}else if(ga instanceof THREE.MeshDepthMaterial){va=ra.near;Da=ra.far;oa.r=oa.g=oa.b=1-V(L.positionScreen.z,va,Da);$.r=$.g=$.b=1-V(F.positionScreen.z,va,Da);R.r=R.g=R.b=1-V(Y.positionScreen.z,va,Da);la.r=($.r+R.r)*0.5;la.g=($.g+R.g)*0.5;la.b=($.b+R.b)*0.5;fa=Sa(oa,$,R,la);Ca(P,Z,W,f,S,T,fa,0,0,1,0,0,1)}else if(ga instanceof THREE.MeshNormalMaterial){ea.r=
+ca(Q.normalWorld.x);ea.g=ca(Q.normalWorld.y);ea.b=ca(Q.normalWorld.z);ea.updateStyleString();ga.wireframe?O(ea.__styleString,ga.wireframeLinewidth):Oa(ea.__styleString)}}}function O(L,F){if(A!=L)m.strokeStyle=A=L;if(J!=F)m.lineWidth=J=F;m.stroke();Fa.inflate(F*2)}function Oa(L){if(G!=L)m.fillStyle=G=L;m.fill()}function Ca(L,F,Y,Q,ga,ya,Ja,sa,za,Aa,wa,Ba,Ga){var Ya,Ta;Ya=Ja.width-1;Ta=Ja.height-1;sa*=Ya;za*=Ta;Aa*=Ya;wa*=Ta;Ba*=Ya;Ga*=Ta;Y-=L;Q-=F;ga-=L;ya-=F;Aa-=sa;wa-=za;Ba-=sa;Ga-=za;Ya=Aa*Ga-Ba*
+wa;if(Ya!=0){Ta=1/Ya;Ya=(Ga*Y-wa*ga)*Ta;wa=(Ga*Q-wa*ya)*Ta;Y=(Aa*ga-Ba*Y)*Ta;Q=(Aa*ya-Ba*Q)*Ta;L=L-Ya*sa-Y*za;F=F-wa*sa-Q*za;m.save();m.transform(Ya,wa,Y,Q,L,F);m.clip();m.drawImage(Ja,0,0);m.restore()}}function Sa(L,F,Y,Q){var ga=~~(L.r*255),ya=~~(L.g*255);L=~~(L.b*255);var Ja=~~(F.r*255),sa=~~(F.g*255);F=~~(F.b*255);var za=~~(Y.r*255),Aa=~~(Y.g*255);Y=~~(Y.b*255);var wa=~~(Q.r*255),Ba=~~(Q.g*255);Q=~~(Q.b*255);N[0]=ga<0?0:ga>255?255:ga;N[1]=ya<0?0:ya>255?255:ya;N[2]=L<0?0:L>255?255:L;N[4]=Ja<0?
+0:Ja>255?255:Ja;N[5]=sa<0?0:sa>255?255:sa;N[6]=F<0?0:F>255?255:F;N[8]=za<0?0:za>255?255:za;N[9]=Aa<0?0:Aa>255?255:Aa;N[10]=Y<0?0:Y>255?255:Y;N[12]=wa<0?0:wa>255?255:wa;N[13]=Ba<0?0:Ba>255?255:Ba;N[14]=Q<0?0:Q>255?255:Q;H.putImageData(U,0,0);na.drawImage(D,0,0);return M}function V(L,F,Y){L=(L-F)/(Y-F);return L*L*(3-2*L)}function ca(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function da(L,F){var Y=F.x-L.x,Q=F.y-L.y,ga=1/Math.sqrt(Y*Y+Q*Q);Y*=ga;Q*=ga;F.x+=Y;F.y+=Q;L.x-=Y;L.y-=Q}var Ha,Pa,Ia,Ka,Wa,Ua,Ma,Qa;
+this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);b=d.projectScene(X,ra,this.sortElements);(n=X.lights.length>0)&&ka(X);Ha=0;for(Pa=b.length;Ha<Pa;Ha++){Ia=b[Ha];Fa.empty();if(Ia instanceof THREE.RenderableParticle){E=Ia;E.x*=k;E.y*=j;Ka=0;for(Wa=Ia.materials.length;Ka<Wa;Ka++)Ra(E,Ia,Ia.materials[Ka],X)}else if(Ia instanceof THREE.RenderableLine){E=Ia.v1;K=Ia.v2;E.positionScreen.x*=k;E.positionScreen.y*=j;K.positionScreen.x*=k;K.positionScreen.y*=j;Fa.addPoint(E.positionScreen.x,E.positionScreen.y);
+Fa.addPoint(K.positionScreen.x,K.positionScreen.y);if(ma.instersects(Fa)){Ka=0;for(Wa=Ia.materials.length;Ka<Wa;)ta(E,K,Ia,Ia.materials[Ka++],X)}}else if(Ia instanceof THREE.RenderableFace3){E=Ia.v1;K=Ia.v2;z=Ia.v3;E.positionScreen.x*=k;E.positionScreen.y*=j;K.positionScreen.x*=k;K.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;if(Ia.overdraw){da(E.positionScreen,K.positionScreen);da(K.positionScreen,z.positionScreen);da(z.positionScreen,E.positionScreen)}Fa.add3Points(E.positionScreen.x,
+E.positionScreen.y,K.positionScreen.x,K.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(ma.instersects(Fa)){Ka=0;for(Wa=Ia.meshMaterials.length;Ka<Wa;){Qa=Ia.meshMaterials[Ka++];if(Qa instanceof THREE.MeshFaceMaterial){Ua=0;for(Ma=Ia.faceMaterials.length;Ua<Ma;)(Qa=Ia.faceMaterials[Ua++])&&La(E,K,z,Ia,Qa,X)}else La(E,K,z,Ia,Qa,X)}}}else if(Ia instanceof THREE.RenderableFace4){E=Ia.v1;K=Ia.v2;z=Ia.v3;I=Ia.v4;E.positionScreen.x*=k;E.positionScreen.y*=j;K.positionScreen.x*=k;K.positionScreen.y*=
+j;z.positionScreen.x*=k;z.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j}qa.addRectangle(Fa)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(fa,ia,pa){var ua,ha,aa,ja;ua=0;for(ha=fa.lights.length;ua<ha;ua++){aa=fa.lights[ua];if(aa instanceof THREE.DirectionalLight){ja=ia.normalWorld.dot(aa.position)*aa.intensity;if(ja>0){pa.r+=aa.color.r*ja;pa.g+=aa.color.g*ja;pa.b+=aa.color.b*ja}}else if(aa instanceof THREE.PointLight){S.sub(aa.position,ia.centroidWorld);S.normalize();ja=ia.normalWorld.dot(S)*aa.intensity;if(ja>0){pa.r+=aa.color.r*ja;pa.g+=aa.color.g*ja;pa.b+=aa.color.b*ja}}}}function c(fa,ia,pa,
+ua,ha,aa){$=d(R++);$.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+"z");if(ha instanceof THREE.MeshBasicMaterial)z.__styleString=ha.color.__styleString;else if(ha instanceof THREE.MeshLambertMaterial)if(K){I.r=P.r;I.g=P.g;I.b=P.b;a(aa,ua,I);z.r=ha.color.r*I.r;z.g=ha.color.g*I.g;z.b=ha.color.b*I.b;z.updateStyleString()}else z.__styleString=ha.color.__styleString;else if(ha instanceof
+THREE.MeshDepthMaterial){f=1-ha.__2near/(ha.__farPlusNear-ua.z*ha.__farMinusNear);z.setRGB(f,f,f)}else ha instanceof THREE.MeshNormalMaterial&&z.setRGB(e(ua.normalWorld.x),e(ua.normalWorld.y),e(ua.normalWorld.z));ha.wireframe?$.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+ha.wireframeLinewidth+"; stroke-opacity: "+ha.opacity+"; stroke-linecap: "+ha.wireframeLinecap+"; stroke-linejoin: "+ha.wireframeLinejoin):$.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+
+ha.opacity);k.appendChild($)}function b(fa,ia,pa,ua,ha,aa,ja){$=d(R++);$.setAttribute("d","M "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+pa.positionScreen.x+","+pa.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(aa instanceof THREE.MeshBasicMaterial)z.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshLambertMaterial)if(K){I.r=P.r;I.g=P.g;I.b=P.b;a(ja,ha,I);z.r=aa.color.r*I.r;z.g=aa.color.g*I.g;
+z.b=aa.color.b*I.b;z.updateStyleString()}else z.__styleString=aa.color.__styleString;else if(aa instanceof THREE.MeshDepthMaterial){f=1-aa.__2near/(aa.__farPlusNear-ha.z*aa.__farMinusNear);z.setRGB(f,f,f)}else aa instanceof THREE.MeshNormalMaterial&&z.setRGB(e(ha.normalWorld.x),e(ha.normalWorld.y),e(ha.normalWorld.z));aa.wireframe?$.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+aa.wireframeLinewidth+"; stroke-opacity: "+aa.opacity+"; stroke-linecap: "+aa.wireframeLinecap+
+"; stroke-linejoin: "+aa.wireframeLinejoin):$.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+aa.opacity);k.appendChild($)}function d(fa){if(T[fa]==null){T[fa]=document.createElementNS("http://www.w3.org/2000/svg","path");Da==0&&T[fa].setAttribute("shape-rendering","crispEdges")}return T[fa]}function e(fa){return fa<0?Math.min((1+fa)*0.5,0.5):0.5+Math.min(fa*0.5,0.5)}var h=null,g=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,t,x,y,q,A,G,J=
+new THREE.Rectangle,E=new THREE.Rectangle,K=!1,z=new THREE.Color(16777215),I=new THREE.Color(16777215),P=new THREE.Color(0),Z=new THREE.Color(0),W=new THREE.Color(0),f,S=new THREE.Vector3,T=[],ea=[],oa=[],$,R,la,va,Da=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(fa){switch(fa){case "high":Da=1;break;case "low":Da=0}};this.setSize=function(fa,ia){j=fa;m=ia;t=j/2;x=m/2;k.setAttribute("viewBox",-t+" "+-x+" "+j+" "+m);k.setAttribute("width",j);
+k.setAttribute("height",m);J.set(-t,-x,t,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(fa,ia){var pa,ua,ha,aa,ja,Na,ma,qa;this.autoClear&&this.clear();h=g.projectScene(fa,ia,this.sortElements);va=la=R=0;if(K=fa.lights.length>0){ma=fa.lights;P.setRGB(0,0,0);Z.setRGB(0,0,0);W.setRGB(0,0,0);pa=0;for(ua=ma.length;pa<ua;pa++){ha=ma[pa];aa=ha.color;if(ha instanceof THREE.AmbientLight){P.r+=aa.r;P.g+=aa.g;P.b+=aa.b}else if(ha instanceof THREE.DirectionalLight){Z.r+=
+aa.r;Z.g+=aa.g;Z.b+=aa.b}else if(ha instanceof THREE.PointLight){W.r+=aa.r;W.g+=aa.g;W.b+=aa.b}}}pa=0;for(ua=h.length;pa<ua;pa++){ma=h[pa];E.empty();if(ma instanceof THREE.RenderableParticle){y=ma;y.x*=t;y.y*=-x;ha=0;for(aa=ma.materials.length;ha<aa;ha++)if(qa=ma.materials[ha]){ja=y;Na=ma;var Fa=la++;if(ea[Fa]==null){ea[Fa]=document.createElementNS("http://www.w3.org/2000/svg","circle");Da==0&&ea[Fa].setAttribute("shape-rendering","crispEdges")}$=ea[Fa];$.setAttribute("cx",ja.x);$.setAttribute("cy",
+ja.y);$.setAttribute("r",Na.scale.x*t);if(qa instanceof THREE.ParticleCircleMaterial){if(K){I.r=P.r+Z.r+W.r;I.g=P.g+Z.g+W.g;I.b=P.b+Z.b+W.b;z.r=qa.color.r*I.r;z.g=qa.color.g*I.g;z.b=qa.color.b*I.b;z.updateStyleString()}else z=qa.color;$.setAttribute("style","fill: "+z.__styleString)}k.appendChild($)}}else if(ma instanceof THREE.RenderableLine){y=ma.v1;q=ma.v2;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);
+E.addPoint(q.positionScreen.x,q.positionScreen.y);if(J.instersects(E)){ha=0;for(aa=ma.materials.length;ha<aa;)if(qa=ma.materials[ha++]){ja=y;Na=q;Fa=va++;if(oa[Fa]==null){oa[Fa]=document.createElementNS("http://www.w3.org/2000/svg","line");Da==0&&oa[Fa].setAttribute("shape-rendering","crispEdges")}$=oa[Fa];$.setAttribute("x1",ja.positionScreen.x);$.setAttribute("y1",ja.positionScreen.y);$.setAttribute("x2",Na.positionScreen.x);$.setAttribute("y2",Na.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){z.__styleString=
+qa.color.__styleString;$.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+qa.linewidth+"; stroke-opacity: "+qa.opacity+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);k.appendChild($)}}}}else if(ma instanceof THREE.RenderableFace3){y=ma.v1;q=ma.v2;A=ma.v3;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=t;A.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,
+q.positionScreen.y);E.addPoint(A.positionScreen.x,A.positionScreen.y);if(J.instersects(E)){ha=0;for(aa=ma.meshMaterials.length;ha<aa;){qa=ma.meshMaterials[ha++];if(qa instanceof THREE.MeshFaceMaterial){ja=0;for(Na=ma.faceMaterials.length;ja<Na;)(qa=ma.faceMaterials[ja++])&&c(y,q,A,ma,qa,fa)}else qa&&c(y,q,A,ma,qa,fa)}}}else if(ma instanceof THREE.RenderableFace4){y=ma.v1;q=ma.v2;A=ma.v3;G=ma.v4;y.positionScreen.x*=t;y.positionScreen.y*=-x;q.positionScreen.x*=t;q.positionScreen.y*=-x;A.positionScreen.x*=
+t;A.positionScreen.y*=-x;G.positionScreen.x*=t;G.positionScreen.y*=-x;E.addPoint(y.positionScreen.x,y.positionScreen.y);E.addPoint(q.positionScreen.x,q.positionScreen.y);E.addPoint(A.positionScreen.x,A.positionScreen.y);E.addPoint(G.positionScreen.x,G.positionScreen.y);if(J.instersects(E)){ha=0;for(aa=ma.meshMaterials.length;ha<aa;){qa=ma.meshMaterials[ha++];if(qa instanceof THREE.MeshFaceMaterial){ja=0;for(Na=ma.faceMaterials.length;ja<Na;)(qa=ma.faceMaterials[ja++])&&b(y,q,A,G,ma,qa,fa)}else qa&&
+b(y,q,A,G,ma,qa,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",
+lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
 color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
@@ -211,101 +212,102 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function c(m,D,p){var n,w,E,C=m.vertices,G=C.length,S=m.colors,P=S.length,M=m.__vertexArray,ca=m.__colorArray,va=m.__sortArray,ha=m.__dirtyVertices,wa=m.__dirtyColors;if(p.sortParticles){pa.multiplySelf(p.matrixWorld);for(n=0;n<G;n++){w=C[n].position;sa.copy(w);pa.multiplyVector3(sa);va[n]=[sa.z,n]}va.sort(function(ia,Ja){return Ja[0]-ia[0]});for(n=0;n<G;n++){w=C[va[n][1]].position;E=n*3;M[E]=w.x;M[E+1]=w.y;M[E+2]=w.z}for(n=0;n<P;n++){E=n*3;color=S[va[n][1]];ca[E]=
-color.r;ca[E+1]=color.g;ca[E+2]=color.b}}else{if(ha)for(n=0;n<G;n++){w=C[n].position;E=n*3;M[E]=w.x;M[E+1]=w.y;M[E+2]=w.z}if(wa)for(n=0;n<P;n++){color=S[n];E=n*3;ca[E]=color.r;ca[E+1]=color.g;ca[E+2]=color.b}}if(ha||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,M,D)}if(wa||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,ca,D)}}function b(m,D){m.fragmentShader=D.fragmentShader;m.vertexShader=D.vertexShader;
-m.uniforms=Uniforms.clone(D.uniforms)}function d(m,D,p,n,w){n.program||W.initMaterial(n,D,p,w);var E=n.program,C=E.uniforms,G=n.uniforms;if(E!=fa){f.useProgram(E);fa=E}f.uniformMatrix4fv(C.projectionMatrix,!1,ea);if(p&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){G.fogNear.value=p.near;
-G.fogFar.value=p.far}else if(p instanceof THREE.FogExp2)G.fogDensity.value=p.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n.lights){var S,P,M=0,ca=0,va=0,ha,wa,ia,Ja=Ea,Ra=Ja.directional.colors,ra=Ja.directional.positions,Ga=Ja.point.colors,O=Ja.point.positions,Oa=0,Fa=0;p=P=P=0;for(S=D.length;p<S;p++){P=D[p];ha=P.color;wa=P.position;ia=P.intensity;if(P instanceof THREE.AmbientLight){M+=ha.r;ca+=ha.g;va+=ha.b}else if(P instanceof THREE.DirectionalLight){P=
-Oa*3;Ra[P]=ha.r*ia;Ra[P+1]=ha.g*ia;Ra[P+2]=ha.b*ia;ra[P]=wa.x;ra[P+1]=wa.y;ra[P+2]=wa.z;Oa+=1}else if(P instanceof THREE.PointLight){P=Fa*3;Ga[P]=ha.r*ia;Ga[P+1]=ha.g*ia;Ga[P+2]=ha.b*ia;O[P]=wa.x;O[P+1]=wa.y;O[P+2]=wa.z;Fa+=1}}for(p=Oa*3;p<Ra.length;p++)Ra[p]=0;for(p=Fa*3;p<Ga.length;p++)Ga[p]=0;Ja.point.length=Fa;Ja.directional.length=Oa;Ja.ambient[0]=M;Ja.ambient[1]=ca;Ja.ambient[2]=va;D=Ea;G.enableLighting.value=D.directional.length+D.point.length;G.ambientLightColor.value=D.ambient;G.directionalLightColor.value=
-D.directional.colors;G.directionalLightDirection.value=D.directional.positions;G.pointLightColor.value=D.point.colors;G.pointLightPosition.value=D.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity;G.map.texture=n.map;G.lightMap.texture=n.lightMap;G.envMap.texture=n.envMap;G.reflectivity.value=n.reflectivity;
-G.refractionRatio.value=n.refractionRatio;G.combine.value=n.combine;G.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);G.opacity.value=n.opacity;G.size.value=n.size;G.scale.value=V.height/
-2;G.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){G.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);G.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);G.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){G.mNear.value=m.near;G.mFar.value=m.far;G.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)G.opacity.value=n.opacity;for(var Sa in G)if(M=E.uniforms[Sa]){p=G[Sa];S=p.type;D=p.value;if(S=="i")f.uniform1i(M,D);else if(S==
-"f")f.uniform1f(M,D);else if(S=="fv1")f.uniform1fv(M,D);else if(S=="fv")f.uniform3fv(M,D);else if(S=="v2")f.uniform2f(M,D.x,D.y);else if(S=="v3")f.uniform3f(M,D.x,D.y,D.z);else if(S=="c")f.uniform3f(M,D.r,D.g,D.b);else if(S=="t"){f.uniform1i(M,D);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(S=0;S<6;++S)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,0,0,f.RGBA,
-f.UNSIGNED_BYTE,p.image[S])}else{p.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(S=0;S<6;++S)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[S]);p.__wasSetOnce=!0}K(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+D);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,
-p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}K(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+D);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,w._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,
-!1,w._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&f.uniform3f(C.cameraPosition,m.position.x,m.position.y,m.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&f.uniformMatrix4fv(C.objectMatrix,!1,w._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&f.uniformMatrix4fv(C.viewMatrix,!1,da);if(n.skinning){f.uniformMatrix4fv(C.cameraInverseMatrix,
-!1,da);f.uniformMatrix4fv(C.boneGlobalMatrices,!1,w.boneMatrices)}return E}function e(m,D,p,n,w,E){if(n.opacity!=0){m=d(m,D,p,n,E).attributes;if(n.morphTargets){D=n.program.attributes;E.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[E.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(D.position,3,f.FLOAT,!1,0,0);if(E.morphTargetForcedOrder.length){p=0;for(var C=E.morphTargetForcedOrder,G=E.morphTargetInfluences;p<n.numSupportedMorphTargets&&
-p<C.length;){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[C[p]]);f.vertexAttribPointer(D["morphTarget"+p],3,f.FLOAT,!1,0,0);E.__webGLMorphTargetInfluences[p]=G[C[p]];p++}}else{C=[];var S=-1,P=0;G=E.morphTargetInfluences;var M,ca=G.length;p=0;for(E.morphTargetBase!==-1&&(C[E.morphTargetBase]=!0);p<n.numSupportedMorphTargets;){for(M=0;M<ca;M++)if(!C[M]&&G[M]>S){P=M;S=G[P]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[P]);f.vertexAttribPointer(D["morphTarget"+p],3,f.FLOAT,!1,0,
-0);E.__webGLMorphTargetInfluences[p]=S;C[P]=1;S=-1;p++}}f.uniform1fv(n.program.uniforms.morphTargetInfluences,E.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(m.position,3,f.FLOAT,!1,0,0)}if(m.color>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLColorBuffer);f.vertexAttribPointer(m.color,3,f.FLOAT,!1,0,0)}if(m.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLNormalBuffer);f.vertexAttribPointer(m.normal,3,f.FLOAT,!1,0,0)}if(m.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,
-w.__webGLTangentBuffer);f.vertexAttribPointer(m.tangent,4,f.FLOAT,!1,0,0)}if(m.uv>=0)if(w.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUVBuffer);f.vertexAttribPointer(m.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv)}else f.disableVertexAttribArray(m.uv);if(m.uv2>=0)if(w.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUV2Buffer);f.vertexAttribPointer(m.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(m.uv2)}else f.disableVertexAttribArray(m.uv2);if(n.skinning&&m.skinVertexA>=0&&
-m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexABuffer);f.vertexAttribPointer(m.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexBBuffer);f.vertexAttribPointer(m.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinIndicesBuffer);f.vertexAttribPointer(m.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinWeightsBuffer);f.vertexAttribPointer(m.skinWeight,4,f.FLOAT,!1,0,0)}if(E instanceof
-THREE.Mesh)if(n.wireframe){f.lineWidth(n.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);f.drawElements(f.LINES,w.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,w.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(n.linewidth);f.drawArrays(E,0,w.__webGLLineCount)}else if(E instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,
-0,w.__webGLParticleCount);else E instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,w.__webGLVertexCount)}}function g(m,D){if(!m.__webGLVertexBuffer)m.__webGLVertexBuffer=f.createBuffer();if(!m.__webGLNormalBuffer)m.__webGLNormalBuffer=f.createBuffer();if(m.hasPos){f.bindBuffer(f.ARRAY_BUFFER,m.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,m.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.position);f.vertexAttribPointer(D.attributes.position,3,f.FLOAT,!1,0,0)}if(m.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,
-m.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,m.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.normal);f.vertexAttribPointer(D.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,m.count);m.count=0}function h(m){if(na!=m.doubleSided){m.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);na=m.doubleSided}if(N!=m.flipSided){m.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);N=m.flipSided}}function j(m){if(ta!=m){m?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);
-ta=m}}function k(m){oa[0].set(m.n41-m.n11,m.n42-m.n12,m.n43-m.n13,m.n44-m.n14);oa[1].set(m.n41+m.n11,m.n42+m.n12,m.n43+m.n13,m.n44+m.n14);oa[2].set(m.n41+m.n21,m.n42+m.n22,m.n43+m.n23,m.n44+m.n24);oa[3].set(m.n41-m.n21,m.n42-m.n22,m.n43-m.n23,m.n44-m.n24);oa[4].set(m.n41-m.n31,m.n42-m.n32,m.n43-m.n33,m.n44-m.n34);oa[5].set(m.n41+m.n31,m.n42+m.n32,m.n43+m.n33,m.n44+m.n34);var D;for(m=0;m<6;m++){D=oa[m];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function o(m){for(var D=m.matrixWorld,p=-m.geometry.boundingSphere.radius*
-Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),n=0;n<6;n++){m=oa[n].x*D.n14+oa[n].y*D.n24+oa[n].z*D.n34+oa[n].w;if(m<=p)return!1}return!0}function t(m,D){m.list[m.count]=D;m.count+=1}function x(m){var D,p,n=m.object,w=m.opaque,E=m.transparent;E.count=0;m=w.count=0;for(D=n.materials.length;m<D;m++){p=n.materials[m];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?t(E,p):t(w,p)}}function y(m){var D,p,n,w,E=m.object,C=m.buffer,G=m.opaque,S=m.transparent;S.count=0;m=G.count=0;for(n=E.materials.length;m<
-n;m++){D=E.materials[m];if(D instanceof THREE.MeshFaceMaterial){D=0;for(p=C.materials.length;D<p;D++)(w=C.materials[D])&&(w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(S,w):t(G,w))}else{w=D;w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(S,w):t(G,w)}}}function q(m,D){return D.z-m.z}function A(m,D){m._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(m._modelViewMatrix).transposeIntoArray(m._normalMatrixArray)}
-function H(m){function D(va){var ha=[];p=0;for(n=va.length;p<n;p++)va[p]==undefined?ha.push("undefined"):ha.push(va[p].id);return ha.join("_")}var p,n,w,E,C,G,S,P,M={},ca=m.morphTargets!==undefined?m.morphTargets.length:0;m.geometryGroups={};w=0;for(E=m.faces.length;w<E;w++){C=m.faces[w];G=C.materials;S=D(G);M[S]==undefined&&(M[S]={hash:S,counter:0});P=M[S].hash+"_"+M[S].counter;m.geometryGroups[P]==undefined&&(m.geometryGroups[P]={faces:[],materials:G,vertices:0,numMorphTargets:ca});C=C instanceof
-THREE.Face3?3:4;if(m.geometryGroups[P].vertices+C>65535){M[S].counter+=1;P=M[S].hash+"_"+M[S].counter;m.geometryGroups[P]==undefined&&(m.geometryGroups[P]={faces:[],materials:G,vertices:0,numMorphTargets:ca})}m.geometryGroups[P].faces.push(w);m.geometryGroups[P].vertices+=C}}function J(m,D,p){m.push({buffer:D,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(m){if(m!=xa){switch(m){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,
-f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}xa=m}}function K(m,D,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(m,f.TEXTURE_WRAP_S,Z(D.wrapS));f.texParameteri(m,f.TEXTURE_WRAP_T,Z(D.wrapT));f.texParameteri(m,f.TEXTURE_MAG_FILTER,
-Z(D.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,Z(D.minFilter));f.generateMipmap(m)}else{f.texParameteri(m,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(m,f.TEXTURE_MAG_FILTER,Q(D.magFilter));f.texParameteri(m,f.TEXTURE_MIN_FILTER,Q(D.minFilter))}}function z(m){if(m&&!m.__webGLFramebuffer){m.__webGLFramebuffer=f.createFramebuffer();m.__webGLRenderbuffer=f.createRenderbuffer();m.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,
-m.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,m.width,m.height);f.bindTexture(f.TEXTURE_2D,m.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Z(m.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Z(m.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Z(m.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Z(m.minFilter));f.texImage2D(f.TEXTURE_2D,0,Z(m.format),m.width,m.height,0,Z(m.format),Z(m.type),null);f.bindFramebuffer(f.FRAMEBUFFER,
-m.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,m.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,m.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var D,p;if(m){D=m.__webGLFramebuffer;p=m.width;m=m.height}else{D=null;p=la;m=ka}if(D!=R){f.bindFramebuffer(f.FRAMEBUFFER,D);f.viewport(qa,ua,p,m);R=D}}function I(m,D){var p;if(m=="fragment")p=
-f.createShader(f.FRAGMENT_SHADER);else m=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,D);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));console.error(D);return null}return p}function Q(m){switch(m){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}
-function Z(m){switch(m){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;
+THREE.WebGLRenderer=function(a){function c(n,C,p){var o,w,B,D=n.vertices,H=D.length,U=n.colors,N=U.length,M=n.__vertexArray,na=n.__colorArray,xa=n.__sortArray,X=n.__dirtyVertices,ra=n.__dirtyColors;if(p.sortParticles){ua.multiplySelf(p.matrixWorld);for(o=0;o<H;o++){w=D[o].position;ja.copy(w);ua.multiplyVector3(ja);xa[o]=[ja.z,o]}xa.sort(function(ka,Ea){return Ea[0]-ka[0]});for(o=0;o<H;o++){w=D[xa[o][1]].position;B=o*3;M[B]=w.x;M[B+1]=w.y;M[B+2]=w.z}for(o=0;o<N;o++){B=o*3;color=U[xa[o][1]];na[B]=color.r;
+na[B+1]=color.g;na[B+2]=color.b}}else{if(X)for(o=0;o<H;o++){w=D[o].position;B=o*3;M[B]=w.x;M[B+1]=w.y;M[B+2]=w.z}if(ra)for(o=0;o<N;o++){color=U[o];B=o*3;na[B]=color.r;na[B+1]=color.g;na[B+2]=color.b}}if(X||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,M,C)}if(ra||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,na,C)}}function b(n,C){n.fragmentShader=C.fragmentShader;n.vertexShader=C.vertexShader;n.uniforms=
+Uniforms.clone(C.uniforms)}function d(n,C,p,o,w){o.program||ea.initMaterial(o,C,p,w);var B=o.program,D=B.uniforms,H=o.uniforms;if(B!=S){f.useProgram(B);S=B}f.uniformMatrix4fv(D.projectionMatrix,!1,ha);if(p&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){H.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){H.fogNear.value=p.near;H.fogFar.value=
+p.far}else if(p instanceof THREE.FogExp2)H.fogDensity.value=p.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var U,N,M=0,na=0,xa=0,X,ra,ka,Ea=Na,Ra=Ea.directional.colors,ta=Ea.directional.positions,La=Ea.point.colors,O=Ea.point.positions,Oa=0,Ca=0;p=N=N=0;for(U=C.length;p<U;p++){N=C[p];X=N.color;ra=N.position;ka=N.intensity;if(N instanceof THREE.AmbientLight){M+=X.r;na+=X.g;xa+=X.b}else if(N instanceof THREE.DirectionalLight){N=Oa*3;Ra[N]=X.r*ka;
+Ra[N+1]=X.g*ka;Ra[N+2]=X.b*ka;ta[N]=ra.x;ta[N+1]=ra.y;ta[N+2]=ra.z;Oa+=1}else if(N instanceof THREE.PointLight){N=Ca*3;La[N]=X.r*ka;La[N+1]=X.g*ka;La[N+2]=X.b*ka;O[N]=ra.x;O[N+1]=ra.y;O[N+2]=ra.z;Ca+=1}}for(p=Oa*3;p<Ra.length;p++)Ra[p]=0;for(p=Ca*3;p<La.length;p++)La[p]=0;Ea.point.length=Ca;Ea.directional.length=Oa;Ea.ambient[0]=M;Ea.ambient[1]=na;Ea.ambient[2]=xa;C=Na;H.enableLighting.value=C.directional.length+C.point.length;H.ambientLightColor.value=C.ambient;H.directionalLightColor.value=C.directional.colors;
+H.directionalLightDirection.value=C.directional.positions;H.pointLightColor.value=C.point.colors;H.pointLightPosition.value=C.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){H.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);H.opacity.value=o.opacity;H.map.texture=o.map;H.lightMap.texture=o.lightMap;H.envMap.texture=o.envMap;H.reflectivity.value=o.reflectivity;H.refractionRatio.value=
+o.refractionRatio;H.combine.value=o.combine;H.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){H.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);H.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){H.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);H.opacity.value=o.opacity;H.size.value=o.size;H.scale.value=W.height/2;H.map.texture=o.map}else if(o instanceof
+THREE.MeshPhongMaterial){H.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);H.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);H.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){H.mNear.value=n.near;H.mFar.value=n.far;H.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)H.opacity.value=o.opacity;for(var Sa in H)if(M=B.uniforms[Sa]){p=H[Sa];U=p.type;C=p.value;if(U=="i")f.uniform1i(M,C);else if(U=="f")f.uniform1f(M,C);else if(U=="fv1")f.uniform1fv(M,
+C);else if(U=="fv")f.uniform3fv(M,C);else if(U=="v2")f.uniform2f(M,C.x,C.y);else if(U=="v3")f.uniform3f(M,C.x,C.y,C.z);else if(U=="c")f.uniform3f(M,C.r,C.g,C.b);else if(U=="t"){f.uniform1i(M,C);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(U=0;U<6;++U)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[U])}else{p.image.__webGLTextureCube=
+f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(U=0;U<6;++U)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[U]);p.__wasSetOnce=!0}K(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+C);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,
+0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}K(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+C);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(D.modelViewMatrix,!1,w._modelViewMatrixArray);f.uniformMatrix3fv(D.normalMatrix,!1,w._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||
+o instanceof THREE.MeshPhongMaterial||o.envMap)&&f.uniform3f(D.cameraPosition,n.position.x,n.position.y,n.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&f.uniformMatrix4fv(D.objectMatrix,!1,w._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&f.uniformMatrix4fv(D.viewMatrix,!1,aa);if(o.skinning){f.uniformMatrix4fv(D.cameraInverseMatrix,!1,aa);f.uniformMatrix4fv(D.boneGlobalMatrices,
+!1,w.boneMatrices)}return B}function e(n,C,p,o,w,B){if(o.opacity!=0){n=d(n,C,p,o,B).attributes;if(o.morphTargets){C=o.program.attributes;B.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[B.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(C.position,3,f.FLOAT,!1,0,0);if(B.morphTargetForcedOrder.length){p=0;for(var D=B.morphTargetForcedOrder,H=B.morphTargetInfluences;p<o.numSupportedMorphTargets&&p<D.length;){f.bindBuffer(f.ARRAY_BUFFER,
+w.__webGLMorphTargetsBuffers[D[p]]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);B.__webGLMorphTargetInfluences[p]=H[D[p]];p++}}else{D=[];var U=-1,N=0;H=B.morphTargetInfluences;var M,na=H.length;p=0;for(B.morphTargetBase!==-1&&(D[B.morphTargetBase]=!0);p<o.numSupportedMorphTargets;){for(M=0;M<na;M++)if(!D[M]&&H[M]>U){N=M;U=H[N]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[N]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);B.__webGLMorphTargetInfluences[p]=U;D[N]=
+1;U=-1;p++}}f.uniform1fv(o.program.uniforms.morphTargetInfluences,B.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(n.position,3,f.FLOAT,!1,0,0)}if(n.color>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLColorBuffer);f.vertexAttribPointer(n.color,3,f.FLOAT,!1,0,0)}if(n.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLNormalBuffer);f.vertexAttribPointer(n.normal,3,f.FLOAT,!1,0,0)}if(n.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLTangentBuffer);
+f.vertexAttribPointer(n.tangent,4,f.FLOAT,!1,0,0)}if(n.uv>=0)if(w.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUVBuffer);f.vertexAttribPointer(n.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv)}else f.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(w.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUV2Buffer);f.vertexAttribPointer(n.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv2)}else f.disableVertexAttribArray(n.uv2);if(o.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=
+0&&n.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexABuffer);f.vertexAttribPointer(n.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexBBuffer);f.vertexAttribPointer(n.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinIndicesBuffer);f.vertexAttribPointer(n.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinWeightsBuffer);f.vertexAttribPointer(n.skinWeight,4,f.FLOAT,!1,0,0)}if(B instanceof THREE.Mesh)if(o.wireframe){f.lineWidth(o.wireframeLinewidth);
+f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);f.drawElements(f.LINES,w.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,w.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(o.linewidth);f.drawArrays(B,0,w.__webGLLineCount)}else if(B instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,w.__webGLParticleCount);else B instanceof THREE.Ribbon&&
+f.drawArrays(f.TRIANGLE_STRIP,0,w.__webGLVertexCount)}}function h(n,C){if(!n.__webGLVertexBuffer)n.__webGLVertexBuffer=f.createBuffer();if(!n.__webGLNormalBuffer)n.__webGLNormalBuffer=f.createBuffer();if(n.hasPos){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,n.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(C.attributes.position);f.vertexAttribPointer(C.attributes.position,3,f.FLOAT,!1,0,0)}if(n.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLNormalBuffer);
+f.bufferData(f.ARRAY_BUFFER,n.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(C.attributes.normal);f.vertexAttribPointer(C.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,n.count);n.count=0}function g(n){if(oa!=n.doubleSided){n.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);oa=n.doubleSided}if($!=n.flipSided){n.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);$=n.flipSided}}function k(n){if(la!=n){n?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);la=n}}function j(n){pa[0].set(n.n41-
+n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);pa[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);pa[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);pa[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);pa[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);pa[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=pa[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,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,
+Math.max(n.scale.y,n.scale.z)),o=0;o<6;o++){n=pa[o].x*C.n14+pa[o].y*C.n24+pa[o].z*C.n34+pa[o].w;if(n<=p)return!1}return!0}function t(n,C){n.list[n.count]=C;n.count+=1}function x(n){var C,p,o=n.object,w=n.opaque,B=n.transparent;B.count=0;n=w.count=0;for(C=o.materials.length;n<C;n++){p=o.materials[n];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?t(B,p):t(w,p)}}function y(n){var C,p,o,w,B=n.object,D=n.buffer,H=n.opaque,U=n.transparent;U.count=0;n=H.count=0;for(o=B.materials.length;n<o;n++){C=
+B.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(p=D.materials.length;C<p;C++)(w=D.materials[C])&&(w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(U,w):t(H,w))}else{w=C;w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(U,w):t(H,w)}}}function q(n,C){return C.z-n.z}function A(n,C){n._modelViewMatrix.multiplyToArray(C.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function G(n){function C(xa){var X=
+[];p=0;for(o=xa.length;p<o;p++)xa[p]==undefined?X.push("undefined"):X.push(xa[p].id);return X.join("_")}var p,o,w,B,D,H,U,N,M={},na=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};w=0;for(B=n.faces.length;w<B;w++){D=n.faces[w];H=D.materials;U=C(H);M[U]==undefined&&(M[U]={hash:U,counter:0});N=M[U].hash+"_"+M[U].counter;n.geometryGroups[N]==undefined&&(n.geometryGroups[N]={faces:[],materials:H,vertices:0,numMorphTargets:na});D=D instanceof THREE.Face3?3:4;if(n.geometryGroups[N].vertices+
+D>65535){M[U].counter+=1;N=M[U].hash+"_"+M[U].counter;n.geometryGroups[N]==undefined&&(n.geometryGroups[N]={faces:[],materials:H,vertices:0,numMorphTargets:na})}n.geometryGroups[N].faces.push(w);n.geometryGroups[N].vertices+=D}}function J(n,C,p){n.push({buffer:C,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(n){if(n!=R){switch(n){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,
+f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}R=n}}function K(n,C,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(n,f.TEXTURE_WRAP_S,Z(C.wrapS));f.texParameteri(n,f.TEXTURE_WRAP_T,Z(C.wrapT));f.texParameteri(n,f.TEXTURE_MAG_FILTER,
+Z(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,Z(C.minFilter));f.generateMipmap(n)}else{f.texParameteri(n,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_MAG_FILTER,P(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,P(C.minFilter))}}function z(n){if(n&&!n.__webGLFramebuffer){n.__webGLFramebuffer=f.createFramebuffer();n.__webGLRenderbuffer=f.createRenderbuffer();n.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,
+n.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,n.width,n.height);f.bindTexture(f.TEXTURE_2D,n.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,Z(n.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,Z(n.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,Z(n.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,Z(n.minFilter));f.texImage2D(f.TEXTURE_2D,0,Z(n.format),n.width,n.height,0,Z(n.format),Z(n.type),null);f.bindFramebuffer(f.FRAMEBUFFER,
+n.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,n.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,n.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var C,p;if(n){C=n.__webGLFramebuffer;p=n.width;n=n.height}else{C=null;p=fa;n=ia}if(C!=T){f.bindFramebuffer(f.FRAMEBUFFER,C);f.viewport(va,Da,p,n);T=C}}function I(n,C){var p;if(n=="fragment")p=
+f.createShader(f.FRAGMENT_SHADER);else n=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,C);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));console.error(C);return null}return p}function P(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}
+function Z(n){switch(n){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;
 case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}
-var V=document.createElement("canvas"),f,fa=null,R=null,W=this,na=null,N=null,xa=null,ta=null,qa=0,ua=0,la=0,ka=0,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Matrix4,ea=new Float32Array(16),da=new Float32Array(16),sa=new THREE.Vector4,Ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Y=!0,ya=new THREE.Color(0),za=0;if(a){if(a.antialias!==undefined)Y=a.antialias;
-a.clearColor!==undefined&&ya.setHex(a.clearColor);if(a.clearAlpha!==undefined)za=a.clearAlpha}this.maxMorphTargets=8;this.domElement=V;this.autoClear=!0;this.sortObjects=!0;(function(m,D,p){try{if(!(f=V.getContext("experimental-webgl",{antialias:m})))throw"Error creating WebGL context.";}catch(n){console.error(n)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);
-f.clearColor(D.r,D.g,D.b,p);_cullEnabled=!0})(Y,ya,za);this.context=f;this.setSize=function(m,D){V.width=m;V.height=D;this.setViewport(0,0,V.width,V.height)};this.setViewport=function(m,D,p,n){qa=m;ua=D;la=p;ka=n;f.viewport(qa,ua,la,ka)};this.setScissor=function(m,D,p,n){f.scissor(m,D,p,n)};this.enableScissorTest=function(m){m?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(m){f.depthMask(m)};this.setClearColorHex=function(m,D){var p=new THREE.Color(m);f.clearColor(p.r,
-p.g,p.b,D)};this.setClearColor=function(m,D){f.clearColor(m.r,m.g,m.b,D)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(m,D,p,n){var w,E,C;if(m instanceof THREE.MeshDepthMaterial)b(m,THREE.ShaderLib.depth);else if(m instanceof THREE.MeshNormalMaterial)b(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial)b(m,THREE.ShaderLib.basic);else if(m instanceof THREE.MeshLambertMaterial)b(m,THREE.ShaderLib.lambert);else if(m instanceof THREE.MeshPhongMaterial)b(m,
-THREE.ShaderLib.phong);else if(m instanceof THREE.LineBasicMaterial)b(m,THREE.ShaderLib.basic);else m instanceof THREE.ParticleBasicMaterial&&b(m,THREE.ShaderLib.particle_basic);var G,S,P,M;C=P=M=0;for(G=D.length;C<G;C++){S=D[C];S instanceof THREE.DirectionalLight&&P++;S instanceof THREE.PointLight&&M++}if(M+P<=4)D=P;else{D=Math.ceil(4*P/(M+P));M=4-D}C={directional:D,point:M};G=50;if(n!==undefined&&n instanceof THREE.SkinnedMesh)G=n.bones.length;M=m.fragmentShader;D=m.vertexShader;G={fog:p,map:m.map,
-envMap:m.envMap,lightMap:m.lightMap,vertexColors:m.vertexColors,sizeAttenuation:m.sizeAttenuation,skinning:m.skinning,morphTargets:m.morphTargets,maxDirLights:C.directional,maxPointLights:C.point,maxBones:G};p=f.createProgram();C=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+G.maxDirLights,"#define MAX_POINT_LIGHTS "+G.maxPointLights,G.fog?"#define USE_FOG":"",G.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",G.map?"#define USE_MAP":"",G.envMap?"#define USE_ENVMAP":
-"",G.lightMap?"#define USE_LIGHTMAP":"",G.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");G=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+G.maxDirLights,"#define MAX_POINT_LIGHTS "+G.maxPointLights,"#define MAX_BONES "+G.maxBones,G.map?"#define USE_MAP":"",G.envMap?"#define USE_ENVMAP":"",G.lightMap?"#define USE_LIGHTMAP":"",G.vertexColors?"#define USE_COLOR":"",G.skinning?"#define USE_SKINNING":
-"",G.morphTargets?"#define USE_MORPHTARGETS":"",G.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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-f.attachShader(p,I("fragment",C+M));f.attachShader(p,I("vertex",G+D));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};m.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m.uniforms)p.push(w);
-w=m.program;M=0;for(D=p.length;M<D;M++){C=p[M];w.uniforms[C]=f.getUniformLocation(w,C)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)p.push("morphTarget"+w);for(E in m.attributes)p.push(E);E=m.program;w=p;p=0;for(M=w.length;p<M;p++){D=w[p];E.attributes[D]=f.getAttribLocation(E,D)}E=m.program.attributes;f.enableVertexAttribArray(E.position);E.color>=0&&f.enableVertexAttribArray(E.color);E.normal>=0&&f.enableVertexAttribArray(E.normal);
-E.tangent>=0&&f.enableVertexAttribArray(E.tangent);if(m.skinning&&E.skinVertexA>=0&&E.skinVertexB>=0&&E.skinIndex>=0&&E.skinWeight>=0){f.enableVertexAttribArray(E.skinVertexA);f.enableVertexAttribArray(E.skinVertexB);f.enableVertexAttribArray(E.skinIndex);f.enableVertexAttribArray(E.skinWeight)}if(m.morphTargets){m.numSupportedMorphTargets=0;if(E.morphTarget0>=0){f.enableVertexAttribArray(E.morphTarget0);m.numSupportedMorphTargets++}if(E.morphTarget1>=0){f.enableVertexAttribArray(E.morphTarget1);
-m.numSupportedMorphTargets++}if(E.morphTarget2>=0){f.enableVertexAttribArray(E.morphTarget2);m.numSupportedMorphTargets++}if(E.morphTarget3>=0){f.enableVertexAttribArray(E.morphTarget3);m.numSupportedMorphTargets++}if(E.morphTarget4>=0){f.enableVertexAttribArray(E.morphTarget4);m.numSupportedMorphTargets++}if(E.morphTarget5>=0){f.enableVertexAttribArray(E.morphTarget5);m.numSupportedMorphTargets++}if(E.morphTarget6>=0){f.enableVertexAttribArray(E.morphTarget6);m.numSupportedMorphTargets++}if(E.morphTarget7>=
-0){f.enableVertexAttribArray(E.morphTarget7);m.numSupportedMorphTargets++}n.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(w=0;w<this.maxMorphTargets;w++)n.__webGLMorphTargetInfluences[w]=0}};this.render=function(m,D,p,n){var w,E,C,G,S,P,M,ca,va=m.lights,ha=m.fog;D.matrixAutoUpdate&&D.updateMatrix();m.update(undefined,!1,D);D.matrixWorldInverse.flattenToArray(da);D.projectionMatrix.flattenToArray(ea);pa.multiply(D.projectionMatrix,D.matrixWorldInverse);k(pa);this.initWebGLObjects(m);
-z(p);(this.autoClear||n)&&this.clear();S=m.__webglObjects.length;for(n=0;n<S;n++){w=m.__webglObjects[n];M=w.object;if(M.visible)if(!(M instanceof THREE.Mesh)||o(M)){M.matrixWorld.flattenToArray(M._objectMatrixArray);A(M,D);y(w);w.render=!0;if(this.sortObjects){sa.copy(M.position);pa.multiplyVector3(sa);w.z=sa.z}}else w.render=!1;else w.render=!1}this.sortObjects&&m.__webglObjects.sort(q);P=m.__webglObjectsImmediate.length;for(n=0;n<P;n++){w=m.__webglObjectsImmediate[n];M=w.object;if(M.visible){M.matrixAutoUpdate&&
-M.matrixWorld.flattenToArray(M._objectMatrixArray);A(M,D);x(w)}}F(THREE.NormalBlending);for(n=0;n<S;n++){w=m.__webglObjects[n];if(w.render){M=w.object;ca=w.buffer;C=w.opaque;h(M);for(w=0;w<C.count;w++){G=C.list[w];j(G.depthTest);e(D,va,ha,G,ca,M)}}}for(n=0;n<P;n++){w=m.__webglObjectsImmediate[n];M=w.object;if(M.visible){C=w.opaque;h(M);for(w=0;w<C.count;w++){G=C.list[w];j(G.depthTest);E=d(D,va,ha,G,M);M.render(function(wa){g(wa,E)})}}}for(n=0;n<S;n++){w=m.__webglObjects[n];if(w.render){M=w.object;
-ca=w.buffer;C=w.transparent;h(M);for(w=0;w<C.count;w++){G=C.list[w];F(G.blending);j(G.depthTest);e(D,va,ha,G,ca,M)}}}for(n=0;n<P;n++){w=m.__webglObjectsImmediate[n];M=w.object;if(M.visible){C=w.transparent;h(M);for(w=0;w<C.count;w++){G=C.list[w];F(G.blending);j(G.depthTest);E=d(D,va,ha,G,M);M.render(function(wa){g(wa,E)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,
-null)}};this.initWebGLObjects=function(m){if(!m.__webglObjects){m.__webglObjects=[];m.__webglObjectsImmediate=[]}for(;m.__objectsAdded.length;){var D=m.__objectsAdded[0],p=m,n=void 0,w=void 0,E=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){w=D.geometry;w.geometryGroups==
-undefined&&H(w);for(n in w.geometryGroups){E=w.geometryGroups[n];if(!E.__webGLVertexBuffer){var C=E;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();
-C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();if(C.numMorphTargets){var G=void 0,S=void 0;C.__webGLMorphTargetsBuffers=[];G=0;for(S=C.numMorphTargets;G<S;G++)C.__webGLMorphTargetsBuffers.push(f.createBuffer())}C=E;var P=D,M=void 0,ca=void 0,va=S=G=0;M=void 0;ca=void 0;var ha=void 0;ca=void 0;var wa=P.geometry;ha=wa.faces;var ia=C.faces;M=0;for(ca=ia.length;M<ca;M++){fi=ia[M];face=ha[fi];if(face instanceof THREE.Face3){G+=3;S+=1;va+=3}else if(face instanceof THREE.Face4){G+=
-4;S+=2;va+=4}}M=C;ca=P;ha=void 0;ia=void 0;var Ja=void 0,Ra=void 0;Ja=void 0;var ra=[];ha=0;for(ia=ca.materials.length;ha<ia;ha++){Ja=ca.materials[ha];if(Ja instanceof THREE.MeshFaceMaterial){Ja=0;for(l=M.materials.length;Ja<l;Ja++)(Ra=M.materials[Ja])&&ra.push(Ra)}else(Ra=Ja)&&ra.push(Ra)}ca=ra;a:{M=void 0;ha=void 0;ia=ca.length;for(M=0;M<ia;M++){ha=ca[M];if(ha.map||ha.lightMap){M=!0;break a}}M=!1}a:{ha=ca;ia=void 0;ra=void 0;Ja=ha.length;for(ia=0;ia<Ja;ia++){ra=ha[ia];if(!(ra instanceof THREE.MeshBasicMaterial||
-ra instanceof THREE.MeshDepthMaterial)){ha=ra&&ra.shading!=undefined&&ra.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ha=!1}a:{ia=void 0;ra=void 0;Ja=ca.length;for(ia=0;ia<Ja;ia++){ra=ca[ia];if(ra.vertexColors){ca=ra.vertexColors;break a}}ca=!1}C.__vertexArray=new Float32Array(G*3);if(ha)C.__normalArray=new Float32Array(G*3);if(wa.hasTangents)C.__tangentArray=new Float32Array(G*4);if(ca)C.__colorArray=new Float32Array(G*3);if(M){if(wa.faceUvs.length>0||wa.faceVertexUvs.length>
-0)C.__uvArray=new Float32Array(G*2);if(wa.faceUvs.length>1||wa.faceVertexUvs.length>1)C.__uv2Array=new Float32Array(G*2)}if(P.geometry.skinWeights.length&&P.geometry.skinIndices.length){C.__skinVertexAArray=new Float32Array(G*4);C.__skinVertexBArray=new Float32Array(G*4);C.__skinIndexArray=new Float32Array(G*4);C.__skinWeightArray=new Float32Array(G*4)}C.__faceArray=new Uint16Array(S*3);C.__lineArray=new Uint16Array(va*2);if(C.numMorphTargets){P=void 0;wa=void 0;C.__morphTargetsArrays=[];P=0;for(wa=
-C.numMorphTargets;P<wa;P++)C.__morphTargetsArrays.push(new Float32Array(G*3))}C.__needsSmoothNormals=ha==THREE.SmoothShading;C.__uvType=M;C.__vertexColorType=ca;C.__normalType=ha;C.__webGLFaceCount=S*3;C.__webGLLineCount=va*2;w.__dirtyVertices=!0;w.__dirtyMorphTargets=!0;w.__dirtyElements=!0;w.__dirtyUvs=!0;w.__dirtyNormals=!0;w.__dirtyTangents=!0;w.__dirtyColors=!0}J(p.__webglObjects,E,D)}}else if(D instanceof THREE.Ribbon){w=D.geometry;if(!w.__webGLVertexBuffer){n=w;n.__webGLVertexBuffer=f.createBuffer();
-n.__webGLColorBuffer=f.createBuffer();n=w;E=n.vertices.length;n.__vertexArray=new Float32Array(E*3);n.__colorArray=new Float32Array(E*3);n.__webGLVertexCount=E;w.__dirtyVertices=!0;w.__dirtyColors=!0}J(p.__webglObjects,w,D)}else if(D instanceof THREE.Line){w=D.geometry;if(!w.__webGLVertexBuffer){n=w;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=w;E=n.vertices.length;n.__vertexArray=new Float32Array(E*3);n.__colorArray=new Float32Array(E*3);n.__webGLLineCount=E;w.__dirtyVertices=
-!0;w.__dirtyColors=!0}J(p.__webglObjects,w,D)}else if(D instanceof THREE.ParticleSystem){w=D.geometry;if(!w.__webGLVertexBuffer){n=w;n.__webGLVertexBuffer=f.createBuffer();n.__webGLColorBuffer=f.createBuffer();n=w;E=n.vertices.length;n.__vertexArray=new Float32Array(E*3);n.__colorArray=new Float32Array(E*3);n.__sortArray=[];n.__webGLParticleCount=E;w.__dirtyVertices=!0;w.__dirtyColors=!0}J(p.__webglObjects,w,D)}else THREE.MarchingCubes!==undefined&&D instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:D,
-opaque:{list:[],count:0},transparent:{list:[],count:0}});m.__objectsAdded.splice(0,1)}for(;m.__objectsRemoved.length;){D=m.__objectsRemoved[0];p=m;w=void 0;n=void 0;for(w=p.__webglObjects.length-1;w>=0;w--){n=p.__webglObjects[w].object;D==n&&p.__webglObjects.splice(w,1)}m.__objectsRemoved.splice(0,1)}D=0;for(p=m.__webglObjects.length;D<p;D++){n=m.__webglObjects[D].object;E=void 0;w=void 0;C=void 0;if(n instanceof THREE.Mesh){w=n.geometry;for(E in w.geometryGroups){C=w.geometryGroups[E];if(w.__dirtyVertices||
-w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){G=f.DYNAMIC_DRAW;S=void 0;va=void 0;var Ga=void 0,O=void 0;Ga=void 0;var Oa=void 0,Fa=void 0,Sa=void 0;P=void 0;wa=void 0;M=void 0;ca=void 0;ha=void 0;var U=void 0,$=void 0,aa=void 0,ma=void 0;Fa=void 0;Sa=void 0;U=void 0;O=void 0;U=void 0;$=void 0;aa=void 0;Fa=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;$=void 0;aa=void 0;ma=void 0;U=void 0;
-$=void 0;aa=void 0;ma=void 0;O=void 0;Oa=void 0;Ga=void 0;Ga=void 0;var Ka=void 0,Xa=void 0,Ma=void 0,Va=Ra=Ja=ra=ia=0,Qa=0,L=0,ga=0,X=0,B=0,T=0,ja=C.__vertexArray,Na=C.__uvArray,Pa=C.__uv2Array,La=C.__normalArray,Ba=C.__tangentArray,Ha=C.__colorArray,Ca=C.__skinVertexAArray,Ia=C.__skinVertexBArray,Aa=C.__skinIndexArray,Da=C.__skinWeightArray,eb=C.__morphTargetsArrays,Ya=C.__faceArray,Ua=C.__lineArray,lb=C.__needsSmoothNormals;wa=C.__vertexColorType;P=C.__uvType;M=C.__normalType;var Ta=n.geometry,
-fb=Ta.__dirtyVertices,gb=Ta.__dirtyElements,db=Ta.__dirtyUvs,hb=Ta.__dirtyNormals,ib=Ta.__dirtyTangents,jb=Ta.__dirtyColors,kb=Ta.__dirtyMorphTargets,Wa=Ta.vertices,mb=C.faces,pb=Ta.faces,nb=Ta.faceVertexUvs[0],ob=Ta.faceVertexUvs[1],ab=Ta.skinVerticesA,bb=Ta.skinVerticesB,cb=Ta.skinIndices,$a=Ta.skinWeights,Za=Ta.morphTargets;S=0;for(va=mb.length;S<va;S++){Ga=mb[S];O=pb[Ga];nb&&(ca=nb[Ga]);ob&&(ha=ob[Ga]);Ga=O.vertexNormals;Oa=O.normal;Fa=O.vertexColors;Sa=O.color;if(O instanceof THREE.Face3){if(fb){U=
-Wa[O.a].position;$=Wa[O.b].position;aa=Wa[O.c].position;ja[ra]=U.x;ja[ra+1]=U.y;ja[ra+2]=U.z;ja[ra+3]=$.x;ja[ra+4]=$.y;ja[ra+5]=$.z;ja[ra+6]=aa.x;ja[ra+7]=aa.y;ja[ra+8]=aa.z;ra+=9}if(kb){Ka=0;for(Xa=Za.length;Ka<Xa;Ka++){U=Za[Ka].vertices[O.a].position;$=Za[Ka].vertices[O.b].position;aa=Za[Ka].vertices[O.c].position;Ma=eb[Ka];Ma[T+0]=U.x;Ma[T+1]=U.y;Ma[T+2]=U.z;Ma[T+3]=$.x;Ma[T+4]=$.y;Ma[T+5]=$.z;Ma[T+6]=aa.x;Ma[T+7]=aa.y;Ma[T+8]=aa.z}T+=9}if($a.length){U=$a[O.a];$=$a[O.b];aa=$a[O.c];Da[B]=U.x;Da[B+
-1]=U.y;Da[B+2]=U.z;Da[B+3]=U.w;Da[B+4]=$.x;Da[B+5]=$.y;Da[B+6]=$.z;Da[B+7]=$.w;Da[B+8]=aa.x;Da[B+9]=aa.y;Da[B+10]=aa.z;Da[B+11]=aa.w;U=cb[O.a];$=cb[O.b];aa=cb[O.c];Aa[B]=U.x;Aa[B+1]=U.y;Aa[B+2]=U.z;Aa[B+3]=U.w;Aa[B+4]=$.x;Aa[B+5]=$.y;Aa[B+6]=$.z;Aa[B+7]=$.w;Aa[B+8]=aa.x;Aa[B+9]=aa.y;Aa[B+10]=aa.z;Aa[B+11]=aa.w;U=ab[O.a];$=ab[O.b];aa=ab[O.c];Ca[B]=U.x;Ca[B+1]=U.y;Ca[B+2]=U.z;Ca[B+3]=1;Ca[B+4]=$.x;Ca[B+5]=$.y;Ca[B+6]=$.z;Ca[B+7]=1;Ca[B+8]=aa.x;Ca[B+9]=aa.y;Ca[B+10]=aa.z;Ca[B+11]=1;U=bb[O.a];$=bb[O.b];
-aa=bb[O.c];Ia[B]=U.x;Ia[B+1]=U.y;Ia[B+2]=U.z;Ia[B+3]=1;Ia[B+4]=$.x;Ia[B+5]=$.y;Ia[B+6]=$.z;Ia[B+7]=1;Ia[B+8]=aa.x;Ia[B+9]=aa.y;Ia[B+10]=aa.z;Ia[B+11]=1;B+=12}if(jb&&wa){if(Fa.length==3&&wa==THREE.VertexColors){U=Fa[0];$=Fa[1];aa=Fa[2]}else aa=$=U=Sa;Ha[X]=U.r;Ha[X+1]=U.g;Ha[X+2]=U.b;Ha[X+3]=$.r;Ha[X+4]=$.g;Ha[X+5]=$.b;Ha[X+6]=aa.r;Ha[X+7]=aa.g;Ha[X+8]=aa.b;X+=9}if(ib&&Ta.hasTangents){Fa=Wa[O.a].tangent;Sa=Wa[O.b].tangent;U=Wa[O.c].tangent;Ba[L]=Fa.x;Ba[L+1]=Fa.y;Ba[L+2]=Fa.z;Ba[L+3]=Fa.w;Ba[L+4]=
-Sa.x;Ba[L+5]=Sa.y;Ba[L+6]=Sa.z;Ba[L+7]=Sa.w;Ba[L+8]=U.x;Ba[L+9]=U.y;Ba[L+10]=U.z;Ba[L+11]=U.w;L+=12}if(hb&&M)if(Ga.length==3&&lb)for(O=0;O<3;O++){Oa=Ga[O];La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}else for(O=0;O<3;O++){La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}if(db&&ca!==undefined&&P)for(O=0;O<3;O++){Ga=ca[O];Na[Ja]=Ga.u;Na[Ja+1]=Ga.v;Ja+=2}if(db&&ha!==undefined&&P)for(O=0;O<3;O++){Ga=ha[O];Pa[Ra]=Ga.u;Pa[Ra+1]=Ga.v;Ra+=2}if(gb){Ya[Va]=ia;Ya[Va+1]=ia+1;Ya[Va+2]=ia+2;Va+=3;Ua[ga]=ia;Ua[ga+
-1]=ia+1;Ua[ga+2]=ia;Ua[ga+3]=ia+2;Ua[ga+4]=ia+1;Ua[ga+5]=ia+2;ga+=6;ia+=3}}else if(O instanceof THREE.Face4){if(fb){U=Wa[O.a].position;$=Wa[O.b].position;aa=Wa[O.c].position;ma=Wa[O.d].position;ja[ra]=U.x;ja[ra+1]=U.y;ja[ra+2]=U.z;ja[ra+3]=$.x;ja[ra+4]=$.y;ja[ra+5]=$.z;ja[ra+6]=aa.x;ja[ra+7]=aa.y;ja[ra+8]=aa.z;ja[ra+9]=ma.x;ja[ra+10]=ma.y;ja[ra+11]=ma.z;ra+=12}if(kb){Ka=0;for(Xa=Za.length;Ka<Xa;Ka++){U=Za[Ka].vertices[O.a].position;$=Za[Ka].vertices[O.b].position;aa=Za[Ka].vertices[O.c].position;
-ma=Za[Ka].vertices[O.d].position;Ma=eb[Ka];Ma[T+0]=U.x;Ma[T+1]=U.y;Ma[T+2]=U.z;Ma[T+3]=$.x;Ma[T+4]=$.y;Ma[T+5]=$.z;Ma[T+6]=aa.x;Ma[T+7]=aa.y;Ma[T+8]=aa.z;Ma[T+9]=ma.x;Ma[T+10]=ma.y;Ma[T+11]=ma.z}T+=12}if($a.length){U=$a[O.a];$=$a[O.b];aa=$a[O.c];ma=$a[O.d];Da[B]=U.x;Da[B+1]=U.y;Da[B+2]=U.z;Da[B+3]=U.w;Da[B+4]=$.x;Da[B+5]=$.y;Da[B+6]=$.z;Da[B+7]=$.w;Da[B+8]=aa.x;Da[B+9]=aa.y;Da[B+10]=aa.z;Da[B+11]=aa.w;Da[B+12]=ma.x;Da[B+13]=ma.y;Da[B+14]=ma.z;Da[B+15]=ma.w;U=cb[O.a];$=cb[O.b];aa=cb[O.c];ma=cb[O.d];
-Aa[B]=U.x;Aa[B+1]=U.y;Aa[B+2]=U.z;Aa[B+3]=U.w;Aa[B+4]=$.x;Aa[B+5]=$.y;Aa[B+6]=$.z;Aa[B+7]=$.w;Aa[B+8]=aa.x;Aa[B+9]=aa.y;Aa[B+10]=aa.z;Aa[B+11]=aa.w;Aa[B+12]=ma.x;Aa[B+13]=ma.y;Aa[B+14]=ma.z;Aa[B+15]=ma.w;U=ab[O.a];$=ab[O.b];aa=ab[O.c];ma=ab[O.d];Ca[B]=U.x;Ca[B+1]=U.y;Ca[B+2]=U.z;Ca[B+3]=1;Ca[B+4]=$.x;Ca[B+5]=$.y;Ca[B+6]=$.z;Ca[B+7]=1;Ca[B+8]=aa.x;Ca[B+9]=aa.y;Ca[B+10]=aa.z;Ca[B+11]=1;Ca[B+12]=ma.x;Ca[B+13]=ma.y;Ca[B+14]=ma.z;Ca[B+15]=1;U=bb[O.a];$=bb[O.b];aa=bb[O.c];ma=bb[O.d];Ia[B]=U.x;Ia[B+1]=U.y;
-Ia[B+2]=U.z;Ia[B+3]=1;Ia[B+4]=$.x;Ia[B+5]=$.y;Ia[B+6]=$.z;Ia[B+7]=1;Ia[B+8]=aa.x;Ia[B+9]=aa.y;Ia[B+10]=aa.z;Ia[B+11]=1;Ia[B+12]=ma.x;Ia[B+13]=ma.y;Ia[B+14]=ma.z;Ia[B+15]=1;B+=16}if(jb&&wa){if(Fa.length==4&&wa==THREE.VertexColors){U=Fa[0];$=Fa[1];aa=Fa[2];Fa=Fa[3]}else Fa=aa=$=U=Sa;Ha[X]=U.r;Ha[X+1]=U.g;Ha[X+2]=U.b;Ha[X+3]=$.r;Ha[X+4]=$.g;Ha[X+5]=$.b;Ha[X+6]=aa.r;Ha[X+7]=aa.g;Ha[X+8]=aa.b;Ha[X+9]=Fa.r;Ha[X+10]=Fa.g;Ha[X+11]=Fa.b;X+=12}if(ib&&Ta.hasTangents){Fa=Wa[O.a].tangent;Sa=Wa[O.b].tangent;U=
-Wa[O.c].tangent;O=Wa[O.d].tangent;Ba[L]=Fa.x;Ba[L+1]=Fa.y;Ba[L+2]=Fa.z;Ba[L+3]=Fa.w;Ba[L+4]=Sa.x;Ba[L+5]=Sa.y;Ba[L+6]=Sa.z;Ba[L+7]=Sa.w;Ba[L+8]=U.x;Ba[L+9]=U.y;Ba[L+10]=U.z;Ba[L+11]=U.w;Ba[L+12]=O.x;Ba[L+13]=O.y;Ba[L+14]=O.z;Ba[L+15]=O.w;L+=16}if(hb&&M)if(Ga.length==4&&lb)for(O=0;O<4;O++){Oa=Ga[O];La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}else for(O=0;O<4;O++){La[Qa]=Oa.x;La[Qa+1]=Oa.y;La[Qa+2]=Oa.z;Qa+=3}if(db&&ca!==undefined&&P)for(O=0;O<4;O++){Ga=ca[O];Na[Ja]=Ga.u;Na[Ja+1]=Ga.v;Ja+=2}if(db&&
-ha!==undefined&&P)for(O=0;O<4;O++){Ga=ha[O];Pa[Ra]=Ga.u;Pa[Ra+1]=Ga.v;Ra+=2}if(gb){Ya[Va]=ia;Ya[Va+1]=ia+1;Ya[Va+2]=ia+2;Ya[Va+3]=ia;Ya[Va+4]=ia+2;Ya[Va+5]=ia+3;Va+=6;Ua[ga]=ia;Ua[ga+1]=ia+1;Ua[ga+2]=ia;Ua[ga+3]=ia+3;Ua[ga+4]=ia+1;Ua[ga+5]=ia+2;Ua[ga+6]=ia+2;Ua[ga+7]=ia+3;ga+=8;ia+=4}}}if(fb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ja,G)}if(kb){Ka=0;for(Xa=Za.length;Ka<Xa;Ka++){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[Ka]);f.bufferData(f.ARRAY_BUFFER,
-eb[Ka],G)}}if(jb&&X>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ha,G)}if(hb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,La,G)}if(ib&&Ta.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,G)}if(db&&Ja>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Na,G)}if(db&&Ra>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,Pa,G)}if(gb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
-C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ya,G);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ua,G)}if(B>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Ca,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,Ia,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Aa,G);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,
-Da,G)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;wa=void 0;C=void 0;M=n.vertices;G=n.colors;ca=M.length;S=G.length;ha=n.__vertexArray;va=n.__colorArray;ia=n.__dirtyColors;if(n.__dirtyVertices){for(P=0;P<ca;P++){wa=M[P].position;C=P*3;ha[C]=wa.x;ha[C+1]=wa.y;ha[C+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,
-n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ha,E)}if(ia){for(P=0;P<S;P++){color=G[P];C=P*3;va[C]=color.r;va[C+1]=color.g;va[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,va,E)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.Line){w=n.geometry;if(w.__dirtyVertices||w.__dirtyColors){n=w;E=f.DYNAMIC_DRAW;P=void 0;P=void 0;wa=void 0;C=void 0;M=n.vertices;G=n.colors;ca=M.length;S=G.length;ha=n.__vertexArray;va=n.__colorArray;ia=n.__dirtyColors;
-if(n.__dirtyVertices){for(P=0;P<ca;P++){wa=M[P].position;C=P*3;ha[C]=wa.x;ha[C+1]=wa.y;ha[C+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ha,E)}if(ia){for(P=0;P<S;P++){color=G[P];C=P*3;va[C]=color.r;va[C+1]=color.g;va[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,va,E)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){w=n.geometry;(w.__dirtyVertices||w.__dirtyColors||n.sortParticles)&&
-c(w,f.DYNAMIC_DRAW,n);w.__dirtyVertices=!1;w.__dirtyColors=!1}}};this.setFaceCulling=function(m,D){if(m){!D||D=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(m=="back")f.cullFace(f.BACK);else m=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+var W=document.createElement("canvas"),f,S=null,T=null,ea=this,oa=null,$=null,R=null,la=null,va=0,Da=0,fa=0,ia=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,ha=new Float32Array(16),aa=new Float32Array(16),ja=new THREE.Vector4,Na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},ma=!0,qa=new THREE.Color(0),Fa=0;if(a){if(a.antialias!==undefined)ma=a.antialias;
+a.clearColor!==undefined&&qa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Fa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=W;this.autoClear=!0;this.sortObjects=!0;(function(n,C,p){try{if(!(f=W.getContext("experimental-webgl",{antialias:n})))throw"Error creating WebGL context.";}catch(o){console.error(o)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);
+f.clearColor(C.r,C.g,C.b,p);_cullEnabled=!0})(ma,qa,Fa);this.context=f;this.setSize=function(n,C){W.width=n;W.height=C;this.setViewport(0,0,W.width,W.height)};this.setViewport=function(n,C,p,o){va=n;Da=C;fa=p;ia=o;f.viewport(va,Da,fa,ia)};this.setScissor=function(n,C,p,o){f.scissor(n,C,p,o)};this.enableScissorTest=function(n){n?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){f.depthMask(n)};this.setClearColorHex=function(n,C){var p=new THREE.Color(n);f.clearColor(p.r,
+p.g,p.b,C)};this.setClearColor=function(n,C){f.clearColor(n.r,n.g,n.b,C)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(n,C,p,o){var w,B,D;if(n instanceof THREE.MeshDepthMaterial)b(n,THREE.ShaderLib.depth);else if(n instanceof THREE.MeshNormalMaterial)b(n,THREE.ShaderLib.normal);else if(n instanceof THREE.MeshBasicMaterial)b(n,THREE.ShaderLib.basic);else if(n instanceof THREE.MeshLambertMaterial)b(n,THREE.ShaderLib.lambert);else if(n instanceof THREE.MeshPhongMaterial)b(n,
+THREE.ShaderLib.phong);else if(n instanceof THREE.LineBasicMaterial)b(n,THREE.ShaderLib.basic);else n instanceof THREE.ParticleBasicMaterial&&b(n,THREE.ShaderLib.particle_basic);var H,U,N,M;D=N=M=0;for(H=C.length;D<H;D++){U=C[D];U instanceof THREE.DirectionalLight&&N++;U instanceof THREE.PointLight&&M++}if(M+N<=4)C=N;else{C=Math.ceil(4*N/(M+N));M=4-C}D={directional:C,point:M};H=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)H=o.bones.length;M=n.fragmentShader;C=n.vertexShader;H={fog:p,map:n.map,
+envMap:n.envMap,lightMap:n.lightMap,vertexColors:n.vertexColors,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxDirLights:D.directional,maxPointLights:D.point,maxBones:H};p=f.createProgram();D=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,H.fog?"#define USE_FOG":"",H.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":
+"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");H=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":
+"",H.morphTargets?"#define USE_MORPHTARGETS":"",H.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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+f.attachShader(p,I("fragment",D+M));f.attachShader(p,I("vertex",H+C));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};n.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in n.uniforms)p.push(w);
+w=n.program;M=0;for(C=p.length;M<C;M++){D=p[M];w.uniforms[D]=f.getUniformLocation(w,D)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)p.push("morphTarget"+w);for(B in n.attributes)p.push(B);B=n.program;w=p;p=0;for(M=w.length;p<M;p++){C=w[p];B.attributes[C]=f.getAttribLocation(B,C)}B=n.program.attributes;f.enableVertexAttribArray(B.position);B.color>=0&&f.enableVertexAttribArray(B.color);B.normal>=0&&f.enableVertexAttribArray(B.normal);
+B.tangent>=0&&f.enableVertexAttribArray(B.tangent);if(n.skinning&&B.skinVertexA>=0&&B.skinVertexB>=0&&B.skinIndex>=0&&B.skinWeight>=0){f.enableVertexAttribArray(B.skinVertexA);f.enableVertexAttribArray(B.skinVertexB);f.enableVertexAttribArray(B.skinIndex);f.enableVertexAttribArray(B.skinWeight)}if(n.morphTargets){n.numSupportedMorphTargets=0;if(B.morphTarget0>=0){f.enableVertexAttribArray(B.morphTarget0);n.numSupportedMorphTargets++}if(B.morphTarget1>=0){f.enableVertexAttribArray(B.morphTarget1);
+n.numSupportedMorphTargets++}if(B.morphTarget2>=0){f.enableVertexAttribArray(B.morphTarget2);n.numSupportedMorphTargets++}if(B.morphTarget3>=0){f.enableVertexAttribArray(B.morphTarget3);n.numSupportedMorphTargets++}if(B.morphTarget4>=0){f.enableVertexAttribArray(B.morphTarget4);n.numSupportedMorphTargets++}if(B.morphTarget5>=0){f.enableVertexAttribArray(B.morphTarget5);n.numSupportedMorphTargets++}if(B.morphTarget6>=0){f.enableVertexAttribArray(B.morphTarget6);n.numSupportedMorphTargets++}if(B.morphTarget7>=
+0){f.enableVertexAttribArray(B.morphTarget7);n.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(w=0;w<this.maxMorphTargets;w++)o.__webGLMorphTargetInfluences[w]=0}};this.render=function(n,C,p,o){var w,B,D,H,U,N,M,na,xa=n.lights,X=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(aa);C.projectionMatrix.flattenToArray(ha);ua.multiply(C.projectionMatrix,C.matrixWorldInverse);j(ua);this.initWebGLObjects(n);
+z(p);(this.autoClear||o)&&this.clear();U=n.__webglObjects.length;for(o=0;o<U;o++){w=n.__webglObjects[o];M=w.object;if(M.visible)if(!(M instanceof THREE.Mesh)||m(M)){M.matrixWorld.flattenToArray(M._objectMatrixArray);A(M,C);y(w);w.render=!0;if(this.sortObjects){ja.copy(M.position);ua.multiplyVector3(ja);w.z=ja.z}}else w.render=!1;else w.render=!1}this.sortObjects&&n.__webglObjects.sort(q);N=n.__webglObjectsImmediate.length;for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];M=w.object;if(M.visible){M.matrixAutoUpdate&&
+M.matrixWorld.flattenToArray(M._objectMatrixArray);A(M,C);x(w)}}E(THREE.NormalBlending);for(o=0;o<U;o++){w=n.__webglObjects[o];if(w.render){M=w.object;na=w.buffer;D=w.opaque;g(M);for(w=0;w<D.count;w++){H=D.list[w];k(H.depthTest);e(C,xa,X,H,na,M)}}}for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];M=w.object;if(M.visible){D=w.opaque;g(M);for(w=0;w<D.count;w++){H=D.list[w];k(H.depthTest);B=d(C,xa,X,H,M);M.render(function(ra){h(ra,B)})}}}for(o=0;o<U;o++){w=n.__webglObjects[o];if(w.render){M=w.object;na=
+w.buffer;D=w.transparent;g(M);for(w=0;w<D.count;w++){H=D.list[w];E(H.blending);k(H.depthTest);e(C,xa,X,H,na,M)}}}for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];M=w.object;if(M.visible){D=w.transparent;g(M);for(w=0;w<D.count;w++){H=D.list[w];E(H.blending);k(H.depthTest);B=d(C,xa,X,H,M);M.render(function(ra){h(ra,B)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,null)}};
+this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[]}for(;n.__objectsAdded.length;){var C=n.__objectsAdded[0],p=n,o=void 0,w=void 0,B=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){w=C.geometry;w.geometryGroups==
+undefined&&G(w);for(o in w.geometryGroups){B=w.geometryGroups[o];if(!B.__webGLVertexBuffer){var D=B;D.__webGLVertexBuffer=f.createBuffer();D.__webGLNormalBuffer=f.createBuffer();D.__webGLTangentBuffer=f.createBuffer();D.__webGLColorBuffer=f.createBuffer();D.__webGLUVBuffer=f.createBuffer();D.__webGLUV2Buffer=f.createBuffer();D.__webGLSkinVertexABuffer=f.createBuffer();D.__webGLSkinVertexBBuffer=f.createBuffer();D.__webGLSkinIndicesBuffer=f.createBuffer();D.__webGLSkinWeightsBuffer=f.createBuffer();
+D.__webGLFaceBuffer=f.createBuffer();D.__webGLLineBuffer=f.createBuffer();if(D.numMorphTargets){var H=void 0,U=void 0;D.__webGLMorphTargetsBuffers=[];H=0;for(U=D.numMorphTargets;H<U;H++)D.__webGLMorphTargetsBuffers.push(f.createBuffer())}D=B;var N=C,M=void 0,na=void 0,xa=U=H=0;M=void 0;na=void 0;var X=void 0;na=void 0;var ra=N.geometry;X=ra.faces;var ka=D.faces;M=0;for(na=ka.length;M<na;M++){fi=ka[M];face=X[fi];if(face instanceof THREE.Face3){H+=3;U+=1;xa+=3}else if(face instanceof THREE.Face4){H+=
+4;U+=2;xa+=4}}M=D;na=N;X=void 0;ka=void 0;var Ea=void 0,Ra=void 0;Ea=void 0;var ta=[];X=0;for(ka=na.materials.length;X<ka;X++){Ea=na.materials[X];if(Ea instanceof THREE.MeshFaceMaterial){Ea=0;for(l=M.materials.length;Ea<l;Ea++)(Ra=M.materials[Ea])&&ta.push(Ra)}else(Ra=Ea)&&ta.push(Ra)}na=ta;a:{M=void 0;X=void 0;ka=na.length;for(M=0;M<ka;M++){X=na[M];if(X.map||X.lightMap||X instanceof THREE.MeshShaderMaterial){M=!0;break a}}M=!1}a:{X=na;ka=void 0;ta=void 0;Ea=X.length;for(ka=0;ka<Ea;ka++){ta=X[ka];
+if(!(ta instanceof THREE.MeshBasicMaterial&&!ta.envMap||ta instanceof THREE.MeshDepthMaterial)){X=ta&&ta.shading!=undefined&&ta.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}X=!1}a:{ka=void 0;ta=void 0;Ea=na.length;for(ka=0;ka<Ea;ka++){ta=na[ka];if(ta.vertexColors){na=ta.vertexColors;break a}}na=!1}D.__vertexArray=new Float32Array(H*3);if(X)D.__normalArray=new Float32Array(H*3);if(ra.hasTangents)D.__tangentArray=new Float32Array(H*4);if(na)D.__colorArray=new Float32Array(H*
+3);if(M){if(ra.faceUvs.length>0||ra.faceVertexUvs.length>0)D.__uvArray=new Float32Array(H*2);if(ra.faceUvs.length>1||ra.faceVertexUvs.length>1)D.__uv2Array=new Float32Array(H*2)}if(N.geometry.skinWeights.length&&N.geometry.skinIndices.length){D.__skinVertexAArray=new Float32Array(H*4);D.__skinVertexBArray=new Float32Array(H*4);D.__skinIndexArray=new Float32Array(H*4);D.__skinWeightArray=new Float32Array(H*4)}D.__faceArray=new Uint16Array(U*3);D.__lineArray=new Uint16Array(xa*2);if(D.numMorphTargets){N=
+void 0;ra=void 0;D.__morphTargetsArrays=[];N=0;for(ra=D.numMorphTargets;N<ra;N++)D.__morphTargetsArrays.push(new Float32Array(H*3))}D.__needsSmoothNormals=X==THREE.SmoothShading;D.__uvType=M;D.__vertexColorType=na;D.__normalType=X;D.__webGLFaceCount=U*3;D.__webGLLineCount=xa*2;w.__dirtyVertices=!0;w.__dirtyMorphTargets=!0;w.__dirtyElements=!0;w.__dirtyUvs=!0;w.__dirtyNormals=!0;w.__dirtyTangents=!0;w.__dirtyColors=!0}J(p.__webglObjects,B,C)}}else if(C instanceof THREE.Ribbon){w=C.geometry;if(!w.__webGLVertexBuffer){o=
+w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;B=o.vertices.length;o.__vertexArray=new Float32Array(B*3);o.__colorArray=new Float32Array(B*3);o.__webGLVertexCount=B;w.__dirtyVertices=!0;w.__dirtyColors=!0}J(p.__webglObjects,w,C)}else if(C instanceof THREE.Line){w=C.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;B=o.vertices.length;o.__vertexArray=new Float32Array(B*3);o.__colorArray=new Float32Array(B*
+3);o.__webGLLineCount=B;w.__dirtyVertices=!0;w.__dirtyColors=!0}J(p.__webglObjects,w,C)}else if(C instanceof THREE.ParticleSystem){w=C.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;B=o.vertices.length;o.__vertexArray=new Float32Array(B*3);o.__colorArray=new Float32Array(B*3);o.__sortArray=[];o.__webGLParticleCount=B;w.__dirtyVertices=!0;w.__dirtyColors=!0}J(p.__webglObjects,w,C)}else THREE.MarchingCubes!==undefined&&C instanceof
+THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:C,opaque:{list:[],count:0},transparent:{list:[],count:0}});n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){C=n.__objectsRemoved[0];p=n;w=void 0;o=void 0;for(w=p.__webglObjects.length-1;w>=0;w--){o=p.__webglObjects[w].object;C==o&&p.__webglObjects.splice(w,1)}n.__objectsRemoved.splice(0,1)}C=0;for(p=n.__webglObjects.length;C<p;C++){o=n.__webglObjects[C].object;B=void 0;w=void 0;D=void 0;if(o instanceof THREE.Mesh){w=o.geometry;
+for(B in w.geometryGroups){D=w.geometryGroups[B];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){H=f.DYNAMIC_DRAW;U=void 0;xa=void 0;var La=void 0,O=void 0;La=void 0;var Oa=void 0,Ca=void 0,Sa=void 0;N=void 0;ra=void 0;M=void 0;na=void 0;X=void 0;var V=void 0,ca=void 0,da=void 0,Ha=void 0;Ca=void 0;Sa=void 0;V=void 0;O=void 0;V=void 0;ca=void 0;da=void 0;Ca=void 0;V=void 0;ca=void 0;da=void 0;Ha=void 0;V=void 0;ca=
+void 0;da=void 0;Ha=void 0;V=void 0;ca=void 0;da=void 0;Ha=void 0;V=void 0;ca=void 0;da=void 0;Ha=void 0;O=void 0;Oa=void 0;La=void 0;La=void 0;var Pa=void 0,Ia=void 0,Ka=void 0,Wa=Ra=Ea=ta=ka=0,Ua=0,Ma=0,Qa=0,L=0,F=0,Y=0,Q=D.__vertexArray,ga=D.__uvArray,ya=D.__uv2Array,Ja=D.__normalArray,sa=D.__tangentArray,za=D.__colorArray,Aa=D.__skinVertexAArray,wa=D.__skinVertexBArray,Ba=D.__skinIndexArray,Ga=D.__skinWeightArray,Ya=D.__morphTargetsArrays,Ta=D.__faceArray,Xa=D.__lineArray,lb=D.__needsSmoothNormals;
+ra=D.__vertexColorType;N=D.__uvType;M=D.__normalType;var Va=o.geometry,fb=Va.__dirtyVertices,gb=Va.__dirtyElements,eb=Va.__dirtyUvs,hb=Va.__dirtyNormals,ib=Va.__dirtyTangents,jb=Va.__dirtyColors,kb=Va.__dirtyMorphTargets,Za=Va.vertices,mb=D.faces,pb=Va.faces,nb=Va.faceVertexUvs[0],ob=Va.faceVertexUvs[1],bb=Va.skinVerticesA,cb=Va.skinVerticesB,db=Va.skinIndices,ab=Va.skinWeights,$a=Va.morphTargets;U=0;for(xa=mb.length;U<xa;U++){La=mb[U];O=pb[La];nb&&(na=nb[La]);ob&&(X=ob[La]);La=O.vertexNormals;Oa=
+O.normal;Ca=O.vertexColors;Sa=O.color;if(O instanceof THREE.Face3){if(fb){V=Za[O.a].position;ca=Za[O.b].position;da=Za[O.c].position;Q[ta]=V.x;Q[ta+1]=V.y;Q[ta+2]=V.z;Q[ta+3]=ca.x;Q[ta+4]=ca.y;Q[ta+5]=ca.z;Q[ta+6]=da.x;Q[ta+7]=da.y;Q[ta+8]=da.z;ta+=9}if(kb){Pa=0;for(Ia=$a.length;Pa<Ia;Pa++){V=$a[Pa].vertices[O.a].position;ca=$a[Pa].vertices[O.b].position;da=$a[Pa].vertices[O.c].position;Ka=Ya[Pa];Ka[Y+0]=V.x;Ka[Y+1]=V.y;Ka[Y+2]=V.z;Ka[Y+3]=ca.x;Ka[Y+4]=ca.y;Ka[Y+5]=ca.z;Ka[Y+6]=da.x;Ka[Y+7]=da.y;
+Ka[Y+8]=da.z}Y+=9}if(ab.length){V=ab[O.a];ca=ab[O.b];da=ab[O.c];Ga[F]=V.x;Ga[F+1]=V.y;Ga[F+2]=V.z;Ga[F+3]=V.w;Ga[F+4]=ca.x;Ga[F+5]=ca.y;Ga[F+6]=ca.z;Ga[F+7]=ca.w;Ga[F+8]=da.x;Ga[F+9]=da.y;Ga[F+10]=da.z;Ga[F+11]=da.w;V=db[O.a];ca=db[O.b];da=db[O.c];Ba[F]=V.x;Ba[F+1]=V.y;Ba[F+2]=V.z;Ba[F+3]=V.w;Ba[F+4]=ca.x;Ba[F+5]=ca.y;Ba[F+6]=ca.z;Ba[F+7]=ca.w;Ba[F+8]=da.x;Ba[F+9]=da.y;Ba[F+10]=da.z;Ba[F+11]=da.w;V=bb[O.a];ca=bb[O.b];da=bb[O.c];Aa[F]=V.x;Aa[F+1]=V.y;Aa[F+2]=V.z;Aa[F+3]=1;Aa[F+4]=ca.x;Aa[F+5]=ca.y;
+Aa[F+6]=ca.z;Aa[F+7]=1;Aa[F+8]=da.x;Aa[F+9]=da.y;Aa[F+10]=da.z;Aa[F+11]=1;V=cb[O.a];ca=cb[O.b];da=cb[O.c];wa[F]=V.x;wa[F+1]=V.y;wa[F+2]=V.z;wa[F+3]=1;wa[F+4]=ca.x;wa[F+5]=ca.y;wa[F+6]=ca.z;wa[F+7]=1;wa[F+8]=da.x;wa[F+9]=da.y;wa[F+10]=da.z;wa[F+11]=1;F+=12}if(jb&&ra){if(Ca.length==3&&ra==THREE.VertexColors){V=Ca[0];ca=Ca[1];da=Ca[2]}else da=ca=V=Sa;za[L]=V.r;za[L+1]=V.g;za[L+2]=V.b;za[L+3]=ca.r;za[L+4]=ca.g;za[L+5]=ca.b;za[L+6]=da.r;za[L+7]=da.g;za[L+8]=da.b;L+=9}if(ib&&Va.hasTangents){Ca=Za[O.a].tangent;
+Sa=Za[O.b].tangent;V=Za[O.c].tangent;sa[Ma]=Ca.x;sa[Ma+1]=Ca.y;sa[Ma+2]=Ca.z;sa[Ma+3]=Ca.w;sa[Ma+4]=Sa.x;sa[Ma+5]=Sa.y;sa[Ma+6]=Sa.z;sa[Ma+7]=Sa.w;sa[Ma+8]=V.x;sa[Ma+9]=V.y;sa[Ma+10]=V.z;sa[Ma+11]=V.w;Ma+=12}if(hb&&M)if(La.length==3&&lb)for(O=0;O<3;O++){Oa=La[O];Ja[Ua]=Oa.x;Ja[Ua+1]=Oa.y;Ja[Ua+2]=Oa.z;Ua+=3}else for(O=0;O<3;O++){Ja[Ua]=Oa.x;Ja[Ua+1]=Oa.y;Ja[Ua+2]=Oa.z;Ua+=3}if(eb&&na!==undefined&&N)for(O=0;O<3;O++){La=na[O];ga[Ea]=La.u;ga[Ea+1]=La.v;Ea+=2}if(eb&&X!==undefined&&N)for(O=0;O<3;O++){La=
+X[O];ya[Ra]=La.u;ya[Ra+1]=La.v;Ra+=2}if(gb){Ta[Wa]=ka;Ta[Wa+1]=ka+1;Ta[Wa+2]=ka+2;Wa+=3;Xa[Qa]=ka;Xa[Qa+1]=ka+1;Xa[Qa+2]=ka;Xa[Qa+3]=ka+2;Xa[Qa+4]=ka+1;Xa[Qa+5]=ka+2;Qa+=6;ka+=3}}else if(O instanceof THREE.Face4){if(fb){V=Za[O.a].position;ca=Za[O.b].position;da=Za[O.c].position;Ha=Za[O.d].position;Q[ta]=V.x;Q[ta+1]=V.y;Q[ta+2]=V.z;Q[ta+3]=ca.x;Q[ta+4]=ca.y;Q[ta+5]=ca.z;Q[ta+6]=da.x;Q[ta+7]=da.y;Q[ta+8]=da.z;Q[ta+9]=Ha.x;Q[ta+10]=Ha.y;Q[ta+11]=Ha.z;ta+=12}if(kb){Pa=0;for(Ia=$a.length;Pa<Ia;Pa++){V=
+$a[Pa].vertices[O.a].position;ca=$a[Pa].vertices[O.b].position;da=$a[Pa].vertices[O.c].position;Ha=$a[Pa].vertices[O.d].position;Ka=Ya[Pa];Ka[Y+0]=V.x;Ka[Y+1]=V.y;Ka[Y+2]=V.z;Ka[Y+3]=ca.x;Ka[Y+4]=ca.y;Ka[Y+5]=ca.z;Ka[Y+6]=da.x;Ka[Y+7]=da.y;Ka[Y+8]=da.z;Ka[Y+9]=Ha.x;Ka[Y+10]=Ha.y;Ka[Y+11]=Ha.z}Y+=12}if(ab.length){V=ab[O.a];ca=ab[O.b];da=ab[O.c];Ha=ab[O.d];Ga[F]=V.x;Ga[F+1]=V.y;Ga[F+2]=V.z;Ga[F+3]=V.w;Ga[F+4]=ca.x;Ga[F+5]=ca.y;Ga[F+6]=ca.z;Ga[F+7]=ca.w;Ga[F+8]=da.x;Ga[F+9]=da.y;Ga[F+10]=da.z;Ga[F+11]=
+da.w;Ga[F+12]=Ha.x;Ga[F+13]=Ha.y;Ga[F+14]=Ha.z;Ga[F+15]=Ha.w;V=db[O.a];ca=db[O.b];da=db[O.c];Ha=db[O.d];Ba[F]=V.x;Ba[F+1]=V.y;Ba[F+2]=V.z;Ba[F+3]=V.w;Ba[F+4]=ca.x;Ba[F+5]=ca.y;Ba[F+6]=ca.z;Ba[F+7]=ca.w;Ba[F+8]=da.x;Ba[F+9]=da.y;Ba[F+10]=da.z;Ba[F+11]=da.w;Ba[F+12]=Ha.x;Ba[F+13]=Ha.y;Ba[F+14]=Ha.z;Ba[F+15]=Ha.w;V=bb[O.a];ca=bb[O.b];da=bb[O.c];Ha=bb[O.d];Aa[F]=V.x;Aa[F+1]=V.y;Aa[F+2]=V.z;Aa[F+3]=1;Aa[F+4]=ca.x;Aa[F+5]=ca.y;Aa[F+6]=ca.z;Aa[F+7]=1;Aa[F+8]=da.x;Aa[F+9]=da.y;Aa[F+10]=da.z;Aa[F+11]=1;Aa[F+
+12]=Ha.x;Aa[F+13]=Ha.y;Aa[F+14]=Ha.z;Aa[F+15]=1;V=cb[O.a];ca=cb[O.b];da=cb[O.c];Ha=cb[O.d];wa[F]=V.x;wa[F+1]=V.y;wa[F+2]=V.z;wa[F+3]=1;wa[F+4]=ca.x;wa[F+5]=ca.y;wa[F+6]=ca.z;wa[F+7]=1;wa[F+8]=da.x;wa[F+9]=da.y;wa[F+10]=da.z;wa[F+11]=1;wa[F+12]=Ha.x;wa[F+13]=Ha.y;wa[F+14]=Ha.z;wa[F+15]=1;F+=16}if(jb&&ra){if(Ca.length==4&&ra==THREE.VertexColors){V=Ca[0];ca=Ca[1];da=Ca[2];Ca=Ca[3]}else Ca=da=ca=V=Sa;za[L]=V.r;za[L+1]=V.g;za[L+2]=V.b;za[L+3]=ca.r;za[L+4]=ca.g;za[L+5]=ca.b;za[L+6]=da.r;za[L+7]=da.g;za[L+
+8]=da.b;za[L+9]=Ca.r;za[L+10]=Ca.g;za[L+11]=Ca.b;L+=12}if(ib&&Va.hasTangents){Ca=Za[O.a].tangent;Sa=Za[O.b].tangent;V=Za[O.c].tangent;O=Za[O.d].tangent;sa[Ma]=Ca.x;sa[Ma+1]=Ca.y;sa[Ma+2]=Ca.z;sa[Ma+3]=Ca.w;sa[Ma+4]=Sa.x;sa[Ma+5]=Sa.y;sa[Ma+6]=Sa.z;sa[Ma+7]=Sa.w;sa[Ma+8]=V.x;sa[Ma+9]=V.y;sa[Ma+10]=V.z;sa[Ma+11]=V.w;sa[Ma+12]=O.x;sa[Ma+13]=O.y;sa[Ma+14]=O.z;sa[Ma+15]=O.w;Ma+=16}if(hb&&M)if(La.length==4&&lb)for(O=0;O<4;O++){Oa=La[O];Ja[Ua]=Oa.x;Ja[Ua+1]=Oa.y;Ja[Ua+2]=Oa.z;Ua+=3}else for(O=0;O<4;O++){Ja[Ua]=
+Oa.x;Ja[Ua+1]=Oa.y;Ja[Ua+2]=Oa.z;Ua+=3}if(eb&&na!==undefined&&N)for(O=0;O<4;O++){La=na[O];ga[Ea]=La.u;ga[Ea+1]=La.v;Ea+=2}if(eb&&X!==undefined&&N)for(O=0;O<4;O++){La=X[O];ya[Ra]=La.u;ya[Ra+1]=La.v;Ra+=2}if(gb){Ta[Wa]=ka;Ta[Wa+1]=ka+1;Ta[Wa+2]=ka+2;Ta[Wa+3]=ka;Ta[Wa+4]=ka+2;Ta[Wa+5]=ka+3;Wa+=6;Xa[Qa]=ka;Xa[Qa+1]=ka+1;Xa[Qa+2]=ka;Xa[Qa+3]=ka+3;Xa[Qa+4]=ka+1;Xa[Qa+5]=ka+2;Xa[Qa+6]=ka+2;Xa[Qa+7]=ka+3;Qa+=8;ka+=4}}}if(fb){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Q,
+H)}if(kb){Pa=0;for(Ia=$a.length;Pa<Ia;Pa++){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLMorphTargetsBuffers[Pa]);f.bufferData(f.ARRAY_BUFFER,Ya[Pa],H)}}if(jb&&L>0){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,za,H)}if(hb){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Ja,H)}if(ib&&Va.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,sa,H)}if(eb&&Ea>0){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLUVBuffer);
+f.bufferData(f.ARRAY_BUFFER,ga,H)}if(eb&&Ra>0){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,ya,H)}if(gb){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,D.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ta,H);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,D.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Xa,H)}if(F>0){f.bindBuffer(f.ARRAY_BUFFER,D.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,Aa,H);f.bindBuffer(f.ARRAY_BUFFER,D.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,
+wa,H);f.bindBuffer(f.ARRAY_BUFFER,D.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,H);f.bindBuffer(f.ARRAY_BUFFER,D.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,Ga,H)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Ribbon){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;B=f.DYNAMIC_DRAW;N=void 0;N=void 0;ra=void 0;D=void 0;M=o.vertices;H=o.colors;na=
+M.length;U=H.length;X=o.__vertexArray;xa=o.__colorArray;ka=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<na;N++){ra=M[N].position;D=N*3;X[D]=ra.x;X[D+1]=ra.y;X[D+2]=ra.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,X,B)}if(ka){for(N=0;N<U;N++){color=H[N];D=N*3;xa[D]=color.r;xa[D+1]=color.g;xa[D+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,xa,B)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=
+o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;B=f.DYNAMIC_DRAW;N=void 0;N=void 0;ra=void 0;D=void 0;M=o.vertices;H=o.colors;na=M.length;U=H.length;X=o.__vertexArray;xa=o.__colorArray;ka=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<na;N++){ra=M[N].position;D=N*3;X[D]=ra.x;X[D+1]=ra.y;X[D+2]=ra.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,X,B)}if(ka){for(N=0;N<U;N++){color=H[N];D=N*3;xa[D]=color.r;xa[D+1]=color.g;xa[D+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,
+o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,xa,B)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.ParticleSystem){w=o.geometry;(w.__dirtyVertices||w.__dirtyColors||o.sortParticles)&&c(w,f.DYNAMIC_DRAW,o);w.__dirtyVertices=!1;w.__dirtyColors=!1}}};this.setFaceCulling=function(n,C){if(n){!C||C=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(n=="back")f.cullFace(f.BACK);else n=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};
+this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
-THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.uvs=[];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
+THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};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};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,o=a.faceVertexUvs[0];e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,x=h.length;t<x;t++){var y=new THREE.Vertex(h[t].position.clone());b&&c.matrix.multiplyVector3(y.position);g.push(y)}t=0;for(x=k.length;t<x;t++){h=k[t];var q,A=h.vertexNormals;if(h instanceof THREE.Face3)q=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof
-THREE.Face4&&(q=new THREE.Face4(h.a+d,h.b+d,h.c+d,h.d+d));q.centroid.copy(h.centroid);q.normal.copy(h.normal);b=0;for(g=A.length;b<g;b++){y=A[b];q.vertexNormals.push(y.clone())}q.materials=h.materials.slice();j.push(q)}t=0;for(x=e.length;t<x;t++){d=e[t];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));o.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,
-c,b){var d,e=[],g=new THREE.Texture(e,c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(t in V.objects)if(!N.objects[t]){H=V.objects[t];if(z=N.geometries[H.geometry]){Z=[];for(i=0;i<H.materials.length;i++)Z[i]=N.materials[H.materials[i]];J=H.position;r=H.rotation;s=H.scale;
-object=new THREE.Mesh(z,Z);object.position.set(J[0],J[1],J[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;N.scene.addObject(object);N.objects[t]=object}}}function h(xa){return function(ta){N.geometries[xa]=ta;g();fa-=1;j()}}function j(){d({total_models:W,total_textures:na,loaded_models:W-fa,loaded_textures:na-R},N);fa==0&&R==0&&b(N)}var k,o,t,x,y,q,A,H,J,F,K,z,I,Q,Z,V,f,fa,R,W,na,N;V=e.data;f=new THREE.Loader;R=fa=0;N={scene:new THREE.Scene,geometries:{},
-materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){R-=1;j()};for(y in V.cameras){F=V.cameras[y];if(F.type=="perspective")I=new THREE.Camera(F.fov,F.aspect,F.near,F.far);else if(F.type=="ortho"){I=new THREE.Camera;I.projectionMatrix=THREE.Matrix4.makeOrtho(F.left,F.right,F.top,F.bottom,F.near,F.far)}J=F.position;F=F.target;I.position.set(J[0],J[1],J[2]);I.target.position.set(F[0],F[1],F[2]);N.cameras[y]=I}for(x in V.lights){y=V.lights[x];if(y.type=="directional"){J=y.direction;
-light=new THREE.DirectionalLight;light.position.set(J[0],J[1],J[2]);light.position.normalize()}else if(y.type=="point"){J=y.position;light=new THREE.PointLight;light.position.set(J[0],J[1],J[2])}F=y.color;i=y.intensity||1;light.color.setRGB(F[0]*i,F[1]*i,F[2]*i);N.scene.addLight(light);N.lights[x]=light}for(q in V.fogs){x=V.fogs[q];if(x.type=="linear")Q=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(Q=new THREE.FogExp2(0,x.density));F=x.color;Q.color.setRGB(F[0],F[1],F[2]);N.fogs[q]=Q}if(N.cameras&&
-V.defaults.camera)N.currentCamera=N.cameras[V.defaults.camera];if(N.fogs&&V.defaults.fog)N.scene.fog=N.fogs[V.defaults.fog];F=V.defaults.bgcolor;N.bgColor=new THREE.Color;N.bgColor.setRGB(F[0],F[1],F[2]);N.bgColorAlpha=V.defaults.bgalpha;for(k in V.geometries){q=V.geometries[k];if(q.type=="bin_mesh"||q.type=="ascii_mesh")fa+=1}W=fa;for(k in V.geometries){q=V.geometries[k];if(q.type=="cube"){z=new Cube(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,null,q.flipped,q.sides);
-N.geometries[k]=z}else if(q.type=="plane"){z=new Plane(q.width,q.height,q.segmentsWidth,q.segmentsHeight);N.geometries[k]=z}else if(q.type=="sphere"){z=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);N.geometries[k]=z}else if(q.type=="cylinder"){z=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);N.geometries[k]=z}else if(q.type=="torus"){z=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);N.geometries[k]=z}else if(q.type=="icosahedron"){z=new Icosahedron(q.subdivisions);
-N.geometries[k]=z}else if(q.type=="bin_mesh")f.loadBinary({model:q.url,callback:h(k)});else q.type=="ascii_mesh"&&f.loadAscii({model:q.url,callback:h(k)})}for(A in V.textures){k=V.textures[A];R+=k.url instanceof Array?k.url.length:1}na=R;for(A in V.textures){k=V.textures[A];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)q=ImageUtils.loadTextureCube(k.url,k.mapping,e);else{q=ImageUtils.loadTexture(k.url,k.mapping,e);if(THREE[k.minFilter]!=
-undefined)q.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)q.magFilter=THREE[k.magFilter]}N.textures[A]=q}for(o in V.materials){A=V.materials[o];for(K in A.parameters)if(K=="envMap"||K=="map"||K=="lightMap")A.parameters[K]=N.textures[A.parameters[K]];else if(K=="shading")A.parameters[K]=A.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")A.parameters[K]=THREE[A.parameters[K]]?THREE[A.parameters[K]]:THREE.NormalBlending;else K=="combine"&&(A.parameters[K]=
-A.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);N.materials[o]=A}g();c(N)}},addMesh:function(a,c,b,d,e,g,h,j,k,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,h=a.vertices,g=e.vertices,k=a.faces,j=e.faces,m=a.faceVertexUvs[0];e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,x=g.length;t<x;t++){var y=new THREE.Vertex(g[t].position.clone());b&&c.matrix.multiplyVector3(y.position);h.push(y)}t=0;for(x=j.length;t<x;t++){g=j[t];var q,A=g.vertexNormals;if(g instanceof THREE.Face3)q=new THREE.Face3(g.a+d,g.b+d,g.c+d);else g instanceof
+THREE.Face4&&(q=new THREE.Face4(g.a+d,g.b+d,g.c+d,g.d+d));q.centroid.copy(g.centroid);q.normal.copy(g.normal);b=0;for(h=A.length;b<h;b++){y=A[b];q.vertexNormals.push(y.clone())}q.materials=g.materials.slice();k.push(q)}t=0;for(x=e.length;t<x;t++){d=e[t];k=[];b=0;for(h=d.length;b<h;b++)k.push(new THREE.UV(d[b].u,d[b].v));m.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,
+c,b){var d,e=[],h=new THREE.Texture(e,c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)h.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return h}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function h(){for(t in W.objects)if(!R.objects[t]){G=W.objects[t];if(z=R.geometries[G.geometry]){Z=[];for(i=0;i<G.materials.length;i++)Z[i]=R.materials[G.materials[i]];J=G.position;r=G.rotation;s=G.scale;
+object=new THREE.Mesh(z,Z);object.position.set(J[0],J[1],J[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;R.scene.addObject(object);R.objects[t]=object}}}function g(la){return function(va){R.geometries[la]=va;h();T-=1;k()}}function k(){d({total_models:oa,total_textures:$,loaded_models:oa-T,loaded_textures:$-ea},R);T==0&&ea==0&&b(R)}var j,m,t,x,y,q,A,G,J,E,K,z,I,P,Z,W,f,S,T,ea,oa,$,R;W=e.data;f=new THREE.BinaryLoader;S=new THREE.JSONLoader;ea=T=0;
+R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){ea-=1;k()};for(y in W.cameras){E=W.cameras[y];if(E.type=="perspective")I=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){I=new THREE.Camera;I.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}J=E.position;E=E.target;I.position.set(J[0],J[1],J[2]);I.target.position.set(E[0],E[1],E[2]);R.cameras[y]=I}for(x in W.lights){y=W.lights[x];
+if(y.type=="directional"){J=y.direction;light=new THREE.DirectionalLight;light.position.set(J[0],J[1],J[2]);light.position.normalize()}else if(y.type=="point"){J=y.position;light=new THREE.PointLight;light.position.set(J[0],J[1],J[2])}E=y.color;i=y.intensity||1;light.color.setRGB(E[0]*i,E[1]*i,E[2]*i);R.scene.addLight(light);R.lights[x]=light}for(q in W.fogs){x=W.fogs[q];if(x.type=="linear")P=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(P=new THREE.FogExp2(0,x.density));E=x.color;P.color.setRGB(E[0],
+E[1],E[2]);R.fogs[q]=P}if(R.cameras&&W.defaults.camera)R.currentCamera=R.cameras[W.defaults.camera];if(R.fogs&&W.defaults.fog)R.scene.fog=R.fogs[W.defaults.fog];E=W.defaults.bgcolor;R.bgColor=new THREE.Color;R.bgColor.setRGB(E[0],E[1],E[2]);R.bgColorAlpha=W.defaults.bgalpha;for(j in W.geometries){q=W.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")T+=1}oa=T;for(j in W.geometries){q=W.geometries[j];if(q.type=="cube"){z=new Cube(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,q.segmentsDepth,
+null,q.flipped,q.sides);R.geometries[j]=z}else if(q.type=="plane"){z=new Plane(q.width,q.height,q.segmentsWidth,q.segmentsHeight);R.geometries[j]=z}else if(q.type=="sphere"){z=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);R.geometries[j]=z}else if(q.type=="cylinder"){z=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);R.geometries[j]=z}else if(q.type=="torus"){z=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);R.geometries[j]=z}else if(q.type=="icosahedron"){z=new Icosahedron(q.subdivisions);
+R.geometries[j]=z}else if(q.type=="bin_mesh")f.load({model:q.url,callback:g(j)});else q.type=="ascii_mesh"&&S.load({model:q.url,callback:g(j)})}for(A in W.textures){j=W.textures[A];ea+=j.url instanceof Array?j.url.length:1}$=ea;for(A in W.textures){j=W.textures[A];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)q=ImageUtils.loadTextureCube(j.url,j.mapping,e);else{q=ImageUtils.loadTexture(j.url,j.mapping,e);if(THREE[j.minFilter]!=undefined)q.minFilter=
+THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)q.magFilter=THREE[j.magFilter]}R.textures[A]=q}for(m in W.materials){A=W.materials[m];for(K in A.parameters)if(K=="envMap"||K=="map"||K=="lightMap")A.parameters[K]=R.textures[A.parameters[K]];else if(K=="shading")A.parameters[K]=A.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")A.parameters[K]=THREE[A.parameters[K]]?THREE[A.parameters[K]]:THREE.NormalBlending;else K=="combine"&&(A.parameters[K]=A.parameters[K]==
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);R.materials[m]=A}h();c(R)}},addMesh:function(a,c,b,d,e,h,g,k,j,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=h;c.rotation.x=g;c.rotation.y=k;c.rotation.z=j;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,
 uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
-c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
-c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
+c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,h=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
+c,1,0,d,0,h,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-d,0,-h,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
 mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 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},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
@@ -315,7 +317,7 @@ 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 c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,h=2*Math.ceil(a*3)+1;h>25&&(h=25);e=(h-1)*0.5;b=Array(h);for(c=d=0;c<h;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<h;++c)b[c]/=d;return b}};
 THREE.QuakeCamera=function(a){function c(b,d){return function(){d.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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;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.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.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)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.dragToLook)switch(b.button){case 0:this.moveForward=
@@ -324,76 +326,77 @@ this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBack
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);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 d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.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(o,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,H=t.getControlPointsArray(),J=t.getLength(),F=H.length,K=0;A=F-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:H[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:H[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<F-1;A++){K=y*J.chunks[A]/J.total;t.keys[A]={time:K,pos:H[A]}}q.hierarchy[0]=t;THREE.AnimationHandler.add(q);return new THREE.Animation(o,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(o,t){var x,
-y,q=new THREE.Geometry;for(x=0;x<o.points.length*t;x++){y=x/(o.points.length*t);y=o.getPoint(y);q.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return q}function d(o,t){var x=b(t,10),y=b(t,10),q=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,q);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 Sphere(1,
-16,8);q=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){x=new THREE.Mesh(y,q);x.position.copy(t.points[i]);x.updateMatrix();o.addChild(x)}}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=
+THREE.PathCamera=function(a){function c(m,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,G=t.getControlPointsArray(),J=t.getLength(),E=G.length,K=0;A=E-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[A]={time:y,pos:G[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<E-1;A++){K=y*J.chunks[A]/J.total;t.keys[A]={time:K,pos:G[A]}}q.hierarchy[0]=t;THREE.AnimationHandler.add(q);return new THREE.Animation(m,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,t){var x,
+y,q=new THREE.Geometry;for(x=0;x<m.points.length*t;x++){y=x/(m.points.length*t);y=m.getPoint(y);q.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return q}function d(m,t){var x=b(t,10),y=b(t,10),q=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,q);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);y=new Sphere(1,
+16,8);q=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){x=new THREE.Mesh(y,q);x.position.copy(t.points[i]);x.updateMatrix();m.addChild(x)}}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 e=Math.PI*2,g=Math.PI/180;this.update=function(o,t,x){var y,q;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)*g;this.theta=this.lon*g;y=this.phi%e;this.phi=y>=0?y:y+e;y=this.verticalAngleMap.srcRange;q=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.horizontalAngleMap.srcRange;q=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[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,x)};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){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);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&&d(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;
-var Cube=function(a,c,b,d,e,g,h,j,k){function o(J,F,K,z,I,Q,Z,V){var f,fa,R=d||1,W=e||1,na=I/2,N=Q/2,xa=t.vertices.length;if(J=="x"&&F=="y"||J=="y"&&F=="x")f="z";else if(J=="x"&&F=="z"||J=="z"&&F=="x"){f="y";W=g||1}else if(J=="z"&&F=="y"||J=="y"&&F=="z"){f="x";R=g||1}var ta=R+1,qa=W+1;I/=R;var ua=Q/W;for(fa=0;fa<qa;fa++)for(Q=0;Q<ta;Q++){var la=new THREE.Vector3;la[J]=(Q*I-na)*K;la[F]=(fa*ua-N)*z;la[f]=Z;t.vertices.push(new THREE.Vertex(la))}for(fa=0;fa<W;fa++)for(Q=0;Q<R;Q++){t.faces.push(new THREE.Face4(Q+
-ta*fa+xa,Q+ta*(fa+1)+xa,Q+1+ta*(fa+1)+xa,Q+1+ta*fa+xa,null,null,V));t.faceVertexUvs[0].push([new THREE.UV(Q/R,fa/W),new THREE.UV(Q/R,(fa+1)/W),new THREE.UV((Q+1)/R,(fa+1)/W),new THREE.UV((Q+1)/R,fa/W)])}}THREE.Geometry.call(this);var t=this,x=a/2,y=c/2,q=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var H in k)this.sides[H]!=
-undefined&&(this.sides[H]=k[H]);this.sides.px&&o("z","y",1*j,-1,b,c,-x,this.materials[0]);this.sides.nx&&o("z","y",-1*j,-1,b,c,x,this.materials[1]);this.sides.py&&o("x","z",1*j,1,a,b,y,this.materials[2]);this.sides.ny&&o("x","z",1*j,-1,a,b,-y,this.materials[3]);this.sides.pz&&o("x","y",1*j,-1,a,c,q,this.materials[4]);this.sides.nz&&o("x","y",-1*j,-1,a,c,-q,this.materials[5]);(function(){for(var J=[],F=[],K=0,z=t.vertices.length;K<z;K++){for(var I=t.vertices[K],Q=!1,Z=0,V=J.length;Z<V;Z++){var f=J[Z];
-if(I.position.x==f.position.x&&I.position.y==f.position.y&&I.position.z==f.position.z){F[K]=Z;Q=!0;break}}if(!Q){F[K]=J.length;J.push(new THREE.Vertex(I.position.clone()))}}K=0;for(z=t.faces.length;K<z;K++){I=t.faces[K];I.a=F[I.a];I.b=F[I.b];I.c=F[I.c];I.d=F[I.d]}t.vertices=J})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,d,e,g){function h(t,x,y){j.vertices.push(new THREE.Vertex(new THREE.Vector3(t,x,y)))}THREE.Geometry.call(this);var j=this,k=Math.PI,o=d/2;for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*c,Math.cos(2*k*d/a)*c,-o);for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*b,Math.cos(2*k*d/a)*b,o);for(d=0;d<a;d++)j.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-o-(g||0));for(d=a;d<a+a/2;d++)j.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,o+(e||0));
-for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function c(x,y,q){var A=Math.sqrt(x*x+y*y+q*q);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,y/A,q/A)))-1}function b(x,y,q,A){A.faces.push(new THREE.Face3(x,y,q))}function d(x,y){var q=e.vertices[x].position,A=e.vertices[y].position;return c((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var e=this,g=new THREE.Geometry,h;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,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),o=d(g.faces[j].b,g.faces[j].c),t=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,t,h);b(g.faces[j].b,o,k,h);b(g.faces[j].c,
-t,o,h);b(k,o,t,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));d[j]=a[j].clone();e[j]=this.vertices.length-1}for(var k=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.0010;o+=c){for(j=0;j<d.length;j++)if(o<this.angle){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));g[j]=this.vertices.length-1}else g=h;o==0&&(h=e);for(j=
-0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.faceVertexUvs[0].push([new THREE.UV(o/b,j/a.length),new THREE.UV(o/b,(j+1)/a.length),new THREE.UV((o-c)/b,(j+1)/a.length),new THREE.UV((o-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var o=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*o-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,h=Math.PI/180;this.update=function(m,t,x){var y,q;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%e;this.phi=y>=0?y:y+e;y=this.verticalAngleMap.srcRange;q=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[0];y=this.horizontalAngleMap.srcRange;q=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(q[1]-q[0])/(y[1]-y[0])+q[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,m,t,x)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.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}),k=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,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&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,t){return function(){t.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
+var Cube=function(a,c,b,d,e,h,g,k,j){function m(J,E,K,z,I,P,Z,W){var f,S,T=d||1,ea=e||1,oa=I/2,$=P/2,R=t.vertices.length;if(J=="x"&&E=="y"||J=="y"&&E=="x")f="z";else if(J=="x"&&E=="z"||J=="z"&&E=="x"){f="y";ea=h||1}else if(J=="z"&&E=="y"||J=="y"&&E=="z"){f="x";T=h||1}var la=T+1,va=ea+1;I/=T;var Da=P/ea;for(S=0;S<va;S++)for(P=0;P<la;P++){var fa=new THREE.Vector3;fa[J]=(P*I-oa)*K;fa[E]=(S*Da-$)*z;fa[f]=Z;t.vertices.push(new THREE.Vertex(fa))}for(S=0;S<ea;S++)for(P=0;P<T;P++){t.faces.push(new THREE.Face4(P+
+la*S+R,P+la*(S+1)+R,P+1+la*(S+1)+R,P+1+la*S+R,null,null,W));t.faceVertexUvs[0].push([new THREE.UV(P/T,S/ea),new THREE.UV(P/T,(S+1)/ea),new THREE.UV((P+1)/T,(S+1)/ea),new THREE.UV((P+1)/T,S/ea)])}}THREE.Geometry.call(this);var t=this,x=a/2,y=c/2,q=b/2;k=k?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var A=0;A<6;A++)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 G in j)this.sides[G]!=
+undefined&&(this.sides[G]=j[G]);this.sides.px&&m("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&m("x","z",1*k,1,a,b,y,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,a,b,-y,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,a,c,q,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,a,c,-q,this.materials[5]);(function(){for(var J=[],E=[],K=0,z=t.vertices.length;K<z;K++){for(var I=t.vertices[K],P=!1,Z=0,W=J.length;Z<W;Z++){var f=J[Z];
+if(I.position.x==f.position.x&&I.position.y==f.position.y&&I.position.z==f.position.z){E[K]=Z;P=!0;break}}if(!P){E[K]=J.length;J.push(new THREE.Vertex(I.position.clone()))}}K=0;for(z=t.faces.length;K<z;K++){I=t.faces[K];I.a=E[I.a];I.b=E[I.b];I.c=E[I.c];I.d=E[I.d]}t.vertices=J})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,d,e,h){function g(t,x,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(t,x,y)))}THREE.Geometry.call(this);var k=this,j=Math.PI,m=d/2;for(d=0;d<a;d++)g(Math.sin(2*j*d/a)*c,Math.cos(2*j*d/a)*c,-m);for(d=0;d<a;d++)g(Math.sin(2*j*d/a)*b,Math.cos(2*j*d/a)*b,m);for(d=0;d<a;d++)k.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){g(0,0,-m-(h||0));for(d=a;d<a+a/2;d++)k.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){g(0,0,m+(e||0));
+for(d=a+a/2;d<2*a;d++)k.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Icosahedron=function(a){function c(x,y,q){var A=Math.sqrt(x*x+y*y+q*q);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,y/A,q/A)))-1}function b(x,y,q,A){A.faces.push(new THREE.Face3(x,y,q))}function d(x,y){var q=e.vertices[x].position,A=e.vertices[y].position;return c((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var e=this,h=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,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var k in h.faces){var j=d(h.faces[k].a,h.faces[k].b),m=d(h.faces[k].b,h.faces[k].c),t=d(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,j,t,g);b(h.faces[k].b,m,j,g);b(h.faces[k].c,
+t,m,g);b(j,m,t,g)}h.faces=g.faces}e.faces=h.faces;delete h;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],h=[],g=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));d[k]=a[k].clone();e[k]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.0010;m+=c){for(k=0;k<d.length;k++)if(m<this.angle){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));h[k]=this.vertices.length-1}else h=g;m==0&&(g=e);for(k=
+0;k<e.length-1;k++){this.faces.push(new THREE.Face4(h[k],h[k+1],e[k+1],e[k]));this.faceVertexUvs[0].push([new THREE.UV(m/b,k/a.length),new THREE.UV(m/b,(k+1)/a.length),new THREE.UV((m-c)/b,(k+1)/a.length),new THREE.UV((m-c)/b,k/a.length)])}e=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,h=a/2,g=c/2;b=b||1;d=d||1;var k=b+1,j=d+1;a/=b;var m=c/d;for(e=0;e<j;e++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(e*m-g),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*e,c+k*(e+1),c+1+k*(e+1),c+1+k*e));this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),o=[],t=0;for(d=0;d<g;d++){var x=2*d/g,y=k*Math.sin(x*e);x=k*Math.cos(x*e);(b==0||b==h)&&d>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,y)))-1);o.push(t)}c.push(o)}var q,A,H;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){o=d==g-1;h=c[b][o?0:d+1];j=c[b][o?g-1:d];k=c[b-1][o?g-1:d];o=c[b-1][o?
-0:d+1];y=b/(e-1);q=(b-1)/(e-1);A=(d+1)/g;x=d/g;t=new THREE.UV(1-A,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,q);var J=new THREE.UV(1-A,q);if(b<c.length-1){q=this.vertices[h].position.clone();A=this.vertices[j].position.clone();H=this.vertices[k].position.clone();q.normalize();A.normalize();H.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([t,y,x])}if(b>1){q=this.vertices[h].position.clone();
-A=this.vertices[k].position.clone();H=this.vertices[o].position.clone();q.normalize();A.normalize();H.normalize();this.faces.push(new THREE.Face3(h,k,o,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([t,x,J])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,h=Math.max(3,c||8),g=Math.max(2,b||6);c=[];for(b=0;b<g+1;b++){d=b/g;var k=a*Math.cos(d*e),j=a*Math.sin(d*e),m=[],t=0;for(d=0;d<h;d++){var x=2*d/h,y=j*Math.sin(x*e);x=j*Math.cos(x*e);(b==0||b==g)&&d>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);m.push(t)}c.push(m)}var q,A,G;e=c.length;for(b=0;b<e;b++){h=c[b].length;if(b>0)for(d=0;d<h;d++){m=d==h-1;g=c[b][m?0:d+1];k=c[b][m?h-1:d];j=c[b-1][m?h-1:d];m=c[b-1][m?
+0:d+1];y=b/(e-1);q=(b-1)/(e-1);A=(d+1)/h;x=d/h;t=new THREE.UV(1-A,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,q);var J=new THREE.UV(1-A,q);if(b<c.length-1){q=this.vertices[g].position.clone();A=this.vertices[k].position.clone();G=this.vertices[j].position.clone();q.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(g,k,j,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([t,y,x])}if(b>1){q=this.vertices[g].position.clone();
+A=this.vertices[j].position.clone();G=this.vertices[m].position.clone();q.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(g,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([t,x,J])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
-1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,c,b,d,e,g,h){function j(x,y,q,A,H,J){y=q/A*x;q=Math.cos(y);return new THREE.Vector3(H*(2+q)*0.5*Math.cos(x),H*(2+q)*Math.sin(x)*0.5,J*H*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var k=
-a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=j(k,h,this.q,this.p,this.radius,this.heightScale);k=j(k+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=k.x-e.x;b.y=k.y-e.y;b.z=k.z-e.z;d.x=k.x+e.x;d.y=k.y+e.y;d.z=k.z+e.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();k=this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=k*d.x+h*g.x;e.y+=k*d.y+h*g.y;e.z+=k*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
-0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.faceVertexUvs[0].push([h,k,o]);this.faces.push(new THREE.Face3(g,d,b));this.faceVertexUvs[0].push([t,
-o,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
+1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var h=(this.segmentsT+1)*(c-1)+b-1,g=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,h,g));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
+var TorusKnot=function(a,c,b,d,e,h,g){function k(x,y,q,A,G,J){y=q/A*x;q=Math.cos(y);return new THREE.Vector3(G*(2+q)*0.5*Math.cos(x),G*(2+q)*Math.sin(x)*0.5,J*G*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=h||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;h=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;e=k(j,g,this.q,this.p,this.radius,this.heightScale);j=k(j+0.01,g,this.q,this.p,this.radius,this.heightScale);b.x=j.x-e.x;b.y=j.y-e.y;b.z=j.z-e.z;d.x=j.x+e.x;d.y=j.y+e.y;d.z=j.z+e.z;h.cross(b,d);d.cross(h,b);h.normalize();d.normalize();j=this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x+=j*d.x+g*h.x;e.y+=j*d.y+g*h.y;e.z+=j*d.z+g*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
+0;c<this.segmentsT;++c){h=(a+1)%this.segmentsR;g=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[h][c];d=this.grid[a][g];h=this.grid[h][g];g=new THREE.UV(a/this.segmentsR,c/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.faceVertexUvs[0].push([g,j,m]);this.faces.push(new THREE.Face3(h,d,b));this.faceVertexUvs[0].push([t,
+m,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
 THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";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 d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
-j.image.width=t;j.image.height=x;j.image.getContext("2d").drawImage(this,0,0,t,x)}else j.image=this;j.needsUpdate=!0};o.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*
-255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
+k.image.width=t;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,t,x)}else k.image=this;k.needsUpdate=!0};m.src=j}var e,h,g;e="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(e="MeshPhongMaterial");if(a.mapDiffuse&&c){g=document.createElement("canvas");h.map=new THREE.Texture(g);h.map.sourceFile=a.mapDiffuse;d(h.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){g=(a.colorDiffuse[0]*
+255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;h.color=g;h.opacity=a.transparency}else if(a.DbgColor)h.color=a.DbgColor;if(a.mapLightmap&&c){g=document.createElement("canvas");h.lightMap=new THREE.Texture(g);h.lightMap.sourceFile=a.mapLightmap;d(h.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](h)}};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=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
-else{var h,j,k,o,t,x,y,q,A,H,J=a.faces;q=a.vertices;var F=a.normals,K=a.colors,z=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&z++;for(h=0;h<z;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}k=0;for(o=q.length;k<o;){A=new THREE.Vertex;A.position.x=q[k++];A.position.y=q[k++];A.position.z=q[k++];g.vertices.push(A)}k=0;for(o=J.length;k<o;){t=J[k++];x=t&1;h=t&2;y=t&4;j=t&8;q=t&16;A=t&32;H=t&64;t&=128;if(x){x=new THREE.Face4;x.a=J[k++];x.b=J[k++];x.c=J[k++];x.d=J[k++];nVertices=4}else{x=new THREE.Face3;x.a=
-J[k++];x.b=J[k++];x.c=J[k++];nVertices=3}if(h){materialIndex=J[k++];x.materials=g.materials[materialIndex]}if(y)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvIndex=J[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(j)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvs=[];for(j=0;j<nVertices;j++){uvIndex=J[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[j]=new THREE.UV(u,v)}g.faceVertexUvs[h].push(uvs)}if(q){normalIndex=J[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];
-normal.y=F[normalIndex++];normal.z=F[normalIndex];x.normal=normal}if(A)for(h=0;h<nVertices;h++){normalIndex=J[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=F[normalIndex++];normal.z=F[normalIndex];x.vertexNormals.push(normal)}if(H){color=new THREE.Color(J[k++]);x.color=color}if(t)for(h=0;h<nVertices;h++){colorIndex=J[k++];color=new THREE.Color(K[colorIndex]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,j,k,o;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<
-j;h+=2){k=a.skinWeights[h];o=a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(k,o,0,0))}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];o=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(k,o,0,0))}}g.bones=a.bones;g.animation=a.animation})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};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,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var e=function(g){function h(p,n){var w=t(p,n),E=t(p,n+1),C=t(p,n+2),G=t(p,n+3),S=(G<<1&255|C>>7)-127;w|=(C&127)<<16|E<<8;if(w==0&&S==-127)return 0;return(1-2*(G>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,S)}function j(p,n){var w=t(p,n),E=t(p,n+1),C=t(p,n+2);return(t(p,n+3)<<24)+(C<<16)+(E<<8)+w}function k(p,n){var w=t(p,n);return(t(p,n+1)<<8)+w}function o(p,n){var w=t(p,n);return w>127?w-256:w}function t(p,
-n){return p.charCodeAt(n)&255}function x(p){var n,w,E;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);p=k(a,p+f);THREE.BinaryLoader.prototype.f3(F,n,w,E,p)}function y(p){var n,w,E,C,G,S;n=j(a,p);w=j(a,p+Z);E=j(a,p+V);C=k(a,p+f);G=j(a,p+fa);S=j(a,p+R);p=j(a,p+W);THREE.BinaryLoader.prototype.f3n(F,I,n,w,E,C,G,S,p)}function q(p){var n,w,E,C;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa);p=k(a,p+ta);THREE.BinaryLoader.prototype.f4(F,n,w,E,C,p)}function A(p){var n,w,E,C,G,S,P,M;n=j(a,p);w=j(a,p+na);E=j(a,p+N);C=j(a,p+xa);
-G=k(a,p+ta);S=j(a,p+qa);P=j(a,p+ua);M=j(a,p+la);p=j(a,p+ka);THREE.BinaryLoader.prototype.f4n(F,I,n,w,E,C,G,S,P,M,p)}function H(p){var n,w;n=j(a,p);w=j(a,p+oa);p=j(a,p+pa);THREE.BinaryLoader.prototype.uv3(F.faceVertexUvs[0],Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[p*2],Q[p*2+1])}function J(p){var n,w,E;n=j(a,p);w=j(a,p+ea);E=j(a,p+da);p=j(a,p+sa);THREE.BinaryLoader.prototype.uv4(F.faceVertexUvs[0],Q[n*2],Q[n*2+1],Q[w*2],Q[w*2+1],Q[E*2],Q[E*2+1],Q[p*2],Q[p*2+1])}var F=this,K=0,z,I=[],Q=[],Z,V,f,fa,R,W,na,
-N,xa,ta,qa,ua,la,ka,oa,pa,ea,da,sa,Ea,Y,ya,za,m,D;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,d,g);z={signature:a.substr(K,8),header_bytes:t(a,K+8),vertex_coordinate_bytes:t(a,K+9),normal_coordinate_bytes:t(a,K+10),uv_coordinate_bytes:t(a,K+11),vertex_index_bytes:t(a,K+12),normal_index_bytes:t(a,K+13),uv_index_bytes:t(a,K+14),material_index_bytes:t(a,K+15),nvertices:j(a,K+16),nnormals:j(a,K+16+4),nuvs:j(a,K+16+8),ntri_flat:j(a,K+16+12),ntri_smooth:j(a,K+16+16),ntri_flat_uv:j(a,
-K+16+20),ntri_smooth_uv:j(a,K+16+24),nquad_flat:j(a,K+16+28),nquad_smooth:j(a,K+16+32),nquad_flat_uv:j(a,K+16+36),nquad_smooth_uv:j(a,K+16+40)};K+=z.header_bytes;Z=z.vertex_index_bytes;V=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;fa=z.vertex_index_bytes*3+z.material_index_bytes;R=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;W=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;na=z.vertex_index_bytes;N=z.vertex_index_bytes*2;xa=z.vertex_index_bytes*3;ta=
-z.vertex_index_bytes*4;qa=z.vertex_index_bytes*4+z.material_index_bytes;ua=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;la=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ka=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;oa=z.uv_index_bytes;pa=z.uv_index_bytes*2;ea=z.uv_index_bytes;da=z.uv_index_bytes*2;sa=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;D=z.vertex_index_bytes*4+z.material_index_bytes;Ea=z.ntri_flat*
-g;Y=z.ntri_smooth*(g+z.normal_index_bytes*3);ya=z.ntri_flat_uv*(g+z.uv_index_bytes*3);za=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);m=z.nquad_flat*D;g=z.nquad_smooth*(D+z.normal_index_bytes*4);D=z.nquad_flat_uv*(D+z.uv_index_bytes*4);K+=function(p){for(var n,w,E,C=z.vertex_coordinate_bytes*3,G=p+z.nvertices*C;p<G;p+=C){n=h(a,p);w=h(a,p+z.vertex_coordinate_bytes);E=h(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(F,n,w,E)}return z.nvertices*C}(K);K+=function(p){for(var n,
-w,E,C=z.normal_coordinate_bytes*3,G=p+z.nnormals*C;p<G;p+=C){n=o(a,p);w=o(a,p+z.normal_coordinate_bytes);E=o(a,p+z.normal_coordinate_bytes*2);I.push(n/127,w/127,E/127)}return z.nnormals*C}(K);K+=function(p){for(var n,w,E=z.uv_coordinate_bytes*2,C=p+z.nuvs*E;p<C;p+=E){n=h(a,p);w=h(a,p+z.uv_coordinate_bytes);Q.push(n,w)}return z.nuvs*E}(K);Ea=K+Ea;Y=Ea+Y;ya=Y+ya;za=ya+za;m=za+m;g=m+g;D=g+D;(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes,E=w+z.uv_index_bytes*3,C=p+z.ntri_flat_uv*E;
-for(n=p;n<C;n+=E){x(n);H(n+w)}return C-p})(Y);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=w+z.uv_index_bytes*3,C=p+z.ntri_smooth_uv*E;for(n=p;n<C;n+=E){y(n);H(n+w)}return C-p})(ya);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes,E=w+z.uv_index_bytes*4,C=p+z.nquad_flat_uv*E;for(n=p;n<C;n+=E){q(n);J(n+w)}return C-p})(g);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,E=w+z.uv_index_bytes*4,C=
-p+z.nquad_smooth_uv*E;for(n=p;n<C;n+=E){A(n);J(n+w)}return C-p})(D);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes,E=p+z.ntri_flat*w;for(n=p;n<E;n+=w)x(n);return E-p})(K);(function(p){var n,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,E=p+z.ntri_smooth*w;for(n=p;n<E;n+=w)y(n);return E-p})(Ea);(function(p){var n,w=z.vertex_index_bytes*4+z.material_index_bytes,E=p+z.nquad_flat*w;for(n=p;n<E;n+=w)q(n);return E-p})(za);(function(p){var n,w=z.vertex_index_bytes*
-4+z.material_index_bytes+z.normal_index_bytes*4,E=p+z.nquad_smooth*w;for(n=p;n<E;n+=w)A(n);return E-p})(m);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[g]))},f3n:function(a,c,
-b,d,e,g,h,j,k){g=a.materials[g];var o=c[j*3],t=c[j*3+1];j=c[j*3+2];var x=c[k*3],y=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(o,t,j),new THREE.Vector3(x,y,k)],g))},f4n:function(a,c,b,d,e,g,h,j,k,o,t){h=a.materials[h];var x=c[k*3],y=c[k*3+1];k=c[k*3+2];var q=c[o*3],A=c[o*3+1];o=c[o*3+2];var H=c[t*3],J=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(x,y,k),
-new THREE.Vector3(q,A,o),new THREE.Vector3(H,J,t)],h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(d,e));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,k));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var h=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(h,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
+else{var g,k,j,m,t,x,y,q,A,G,J=a.faces;q=a.vertices;var E=a.normals,K=a.colors,z=0;for(g=0;g<a.uvs.length;g++)a.uvs[g].length&&z++;for(g=0;g<z;g++){h.faceUvs[g]=[];h.faceVertexUvs[g]=[]}j=0;for(m=q.length;j<m;){A=new THREE.Vertex;A.position.x=q[j++];A.position.y=q[j++];A.position.z=q[j++];h.vertices.push(A)}j=0;for(m=J.length;j<m;){t=J[j++];x=t&1;g=t&2;y=t&4;k=t&8;q=t&16;A=t&32;G=t&64;t&=128;if(x){x=new THREE.Face4;x.a=J[j++];x.b=J[j++];x.c=J[j++];x.d=J[j++];nVertices=4}else{x=new THREE.Face3;x.a=
+J[j++];x.b=J[j++];x.c=J[j++];nVertices=3}if(g){materialIndex=J[j++];x.materials=h.materials[materialIndex]}if(y)for(g=0;g<z;g++){uvLayer=a.uvs[g];uvIndex=J[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];h.faceUvs[g].push(new THREE.UV(u,v))}if(k)for(g=0;g<z;g++){uvLayer=a.uvs[g];uvs=[];for(k=0;k<nVertices;k++){uvIndex=J[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[k]=new THREE.UV(u,v)}h.faceVertexUvs[g].push(uvs)}if(q){normalIndex=J[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];
+normal.y=E[normalIndex++];normal.z=E[normalIndex];x.normal=normal}if(A)for(g=0;g<nVertices;g++){normalIndex=J[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];normal.y=E[normalIndex++];normal.z=E[normalIndex];x.vertexNormals.push(normal)}if(G){color=new THREE.Color(J[j++]);x.color=color}if(t)for(g=0;g<nVertices;g++){colorIndex=J[j++];color=new THREE.Color(K[colorIndex]);x.vertexColors.push(color)}h.faces.push(x)}}})();(function(){var g,k,j,m;if(a.skinWeights){g=0;for(k=a.skinWeights.length;g<
+k;g+=2){j=a.skinWeights[g];m=a.skinWeights[g+1];h.skinWeights.push(new THREE.Vector4(j,m,0,0))}}if(a.skinIndices){g=0;for(k=a.skinIndices.length;g<k;g+=2){j=a.skinIndices[g];m=a.skinIndices[g+1];h.skinIndices.push(new THREE.Vector4(j,m,0,0))}}h.bones=a.bones;h.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var g,k,j,m;g=0;for(k=a.morphTargets.length;g<k;g++){h.morphTargets[g]={};h.morphTargets[g].name=a.morphTargets[g].name;h.morphTargets[g].vertices=[];dstVertices=h.morphTargets[g].vertices;
+srcVertices=a.morphTargets[g].vertices;j=0;for(m=srcVertices.length;j<m;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};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,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(g){THREE.BinaryLoader.prototype.loadAjaxBuffers(g.data.buffers,g.data.materials,b,e,d,h)};c.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};
+c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,h){var g=new XMLHttpRequest,k=d+"/"+a,j=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,b,e,c):alert("Couldn't load ["+k+"] ["+g.status+"]");else if(g.readyState==3){if(h){j==0&&(j=g.getResponseHeader("Content-Length"));h({total:j,loaded:g.responseText.length})}}else g.readyState==2&&(j=g.getResponseHeader("Content-Length"))};g.open("GET",k,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
+g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,c,b,d){var e=function(h){function g(p,o){var w=t(p,o),B=t(p,o+1),D=t(p,o+2),H=t(p,o+3),U=(H<<1&255|D>>7)-127;w|=(D&127)<<16|B<<8;if(w==0&&U==-127)return 0;return(1-2*(H>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,U)}function k(p,o){var w=t(p,o),B=t(p,o+1),D=t(p,o+2);return(t(p,o+3)<<24)+(D<<16)+(B<<8)+w}function j(p,o){var w=t(p,o);return(t(p,o+1)<<8)+w}function m(p,o){var w=t(p,o);return w>127?w-256:w}function t(p,
+o){return p.charCodeAt(o)&255}function x(p){var o,w,B;o=k(a,p);w=k(a,p+Z);B=k(a,p+W);p=j(a,p+f);THREE.BinaryLoader.prototype.f3(E,o,w,B,p)}function y(p){var o,w,B,D,H,U;o=k(a,p);w=k(a,p+Z);B=k(a,p+W);D=j(a,p+f);H=k(a,p+S);U=k(a,p+T);p=k(a,p+ea);THREE.BinaryLoader.prototype.f3n(E,I,o,w,B,D,H,U,p)}function q(p){var o,w,B,D;o=k(a,p);w=k(a,p+oa);B=k(a,p+$);D=k(a,p+R);p=j(a,p+la);THREE.BinaryLoader.prototype.f4(E,o,w,B,D,p)}function A(p){var o,w,B,D,H,U,N,M;o=k(a,p);w=k(a,p+oa);B=k(a,p+$);D=k(a,p+R);H=
+j(a,p+la);U=k(a,p+va);N=k(a,p+Da);M=k(a,p+fa);p=k(a,p+ia);THREE.BinaryLoader.prototype.f4n(E,I,o,w,B,D,H,U,N,M,p)}function G(p){var o,w;o=k(a,p);w=k(a,p+pa);p=k(a,p+ua);THREE.BinaryLoader.prototype.uv3(E.faceVertexUvs[0],P[o*2],P[o*2+1],P[w*2],P[w*2+1],P[p*2],P[p*2+1])}function J(p){var o,w,B;o=k(a,p);w=k(a,p+ha);B=k(a,p+aa);p=k(a,p+ja);THREE.BinaryLoader.prototype.uv4(E.faceVertexUvs[0],P[o*2],P[o*2+1],P[w*2],P[w*2+1],P[B*2],P[B*2+1],P[p*2],P[p*2+1])}var E=this,K=0,z,I=[],P=[],Z,W,f,S,T,ea,oa,$,
+R,la,va,Da,fa,ia,pa,ua,ha,aa,ja,Na,ma,qa,Fa,n,C;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,d,h);z={signature:a.substr(K,8),header_bytes:t(a,K+8),vertex_coordinate_bytes:t(a,K+9),normal_coordinate_bytes:t(a,K+10),uv_coordinate_bytes:t(a,K+11),vertex_index_bytes:t(a,K+12),normal_index_bytes:t(a,K+13),uv_index_bytes:t(a,K+14),material_index_bytes:t(a,K+15),nvertices:k(a,K+16),nnormals:k(a,K+16+4),nuvs:k(a,K+16+8),ntri_flat:k(a,K+16+12),ntri_smooth:k(a,K+16+16),ntri_flat_uv:k(a,
+K+16+20),ntri_smooth_uv:k(a,K+16+24),nquad_flat:k(a,K+16+28),nquad_smooth:k(a,K+16+32),nquad_flat_uv:k(a,K+16+36),nquad_smooth_uv:k(a,K+16+40)};K+=z.header_bytes;Z=z.vertex_index_bytes;W=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;S=z.vertex_index_bytes*3+z.material_index_bytes;T=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;ea=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;oa=z.vertex_index_bytes;$=z.vertex_index_bytes*2;R=z.vertex_index_bytes*3;la=
+z.vertex_index_bytes*4;va=z.vertex_index_bytes*4+z.material_index_bytes;Da=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;fa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ia=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;pa=z.uv_index_bytes;ua=z.uv_index_bytes*2;ha=z.uv_index_bytes;aa=z.uv_index_bytes*2;ja=z.uv_index_bytes*3;h=z.vertex_index_bytes*3+z.material_index_bytes;C=z.vertex_index_bytes*4+z.material_index_bytes;Na=z.ntri_flat*
+h;ma=z.ntri_smooth*(h+z.normal_index_bytes*3);qa=z.ntri_flat_uv*(h+z.uv_index_bytes*3);Fa=z.ntri_smooth_uv*(h+z.normal_index_bytes*3+z.uv_index_bytes*3);n=z.nquad_flat*C;h=z.nquad_smooth*(C+z.normal_index_bytes*4);C=z.nquad_flat_uv*(C+z.uv_index_bytes*4);K+=function(p){for(var o,w,B,D=z.vertex_coordinate_bytes*3,H=p+z.nvertices*D;p<H;p+=D){o=g(a,p);w=g(a,p+z.vertex_coordinate_bytes);B=g(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(E,o,w,B)}return z.nvertices*D}(K);K+=function(p){for(var o,
+w,B,D=z.normal_coordinate_bytes*3,H=p+z.nnormals*D;p<H;p+=D){o=m(a,p);w=m(a,p+z.normal_coordinate_bytes);B=m(a,p+z.normal_coordinate_bytes*2);I.push(o/127,w/127,B/127)}return z.nnormals*D}(K);K+=function(p){for(var o,w,B=z.uv_coordinate_bytes*2,D=p+z.nuvs*B;p<D;p+=B){o=g(a,p);w=g(a,p+z.uv_coordinate_bytes);P.push(o,w)}return z.nuvs*B}(K);Na=K+Na;ma=Na+ma;qa=ma+qa;Fa=qa+Fa;n=Fa+n;h=n+h;C=h+C;(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,B=w+z.uv_index_bytes*3,D=p+z.ntri_flat_uv*
+B;for(o=p;o<D;o+=B){x(o);G(o+w)}return D-p})(ma);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,B=w+z.uv_index_bytes*3,D=p+z.ntri_smooth_uv*B;for(o=p;o<D;o+=B){y(o);G(o+w)}return D-p})(qa);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,B=w+z.uv_index_bytes*4,D=p+z.nquad_flat_uv*B;for(o=p;o<D;o+=B){q(o);J(o+w)}return D-p})(h);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,B=w+z.uv_index_bytes*
+4,D=p+z.nquad_smooth_uv*B;for(o=p;o<D;o+=B){A(o);J(o+w)}return D-p})(C);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,B=p+z.ntri_flat*w;for(o=p;o<B;o+=w)x(o);return B-p})(K);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,B=p+z.ntri_smooth*w;for(o=p;o<B;o+=w)y(o);return B-p})(Na);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,B=p+z.nquad_flat*w;for(o=p;o<B;o+=w)q(o);return B-p})(Fa);(function(p){var o,w=z.vertex_index_bytes*
+4+z.material_index_bytes+z.normal_index_bytes*4,B=p+z.nquad_smooth*w;for(o=p;o<B;o+=w)A(o);return B-p})(n);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,h){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[h]))},f3n:function(a,c,
+b,d,e,h,g,k,j){h=a.materials[h];var m=c[k*3],t=c[k*3+1];k=c[k*3+2];var x=c[j*3],y=c[j*3+1];j=c[j*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(m,t,k),new THREE.Vector3(x,y,j)],null,h))},f4n:function(a,c,b,d,e,h,g,k,j,m,t){g=a.materials[g];var x=c[j*3],y=c[j*3+1];j=c[j*3+2];var q=c[m*3],A=c[m*3+1];m=c[m*3+2];var G=c[t*3],J=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,h,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
+y,j),new THREE.Vector3(q,A,m),new THREE.Vector3(G,J,t)],null,g))},uv3:function(a,c,b,d,e,h,g){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(d,e));k.push(new THREE.UV(h,g));a.push(k)},uv4:function(a,c,b,d,e,h,g,k,j){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(h,g));m.push(new THREE.UV(k,j));a.push(m)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 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,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=o;e[g]=this.lerp(t[b],t[b+3],h);e[g+1]=this.lerp(t[b+1],t[b+4],h);e[g+2]=this.lerp(t[b+2],t[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
-2]=o;d=b+this.yd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,o,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=o+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,o=g+this.yd,t=g+this.zd,x=k+this.yd,y=k+this.zd,q=g+this.yd+this.zd,A=k+this.yd+this.zd,H=0,J=this.field[g],F=this.field[k],K=this.field[o],z=this.field[x],I=this.field[t],Q=this.field[y],Z=this.field[q],V=this.field[A];J<h&&(H|=1);F<h&&(H|=2);K<h&&(H|=8);z<h&&(H|=4);I<h&&(H|=16);Q<h&&(H|=32);Z<h&&(H|=128);V<h&&(H|=64);var f=THREE.edgeTable[H];if(f==0)return 0;
-var fa=this.delta,R=b+fa,W=d+fa;fa=e+fa;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,J,F)}if(f&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,R,d,e,F,z)}if(f&4){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,6,h,b,W,e,K,z)}if(f&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,J,K)}if(f&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,12,h,
-b,d,fa,I,Q)}if(f&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,h,R,d,fa,Q,V)}if(f&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,h,b,W,fa,Z,V)}if(f&128){this.compNorm(t);this.compNorm(q);this.VIntY(t*3,this.vlist,this.nlist,21,h,b,d,fa,I,Z)}if(f&256){this.compNorm(g);this.compNorm(t);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,J,I)}if(f&512){this.compNorm(k);this.compNorm(y);this.VIntZ(k*3,this.vlist,this.nlist,27,h,R,d,e,F,Q)}if(f&
-1024){this.compNorm(x);this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,h,R,W,e,z,V)}if(f&2048){this.compNorm(o);this.compNorm(q);this.VIntZ(o*3,this.vlist,this.nlist,33,h,b,W,e,K,Z)}H<<=4;for(h=g=0;THREE.triTable[H+h]!=-1;){b=H+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+
-2]=b[e+2];this.positionArray[k+3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=
-this.maxCount-3&&j(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,o=d*this.size,t=b*this.size,x=Math.floor(k-j);x<1&&(x=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var y=Math.floor(o-j);y<1&&(y=1);o=Math.floor(o+j);o>this.size-1&&(o=this.size-1);var q=Math.floor(t-
-j);q<1&&(q=1);j=Math.floor(t+j);j>this.size-1&&(j=this.size-1);for(var A,H,J,F,K,z;x<k;x++){t=this.size2*x;H=x/this.size-e;K=H*H;for(H=y;H<o;H++){J=t+this.size*H;A=H/this.size-d;z=A*A;for(A=q;A<j;A++){F=A/this.size-b;F=g/(1.0E-6+F*F+z+K)-h;F>0&&(this.field[J+A]+=F)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,o=this.size,t=this.yd,x=this.zd,y=this.field,q=o*Math.sqrt(b/d);q>o&&(q=o);for(e=0;e<q;e++){g=e/o;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<o;g++){k=e+g*t;for(h=0;h<o;h++)y[x*h+k]+=j}}};this.addPlaneY=
-function(b,d){var e,g,h,j,k,o,t=this.size,x=this.yd,y=this.zd,q=this.field,A=t*Math.sqrt(b/d);A>t&&(A=t);for(g=0;g<A;g++){e=g/t;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*x;for(e=0;e<t;e++){o=k+e;for(h=0;h<t;h++)q[y*h+o]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){o=k+g*yd;for(e=0;e<size;e++)field[o+e]+=j}}}};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 d,e,g,h,j,k,o,t,x,y=this.size-2;for(h=1;h<y;h++){x=this.size2*h;o=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){t=x+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<y;e++){j=(e-this.halfsize)/this.halfsize;d=t+e;this.polygonize(j,k,o,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,
-k,o,t,x,y;for(g=0;g<e.count;g++){o=g*3;x=o+1;y=o+2;h=e.positionArray[o];j=e.positionArray[x];k=e.positionArray[y];t=new THREE.Vector3(h,j,k);h=e.normalArray[o];j=e.normalArray[x];k=e.normalArray[y];o=new THREE.Vector3(h,j,k);o.normalize();o=new THREE.Vertex(t,o);d.vertices.push(o)}nfaces=e.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;x=o+1;y=o+2;t=d.vertices[o].normal;h=d.vertices[x].normal;j=d.vertices[y].normal;o=new THREE.Face3(o,x,y,[t,h,j]);d.faces.push(o)}b+=nfaces;e.count=0});return d};this.init(a)};
+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,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,h,g,k,j,m,t,x){g=(g-t)/(x-t);t=this.normal_cache;d[h]=k+g*this.delta;d[h+1]=j;d[h+2]=m;e[h]=this.lerp(t[b],t[b+3],g);e[h+1]=this.lerp(t[b+1],t[b+4],g);e[h+2]=this.lerp(t[b+2],t[b+5],g)};this.VIntY=function(b,d,e,h,g,k,j,m,t,x){g=(g-t)/(x-t);t=this.normal_cache;d[h]=k;d[h+1]=j+g*this.delta;d[h+
+2]=m;d=b+this.yd*3;e[h]=this.lerp(t[b],t[d],g);e[h+1]=this.lerp(t[b+1],t[d+1],g);e[h+2]=this.lerp(t[b+2],t[d+2],g)};this.VIntZ=function(b,d,e,h,g,k,j,m,t,x){g=(g-t)/(x-t);t=this.normal_cache;d[h]=k;d[h+1]=j;d[h+2]=m+g*this.delta;d=b+this.zd*3;e[h]=this.lerp(t[b],t[d],g);e[h+1]=this.lerp(t[b+1],t[d+1],g);e[h+2]=this.lerp(t[b+2],t[d+2],g)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,h,g,k){var j=h+1,m=h+this.yd,t=h+this.zd,x=j+this.yd,y=j+this.zd,q=h+this.yd+this.zd,A=j+this.yd+this.zd,G=0,J=this.field[h],E=this.field[j],K=this.field[m],z=this.field[x],I=this.field[t],P=this.field[y],Z=this.field[q],W=this.field[A];J<g&&(G|=1);E<g&&(G|=2);K<g&&(G|=8);z<g&&(G|=4);I<g&&(G|=16);P<g&&(G|=32);Z<g&&(G|=128);W<g&&(G|=64);var f=THREE.edgeTable[G];if(f==0)return 0;
+var S=this.delta,T=b+S,ea=d+S;S=e+S;if(f&1){this.compNorm(h);this.compNorm(j);this.VIntX(h*3,this.vlist,this.nlist,0,g,b,d,e,J,E)}if(f&2){this.compNorm(j);this.compNorm(x);this.VIntY(j*3,this.vlist,this.nlist,3,g,T,d,e,E,z)}if(f&4){this.compNorm(m);this.compNorm(x);this.VIntX(m*3,this.vlist,this.nlist,6,g,b,ea,e,K,z)}if(f&8){this.compNorm(h);this.compNorm(m);this.VIntY(h*3,this.vlist,this.nlist,9,g,b,d,e,J,K)}if(f&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,12,g,b,d,
+S,I,P)}if(f&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,g,T,d,S,P,W)}if(f&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,g,b,ea,S,Z,W)}if(f&128){this.compNorm(t);this.compNorm(q);this.VIntY(t*3,this.vlist,this.nlist,21,g,b,d,S,I,Z)}if(f&256){this.compNorm(h);this.compNorm(t);this.VIntZ(h*3,this.vlist,this.nlist,24,g,b,d,e,J,I)}if(f&512){this.compNorm(j);this.compNorm(y);this.VIntZ(j*3,this.vlist,this.nlist,27,g,T,d,e,E,P)}if(f&1024){this.compNorm(x);
+this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,g,T,ea,e,z,W)}if(f&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,g,b,ea,e,K,Z)}G<<=4;for(g=h=0;THREE.triTable[G+g]!=-1;){b=G+g;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],k);g+=3;h++}return h};this.posnormtriv=function(b,d,e,h,g,k){var j=this.count*3;this.positionArray[j]=b[e];this.positionArray[j+1]=b[e+1];this.positionArray[j+2]=b[e+2];this.positionArray[j+
+3]=b[h];this.positionArray[j+4]=b[h+1];this.positionArray[j+5]=b[h+2];this.positionArray[j+6]=b[g];this.positionArray[j+7]=b[g+1];this.positionArray[j+8]=b[g+2];this.normalArray[j]=d[e];this.normalArray[j+1]=d[e+1];this.normalArray[j+2]=d[e+2];this.normalArray[j+3]=d[h];this.normalArray[j+4]=d[h+1];this.normalArray[j+5]=d[h+2];this.normalArray[j+6]=d[g];this.normalArray[j+7]=d[g+1];this.normalArray[j+8]=d[g+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(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,h,g){var k=this.size*Math.sqrt(h/g),j=e*this.size,m=d*this.size,t=b*this.size,x=Math.floor(j-k);x<1&&(x=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var y=Math.floor(m-k);y<1&&(y=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var q=Math.floor(t-k);q<1&&(q=1);k=Math.floor(t+k);
+k>this.size-1&&(k=this.size-1);for(var A,G,J,E,K,z;x<j;x++){t=this.size2*x;G=x/this.size-e;K=G*G;for(G=y;G<m;G++){J=t+this.size*G;A=G/this.size-d;z=A*A;for(A=q;A<k;A++){E=A/this.size-b;E=h/(1.0E-6+E*E+z+K)-g;E>0&&(this.field[J+A]+=E)}}}};this.addPlaneX=function(b,d){var e,h,g,k,j,m=this.size,t=this.yd,x=this.zd,y=this.field,q=m*Math.sqrt(b/d);q>m&&(q=m);for(e=0;e<q;e++){h=e/m;h*=h;k=b/(1.0E-4+h)-d;if(k>0)for(h=0;h<m;h++){j=e+h*t;for(g=0;g<m;g++)y[x*g+j]+=k}}};this.addPlaneY=function(b,d){var e,h,
+g,k,j,m,t=this.size,x=this.yd,y=this.zd,q=this.field,A=t*Math.sqrt(b/d);A>t&&(A=t);for(h=0;h<A;h++){e=h/t;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=h*x;for(e=0;e<t;e++){m=j+e;for(g=0;g<t;g++)q[y*g+m]+=k}}}};this.addPlaneZ=function(b,d){var e,h,g,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(g=0;g<dist;g++){e=g/size;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=zd*g;for(h=0;h<size;h++){m=j+h*yd;for(e=0;e<size;e++)field[m+e]+=k}}}};this.reset=function(){var b;
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,e,h,g,k,j,m,t,x,y=this.size-2;for(g=1;g<y;g++){x=this.size2*g;m=(g-this.halfsize)/this.halfsize;for(h=1;h<y;h++){t=x+this.size*h;j=(h-this.halfsize)/this.halfsize;for(e=1;e<y;e++){k=(e-this.halfsize)/this.halfsize;d=t+e;this.polygonize(k,j,m,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var h,g,k,j,m,t,x,y;for(h=
+0;h<e.count;h++){m=h*3;x=m+1;y=m+2;g=e.positionArray[m];k=e.positionArray[x];j=e.positionArray[y];t=new THREE.Vector3(g,k,j);g=e.normalArray[m];k=e.normalArray[x];j=e.normalArray[y];m=new THREE.Vector3(g,k,j);m.normalize();m=new THREE.Vertex(t,m);d.vertices.push(m)}nfaces=e.count/3;for(h=0;h<nfaces;h++){m=(b+h)*3;x=m+1;y=m+2;t=d.vertices[m].normal;g=d.vertices[x].normal;k=d.vertices[y].normal;m=new THREE.Face3(m,x,y,[t,g,k]);d.faces.push(m)}b+=nfaces;e.count=0});return d};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,

+ 44 - 44
build/custom/ThreeCanvas.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):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(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(y,u,B,z){z=z.clone().subSelf(u);B=B.clone().subSelf(u);var o=y.clone().subSelf(u);y=z.dot(z);u=z.dot(B);z=z.dot(o);var H=B.dot(B);B=B.dot(o);o=1/(y*H-u*u);H=(H*z-u*B)*o;y=(y*B-u*z)*o;return H>0&&y>0&&H+y<1}var c,d,e,f,g,j,h,i,n,m,
-q,l=a.geometry,v=l.vertices,r=[];c=0;for(d=l.faces.length;c<d;c++){e=l.faces[c];m=this.origin.clone();q=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(v[e.a].position.clone());g=h.multiplyVector3(v[e.b].position.clone());j=h.multiplyVector3(v[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(v[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=q.dot(i);if(n<0){i=i.dot((new THREE.Vector3).sub(f,m))/n;m=m.addSelf(q.multiplyScalar(i));
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(z,s,B,x){x=x.clone().subSelf(s);B=B.clone().subSelf(s);var o=z.clone().subSelf(s);z=x.dot(x);s=x.dot(B);x=x.dot(o);var J=B.dot(B);B=B.dot(o);o=1/(z*J-s*s);J=(J*x-s*B)*o;z=(z*B-s*x)*o;return J>0&&z>0&&J+z<1}var c,d,e,f,g,j,h,i,n,m,
+p,l=a.geometry,u=l.vertices,r=[];c=0;for(d=l.faces.length;c<d;c++){e=l.faces[c];m=this.origin.clone();p=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(u[e.a].position.clone());g=h.multiplyVector3(u[e.b].position.clone());j=h.multiplyVector3(u[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(u[e.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(e.normal.clone());n=p.dot(i);if(n<0){i=i.dot((new THREE.Vector3).sub(f,m))/n;m=m.addSelf(p.multiplyScalar(i));
 if(e instanceof THREE.Face3){if(b(m,f,g,j)){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}else if(e instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,j,h))){e={distance:this.origin.distanceTo(m),point:m,face:e,object:a};r.push(e)}}}return r}};
 THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b,c,d,e,f,g,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(h,i,n,m){j=!1;b=h;c=i;d=n;e=m;a()};this.addPoint=function(h,i){if(j){j=!1;b=h;c=i;d=h;e=i}else{b=b<h?b:h;c=c<i?c:i;d=d>h?d:h;e=e>i?e:i}a()};
-this.add3Points=function(h,i,n,m,q,l){if(j){j=!1;b=h<n?h<q?h:q:n<q?n:q;c=i<m?i<l?i:l:m<l?m:l;d=h>n?h>q?h:q:n>q?n:q;e=i>m?i>l?i:l:m>l?m:l}else{b=h<n?h<q?h<b?h:b:q<b?q:b:n<q?n<b?n:b:q<b?q:b;c=i<m?i<l?i<c?i:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c;d=h>n?h>q?h>d?h:d:q>d?q:d:n>q?n>d?n:d:q>d?q:d;e=i>m?i>l?i>e?i:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e}a()};this.addRectangle=function(h){if(j){j=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
+this.add3Points=function(h,i,n,m,p,l){if(j){j=!1;b=h<n?h<p?h:p:n<p?n:p;c=i<m?i<l?i:l:m<l?m:l;d=h>n?h>p?h:p:n>p?n:p;e=i>m?i>l?i:l:m>l?m:l}else{b=h<n?h<p?h<b?h:b:p<b?p:b:n<p?n<b?n:b:p<b?p:b;c=i<m?i<l?i<c?i:c:l<c?l:c:m<l?m<c?m:c:l<c?l:c;d=h>n?h>p?h>d?h:d:p>d?p:d:n>p?n>d?n:d:p>d?p:d;e=i>m?i>l?i>e?i:e:l>e?l:e:m>l?m>e?m:e:l>e?l:e}a()};this.addRectangle=function(h){if(j){j=!1;b=h.getLeft();c=h.getTop();d=h.getRight();e=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();d=d>h.getRight()?
 d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){j=!0;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,e,f,g,j,h,i,n,m,q,l,v,r){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,n||1,m||0,q||0,l||0,v||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,n,m,q,l,v,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=n;this.n34=m;this.n41=q;this.n42=l;this.n43=v;this.n44=r;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,d,e,f,g,j,h,i,n,m,p,l,u,r){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,n||1,m||0,p||0,l||0,u||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,n,m,p,l,u,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=n;this.n34=m;this.n41=p;this.n42=l;this.n43=u;this.n44=r;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__v1,
 e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;d.cross(c,f).normalize();if(d.length()===0){f.x+=1.0E-4;d.cross(c,f).normalize()}e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
 d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,q=a.n33,l=a.n34,v=a.n41,r=a.n42,y=a.n43,u=a.n44,B=b.n11,z=b.n12,o=b.n13,H=b.n14,I=b.n21,N=b.n22,
-O=b.n23,U=b.n24,s=b.n31,x=b.n32,E=b.n33,C=b.n34;this.n11=c*B+d*I+e*s;this.n12=c*z+d*N+e*x;this.n13=c*o+d*O+e*E;this.n14=c*H+d*U+e*C+f;this.n21=g*B+j*I+h*s;this.n22=g*z+j*N+h*x;this.n23=g*o+j*O+h*E;this.n24=g*H+j*U+h*C+i;this.n31=n*B+m*I+q*s;this.n32=n*z+m*N+q*x;this.n33=n*o+m*O+q*E;this.n34=n*H+m*U+q*C+l;this.n41=v*B+r*I+y*s;this.n42=v*z+r*N+y*x;this.n43=v*o+r*O+y*E;this.n44=v*H+r*U+y*C+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,p=a.n33,l=a.n34,u=a.n41,r=a.n42,z=a.n43,s=a.n44,B=b.n11,x=b.n12,o=b.n13,J=b.n14,K=b.n21,O=b.n22,
+P=b.n23,y=b.n24,w=b.n31,E=b.n32,H=b.n33,F=b.n34;this.n11=c*B+d*K+e*w;this.n12=c*x+d*O+e*E;this.n13=c*o+d*P+e*H;this.n14=c*J+d*y+e*F+f;this.n21=g*B+j*K+h*w;this.n22=g*x+j*O+h*E;this.n23=g*o+j*P+h*H;this.n24=g*J+j*y+h*F+i;this.n31=n*B+m*K+p*w;this.n32=n*x+m*O+p*E;this.n33=n*o+m*P+p*H;this.n34=n*J+m*y+p*F+l;this.n41=u*B+r*K+z*w;this.n42=u*x+r*O+z*E;this.n43=u*o+r*P+z*H;this.n44=u*J+r*y+z*F+s;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);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(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,j=this.n24,h=this.n31,i=this.n32,n=this.n33,m=this.n34,q=this.n41,l=this.n42,v=this.n43,r=this.n44;return d*g*i*q-c*j*i*q-d*f*n*q+b*j*n*q+c*f*m*q-b*g*m*q-d*g*h*l+c*j*h*l+d*e*n*l-a*j*n*l-c*e*m*l+a*g*m*l+d*f*h*v-b*j*h*v-d*e*i*v+a*j*i*v+b*e*m*v-a*f*m*v-c*f*h*r+b*g*h*r+c*e*i*r-a*g*i*r-b*e*n*r+a*f*n*r},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,f=this.n22,g=this.n23,j=this.n24,h=this.n31,i=this.n32,n=this.n33,m=this.n34,p=this.n41,l=this.n42,u=this.n43,r=this.n44;return d*g*i*p-c*j*i*p-d*f*n*p+b*j*n*p+c*f*m*p-b*g*m*p-d*g*h*l+c*j*h*l+d*e*n*l-a*j*n*l-c*e*m*l+a*g*m*l+d*f*h*u-b*j*h*u-d*e*i*u+a*j*i*u+b*e*m*u-a*f*m*u-c*f*h*r+b*g*h*r+c*e*i*r-a*g*i*r-b*e*n*r+a*f*n*r},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
@@ -34,8 +34,8 @@ b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:functio
 f+c,h*g-d*j,h*j+d*g,0,h*g+d*j,i*g+c,i*j-d*f,0,h*j-d*g,i*j+d*f,e*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,j=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=j*f+a*d;this.n22=-j*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=
 a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,j=d+d;a=b*f;var h=b*g;b*=j;var i=c*g;c*=j;d*=j;f*=e;g*=e;e*=j;this.n11=1-(i+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,q=a.n33,l=a.n34,v=a.n41,r=a.n42,y=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*l*r-i*q*r+i*m*y-j*l*y-h*m*u+j*q*u;b.n12=f*q*r-e*l*r-f*m*y+d*l*y+e*m*u-d*q*u;b.n13=e*i*r-f*h*r+f*j*y-d*i*y-e*j*u+d*h*u;b.n14=f*h*m-e*i*m-f*j*q+d*i*q+e*j*l-d*h*l;b.n21=i*q*v-h*l*v-i*n*y+g*l*y+h*n*u-g*q*u;b.n22=e*l*v-f*q*v+f*n*y-c*l*y-e*n*u+c*q*u;b.n23=f*h*v-e*i*v-f*g*y+c*i*y+e*g*u-c*h*u;
-b.n24=e*i*n-f*h*n+f*g*q-c*i*q-e*g*l+c*h*l;b.n31=j*l*v-i*m*v+i*n*r-g*l*r-j*n*u+g*m*u;b.n32=f*m*v-d*l*v-f*n*r+c*l*r+d*n*u-c*m*u;b.n33=e*i*v-f*j*v+f*g*r-c*i*r-d*g*u+c*j*u;b.n34=f*j*n-d*i*n-f*g*m+c*i*m+d*g*l-c*j*l;b.n41=h*m*v-j*q*v-h*n*r+g*q*r+j*n*y-g*m*y;b.n42=d*q*v-e*m*v+e*n*r-c*q*r-d*n*y+c*m*y;b.n43=e*j*v-d*h*v-e*g*r+c*h*r+d*g*y-c*j*y;b.n44=d*h*n-e*j*n+e*g*m-c*h*m-d*g*q+c*j*q;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,n=a.n31,m=a.n32,p=a.n33,l=a.n34,u=a.n41,r=a.n42,z=a.n43,s=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*l*r-i*p*r+i*m*z-j*l*z-h*m*s+j*p*s;b.n12=f*p*r-e*l*r-f*m*z+d*l*z+e*m*s-d*p*s;b.n13=e*i*r-f*h*r+f*j*z-d*i*z-e*j*s+d*h*s;b.n14=f*h*m-e*i*m-f*j*p+d*i*p+e*j*l-d*h*l;b.n21=i*p*u-h*l*u-i*n*z+g*l*z+h*n*s-g*p*s;b.n22=e*l*u-f*p*u+f*n*z-c*l*z-e*n*s+c*p*s;b.n23=f*h*u-e*i*u-f*g*z+c*i*z+e*g*s-c*h*s;
+b.n24=e*i*n-f*h*n+f*g*p-c*i*p-e*g*l+c*h*l;b.n31=j*l*u-i*m*u+i*n*r-g*l*r-j*n*s+g*m*s;b.n32=f*m*u-d*l*u-f*n*r+c*l*r+d*n*s-c*m*s;b.n33=e*i*u-f*j*u+f*g*r-c*i*r-d*g*s+c*j*s;b.n34=f*j*n-d*i*n-f*g*m+c*i*m+d*g*l-c*j*l;b.n41=h*m*u-j*p*u-h*n*r+g*p*r+j*n*z-g*m*z;b.n42=d*p*u-e*m*u+e*n*r-c*p*r-d*n*z+c*m*z;b.n43=e*j*u-d*h*u-e*g*r+c*h*r+d*g*z-c*j*z;b.n44=d*h*n-e*j*n+e*g*m-c*h*m-d*g*p+c*j*p;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*j;c[5]=a*h;c[6]=a*i;c[7]=a*n;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,j,h,i;g=new THREE.Matrix4;j=b-a;h=c-d;i=f-e;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((b+a)/j);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -56,10 +56,10 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,e,f,g,j=new THREE.Vector3,h=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){f=this.faces[d];if(a&&f.vertexNormals.length){j.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];j.sub(g.position,c.position);h.sub(b.position,c.position);j.crossSelf(h)}j.isZero()||
 j.normalize();f.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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{d=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);
-c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(C,M,L,D,J,aa,F){f=C.vertices[M].position;g=C.vertices[L].position;j=C.vertices[D].position;h=e[J];i=e[aa];n=e[F];m=g.x-f.x;q=j.x-f.x;l=g.y-f.y;v=j.y-f.y;r=g.z-f.z;y=j.z-f.z;u=i.u-h.u;B=n.u-h.u;z=i.v-h.v;o=n.v-h.v;H=1/(u*o-B*z);O.set((o*
-m-z*q)*H,(o*l-z*v)*H,(o*r-z*y)*H);U.set((u*q-B*m)*H,(u*v-B*l)*H,(u*y-B*r)*H);I[M].addSelf(O);I[L].addSelf(O);I[D].addSelf(O);N[M].addSelf(U);N[L].addSelf(U);N[D].addSelf(U)}var b,c,d,e,f,g,j,h,i,n,m,q,l,v,r,y,u,B,z,o,H,I=[],N=[],O=new THREE.Vector3,U=new THREE.Vector3,s=new THREE.Vector3,x=new THREE.Vector3,E=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){I[b]=new THREE.Vector3;N[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof
+c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(F,G,D,L,S,N,C){f=F.vertices[G].position;g=F.vertices[D].position;j=F.vertices[L].position;h=e[S];i=e[N];n=e[C];m=g.x-f.x;p=j.x-f.x;l=g.y-f.y;u=j.y-f.y;r=g.z-f.z;z=j.z-f.z;s=i.u-h.u;B=n.u-h.u;x=i.v-h.v;o=n.v-h.v;J=1/(s*o-B*x);P.set((o*
+m-x*p)*J,(o*l-x*u)*J,(o*r-x*z)*J);y.set((s*p-B*m)*J,(s*u-B*l)*J,(s*z-B*r)*J);K[G].addSelf(P);K[D].addSelf(P);K[L].addSelf(P);O[G].addSelf(y);O[D].addSelf(y);O[L].addSelf(y)}var b,c,d,e,f,g,j,h,i,n,m,p,l,u,r,z,s,B,x,o,J,K=[],O=[],P=new THREE.Vector3,y=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){K[b]=new THREE.Vector3;O[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.faceVertexUvs[b][0];if(d instanceof
 THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<
-c;b++){E.copy(this.vertices[b].normal);d=I[b];s.copy(d);s.subSelf(E.multiplyScalar(E.dot(d))).normalize();x.cross(this.vertices[b].normal,d);d=x.dot(N[b]);d=d<0?-1:1;this.vertices[b].tangent.set(s.x,s.y,s.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=
+c;b++){H.copy(this.vertices[b].normal);d=K[b];w.copy(d);w.subSelf(H.multiplyScalar(H.dot(d))).normalize();E.cross(this.vertices[b].normal,d);d=E.dot(O[b]);d=d<0?-1:1;this.vertices[b].tangent.set(w.x,w.y,w.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=
 1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},
 computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var f=0;f<a.length;f++)a[f].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var f=0;f<e.hierarchy.length;f++){for(var g=0;g<e.hierarchy[f].keys.length;g++){if(e.hierarchy[f].keys[g].time<
@@ -71,8 +71,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.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 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 b=["pos","rot","scl"],c,d,e,f,g,j,h,i,n=this.data.JIT.hierarchy,m,q;this.currentTime+=a*this.timeScale;q=this.currentTime;m=this.currentTime%=this.data.length;i=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,v=this.hierarchy.length;l<v;l++){a=this.hierarchy[l];h=a.animationCache;if(this.JITCompile&&n[l][i]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[l][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=n[l][i];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 r=0;r<3;r++){c=b[r];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=q){if(m<q)if(this.loop){g=this.data.hierarchy[l].keys[0];for(j=this.getNextKeyWith(c,l,1);j.time<m;){g=j;j=this.getNextKeyWith(c,l,j.index+1)}}else{this.stop();return}else{do{g=j;j=this.getNextKeyWith(c,l,j.index+1)}while(j.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,g,j,h,i,n=this.data.JIT.hierarchy,m,p;this.currentTime+=a*this.timeScale;p=this.currentTime;m=this.currentTime%=this.data.length;i=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var l=0,u=this.hierarchy.length;l<u;l++){a=this.hierarchy[l];h=a.animationCache;if(this.JITCompile&&n[l][i]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[l][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=n[l][i];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 r=0;r<3;r++){c=b[r];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=p){if(m<p)if(this.loop){g=this.data.hierarchy[l].keys[0];for(j=this.getNextKeyWith(c,l,1);j.time<m;){g=j;j=this.getNextKeyWith(c,l,j.index+1)}}else{this.stop();return}else{do{g=j;j=this.getNextKeyWith(c,l,j.index+1)}while(j.time<
 m)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-g.time)/(j.time-g.time);e=g[c];f=j[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+l);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",l,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",l,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c===
 "rot")THREE.Quaternion.slerp(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}if(this.JITCompile&&n[0][i]===undefined){this.hierarchy[0].update(undefined,!0);for(l=0;l<this.hierarchy.length;l++)n[l][i]=this.hierarchy[l]instanceof THREE.Bone?this.hierarchy[l].skinMatrix.clone():this.hierarchy[l].matrix.clone()}}};
@@ -125,35 +125,35 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 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.Projector=function(){function a(){var s=h[j]=h[j]||new THREE.RenderableVertex;j++;return s}function b(s,x){return x.z-s.z}function c(s,x){var E=0,C=1,M=s.z+s.w,L=x.z+x.w,D=-s.z+s.w,J=-x.z+x.w;if(M>=0&&L>=0&&D>=0&&J>=0)return!0;else if(M<0&&L<0||D<0&&J<0)return!1;else{if(M<0)E=Math.max(E,M/(M-L));else L<0&&(C=Math.min(C,M/(M-L)));if(D<0)E=Math.max(E,D/(D-J));else J<0&&(C=Math.min(C,D/(D-J)));if(C<E)return!1;else{s.lerpSelf(x,E);x.lerpSelf(s,1-C);return!0}}}var d,e,f=[],g,j,h=[],i,n,m=[],q,l,
-v=[],r,y,u=[],B=new THREE.Vector4,z=new THREE.Vector4,o=new THREE.Matrix4,H=new THREE.Matrix4,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,O=new THREE.Vector4,U;this.projectVector=function(s,x){o.multiply(x.projectionMatrix,x.matrixWorldInverse);o.multiplyVector3(s);return s};this.unprojectVector=function(s,x){o.multiply(THREE.Matrix4.makeInvert(x.projectionMatrix),x.matrixWorld);o.multiplyVector3(s);return s};
-this.projectObjects=function(s,x,E){x=[];var C,M,L;e=0;M=s.objects;s=0;for(C=M.length;s<C;s++){L=M[s];var D;if(!(D=!L.visible))if(D=L instanceof THREE.Mesh){a:{D=void 0;for(var J=L.matrixWorld,aa=-L.geometry.boundingSphere.radius*Math.max(L.scale.x,Math.max(L.scale.y,L.scale.z)),F=0;F<6;F++){D=I[F].x*J.n14+I[F].y*J.n24+I[F].z*J.n34+I[F].w;if(D<=aa){D=!1;break a}}D=!0}D=!D}if(!D){D=f[e]=f[e]||new THREE.RenderableObject;e++;d=D;B.copy(L.position);o.multiplyVector3(B);d.object=L;d.z=B.z;x.push(d)}}E&&
-x.sort(b);return x};this.projectScene=function(s,x,E){var C=[],M=x.near,L=x.far,D,J,aa,F,$,Q,da,qa,ea,X,K,ma,R,T;y=l=n=0;x.matrixAutoUpdate&&x.updateMatrix();s.update(undefined,!1,x);o.multiply(x.projectionMatrix,x.matrixWorldInverse);I[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);I[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);I[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);I[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);I[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-
-o.n33,o.n44-o.n34);I[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(D=0;D<6;D++){$=I[D];$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z))}$=this.projectObjects(s,x,!0);s=0;for(D=$.length;s<D;s++){Q=$[s].object;if(Q.visible){da=Q.matrixWorld;ea=Q.matrixRotationWorld;qa=Q.materials;j=0;if(Q instanceof THREE.Mesh){X=Q.geometry;K=X.vertices;ma=X.faces;J=0;for(aa=K.length;J<aa;J++){g=a();g.positionWorld.copy(K[J].position);da.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);
-o.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>M&&g.positionScreen.z<L}J=0;for(aa=ma.length;J<aa;J++){K=ma[J];if(K instanceof THREE.Face3){F=h[K.a];R=h[K.b];T=h[K.c];if(F.visible&&R.visible&&T.visible&&(Q.doubleSided||Q.flipSided!=(T.positionScreen.x-F.positionScreen.x)*(R.positionScreen.y-F.positionScreen.y)-(T.positionScreen.y-F.positionScreen.y)*(R.positionScreen.x-F.positionScreen.x)<0)){var ia=m[n]=
-m[n]||new THREE.RenderableFace3;n++;i=ia;i.v1.copy(F);i.v2.copy(R);i.v3.copy(T);i.normalWorld.copy(K.normal);ea.multiplyVector3(i.normalWorld);i.centroidWorld.copy(K.centroid);da.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);R=K.vertexNormals;U=i.vertexNormalsWorld;for(F=0;F<3;F++){T=U[F];T.copy(R[F]);ea.multiplyVector3(T)}if(F=X.faceVertexUvs[0][J]){i.uvs[0]=F[0];i.uvs[1]=F[1];i.uvs[2]=F[2]}i.meshMaterials=qa;i.faceMaterials=K.materials;
-i.z=i.centroidScreen.z;C.push(i)}}}}else if(Q instanceof THREE.Line){H.multiply(o,da);K=Q.geometry.vertices;F=a();F.positionScreen.copy(K[0].position);H.multiplyVector4(F.positionScreen);J=1;for(aa=K.length;J<aa;J++){F=a();F.positionScreen.copy(K[J].position);H.multiplyVector4(F.positionScreen);R=h[j-2];N.copy(F.positionScreen);O.copy(R.positionScreen);if(c(N,O)){N.multiplyScalar(1/N.w);O.multiplyScalar(1/O.w);da=v[l]=v[l]||new THREE.RenderableLine;l++;q=da;q.v1.positionScreen.copy(N);q.v2.positionScreen.copy(O);
-q.z=Math.max(N.z,O.z);q.materials=Q.materials;C.push(q)}}}else if(Q instanceof THREE.Particle){z.set(Q.position.x,Q.position.y,Q.position.z,1);o.multiplyVector4(z);z.z/=z.w;if(z.z>0&&z.z<1){da=u[y]=u[y]||new THREE.RenderableParticle;y++;r=da;r.x=z.x/z.w;r.y=z.y/z.w;r.z=z.z;r.rotation=Q.rotation.z;r.scale.x=Q.scale.x*Math.abs(r.x-(z.x+x.projectionMatrix.n11)/(z.w+x.projectionMatrix.n14));r.scale.y=Q.scale.y*Math.abs(r.y-(z.y+x.projectionMatrix.n22)/(z.w+x.projectionMatrix.n24));r.materials=Q.materials;
-C.push(r)}}}}E&&C.sort(b);return C}};
-THREE.CanvasRenderer=function(){function a(V){if(q!=V)i.globalAlpha=q=V}function b(V){if(l!=V){switch(V){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}l=V}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,j,h,i=e.getContext("2d"),n=new THREE.Color(0),m=0,q=1,l=0,v=null,r=null,y=1,u,B,z,o,H,I,N,O,U,s=new THREE.Color,
-x=new THREE.Color,E=new THREE.Color,C=new THREE.Color,M=new THREE.Color,L,D,J,aa,F,$,Q,da,qa,ea=new THREE.Rectangle,X=new THREE.Rectangle,K=new THREE.Rectangle,ma=!1,R=new THREE.Color,T=new THREE.Color,ia=new THREE.Color,na=new THREE.Color,P=new THREE.Vector3,ra,sa,Ca,ba,ta,xa,oa=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);Ca=sa.getImageData(0,0,2,2);ba=Ca.data;ta=document.createElement("canvas");ta.width=ta.height=
-oa;xa=ta.getContext("2d");xa.translate(-oa/2,-oa/2);xa.scale(oa,oa);oa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(V,fa){f=V;g=fa;j=f/2;h=g/2;e.width=f;e.height=g;ea.set(-j,-h,j,h);q=1;l=0;r=v=null;y=1};this.setClearColor=function(V,fa){n=V;m=fa};this.setClearColorHex=function(V,fa){n.setHex(V);m=fa};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!X.isEmpty()){X.inflate(1);X.minSelf(ea);if(n.hex==0&&m==0)i.clearRect(X.getX(),X.getY(),
-X.getWidth(),X.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+m+")";i.fillRect(X.getX(),X.getY(),X.getWidth(),X.getHeight())}X.empty()}};this.render=function(V,fa){function La(k){var A,w,p,t=k.lights;T.setRGB(0,0,0);ia.setRGB(0,0,0);na.setRGB(0,0,0);k=0;for(A=t.length;k<A;k++){w=t[k];p=w.color;if(w instanceof THREE.AmbientLight){T.r+=p.r;T.g+=p.g;T.b+=p.b}else if(w instanceof THREE.DirectionalLight){ia.r+=
-p.r;ia.g+=p.g;ia.b+=p.b}else if(w instanceof THREE.PointLight){na.r+=p.r;na.g+=p.g;na.b+=p.b}}}function ya(k,A,w,p){var t,G,W,Y,Z=k.lights;k=0;for(t=Z.length;k<t;k++){G=Z[k];W=G.color;Y=G.intensity;if(G instanceof THREE.DirectionalLight){G=w.dot(G.position)*Y;if(G>0){p.r+=W.r*G;p.g+=W.g*G;p.b+=W.b*G}}else if(G instanceof THREE.PointLight){P.sub(G.position,A);P.normalize();G=w.dot(P)*Y;if(G>0){p.r+=W.r*G;p.g+=W.g*G;p.b+=W.b*G}}}}function Ma(k,A,w){if(w.opacity!=0){a(w.opacity);b(w.blending);var p,
-t,G,W,Y,Z;if(w instanceof THREE.ParticleBasicMaterial){if(w.map){W=w.map.image;Y=W.width>>1;Z=W.height>>1;w=A.scale.x*j;G=A.scale.y*h;p=w*Y;t=G*Z;K.set(k.x-p,k.y-t,k.x+p,k.y+t);if(ea.instersects(K)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(w,-G);i.translate(-Y,-Z);i.drawImage(W,0,0);i.restore()}}}else if(w instanceof THREE.ParticleCanvasMaterial){if(ma){R.r=T.r+ia.r+na.r;R.g=T.g+ia.g+na.g;R.b=T.b+ia.b+na.b;s.r=w.color.r*R.r;s.g=w.color.g*R.g;s.b=w.color.b*R.b;s.updateStyleString()}else s.__styleString=
-w.color.__styleString;p=A.scale.x*j;t=A.scale.y*h;K.set(k.x-p,k.y-t,k.x+p,k.y+t);if(ea.instersects(K)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(p,t);w.program(i,s);i.restore()}}}}function Na(k,A,w,p){if(p.opacity!=0){a(p.opacity);b(p.blending);i.beginPath();i.moveTo(k.positionScreen.x,k.positionScreen.y);i.lineTo(A.positionScreen.x,A.positionScreen.y);i.closePath();if(p instanceof THREE.LineBasicMaterial){s.__styleString=p.color.__styleString;k=p.linewidth;if(y!=k)i.lineWidth=y=
-k;k=s.__styleString;if(v!=k)i.strokeStyle=v=k;i.stroke();K.inflate(p.linewidth*2)}}}function Ha(k,A,w,p,t,G){if(t.opacity!=0){a(t.opacity);b(t.blending);o=k.positionScreen.x;H=k.positionScreen.y;I=A.positionScreen.x;N=A.positionScreen.y;O=w.positionScreen.x;U=w.positionScreen.y;i.beginPath();i.moveTo(o,H);i.lineTo(I,N);i.lineTo(O,U);i.lineTo(o,H);i.closePath();if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&ua(o,H,I,N,O,U,t.map.image,p.uvs[0].u,p.uvs[0].v,
-p.uvs[1].u,p.uvs[1].v,p.uvs[2].u,p.uvs[2].v);else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping){k=fa.matrixWorldInverse;P.copy(p.vertexNormalsWorld[0]);aa=(P.x*k.n11+P.y*k.n12+P.z*k.n13)*0.5+0.5;F=-(P.x*k.n21+P.y*k.n22+P.z*k.n23)*0.5+0.5;P.copy(p.vertexNormalsWorld[1]);$=(P.x*k.n11+P.y*k.n12+P.z*k.n13)*0.5+0.5;Q=-(P.x*k.n21+P.y*k.n22+P.z*k.n23)*0.5+0.5;P.copy(p.vertexNormalsWorld[2]);da=(P.x*k.n11+P.y*k.n12+P.z*k.n13)*0.5+0.5;qa=-(P.x*k.n21+P.y*k.n22+P.z*k.n23)*0.5+
-0.5;ua(o,H,I,N,O,U,t.envMap.image,aa,F,$,Q,da,qa)}}else t.wireframe?za(t.color.__styleString,t.wireframeLinewidth):Aa(t.color.__styleString);else if(t instanceof THREE.MeshLambertMaterial){if(t.map&&!t.wireframe){t.map.mapping instanceof THREE.UVMapping&&ua(o,H,I,N,O,U,t.map.image,p.uvs[0].u,p.uvs[0].v,p.uvs[1].u,p.uvs[1].v,p.uvs[2].u,p.uvs[2].v);b(THREE.SubtractiveBlending)}if(ma)if(!t.wireframe&&t.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3){x.r=E.r=C.r=T.r;x.g=E.g=C.g=T.g;x.b=
-E.b=C.b=T.b;ya(G,p.v1.positionWorld,p.vertexNormalsWorld[0],x);ya(G,p.v2.positionWorld,p.vertexNormalsWorld[1],E);ya(G,p.v3.positionWorld,p.vertexNormalsWorld[2],C);M.r=(E.r+C.r)*0.5;M.g=(E.g+C.g)*0.5;M.b=(E.b+C.b)*0.5;J=Ia(x,E,C,M);ua(o,H,I,N,O,U,J,0,0,1,0,0,1)}else{R.r=T.r;R.g=T.g;R.b=T.b;ya(G,p.centroidWorld,p.normalWorld,R);s.r=t.color.r*R.r;s.g=t.color.g*R.g;s.b=t.color.b*R.b;s.updateStyleString();t.wireframe?za(s.__styleString,t.wireframeLinewidth):Aa(s.__styleString)}else t.wireframe?za(t.color.__styleString,
-t.wireframeLinewidth):Aa(t.color.__styleString)}else if(t instanceof THREE.MeshDepthMaterial){L=fa.near;D=fa.far;x.r=x.g=x.b=1-Da(k.positionScreen.z,L,D);E.r=E.g=E.b=1-Da(A.positionScreen.z,L,D);C.r=C.g=C.b=1-Da(w.positionScreen.z,L,D);M.r=(E.r+C.r)*0.5;M.g=(E.g+C.g)*0.5;M.b=(E.b+C.b)*0.5;J=Ia(x,E,C,M);ua(o,H,I,N,O,U,J,0,0,1,0,0,1)}else if(t instanceof THREE.MeshNormalMaterial){s.r=Ea(p.normalWorld.x);s.g=Ea(p.normalWorld.y);s.b=Ea(p.normalWorld.z);s.updateStyleString();t.wireframe?za(s.__styleString,
-t.wireframeLinewidth):Aa(s.__styleString)}}}function za(k,A){if(v!=k)i.strokeStyle=v=k;if(y!=A)i.lineWidth=y=A;i.stroke();K.inflate(A*2)}function Aa(k){if(r!=k)i.fillStyle=r=k;i.fill()}function ua(k,A,w,p,t,G,W,Y,Z,ja,ca,ka,va){var ga,la;ga=W.width-1;la=W.height-1;Y*=ga;Z*=la;ja*=ga;ca*=la;ka*=ga;va*=la;w-=k;p-=A;t-=k;G-=A;ja-=Y;ca-=Z;ka-=Y;va-=Z;ga=ja*va-ka*ca;if(ga!=0){la=1/ga;ga=(va*w-ca*t)*la;ca=(va*p-ca*G)*la;w=(ja*t-ka*w)*la;p=(ja*G-ka*p)*la;k=k-ga*Y-w*Z;A=A-ca*Y-p*Z;i.save();i.transform(ga,
-ca,w,p,k,A);i.clip();i.drawImage(W,0,0);i.restore()}}function Ia(k,A,w,p){var t=~~(k.r*255),G=~~(k.g*255);k=~~(k.b*255);var W=~~(A.r*255),Y=~~(A.g*255);A=~~(A.b*255);var Z=~~(w.r*255),ja=~~(w.g*255);w=~~(w.b*255);var ca=~~(p.r*255),ka=~~(p.g*255);p=~~(p.b*255);ba[0]=t<0?0:t>255?255:t;ba[1]=G<0?0:G>255?255:G;ba[2]=k<0?0:k>255?255:k;ba[4]=W<0?0:W>255?255:W;ba[5]=Y<0?0:Y>255?255:Y;ba[6]=A<0?0:A>255?255:A;ba[8]=Z<0?0:Z>255?255:Z;ba[9]=ja<0?0:ja>255?255:ja;ba[10]=w<0?0:w>255?255:w;ba[12]=ca<0?0:ca>255?
-255:ca;ba[13]=ka<0?0:ka>255?255:ka;ba[14]=p<0?0:p>255?255:p;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(k,A,w){k=(k-A)/(w-A);return k*k*(3-2*k)}function Ea(k){k=(k+1)*0.5;return k<0?0:k>1?1:k}function Fa(k,A){var w=A.x-k.x,p=A.y-k.y,t=1/Math.sqrt(w*w+p*p);w*=t;p*=t;A.x+=w;A.y+=p;k.x-=w;k.y-=p}var Ba,Ja,S,ha,pa,Ga,Ka,wa;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=d.projectScene(V,fa,this.sortElements);(ma=V.lights.length>0)&&La(V);Ba=0;for(Ja=c.length;Ba<Ja;Ba++){S=
-c[Ba];K.empty();if(S instanceof THREE.RenderableParticle){u=S;u.x*=j;u.y*=h;ha=0;for(pa=S.materials.length;ha<pa;ha++)Ma(u,S,S.materials[ha],V)}else if(S instanceof THREE.RenderableLine){u=S.v1;B=S.v2;u.positionScreen.x*=j;u.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;K.addPoint(u.positionScreen.x,u.positionScreen.y);K.addPoint(B.positionScreen.x,B.positionScreen.y);if(ea.instersects(K)){ha=0;for(pa=S.materials.length;ha<pa;)Na(u,B,S,S.materials[ha++],V)}}else if(S instanceof THREE.RenderableFace3){u=
-S.v1;B=S.v2;z=S.v3;u.positionScreen.x*=j;u.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;z.positionScreen.x*=j;z.positionScreen.y*=h;if(S.overdraw){Fa(u.positionScreen,B.positionScreen);Fa(B.positionScreen,z.positionScreen);Fa(z.positionScreen,u.positionScreen)}K.add3Points(u.positionScreen.x,u.positionScreen.y,B.positionScreen.x,B.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(ea.instersects(K)){ha=0;for(pa=S.meshMaterials.length;ha<pa;){wa=S.meshMaterials[ha++];if(wa instanceof
-THREE.MeshFaceMaterial){Ga=0;for(Ka=S.faceMaterials.length;Ga<Ka;)(wa=S.faceMaterials[Ga++])&&Ha(u,B,z,S,wa,V)}else Ha(u,B,z,S,wa,V)}}}X.addRectangle(K)}i.setTransform(1,0,0,1,0,0)}};
+THREE.Projector=function(){function a(){var y=h[j]=h[j]||new THREE.RenderableVertex;j++;return y}function b(y,w){return w.z-y.z}function c(y,w){var E=0,H=1,F=y.z+y.w,G=w.z+w.w,D=-y.z+y.w,L=-w.z+w.w;if(F>=0&&G>=0&&D>=0&&L>=0)return!0;else if(F<0&&G<0||D<0&&L<0)return!1;else{if(F<0)E=Math.max(E,F/(F-G));else G<0&&(H=Math.min(H,F/(F-G)));if(D<0)E=Math.max(E,D/(D-L));else L<0&&(H=Math.min(H,D/(D-L)));if(H<E)return!1;else{y.lerpSelf(w,E);w.lerpSelf(y,1-H);return!0}}}var d,e,f=[],g,j,h=[],i,n,m=[],p,l,
+u=[],r,z,s=[],B=new THREE.Vector4,x=new THREE.Vector4,o=new THREE.Matrix4,J=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(y,w){o.multiply(w.projectionMatrix,w.matrixWorldInverse);o.multiplyVector3(y);return y};this.unprojectVector=function(y,w){o.multiply(THREE.Matrix4.makeInvert(w.projectionMatrix),w.matrixWorld);o.multiplyVector3(y);return y};this.projectObjects=
+function(y,w,E){w=[];var H,F,G;e=0;F=y.objects;y=0;for(H=F.length;y<H;y++){G=F[y];var D;if(!(D=!G.visible))if(D=G instanceof THREE.Mesh){a:{D=void 0;for(var L=G.matrixWorld,S=-G.geometry.boundingSphere.radius*Math.max(G.scale.x,Math.max(G.scale.y,G.scale.z)),N=0;N<6;N++){D=K[N].x*L.n14+K[N].y*L.n24+K[N].z*L.n34+K[N].w;if(D<=S){D=!1;break a}}D=!0}D=!D}if(!D){D=f[e]=f[e]||new THREE.RenderableObject;e++;d=D;B.copy(G.position);o.multiplyVector3(B);d.object=G;d.z=B.z;w.push(d)}}E&&w.sort(b);return w};
+this.projectScene=function(y,w,E){var H=[],F=w.near,G=w.far,D,L,S,N,C,ba,Y,ha,ca,Q,fa,ia,Z,$,ga,V,W;z=l=n=0;w.matrixAutoUpdate&&w.updateMatrix();y.update(undefined,!1,w);o.multiply(w.projectionMatrix,w.matrixWorldInverse);K[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);K[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);K[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);K[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);K[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-
+o.n34);K[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(D=0;D<6;D++){ca=K[D];ca.divideScalar(Math.sqrt(ca.x*ca.x+ca.y*ca.y+ca.z*ca.z))}ca=this.projectObjects(y,w,!0);y=0;for(D=ca.length;y<D;y++){Q=ca[y].object;if(Q.visible){fa=Q.matrixWorld;ia=Q.matrixRotationWorld;Z=Q.materials;$=Q.overdraw;j=0;if(Q instanceof THREE.Mesh){ga=Q.geometry;N=ga.vertices;V=ga.faces;ga=ga.faceVertexUvs;L=0;for(S=N.length;L<S;L++){g=a();g.positionWorld.copy(N[L].position);fa.multiplyVector3(g.positionWorld);
+g.positionScreen.copy(g.positionWorld);o.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>F&&g.positionScreen.z<G}N=0;for(L=V.length;N<L;N++){S=V[N];if(S instanceof THREE.Face3){C=h[S.a];ba=h[S.b];Y=h[S.c];if(C.visible&&ba.visible&&Y.visible&&(Q.doubleSided||Q.flipSided!=(Y.positionScreen.x-C.positionScreen.x)*(ba.positionScreen.y-C.positionScreen.y)-(Y.positionScreen.y-C.positionScreen.y)*(ba.positionScreen.x-
+C.positionScreen.x)<0)){ha=m[n]=m[n]||new THREE.RenderableFace3;n++;i=ha;i.v1.copy(C);i.v2.copy(ba);i.v3.copy(Y);i.normalWorld.copy(S.normal);ia.multiplyVector3(i.normalWorld);i.centroidWorld.copy(S.centroid);fa.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);o.multiplyVector3(i.centroidScreen);Y=S.vertexNormals;C=0;for(ba=Y.length;C<ba;C++){ha=i.vertexNormalsWorld[C];ha.copy(Y[C]);ia.multiplyVector3(ha)}C=0;for(ba=ga.length;C<ba;C++)if(W=ga[C][N]){Y=0;for(ha=W.length;Y<ha;Y++)i.uvs[C][Y]=
+W[Y]}i.meshMaterials=Z;i.faceMaterials=S.materials;i.overdraw=$;i.z=i.centroidScreen.z;H.push(i)}}}}else if(Q instanceof THREE.Line){J.multiply(o,fa);N=Q.geometry.vertices;C=a();C.positionScreen.copy(N[0].position);J.multiplyVector4(C.positionScreen);L=1;for(S=N.length;L<S;L++){C=a();C.positionScreen.copy(N[L].position);J.multiplyVector4(C.positionScreen);ba=h[j-2];O.copy(C.positionScreen);P.copy(ba.positionScreen);if(c(O,P)){O.multiplyScalar(1/O.w);P.multiplyScalar(1/P.w);fa=u[l]=u[l]||new THREE.RenderableLine;
+l++;p=fa;p.v1.positionScreen.copy(O);p.v2.positionScreen.copy(P);p.z=Math.max(O.z,P.z);p.materials=Q.materials;H.push(p)}}}else if(Q instanceof THREE.Particle){x.set(Q.position.x,Q.position.y,Q.position.z,1);o.multiplyVector4(x);x.z/=x.w;if(x.z>0&&x.z<1){fa=s[z]=s[z]||new THREE.RenderableParticle;z++;r=fa;r.x=x.x/x.w;r.y=x.y/x.w;r.z=x.z;r.rotation=Q.rotation.z;r.scale.x=Q.scale.x*Math.abs(r.x-(x.x+w.projectionMatrix.n11)/(x.w+w.projectionMatrix.n14));r.scale.y=Q.scale.y*Math.abs(r.y-(x.y+w.projectionMatrix.n22)/
+(x.w+w.projectionMatrix.n24));r.materials=Q.materials;H.push(r)}}}}E&&H.sort(b);return H}};
+THREE.CanvasRenderer=function(){function a(T){if(p!=T)i.globalAlpha=p=T}function b(T){if(l!=T){switch(T){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}l=T}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,j,h,i=e.getContext("2d"),n=new THREE.Color(0),m=0,p=1,l=0,u=null,r=null,z=1,s,B,x,o,J,K,O,P,y,w,E=new THREE.Color,
+H=new THREE.Color,F=new THREE.Color,G=new THREE.Color,D=new THREE.Color,L,S,N,C,ba,Y,ha,ca,Q,fa,ia=new THREE.Rectangle,Z=new THREE.Rectangle,$=new THREE.Rectangle,ga=!1,V=new THREE.Color,W=new THREE.Color,pa=new THREE.Color,qa=new THREE.Color,R=new THREE.Vector3,ta,ua,Ea,da,va,za,ra=16;ta=document.createElement("canvas");ta.width=ta.height=2;ua=ta.getContext("2d");ua.fillStyle="rgba(0,0,0,1)";ua.fillRect(0,0,2,2);Ea=ua.getImageData(0,0,2,2);da=Ea.data;va=document.createElement("canvas");va.width=
+va.height=ra;za=va.getContext("2d");za.translate(-ra/2,-ra/2);za.scale(ra,ra);ra--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(T,ja){f=T;g=ja;j=f/2;h=g/2;e.width=f;e.height=g;ia.set(-j,-h,j,h);p=1;l=0;r=u=null;z=1};this.setClearColor=function(T,ja){n=T;m=ja};this.setClearColorHex=function(T,ja){n.setHex(T);m=ja};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!Z.isEmpty()){Z.inflate(1);Z.minSelf(ia);if(n.hex==0&&m==0)i.clearRect(Z.getX(),
+Z.getY(),Z.getWidth(),Z.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+m+")";i.fillRect(Z.getX(),Z.getY(),Z.getWidth(),Z.getHeight())}Z.empty()}};this.render=function(T,ja){function Na(k){var A,v,q,t=k.lights;W.setRGB(0,0,0);pa.setRGB(0,0,0);qa.setRGB(0,0,0);k=0;for(A=t.length;k<A;k++){v=t[k];q=v.color;if(v instanceof THREE.AmbientLight){W.r+=q.r;W.g+=q.g;W.b+=q.b}else if(v instanceof THREE.DirectionalLight){pa.r+=
+q.r;pa.g+=q.g;pa.b+=q.b}else if(v instanceof THREE.PointLight){qa.r+=q.r;qa.g+=q.g;qa.b+=q.b}}}function Aa(k,A,v,q){var t,I,U,X,aa=k.lights;k=0;for(t=aa.length;k<t;k++){I=aa[k];U=I.color;X=I.intensity;if(I instanceof THREE.DirectionalLight){I=v.dot(I.position)*X;if(I>0){q.r+=U.r*I;q.g+=U.g*I;q.b+=U.b*I}}else if(I instanceof THREE.PointLight){R.sub(I.position,A);R.normalize();I=v.dot(R)*X;if(I>0){q.r+=U.r*I;q.g+=U.g*I;q.b+=U.b*I}}}}function Oa(k,A,v){if(v.opacity!=0){a(v.opacity);b(v.blending);var q,
+t,I,U,X,aa;if(v instanceof THREE.ParticleBasicMaterial){if(v.map){U=v.map.image;X=U.width>>1;aa=U.height>>1;v=A.scale.x*j;I=A.scale.y*h;q=v*X;t=I*aa;$.set(k.x-q,k.y-t,k.x+q,k.y+t);if(ia.instersects($)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(v,-I);i.translate(-X,-aa);i.drawImage(U,0,0);i.restore()}}}else if(v instanceof THREE.ParticleCanvasMaterial){if(ga){V.r=W.r+pa.r+qa.r;V.g=W.g+pa.g+qa.g;V.b=W.b+pa.b+qa.b;E.r=v.color.r*V.r;E.g=v.color.g*V.g;E.b=v.color.b*V.b;E.updateStyleString()}else E.__styleString=
+v.color.__styleString;q=A.scale.x*j;t=A.scale.y*h;$.set(k.x-q,k.y-t,k.x+q,k.y+t);if(ia.instersects($)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(q,t);v.program(i,E);i.restore()}}}}function Pa(k,A,v,q){if(q.opacity!=0){a(q.opacity);b(q.blending);i.beginPath();i.moveTo(k.positionScreen.x,k.positionScreen.y);i.lineTo(A.positionScreen.x,A.positionScreen.y);i.closePath();if(q instanceof THREE.LineBasicMaterial){E.__styleString=q.color.__styleString;k=q.linewidth;if(z!=k)i.lineWidth=z=
+k;k=E.__styleString;if(u!=k)i.strokeStyle=u=k;i.stroke();$.inflate(q.linewidth*2)}}}function Ja(k,A,v,q,t,I){if(t.opacity!=0){a(t.opacity);b(t.blending);J=k.positionScreen.x;K=k.positionScreen.y;O=A.positionScreen.x;P=A.positionScreen.y;y=v.positionScreen.x;w=v.positionScreen.y;i.beginPath();i.moveTo(J,K);i.lineTo(O,P);i.lineTo(y,w);i.lineTo(J,K);i.closePath();if(t instanceof THREE.MeshBasicMaterial)if(t.map){if(t.map.mapping instanceof THREE.UVMapping){C=q.uvs[0];wa(J,K,O,P,y,w,t.map.image,C[0].u,
+C[0].v,C[1].u,C[1].v,C[2].u,C[2].v)}}else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping){k=ja.matrixWorldInverse;R.copy(q.vertexNormalsWorld[0]);ba=(R.x*k.n11+R.y*k.n12+R.z*k.n13)*0.5+0.5;Y=-(R.x*k.n21+R.y*k.n22+R.z*k.n23)*0.5+0.5;R.copy(q.vertexNormalsWorld[1]);ha=(R.x*k.n11+R.y*k.n12+R.z*k.n13)*0.5+0.5;ca=-(R.x*k.n21+R.y*k.n22+R.z*k.n23)*0.5+0.5;R.copy(q.vertexNormalsWorld[2]);Q=(R.x*k.n11+R.y*k.n12+R.z*k.n13)*0.5+0.5;fa=-(R.x*k.n21+R.y*k.n22+R.z*k.n23)*0.5+0.5;wa(J,
+K,O,P,y,w,t.envMap.image,ba,Y,ha,ca,Q,fa)}}else t.wireframe?Ba(t.color.__styleString,t.wireframeLinewidth):Ca(t.color.__styleString);else if(t instanceof THREE.MeshLambertMaterial){if(t.map&&!t.wireframe){if(t.map.mapping instanceof THREE.UVMapping){C=q.uvs[0];wa(J,K,O,P,y,w,t.map.image,C[0].u,C[0].v,C[1].u,C[1].v,C[2].u,C[2].v)}b(THREE.SubtractiveBlending)}if(ga)if(!t.wireframe&&t.shading==THREE.SmoothShading&&q.vertexNormalsWorld.length==3){H.r=F.r=G.r=W.r;H.g=F.g=G.g=W.g;H.b=F.b=G.b=W.b;Aa(I,q.v1.positionWorld,
+q.vertexNormalsWorld[0],H);Aa(I,q.v2.positionWorld,q.vertexNormalsWorld[1],F);Aa(I,q.v3.positionWorld,q.vertexNormalsWorld[2],G);D.r=(F.r+G.r)*0.5;D.g=(F.g+G.g)*0.5;D.b=(F.b+G.b)*0.5;N=Ka(H,F,G,D);wa(J,K,O,P,y,w,N,0,0,1,0,0,1)}else{V.r=W.r;V.g=W.g;V.b=W.b;Aa(I,q.centroidWorld,q.normalWorld,V);E.r=t.color.r*V.r;E.g=t.color.g*V.g;E.b=t.color.b*V.b;E.updateStyleString();t.wireframe?Ba(E.__styleString,t.wireframeLinewidth):Ca(E.__styleString)}else t.wireframe?Ba(t.color.__styleString,t.wireframeLinewidth):
+Ca(t.color.__styleString)}else if(t instanceof THREE.MeshDepthMaterial){L=ja.near;S=ja.far;H.r=H.g=H.b=1-Fa(k.positionScreen.z,L,S);F.r=F.g=F.b=1-Fa(A.positionScreen.z,L,S);G.r=G.g=G.b=1-Fa(v.positionScreen.z,L,S);D.r=(F.r+G.r)*0.5;D.g=(F.g+G.g)*0.5;D.b=(F.b+G.b)*0.5;N=Ka(H,F,G,D);wa(J,K,O,P,y,w,N,0,0,1,0,0,1)}else if(t instanceof THREE.MeshNormalMaterial){E.r=Ga(q.normalWorld.x);E.g=Ga(q.normalWorld.y);E.b=Ga(q.normalWorld.z);E.updateStyleString();t.wireframe?Ba(E.__styleString,t.wireframeLinewidth):
+Ca(E.__styleString)}}}function Ba(k,A){if(u!=k)i.strokeStyle=u=k;if(z!=A)i.lineWidth=z=A;i.stroke();$.inflate(A*2)}function Ca(k){if(r!=k)i.fillStyle=r=k;i.fill()}function wa(k,A,v,q,t,I,U,X,aa,ma,ea,na,xa){var ka,oa;ka=U.width-1;oa=U.height-1;X*=ka;aa*=oa;ma*=ka;ea*=oa;na*=ka;xa*=oa;v-=k;q-=A;t-=k;I-=A;ma-=X;ea-=aa;na-=X;xa-=aa;ka=ma*xa-na*ea;if(ka!=0){oa=1/ka;ka=(xa*v-ea*t)*oa;ea=(xa*q-ea*I)*oa;v=(ma*t-na*v)*oa;q=(ma*I-na*q)*oa;k=k-ka*X-v*aa;A=A-ea*X-q*aa;i.save();i.transform(ka,ea,v,q,k,A);i.clip();
+i.drawImage(U,0,0);i.restore()}}function Ka(k,A,v,q){var t=~~(k.r*255),I=~~(k.g*255);k=~~(k.b*255);var U=~~(A.r*255),X=~~(A.g*255);A=~~(A.b*255);var aa=~~(v.r*255),ma=~~(v.g*255);v=~~(v.b*255);var ea=~~(q.r*255),na=~~(q.g*255);q=~~(q.b*255);da[0]=t<0?0:t>255?255:t;da[1]=I<0?0:I>255?255:I;da[2]=k<0?0:k>255?255:k;da[4]=U<0?0:U>255?255:U;da[5]=X<0?0:X>255?255:X;da[6]=A<0?0:A>255?255:A;da[8]=aa<0?0:aa>255?255:aa;da[9]=ma<0?0:ma>255?255:ma;da[10]=v<0?0:v>255?255:v;da[12]=ea<0?0:ea>255?255:ea;da[13]=na<
+0?0:na>255?255:na;da[14]=q<0?0:q>255?255:q;ua.putImageData(Ea,0,0);za.drawImage(ta,0,0);return va}function Fa(k,A,v){k=(k-A)/(v-A);return k*k*(3-2*k)}function Ga(k){k=(k+1)*0.5;return k<0?0:k>1?1:k}function Ha(k,A){var v=A.x-k.x,q=A.y-k.y,t=1/Math.sqrt(v*v+q*q);v*=t;q*=t;A.x+=v;A.y+=q;k.x-=v;k.y-=q}var Da,La,M,la,sa,Ia,Ma,ya;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=d.projectScene(T,ja,this.sortElements);(ga=T.lights.length>0)&&Na(T);Da=0;for(La=c.length;Da<La;Da++){M=c[Da];$.empty();
+if(M instanceof THREE.RenderableParticle){s=M;s.x*=j;s.y*=h;la=0;for(sa=M.materials.length;la<sa;la++)Oa(s,M,M.materials[la],T)}else if(M instanceof THREE.RenderableLine){s=M.v1;B=M.v2;s.positionScreen.x*=j;s.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;$.addPoint(s.positionScreen.x,s.positionScreen.y);$.addPoint(B.positionScreen.x,B.positionScreen.y);if(ia.instersects($)){la=0;for(sa=M.materials.length;la<sa;)Pa(s,B,M,M.materials[la++],T)}}else if(M instanceof THREE.RenderableFace3){s=
+M.v1;B=M.v2;x=M.v3;s.positionScreen.x*=j;s.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;x.positionScreen.x*=j;x.positionScreen.y*=h;if(M.overdraw){Ha(s.positionScreen,B.positionScreen);Ha(B.positionScreen,x.positionScreen);Ha(x.positionScreen,s.positionScreen)}$.add3Points(s.positionScreen.x,s.positionScreen.y,B.positionScreen.x,B.positionScreen.y,x.positionScreen.x,x.positionScreen.y);if(ia.instersects($)){la=0;for(sa=M.meshMaterials.length;la<sa;){ya=M.meshMaterials[la++];if(ya instanceof
+THREE.MeshFaceMaterial){Ia=0;for(Ma=M.faceMaterials.length;Ia<Ma;)(ya=M.faceMaterials[Ia++])&&Ja(s,B,x,M,ya,T)}else Ja(s,B,x,M,ya,T)}}}else if(M instanceof THREE.RenderableFace4){s=M.v1;B=M.v2;x=M.v3;o=M.v4;s.positionScreen.x*=j;s.positionScreen.y*=h;B.positionScreen.x*=j;B.positionScreen.y*=h;x.positionScreen.x*=j;x.positionScreen.y*=h;o.positionScreen.x*=j;o.positionScreen.y*=h}Z.addRectangle($)}i.setTransform(1,0,0,1,0,0)}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,e=c.length;for(d=0;d<e;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
-THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.uvs=[];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
+THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};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};

+ 13 - 13
build/custom/ThreeDOM.js

@@ -12,7 +12,7 @@ this.length();a>0?this.multiplyScalar(1/a):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(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(g,f){return g.distance-f.distance});return d},intersectObject:function(a){function b(s,u,B,v){v=v.clone().subSelf(u);B=B.clone().subSelf(u);var o=s.clone().subSelf(u);s=v.dot(v);u=v.dot(B);v=v.dot(o);var G=B.dot(B);B=B.dot(o);o=1/(s*G-u*u);G=(G*v-u*B)*o;s=(s*B-u*v)*o;return G>0&&s>0&&G+s<1}var c,e,d,g,f,i,h,j,m,l,
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(g,f){return g.distance-f.distance});return d},intersectObject:function(a){function b(s,u,C,v){v=v.clone().subSelf(u);C=C.clone().subSelf(u);var o=s.clone().subSelf(u);s=v.dot(v);u=v.dot(C);v=v.dot(o);var I=C.dot(C);C=C.dot(o);o=1/(s*I-u*u);I=(I*v-u*C)*o;s=(s*C-u*v)*o;return I>0&&s>0&&I+s<1}var c,e,d,g,f,i,h,j,m,l,
 n,k=a.geometry,q=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];l=this.origin.clone();n=this.direction.clone();h=a.matrixWorld;g=h.multiplyVector3(q[d.a].position.clone());f=h.multiplyVector3(q[d.b].position.clone());i=h.multiplyVector3(q[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(q[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());m=n.dot(j);if(m<0){j=j.dot((new THREE.Vector3).sub(g,l))/m;l=l.addSelf(n.multiplyScalar(j));
 if(d instanceof THREE.Face3){if(b(l,g,f,i)){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(l,g,f,h)||b(l,f,i,h))){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};p.push(d)}}}return p}};
 THREE.Rectangle=function(){function a(){g=e-b;f=d-c}var b,c,e,d,g,f,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,m,l){i=!1;b=h;c=j;e=m;d=l;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
@@ -23,8 +23,8 @@ THREE.Matrix4=function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,q,p){this.set(a||1,b||0,c||0,
 THREE.Matrix4.prototype={set:function(a,b,c,e,d,g,f,i,h,j,m,l,n,k,q,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=g;this.n23=f;this.n24=i;this.n31=h;this.n32=j;this.n33=m;this.n34=l;this.n41=n;this.n42=k;this.n43=q;this.n44=p;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
 d=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(c,g).normalize()}d.cross(g,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=g.x;this.n21=e.y;this.n22=d.y;this.n23=g.y;this.n31=e.z;this.n32=d.z;this.n33=g.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
 e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,q=a.n41,p=a.n42,s=a.n43,u=a.n44,B=b.n11,v=b.n12,o=b.n13,G=b.n14,D=b.n21,I=b.n22,
-J=b.n23,P=b.n24,t=b.n31,r=b.n32,F=b.n33,z=b.n34;this.n11=c*B+e*D+d*t;this.n12=c*v+e*I+d*r;this.n13=c*o+e*J+d*F;this.n14=c*G+e*P+d*z+g;this.n21=f*B+i*D+h*t;this.n22=f*v+i*I+h*r;this.n23=f*o+i*J+h*F;this.n24=f*G+i*P+h*z+j;this.n31=m*B+l*D+n*t;this.n32=m*v+l*I+n*r;this.n33=m*o+l*J+n*F;this.n34=m*G+l*P+n*z+k;this.n41=q*B+p*D+s*t;this.n42=q*v+p*I+s*r;this.n43=q*o+p*J+s*F;this.n44=q*G+p*P+s*z+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,g=a.n14,f=a.n21,i=a.n22,h=a.n23,j=a.n24,m=a.n31,l=a.n32,n=a.n33,k=a.n34,q=a.n41,p=a.n42,s=a.n43,u=a.n44,C=b.n11,v=b.n12,o=b.n13,I=b.n14,F=b.n21,K=b.n22,
+L=b.n23,t=b.n24,r=b.n31,G=b.n32,z=b.n33,D=b.n34;this.n11=c*C+e*F+d*r;this.n12=c*v+e*K+d*G;this.n13=c*o+e*L+d*z;this.n14=c*I+e*t+d*D+g;this.n21=f*C+i*F+h*r;this.n22=f*v+i*K+h*G;this.n23=f*o+i*L+h*z;this.n24=f*I+i*t+h*D+j;this.n31=m*C+l*F+n*r;this.n32=m*v+l*K+n*G;this.n33=m*o+l*L+n*z;this.n34=m*I+l*t+n*D+k;this.n41=q*C+p*F+s*r;this.n42=q*v+p*K+s*G;this.n43=q*o+p*L+s*z;this.n44=q*I+p*t+s*D+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);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(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
 this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,g=this.n22,f=this.n23,i=this.n24,h=this.n31,j=this.n32,m=this.n33,l=this.n34,n=this.n41,k=this.n42,q=this.n43,p=this.n44;return e*f*j*n-c*i*j*n-e*g*m*n+b*i*m*n+c*g*l*n-b*f*l*n-e*f*h*k+c*i*h*k+e*d*m*k-a*i*m*k-c*d*l*k+a*f*l*k+e*g*h*q-b*i*h*q-e*d*j*q+a*i*j*q+b*d*l*q-a*g*l*q-c*g*h*p+b*f*h*p+c*d*j*p-a*f*j*p-b*d*m*p+a*g*m*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
@@ -84,16 +84,16 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 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.Projector=function(){function a(){var t=h[i]=h[i]||new THREE.RenderableVertex;i++;return t}function b(t,r){return r.z-t.z}function c(t,r){var F=0,z=1,H=t.z+t.w,C=r.z+r.w,x=-t.z+t.w,y=-r.z+r.w;if(H>=0&&C>=0&&x>=0&&y>=0)return!0;else if(H<0&&C<0||x<0&&y<0)return!1;else{if(H<0)F=Math.max(F,H/(H-C));else C<0&&(z=Math.min(z,H/(H-C)));if(x<0)F=Math.max(F,x/(x-y));else y<0&&(z=Math.min(z,x/(x-y)));if(z<F)return!1;else{t.lerpSelf(r,F);r.lerpSelf(t,1-z);return!0}}}var e,d,g=[],f,i,h=[],j,m,l=[],n,k,
-q=[],p,s,u=[],B=new THREE.Vector4,v=new THREE.Vector4,o=new THREE.Matrix4,G=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,J=new THREE.Vector4,P;this.projectVector=function(t,r){o.multiply(r.projectionMatrix,r.matrixWorldInverse);o.multiplyVector3(t);return t};this.unprojectVector=function(t,r){o.multiply(THREE.Matrix4.makeInvert(r.projectionMatrix),r.matrixWorld);o.multiplyVector3(t);return t};
-this.projectObjects=function(t,r,F){r=[];var z,H,C;d=0;H=t.objects;t=0;for(z=H.length;t<z;t++){C=H[t];var x;if(!(x=!C.visible))if(x=C instanceof THREE.Mesh){a:{x=void 0;for(var y=C.matrixWorld,M=-C.geometry.boundingSphere.radius*Math.max(C.scale.x,Math.max(C.scale.y,C.scale.z)),w=0;w<6;w++){x=D[w].x*y.n14+D[w].y*y.n24+D[w].z*y.n34+D[w].w;if(x<=M){x=!1;break a}}x=!0}x=!x}if(!x){x=g[d]=g[d]||new THREE.RenderableObject;d++;e=x;B.copy(C.position);o.multiplyVector3(B);e.object=C;e.z=B.z;r.push(e)}}F&&
-r.sort(b);return r};this.projectScene=function(t,r,F){var z=[],H=r.near,C=r.far,x,y,M,w,K,A,N,T,R,Q,E,S,L,O;s=k=m=0;r.matrixAutoUpdate&&r.updateMatrix();t.update(undefined,!1,r);o.multiply(r.projectionMatrix,r.matrixWorldInverse);D[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);D[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);D[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);D[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);D[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-
-o.n33,o.n44-o.n34);D[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(x=0;x<6;x++){K=D[x];K.divideScalar(Math.sqrt(K.x*K.x+K.y*K.y+K.z*K.z))}K=this.projectObjects(t,r,!0);t=0;for(x=K.length;t<x;t++){A=K[t].object;if(A.visible){N=A.matrixWorld;R=A.matrixRotationWorld;T=A.materials;i=0;if(A instanceof THREE.Mesh){Q=A.geometry;E=Q.vertices;S=Q.faces;y=0;for(M=E.length;y<M;y++){f=a();f.positionWorld.copy(E[y].position);N.multiplyVector3(f.positionWorld);f.positionScreen.copy(f.positionWorld);
-o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>H&&f.positionScreen.z<C}y=0;for(M=S.length;y<M;y++){E=S[y];if(E instanceof THREE.Face3){w=h[E.a];L=h[E.b];O=h[E.c];if(w.visible&&L.visible&&O.visible&&(A.doubleSided||A.flipSided!=(O.positionScreen.x-w.positionScreen.x)*(L.positionScreen.y-w.positionScreen.y)-(O.positionScreen.y-w.positionScreen.y)*(L.positionScreen.x-w.positionScreen.x)<0)){var U=l[m]=l[m]||
-new THREE.RenderableFace3;m++;j=U;j.v1.copy(w);j.v2.copy(L);j.v3.copy(O);j.normalWorld.copy(E.normal);R.multiplyVector3(j.normalWorld);j.centroidWorld.copy(E.centroid);N.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);o.multiplyVector3(j.centroidScreen);L=E.vertexNormals;P=j.vertexNormalsWorld;for(w=0;w<3;w++){O=P[w];O.copy(L[w]);R.multiplyVector3(O)}if(w=Q.faceVertexUvs[0][y]){j.uvs[0]=w[0];j.uvs[1]=w[1];j.uvs[2]=w[2]}j.meshMaterials=T;j.faceMaterials=E.materials;j.z=j.centroidScreen.z;
-z.push(j)}}}}else if(A instanceof THREE.Line){G.multiply(o,N);E=A.geometry.vertices;w=a();w.positionScreen.copy(E[0].position);G.multiplyVector4(w.positionScreen);y=1;for(M=E.length;y<M;y++){w=a();w.positionScreen.copy(E[y].position);G.multiplyVector4(w.positionScreen);L=h[i-2];I.copy(w.positionScreen);J.copy(L.positionScreen);if(c(I,J)){I.multiplyScalar(1/I.w);J.multiplyScalar(1/J.w);N=q[k]=q[k]||new THREE.RenderableLine;k++;n=N;n.v1.positionScreen.copy(I);n.v2.positionScreen.copy(J);n.z=Math.max(I.z,
-J.z);n.materials=A.materials;z.push(n)}}}else if(A instanceof THREE.Particle){v.set(A.position.x,A.position.y,A.position.z,1);o.multiplyVector4(v);v.z/=v.w;if(v.z>0&&v.z<1){N=u[s]=u[s]||new THREE.RenderableParticle;s++;p=N;p.x=v.x/v.w;p.y=v.y/v.w;p.z=v.z;p.rotation=A.rotation.z;p.scale.x=A.scale.x*Math.abs(p.x-(v.x+r.projectionMatrix.n11)/(v.w+r.projectionMatrix.n14));p.scale.y=A.scale.y*Math.abs(p.y-(v.y+r.projectionMatrix.n22)/(v.w+r.projectionMatrix.n24));p.materials=A.materials;z.push(p)}}}}F&&
-z.sort(b);return z}};
+THREE.Projector=function(){function a(){var t=h[i]=h[i]||new THREE.RenderableVertex;i++;return t}function b(t,r){return r.z-t.z}function c(t,r){var G=0,z=1,D=t.z+t.w,E=r.z+r.w,w=-t.z+t.w,A=-r.z+r.w;if(D>=0&&E>=0&&w>=0&&A>=0)return!0;else if(D<0&&E<0||w<0&&A<0)return!1;else{if(D<0)G=Math.max(G,D/(D-E));else E<0&&(z=Math.min(z,D/(D-E)));if(w<0)G=Math.max(G,w/(w-A));else A<0&&(z=Math.min(z,w/(w-A)));if(z<G)return!1;else{t.lerpSelf(r,G);r.lerpSelf(t,1-z);return!0}}}var e,d,g=[],f,i,h=[],j,m,l=[],n,k,
+q=[],p,s,u=[],C=new THREE.Vector4,v=new THREE.Vector4,o=new THREE.Matrix4,I=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,L=new THREE.Vector4;this.projectVector=function(t,r){o.multiply(r.projectionMatrix,r.matrixWorldInverse);o.multiplyVector3(t);return t};this.unprojectVector=function(t,r){o.multiply(THREE.Matrix4.makeInvert(r.projectionMatrix),r.matrixWorld);o.multiplyVector3(t);return t};this.projectObjects=
+function(t,r,G){r=[];var z,D,E;d=0;D=t.objects;t=0;for(z=D.length;t<z;t++){E=D[t];var w;if(!(w=!E.visible))if(w=E instanceof THREE.Mesh){a:{w=void 0;for(var A=E.matrixWorld,H=-E.geometry.boundingSphere.radius*Math.max(E.scale.x,Math.max(E.scale.y,E.scale.z)),B=0;B<6;B++){w=F[B].x*A.n14+F[B].y*A.n24+F[B].z*A.n34+F[B].w;if(w<=H){w=!1;break a}}w=!0}w=!w}if(!w){w=g[d]=g[d]||new THREE.RenderableObject;d++;e=w;C.copy(E.position);o.multiplyVector3(C);e.object=E;e.z=C.z;r.push(e)}}G&&r.sort(b);return r};
+this.projectScene=function(t,r,G){var z=[],D=r.near,E=r.far,w,A,H,B,x,M,J,P,N,y,O,R,U,V,Q,S,T;s=k=m=0;r.matrixAutoUpdate&&r.updateMatrix();t.update(undefined,!1,r);o.multiply(r.projectionMatrix,r.matrixWorldInverse);F[0].set(o.n41-o.n11,o.n42-o.n12,o.n43-o.n13,o.n44-o.n14);F[1].set(o.n41+o.n11,o.n42+o.n12,o.n43+o.n13,o.n44+o.n14);F[2].set(o.n41+o.n21,o.n42+o.n22,o.n43+o.n23,o.n44+o.n24);F[3].set(o.n41-o.n21,o.n42-o.n22,o.n43-o.n23,o.n44-o.n24);F[4].set(o.n41-o.n31,o.n42-o.n32,o.n43-o.n33,o.n44-o.n34);
+F[5].set(o.n41+o.n31,o.n42+o.n32,o.n43+o.n33,o.n44+o.n34);for(w=0;w<6;w++){N=F[w];N.divideScalar(Math.sqrt(N.x*N.x+N.y*N.y+N.z*N.z))}N=this.projectObjects(t,r,!0);t=0;for(w=N.length;t<w;t++){y=N[t].object;if(y.visible){O=y.matrixWorld;R=y.matrixRotationWorld;U=y.materials;V=y.overdraw;i=0;if(y instanceof THREE.Mesh){Q=y.geometry;B=Q.vertices;S=Q.faces;Q=Q.faceVertexUvs;A=0;for(H=B.length;A<H;A++){f=a();f.positionWorld.copy(B[A].position);O.multiplyVector3(f.positionWorld);f.positionScreen.copy(f.positionWorld);
+o.multiplyVector4(f.positionScreen);f.positionScreen.x/=f.positionScreen.w;f.positionScreen.y/=f.positionScreen.w;f.visible=f.positionScreen.z>D&&f.positionScreen.z<E}B=0;for(A=S.length;B<A;B++){H=S[B];if(H instanceof THREE.Face3){x=h[H.a];M=h[H.b];J=h[H.c];if(x.visible&&M.visible&&J.visible&&(y.doubleSided||y.flipSided!=(J.positionScreen.x-x.positionScreen.x)*(M.positionScreen.y-x.positionScreen.y)-(J.positionScreen.y-x.positionScreen.y)*(M.positionScreen.x-x.positionScreen.x)<0)){P=l[m]=l[m]||new THREE.RenderableFace3;
+m++;j=P;j.v1.copy(x);j.v2.copy(M);j.v3.copy(J);j.normalWorld.copy(H.normal);R.multiplyVector3(j.normalWorld);j.centroidWorld.copy(H.centroid);O.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);o.multiplyVector3(j.centroidScreen);J=H.vertexNormals;x=0;for(M=J.length;x<M;x++){P=j.vertexNormalsWorld[x];P.copy(J[x]);R.multiplyVector3(P)}x=0;for(M=Q.length;x<M;x++)if(T=Q[x][B]){J=0;for(P=T.length;J<P;J++)j.uvs[x][J]=T[J]}j.meshMaterials=U;j.faceMaterials=H.materials;j.overdraw=V;
+j.z=j.centroidScreen.z;z.push(j)}}}}else if(y instanceof THREE.Line){I.multiply(o,O);B=y.geometry.vertices;x=a();x.positionScreen.copy(B[0].position);I.multiplyVector4(x.positionScreen);A=1;for(H=B.length;A<H;A++){x=a();x.positionScreen.copy(B[A].position);I.multiplyVector4(x.positionScreen);M=h[i-2];K.copy(x.positionScreen);L.copy(M.positionScreen);if(c(K,L)){K.multiplyScalar(1/K.w);L.multiplyScalar(1/L.w);O=q[k]=q[k]||new THREE.RenderableLine;k++;n=O;n.v1.positionScreen.copy(K);n.v2.positionScreen.copy(L);
+n.z=Math.max(K.z,L.z);n.materials=y.materials;z.push(n)}}}else if(y instanceof THREE.Particle){v.set(y.position.x,y.position.y,y.position.z,1);o.multiplyVector4(v);v.z/=v.w;if(v.z>0&&v.z<1){O=u[s]=u[s]||new THREE.RenderableParticle;s++;p=O;p.x=v.x/v.w;p.y=v.y/v.w;p.z=v.z;p.rotation=y.rotation.z;p.scale.x=y.scale.x*Math.abs(p.x-(v.x+r.projectionMatrix.n11)/(v.w+r.projectionMatrix.n14));p.scale.y=y.scale.y*Math.abs(p.y-(v.y+r.projectionMatrix.n22)/(v.w+r.projectionMatrix.n24));p.materials=y.materials;
+z.push(p)}}}}G&&z.sort(b);return z}};
 THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,d,g;this.domElement=document.createElement("div");this.setSize=function(f,i){c=f;e=i;d=c/2;g=e/2};this.render=function(f,i){var h,j,m,l,n,k,q,p;a=b.projectScene(f,i);h=0;for(j=a.length;h<j;h++){n=a[h];if(n instanceof THREE.RenderableParticle){q=n.x*d+d;p=n.y*g+g;m=0;for(l=n.material.length;m<l;m++){k=n.material[m];if(k instanceof THREE.ParticleDOMMaterial){k=k.domElement;k.style.left=q+"px";k.style.top=p+"px"}}}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};

+ 79 - 78
build/custom/ThreeExtras.js

@@ -1,18 +1,18 @@
 // ThreeExtras.js r36 - http://github.com/mrdoob/three.js
-var GeometryUtils={merge:function(a,d){var b=d instanceof THREE.Mesh,c=a.vertices.length,g=b?d.geometry:d,f=a.vertices,e=g.vertices,h=a.faces,j=g.faces,l=a.faceVertexUvs[0];g=g.faceVertexUvs[0];b&&d.matrixAutoUpdate&&d.updateMatrix();for(var k=0,o=e.length;k<o;k++){var q=new THREE.Vertex(e[k].position.clone());b&&d.matrix.multiplyVector3(q.position);f.push(q)}k=0;for(o=j.length;k<o;k++){e=j[k];var m,t=e.vertexNormals;if(e instanceof THREE.Face3)m=new THREE.Face3(e.a+c,e.b+c,e.c+c);else e instanceof
-THREE.Face4&&(m=new THREE.Face4(e.a+c,e.b+c,e.c+c,e.d+c));m.centroid.copy(e.centroid);m.normal.copy(e.normal);b=0;for(f=t.length;b<f;b++){q=t[b];m.vertexNormals.push(q.clone())}m.materials=e.materials.slice();h.push(m)}k=0;for(o=g.length;k<o;k++){c=g[k];h=[];b=0;for(f=c.length;b<f;b++)h.push(new THREE.UV(c[b].u,c[b].v));l.push(h)}}},ImageUtils={loadTexture:function(a,d,b){var c=new Image,g=new THREE.Texture(c,d);c.onload=function(){g.needsUpdate=!0;b&&b(this)};c.src=a;return g},loadTextureCube:function(a,
-d,b){var c,g=[],f=new THREE.Texture(g,d);d=g.loadCount=0;for(c=a.length;d<c;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)f.needsUpdate=!0;b&&b(this)};g[d].src=a[d]}return f}},SceneUtils={loadScene:function(a,d,b,c){a=new Worker(a);a.postMessage(0);a.onmessage=function(g){function f(){for(k in E.objects)if(!F.objects[k]){B=E.objects[k];if(n=F.geometries[B.geometry]){M=[];for(i=0;i<B.materials.length;i++)M[i]=F.materials[B.materials[i]];z=B.position;r=B.rotation;s=B.scale;
-object=new THREE.Mesh(n,M);object.position.set(z[0],z[1],z[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;F.scene.addObject(object);F.objects[k]=object}}}function e(P){return function(O){F.geometries[P]=O;f();H-=1;h()}}function h(){c({total_models:L,total_textures:Q,loaded_models:L-H,loaded_textures:Q-K},F);H==0&&K==0&&b(F)}var j,l,k,o,q,m,t,B,z,x,y,n,I,D,M,E,J,H,K,L,Q,F;E=g.data;J=new THREE.Loader;K=H=0;F={scene:new THREE.Scene,geometries:{},materials:{},
-textures:{},objects:{},cameras:{},lights:{},fogs:{}};g=function(){K-=1;h()};for(q in E.cameras){x=E.cameras[q];if(x.type=="perspective")I=new THREE.Camera(x.fov,x.aspect,x.near,x.far);else if(x.type=="ortho"){I=new THREE.Camera;I.projectionMatrix=THREE.Matrix4.makeOrtho(x.left,x.right,x.top,x.bottom,x.near,x.far)}z=x.position;x=x.target;I.position.set(z[0],z[1],z[2]);I.target.position.set(x[0],x[1],x[2]);F.cameras[q]=I}for(o in E.lights){q=E.lights[o];if(q.type=="directional"){z=q.direction;light=
-new THREE.DirectionalLight;light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(q.type=="point"){z=q.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}x=q.color;i=q.intensity||1;light.color.setRGB(x[0]*i,x[1]*i,x[2]*i);F.scene.addLight(light);F.lights[o]=light}for(m in E.fogs){o=E.fogs[m];if(o.type=="linear")D=new THREE.Fog(0,o.near,o.far);else o.type=="exp2"&&(D=new THREE.FogExp2(0,o.density));x=o.color;D.color.setRGB(x[0],x[1],x[2]);F.fogs[m]=D}if(F.cameras&&
-E.defaults.camera)F.currentCamera=F.cameras[E.defaults.camera];if(F.fogs&&E.defaults.fog)F.scene.fog=F.fogs[E.defaults.fog];x=E.defaults.bgcolor;F.bgColor=new THREE.Color;F.bgColor.setRGB(x[0],x[1],x[2]);F.bgColorAlpha=E.defaults.bgalpha;for(j in E.geometries){m=E.geometries[j];if(m.type=="bin_mesh"||m.type=="ascii_mesh")H+=1}L=H;for(j in E.geometries){m=E.geometries[j];if(m.type=="cube"){n=new Cube(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides);
-F.geometries[j]=n}else if(m.type=="plane"){n=new Plane(m.width,m.height,m.segmentsWidth,m.segmentsHeight);F.geometries[j]=n}else if(m.type=="sphere"){n=new Sphere(m.radius,m.segmentsWidth,m.segmentsHeight);F.geometries[j]=n}else if(m.type=="cylinder"){n=new Cylinder(m.numSegs,m.topRad,m.botRad,m.height,m.topOffset,m.botOffset);F.geometries[j]=n}else if(m.type=="torus"){n=new Torus(m.radius,m.tube,m.segmentsR,m.segmentsT);F.geometries[j]=n}else if(m.type=="icosahedron"){n=new Icosahedron(m.subdivisions);
-F.geometries[j]=n}else if(m.type=="bin_mesh")J.loadBinary({model:m.url,callback:e(j)});else m.type=="ascii_mesh"&&J.loadAscii({model:m.url,callback:e(j)})}for(t in E.textures){j=E.textures[t];K+=j.url instanceof Array?j.url.length:1}Q=K;for(t in E.textures){j=E.textures[t];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)m=ImageUtils.loadTextureCube(j.url,j.mapping,g);else{m=ImageUtils.loadTexture(j.url,j.mapping,g);if(THREE[j.minFilter]!=
-undefined)m.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)m.magFilter=THREE[j.magFilter]}F.textures[t]=m}for(l in E.materials){t=E.materials[l];for(y in t.parameters)if(y=="envMap"||y=="map"||y=="lightMap")t.parameters[y]=F.textures[t.parameters[y]];else if(y=="shading")t.parameters[y]=t.parameters[y]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(y=="blending")t.parameters[y]=THREE[t.parameters[y]]?THREE[t.parameters[y]]:THREE.NormalBlending;else y=="combine"&&(t.parameters[y]=
-t.parameters[y]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);t=new THREE[t.type](t.parameters);F.materials[l]=t}f();d(F)}},addMesh:function(a,d,b,c,g,f,e,h,j,l){d=new THREE.Mesh(d,l);d.scale.x=d.scale.y=d.scale.z=b;d.position.x=c;d.position.y=g;d.position.z=f;d.rotation.x=e;d.rotation.y=h;d.rotation.z=j;a.addObject(d);return d},addPanoramaCubeWebGL:function(a,d,b){var c=ShaderUtils.lib.cube;c.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,
-uniforms:c.uniforms});d=new THREE.Mesh(new Cube(d,d,d,1,1,1,null,!0),b);a.addObject(d);return d},addPanoramaCube:function(a,d,b){var c=[];c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
-d=new THREE.Mesh(new Cube(d,d,d,1,1,c,!0),new THREE.MeshFaceMaterial);a.addObject(d);return d},addPanoramaCubePlanes:function(a,d,b){var c=d/2;d=new Plane(d,d);var g=Math.PI,f=Math.PI/2;SceneUtils.addMesh(a,d,1,0,0,-c,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,d,1,-c,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,d,1,c,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
-d,1,0,c,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,d,1,0,-c,0,-f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,d){SceneUtils.traverseHierarchy(a,function(b){b.visible=d})},traverseHierarchy:function(a,d){var b,c,g=a.children.length;for(c=0;c<g;c++){b=a.children[c];d(b);SceneUtils.traverseHierarchy(b,d)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
+var GeometryUtils={merge:function(a,e){var b=e instanceof THREE.Mesh,c=a.vertices.length,g=b?e.geometry:e,f=a.vertices,d=g.vertices,h=a.faces,j=g.faces,l=a.faceVertexUvs[0];g=g.faceVertexUvs[0];b&&e.matrixAutoUpdate&&e.updateMatrix();for(var k=0,o=d.length;k<o;k++){var q=new THREE.Vertex(d[k].position.clone());b&&e.matrix.multiplyVector3(q.position);f.push(q)}k=0;for(o=j.length;k<o;k++){d=j[k];var m,t=d.vertexNormals;if(d instanceof THREE.Face3)m=new THREE.Face3(d.a+c,d.b+c,d.c+c);else d instanceof
+THREE.Face4&&(m=new THREE.Face4(d.a+c,d.b+c,d.c+c,d.d+c));m.centroid.copy(d.centroid);m.normal.copy(d.normal);b=0;for(f=t.length;b<f;b++){q=t[b];m.vertexNormals.push(q.clone())}m.materials=d.materials.slice();h.push(m)}k=0;for(o=g.length;k<o;k++){c=g[k];h=[];b=0;for(f=c.length;b<f;b++)h.push(new THREE.UV(c[b].u,c[b].v));l.push(h)}}},ImageUtils={loadTexture:function(a,e,b){var c=new Image,g=new THREE.Texture(c,e);c.onload=function(){g.needsUpdate=!0;b&&b(this)};c.src=a;return g},loadTextureCube:function(a,
+e,b){var c,g=[],f=new THREE.Texture(g,e);e=g.loadCount=0;for(c=a.length;e<c;++e){g[e]=new Image;g[e].onload=function(){g.loadCount+=1;if(g.loadCount==6)f.needsUpdate=!0;b&&b(this)};g[e].src=a[e]}return f}},SceneUtils={loadScene:function(a,e,b,c){a=new Worker(a);a.postMessage(0);a.onmessage=function(g){function f(){for(k in F.objects)if(!E.objects[k]){B=F.objects[k];if(n=E.geometries[B.geometry]){M=[];for(i=0;i<B.materials.length;i++)M[i]=E.materials[B.materials[i]];z=B.position;r=B.rotation;s=B.scale;
+object=new THREE.Mesh(n,M);object.position.set(z[0],z[1],z[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;E.scene.addObject(object);E.objects[k]=object}}}function d(O){return function(U){E.geometries[O]=U;f();K-=1;h()}}function h(){c({total_models:P,total_textures:Q,loaded_models:P-K,loaded_textures:Q-L},E);K==0&&L==0&&b(E)}var j,l,k,o,q,m,t,B,z,x,y,n,H,D,M,F,J,I,K,L,P,Q,E;F=g.data;J=new THREE.BinaryLoader;I=new THREE.JSONLoader;L=K=0;E={scene:new THREE.Scene,
+geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};g=function(){L-=1;h()};for(q in F.cameras){x=F.cameras[q];if(x.type=="perspective")H=new THREE.Camera(x.fov,x.aspect,x.near,x.far);else if(x.type=="ortho"){H=new THREE.Camera;H.projectionMatrix=THREE.Matrix4.makeOrtho(x.left,x.right,x.top,x.bottom,x.near,x.far)}z=x.position;x=x.target;H.position.set(z[0],z[1],z[2]);H.target.position.set(x[0],x[1],x[2]);E.cameras[q]=H}for(o in F.lights){q=F.lights[o];if(q.type=="directional"){z=
+q.direction;light=new THREE.DirectionalLight;light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(q.type=="point"){z=q.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}x=q.color;i=q.intensity||1;light.color.setRGB(x[0]*i,x[1]*i,x[2]*i);E.scene.addLight(light);E.lights[o]=light}for(m in F.fogs){o=F.fogs[m];if(o.type=="linear")D=new THREE.Fog(0,o.near,o.far);else o.type=="exp2"&&(D=new THREE.FogExp2(0,o.density));x=o.color;D.color.setRGB(x[0],x[1],x[2]);E.fogs[m]=
+D}if(E.cameras&&F.defaults.camera)E.currentCamera=E.cameras[F.defaults.camera];if(E.fogs&&F.defaults.fog)E.scene.fog=E.fogs[F.defaults.fog];x=F.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(x[0],x[1],x[2]);E.bgColorAlpha=F.defaults.bgalpha;for(j in F.geometries){m=F.geometries[j];if(m.type=="bin_mesh"||m.type=="ascii_mesh")K+=1}P=K;for(j in F.geometries){m=F.geometries[j];if(m.type=="cube"){n=new Cube(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,
+m.sides);E.geometries[j]=n}else if(m.type=="plane"){n=new Plane(m.width,m.height,m.segmentsWidth,m.segmentsHeight);E.geometries[j]=n}else if(m.type=="sphere"){n=new Sphere(m.radius,m.segmentsWidth,m.segmentsHeight);E.geometries[j]=n}else if(m.type=="cylinder"){n=new Cylinder(m.numSegs,m.topRad,m.botRad,m.height,m.topOffset,m.botOffset);E.geometries[j]=n}else if(m.type=="torus"){n=new Torus(m.radius,m.tube,m.segmentsR,m.segmentsT);E.geometries[j]=n}else if(m.type=="icosahedron"){n=new Icosahedron(m.subdivisions);
+E.geometries[j]=n}else if(m.type=="bin_mesh")J.load({model:m.url,callback:d(j)});else m.type=="ascii_mesh"&&I.load({model:m.url,callback:d(j)})}for(t in F.textures){j=F.textures[t];L+=j.url instanceof Array?j.url.length:1}Q=L;for(t in F.textures){j=F.textures[t];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)m=ImageUtils.loadTextureCube(j.url,j.mapping,g);else{m=ImageUtils.loadTexture(j.url,j.mapping,g);if(THREE[j.minFilter]!=undefined)m.minFilter=
+THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)m.magFilter=THREE[j.magFilter]}E.textures[t]=m}for(l in F.materials){t=F.materials[l];for(y in t.parameters)if(y=="envMap"||y=="map"||y=="lightMap")t.parameters[y]=E.textures[t.parameters[y]];else if(y=="shading")t.parameters[y]=t.parameters[y]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(y=="blending")t.parameters[y]=THREE[t.parameters[y]]?THREE[t.parameters[y]]:THREE.NormalBlending;else y=="combine"&&(t.parameters[y]=t.parameters[y]==
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);t=new THREE[t.type](t.parameters);E.materials[l]=t}f();e(E)}},addMesh:function(a,e,b,c,g,f,d,h,j,l){e=new THREE.Mesh(e,l);e.scale.x=e.scale.y=e.scale.z=b;e.position.x=c;e.position.y=g;e.position.z=f;e.rotation.x=d;e.rotation.y=h;e.rotation.z=j;a.addObject(e);return e},addPanoramaCubeWebGL:function(a,e,b){var c=ShaderUtils.lib.cube;c.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,
+uniforms:c.uniforms});e=new THREE.Mesh(new Cube(e,e,e,1,1,1,null,!0),b);a.addObject(e);return e},addPanoramaCube:function(a,e,b){var c=[];c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
+e=new THREE.Mesh(new Cube(e,e,e,1,1,c,!0),new THREE.MeshFaceMaterial);a.addObject(e);return e},addPanoramaCubePlanes:function(a,e,b){var c=e/2;e=new Plane(e,e);var g=Math.PI,f=Math.PI/2;SceneUtils.addMesh(a,e,1,0,0,-c,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,e,1,-c,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,e,1,c,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
+e,1,0,c,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,e,1,0,-c,0,-f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,e){SceneUtils.traverseHierarchy(a,function(b){b.visible=e})},traverseHierarchy:function(a,e){var b,c,g=a.children.length;for(c=0;c<g;c++){b=a.children[c];e(b);SceneUtils.traverseHierarchy(b,e)}}},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},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
@@ -22,85 +22,86 @@ 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,c,g,f=2*Math.ceil(a*3)+1;f>25&&(f=25);g=(f-1)*0.5;b=Array(f);for(d=c=0;d<f;++d){b[d]=Math.exp(-((d-g)*(d-g))/(2*a*a));c+=b[d]}for(d=0;d<f;++d)b[d]/=c;return b}};
-THREE.QuakeCamera=function(a){function d(b,c){return function(){c.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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var e,b,c,g,f=2*Math.ceil(a*3)+1;f>25&&(f=25);g=(f-1)*0.5;b=Array(f);for(e=c=0;e<f;++e){b[e]=Math.exp(-((e-g)*(e-g))/(2*a*a));c+=b[e]}for(e=0;e<f;++e)b[e]/=c;return b}};
+THREE.QuakeCamera=function(a){function e(b,c){return function(){c.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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;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.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.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)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.dragToLook)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}};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(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);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.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,o,q){var m={name:o,fps:0.6,length:q,hierarchy:[]},t,B=k.getControlPointsArray(),z=k.getLength(),x=B.length,y=0;t=x-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[t]={time:q,pos:B[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<x-1;t++){y=q*z.chunks[t]/z.total;k.keys[t]={time:y,pos:B[t]}}m.hierarchy[0]=k;THREE.AnimationHandler.add(m);return new THREE.Animation(l,o,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var o,
+!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(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,e){this.matrix.rotateAxis(e);if(this.noFly)e.y=0;this.position.addSelf(e.multiplyScalar(a));this.target.position.addSelf(e.multiplyScalar(a))};
+THREE.PathCamera=function(a){function e(l,k,o,q){var m={name:o,fps:0.6,length:q,hierarchy:[]},t,B=k.getControlPointsArray(),z=k.getLength(),x=B.length,y=0;t=x-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:B[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[t]={time:q,pos:B[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<x-1;t++){y=q*z.chunks[t]/z.total;k.keys[t]={time:y,pos:B[t]}}m.hierarchy[0]=k;THREE.AnimationHandler.add(m);return new THREE.Animation(l,o,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var o,
 q,m=new THREE.Geometry;for(o=0;o<l.points.length*k;o++){q=o/(l.points.length*k);q=l.getPoint(q);m.vertices[o]=new THREE.Vertex(new THREE.Vector3(q.x,q.y,q.z))}return m}function c(l,k){var o=b(k,10),q=b(k,10),m=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(o,m);particleObj=new THREE.ParticleSystem(q,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);q=new Sphere(1,
 16,8);m=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){o=new THREE.Mesh(q,m);o.position.copy(k.points[i]);o.updateMatrix();l.addChild(o)}}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 g=Math.PI*2,f=Math.PI/180;this.update=function(l,k,o){var q,m;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;q=this.phi%g;this.phi=q>=0?q:q+g;q=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;
 this.phi=(this.phi-q[0])*(m[1]-m[0])/(q[1]-q[0])+m[0];q=this.horizontalAngleMap.srcRange;m=this.horizontalAngleMap.dstRange;this.theta=(this.theta-q[0])*(m[1]-m[0])/(q[1]-q[0])+m[0];q=this.target.position;q.x=100*Math.sin(this.phi)*Math.cos(this.theta);q.y=100*Math.cos(this.phi);q.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,o)};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 e=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,e);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&&c(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;
-var Cube=function(a,d,b,c,g,f,e,h,j){function l(z,x,y,n,I,D,M,E){var J,H,K=c||1,L=g||1,Q=I/2,F=D/2,P=k.vertices.length;if(z=="x"&&x=="y"||z=="y"&&x=="x")J="z";else if(z=="x"&&x=="z"||z=="z"&&x=="x"){J="y";L=f||1}else if(z=="z"&&x=="y"||z=="y"&&x=="z"){J="x";K=f||1}var O=K+1,Z=L+1;I/=K;var $=D/L;for(H=0;H<Z;H++)for(D=0;D<O;D++){var T=new THREE.Vector3;T[z]=(D*I-Q)*y;T[x]=(H*$-F)*n;T[J]=M;k.vertices.push(new THREE.Vertex(T))}for(H=0;H<L;H++)for(D=0;D<K;D++){k.faces.push(new THREE.Face4(D+O*H+P,D+O*
-(H+1)+P,D+1+O*(H+1)+P,D+1+O*H+P,null,null,E));k.faceVertexUvs[0].push([new THREE.UV(D/K,H/L),new THREE.UV(D/K,(H+1)/L),new THREE.UV((D+1)/K,(H+1)/L),new THREE.UV((D+1)/K,H/L)])}}THREE.Geometry.call(this);var k=this,o=a/2,q=d/2,m=b/2;h=h?-1:1;if(e!==undefined)if(e instanceof Array)this.materials=e;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([e])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var B in j)this.sides[B]!=undefined&&(this.sides[B]=
-j[B]);this.sides.px&&l("z","y",1*h,-1,b,d,-o,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,d,o,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,q,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-q,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,d,m,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,d,-m,this.materials[5]);(function(){for(var z=[],x=[],y=0,n=k.vertices.length;y<n;y++){for(var I=k.vertices[y],D=!1,M=0,E=z.length;M<E;M++){var J=z[M];if(I.position.x==J.position.x&&
-I.position.y==J.position.y&&I.position.z==J.position.z){x[y]=M;D=!0;break}}if(!D){x[y]=z.length;z.push(new THREE.Vertex(I.position.clone()))}}y=0;for(n=k.faces.length;y<n;y++){I=k.faces[y];I.a=x[I.a];I.b=x[I.b];I.c=x[I.c];I.d=x[I.d]}k.vertices=z})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,d,b,c,g,f){function e(k,o,q){h.vertices.push(new THREE.Vertex(new THREE.Vector3(k,o,q)))}THREE.Geometry.call(this);var h=this,j=Math.PI,l=c/2;for(c=0;c<a;c++)e(Math.sin(2*j*c/a)*d,Math.cos(2*j*c/a)*d,-l);for(c=0;c<a;c++)e(Math.sin(2*j*c/a)*b,Math.cos(2*j*c/a)*b,l);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){e(0,0,-l-(f||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(d>0){e(0,0,l+(g||0));
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var d=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(j,d);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
+e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(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;
+var Cube=function(a,e,b,c,g,f,d,h,j){function l(z,x,y,n,H,D,M,F){var J,I,K=c||1,L=g||1,P=H/2,Q=D/2,E=k.vertices.length;if(z=="x"&&x=="y"||z=="y"&&x=="x")J="z";else if(z=="x"&&x=="z"||z=="z"&&x=="x"){J="y";L=f||1}else if(z=="z"&&x=="y"||z=="y"&&x=="z"){J="x";K=f||1}var O=K+1,U=L+1;H/=K;var $=D/L;for(I=0;I<U;I++)for(D=0;D<O;D++){var T=new THREE.Vector3;T[z]=(D*H-P)*y;T[x]=(I*$-Q)*n;T[J]=M;k.vertices.push(new THREE.Vertex(T))}for(I=0;I<L;I++)for(D=0;D<K;D++){k.faces.push(new THREE.Face4(D+O*I+E,D+O*
+(I+1)+E,D+1+O*(I+1)+E,D+1+O*I+E,null,null,F));k.faceVertexUvs[0].push([new THREE.UV(D/K,I/L),new THREE.UV(D/K,(I+1)/L),new THREE.UV((D+1)/K,(I+1)/L),new THREE.UV((D+1)/K,I/L)])}}THREE.Geometry.call(this);var k=this,o=a/2,q=e/2,m=b/2;h=h?-1:1;if(d!==undefined)if(d instanceof Array)this.materials=d;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([d])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var B in j)this.sides[B]!=undefined&&(this.sides[B]=
+j[B]);this.sides.px&&l("z","y",1*h,-1,b,e,-o,this.materials[0]);this.sides.nx&&l("z","y",-1*h,-1,b,e,o,this.materials[1]);this.sides.py&&l("x","z",1*h,1,a,b,q,this.materials[2]);this.sides.ny&&l("x","z",1*h,-1,a,b,-q,this.materials[3]);this.sides.pz&&l("x","y",1*h,-1,a,e,m,this.materials[4]);this.sides.nz&&l("x","y",-1*h,-1,a,e,-m,this.materials[5]);(function(){for(var z=[],x=[],y=0,n=k.vertices.length;y<n;y++){for(var H=k.vertices[y],D=!1,M=0,F=z.length;M<F;M++){var J=z[M];if(H.position.x==J.position.x&&
+H.position.y==J.position.y&&H.position.z==J.position.z){x[y]=M;D=!0;break}}if(!D){x[y]=z.length;z.push(new THREE.Vertex(H.position.clone()))}}y=0;for(n=k.faces.length;y<n;y++){H=k.faces[y];H.a=x[H.a];H.b=x[H.b];H.c=x[H.c];H.d=x[H.d]}k.vertices=z})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,e,b,c,g,f){function d(k,o,q){h.vertices.push(new THREE.Vertex(new THREE.Vector3(k,o,q)))}THREE.Geometry.call(this);var h=this,j=Math.PI,l=c/2;for(c=0;c<a;c++)d(Math.sin(2*j*c/a)*e,Math.cos(2*j*c/a)*e,-l);for(c=0;c<a;c++)d(Math.sin(2*j*c/a)*b,Math.cos(2*j*c/a)*b,l);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){d(0,0,-l-(f||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(e>0){d(0,0,l+(g||0));
 for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function d(o,q,m){var t=Math.sqrt(o*o+q*q+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(o/t,q/t,m/t)))-1}function b(o,q,m,t){t.faces.push(new THREE.Face3(o,q,m))}function c(o,q){var m=g.vertices[o].position,t=g.vertices[q].position;return d((m.x+t.x)/2,(m.y+t.y)/2,(m.z+t.z)/2)}var g=this,f=new THREE.Geometry,e;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++){e=new THREE.Geometry;for(var h in f.faces){var j=c(f.faces[h].a,f.faces[h].b),l=c(f.faces[h].b,f.faces[h].c),k=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,e);b(f.faces[h].b,l,j,e);b(f.faces[h].c,
-k,l,e);b(j,l,k,e)}f.faces=e.faces}g.faces=f.faces;delete f;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,d,b){THREE.Geometry.call(this);this.steps=d||12;this.angle=b||2*Math.PI;d=this.angle/this.steps;for(var c=[],g=[],f=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(d),l=0;l<=this.angle+0.0010;l+=d){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=e;l==0&&(e=g);for(h=
-0;h<g.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],g[h+1],g[h]));this.faceVertexUvs[0].push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(a,d,b,c){THREE.Geometry.call(this);var g,f=a/2,e=d/2;b=b||1;c=c||1;var h=b+1,j=c+1;a/=b;var l=d/c;for(g=0;g<j;g++)for(d=0;d<h;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*a-f,-(g*l-e),0)));for(g=0;g<c;g++)for(d=0;d<b;d++){this.faces.push(new THREE.Face4(d+h*g,d+h*(g+1),d+1+h*(g+1),d+1+h*g));this.faceVertexUvs[0].push([new THREE.UV(d/b,g/c),new THREE.UV(d/b,(g+1)/c),new THREE.UV((d+1)/b,(g+1)/c),new THREE.UV((d+1)/b,g/c)])}this.computeCentroids();this.computeFaceNormals()};
+var Icosahedron=function(a){function e(o,q,m){var t=Math.sqrt(o*o+q*q+m*m);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(o/t,q/t,m/t)))-1}function b(o,q,m,t){t.faces.push(new THREE.Face3(o,q,m))}function c(o,q){var m=g.vertices[o].position,t=g.vertices[q].position;return e((m.x+t.x)/2,(m.y+t.y)/2,(m.z+t.z)/2)}var g=this,f=new THREE.Geometry,d;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
+1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-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++){d=new THREE.Geometry;for(var h in f.faces){var j=c(f.faces[h].a,f.faces[h].b),l=c(f.faces[h].b,f.faces[h].c),k=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,j,k,d);b(f.faces[h].b,l,j,d);b(f.faces[h].c,
+k,l,d);b(j,l,k,d)}f.faces=d.faces}g.faces=f.faces;delete f;delete d;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],g=[],f=[],d=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();g[h]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(e),l=0;l<=this.angle+0.0010;l+=e){for(h=0;h<c.length;h++)if(l<this.angle){c[h]=j.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=d;l==0&&(d=g);for(h=
+0;h<g.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],g[h+1],g[h]));this.faceVertexUvs[0].push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-e)/b,(h+1)/a.length),new THREE.UV((l-e)/b,h/a.length)])}g=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(a,e,b,c){THREE.Geometry.call(this);var g,f=a/2,d=e/2;b=b||1;c=c||1;var h=b+1,j=c+1;a/=b;var l=e/c;for(g=0;g<j;g++)for(e=0;e<h;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-f,-(g*l-d),0)));for(g=0;g<c;g++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+h*g,e+h*(g+1),e+1+h*(g+1),e+1+h*g));this.faceVertexUvs[0].push([new THREE.UV(e/b,g/c),new THREE.UV(e/b,(g+1)/c),new THREE.UV((e+1)/b,(g+1)/c),new THREE.UV((e+1)/b,g/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,d,b){THREE.Geometry.call(this);var c,g=Math.PI,f=Math.max(3,d||8),e=Math.max(2,b||6);d=[];for(b=0;b<e+1;b++){c=b/e;var h=a*Math.cos(c*g),j=a*Math.sin(c*g),l=[],k=0;for(c=0;c<f;c++){var o=2*c/f,q=j*Math.sin(o*g);o=j*Math.cos(o*g);(b==0||b==e)&&c>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,h,q)))-1);l.push(k)}d.push(l)}var m,t,B;g=d.length;for(b=0;b<g;b++){f=d[b].length;if(b>0)for(c=0;c<f;c++){l=c==f-1;e=d[b][l?0:c+1];h=d[b][l?f-1:c];j=d[b-1][l?f-1:c];l=d[b-1][l?
-0:c+1];q=b/(g-1);m=(b-1)/(g-1);t=(c+1)/f;o=c/f;k=new THREE.UV(1-t,q);q=new THREE.UV(1-o,q);o=new THREE.UV(1-o,m);var z=new THREE.UV(1-t,m);if(b<d.length-1){m=this.vertices[e].position.clone();t=this.vertices[h].position.clone();B=this.vertices[j].position.clone();m.normalize();t.normalize();B.normalize();this.faces.push(new THREE.Face3(e,h,j,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z)]));this.faceVertexUvs[0].push([k,q,o])}if(b>1){m=this.vertices[e].position.clone();
-t=this.vertices[j].position.clone();B=this.vertices[l].position.clone();m.normalize();t.normalize();B.normalize();this.faces.push(new THREE.Face3(e,j,l,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z)]));this.faceVertexUvs[0].push([k,o,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
-var Torus=function(a,d,b,c){this.radius=a||100;this.tube=d||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(d=0;d<=this.segmentsR;++d)for(b=0;b<=this.segmentsT;++b){c=b/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(c),(this.radius+this.tube*Math.cos(g))*Math.sin(c),this.tube*Math.sin(g))));a.push([b/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(b=
-1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*d+b;g=(this.segmentsT+1)*d+b-1;var f=(this.segmentsT+1)*(d-1)+b-1,e=(this.segmentsT+1)*(d-1)+b;this.faces.push(new THREE.Face4(c,g,f,e));this.faceVertexUvs[0].push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,d,b,c,g,f,e){function h(o,q,m,t,B,z){q=m/t*o;m=Math.cos(q);return new THREE.Vector3(B*(2+m)*0.5*Math.cos(o),B*(2+m)*Math.sin(o)*0.5,z*B*Math.sin(q)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=d||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=g||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=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;e=d/this.segmentsT*2*Math.PI;g=h(j,e,this.q,this.p,this.radius,this.heightScale);j=h(j+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=j.x-g.x;b.y=j.y-g.y;b.z=j.z-g.z;c.x=j.x+g.x;c.y=j.y+g.y;c.z=j.z+g.z;f.cross(b,c);c.cross(f,b);f.normalize();c.normalize();j=this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=j*c.x+e*f.x;g.y+=j*c.y+e*f.y;g.z+=j*c.z+e*f.z;this.grid[a][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(d=
-0;d<this.segmentsT;++d){f=(a+1)%this.segmentsR;e=(d+1)%this.segmentsT;g=this.grid[a][d];b=this.grid[f][d];c=this.grid[a][e];f=this.grid[f][e];e=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/this.segmentsR,(d+1)/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,b,c));this.faceVertexUvs[0].push([e,j,l]);this.faces.push(new THREE.Face3(f,c,b));this.faceVertexUvs[0].push([k,
+var Sphere=function(a,e,b){THREE.Geometry.call(this);var c,g=Math.PI,f=Math.max(3,e||8),d=Math.max(2,b||6);e=[];for(b=0;b<d+1;b++){c=b/d;var h=a*Math.cos(c*g),j=a*Math.sin(c*g),l=[],k=0;for(c=0;c<f;c++){var o=2*c/f,q=j*Math.sin(o*g);o=j*Math.cos(o*g);(b==0||b==d)&&c>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,h,q)))-1);l.push(k)}e.push(l)}var m,t,B;g=e.length;for(b=0;b<g;b++){f=e[b].length;if(b>0)for(c=0;c<f;c++){l=c==f-1;d=e[b][l?0:c+1];h=e[b][l?f-1:c];j=e[b-1][l?f-1:c];l=e[b-1][l?
+0:c+1];q=b/(g-1);m=(b-1)/(g-1);t=(c+1)/f;o=c/f;k=new THREE.UV(1-t,q);q=new THREE.UV(1-o,q);o=new THREE.UV(1-o,m);var z=new THREE.UV(1-t,m);if(b<e.length-1){m=this.vertices[d].position.clone();t=this.vertices[h].position.clone();B=this.vertices[j].position.clone();m.normalize();t.normalize();B.normalize();this.faces.push(new THREE.Face3(d,h,j,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z)]));this.faceVertexUvs[0].push([k,q,o])}if(b>1){m=this.vertices[d].position.clone();
+t=this.vertices[j].position.clone();B=this.vertices[l].position.clone();m.normalize();t.normalize();B.normalize();this.faces.push(new THREE.Face3(d,j,l,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z)]));this.faceVertexUvs[0].push([k,o,z])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Torus=function(a,e,b,c){this.radius=a||100;this.tube=e||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(e=0;e<=this.segmentsR;++e)for(b=0;b<=this.segmentsT;++b){c=b/this.segmentsT*2*Math.PI;var g=e/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(c),(this.radius+this.tube*Math.cos(g))*Math.sin(c),this.tube*Math.sin(g))));a.push([b/this.segmentsT,1-e/this.segmentsR])}for(e=1;e<=this.segmentsR;++e)for(b=
+1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*e+b;g=(this.segmentsT+1)*e+b-1;var f=(this.segmentsT+1)*(e-1)+b-1,d=(this.segmentsT+1)*(e-1)+b;this.faces.push(new THREE.Face4(c,g,f,d));this.faceVertexUvs[0].push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[d][0],a[d][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
+var TorusKnot=function(a,e,b,c,g,f,d){function h(o,q,m,t,B,z){q=m/t*o;m=Math.cos(q);return new THREE.Vector3(B*(2+m)*0.5*Math.cos(o),B*(2+m)*Math.sin(o)*0.5,z*B*Math.sin(q)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=e||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=g||2;this.q=f||3;this.heightScale=d||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(e=0;e<this.segmentsT;++e){var j=
+a/this.segmentsR*2*this.p*Math.PI;d=e/this.segmentsT*2*Math.PI;g=h(j,d,this.q,this.p,this.radius,this.heightScale);j=h(j+0.01,d,this.q,this.p,this.radius,this.heightScale);b.x=j.x-g.x;b.y=j.y-g.y;b.z=j.z-g.z;c.x=j.x+g.x;c.y=j.y+g.y;c.z=j.z+g.z;f.cross(b,c);c.cross(f,b);f.normalize();c.normalize();j=this.tube*Math.cos(d);d=this.tube*Math.sin(d);g.x+=j*c.x+d*f.x;g.y+=j*c.y+d*f.y;g.z+=j*c.z+d*f.z;this.grid[a][e]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(e=
+0;e<this.segmentsT;++e){f=(a+1)%this.segmentsR;d=(e+1)%this.segmentsT;g=this.grid[a][e];b=this.grid[f][e];c=this.grid[a][d];f=this.grid[f][d];d=new THREE.UV(a/this.segmentsR,e/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,e/this.segmentsT);var l=new THREE.UV(a/this.segmentsR,(e+1)/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(e+1)/this.segmentsT);this.faces.push(new THREE.Face3(g,b,c));this.faceVertexUvs[0].push([d,j,l]);this.faces.push(new THREE.Face3(f,c,b));this.faceVertexUvs[0].push([k,
 l,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";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 c=0;c<d.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(d[c],b)]},createMaterial:function(a,d){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function c(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)),o=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
-h.image.width=k;h.image.height=o;h.image.getContext("2d").drawImage(this,0,0,k,o)}else h.image=this;h.needsUpdate=!0};l.src=j}var g,f,e;g="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(g="MeshPhongMaterial");if(a.mapDiffuse&&d){e=document.createElement("canvas");f.map=new THREE.Texture(e);f.map.sourceFile=a.mapDiffuse;c(f.map,d+"/"+a.mapDiffuse)}else if(a.colorDiffuse){e=(a.colorDiffuse[0]*
-255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=e;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&d){e=document.createElement("canvas");f.lightMap=new THREE.Texture(e);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,d+"/"+a.mapLightmap)}return new THREE[g](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var e="Loaded ";e+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
+e},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,e,b){a.materials=[];for(var c=0;c<e.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(e[c],b)]},createMaterial:function(a,e){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function c(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)),o=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
+h.image.width=k;h.image.height=o;h.image.getContext("2d").drawImage(this,0,0,k,o)}else h.image=this;h.needsUpdate=!0};l.src=j}var g,f,d;g="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};a.shading&&a.shading=="Phong"&&(g="MeshPhongMaterial");if(a.mapDiffuse&&e){d=document.createElement("canvas");f.map=new THREE.Texture(d);f.map.sourceFile=a.mapDiffuse;c(f.map,e+"/"+a.mapDiffuse)}else if(a.colorDiffuse){d=(a.colorDiffuse[0]*
+255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=d;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&e){d=document.createElement("canvas");f.lightMap=new THREE.Texture(d);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,e+"/"+a.mapLightmap)}return new THREE[g](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=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(d);a=(new Date).getTime();d=new Worker(d);d.onmessage=function(g){THREE.JSONLoader.prototype.createModel(g.data,b,c)};d.postMessage(a)},createModel:function(a,d,b){var c=function(g){var f=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f,a.materials,g);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
-else{var e,h,j,l,k,o,q,m,t,B,z=a.faces;m=a.vertices;var x=a.normals,y=a.colors,n=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&n++;for(e=0;e<n;e++){f.faceUvs[e]=[];f.faceVertexUvs[e]=[]}j=0;for(l=m.length;j<l;){t=new THREE.Vertex;t.position.x=m[j++];t.position.y=m[j++];t.position.z=m[j++];f.vertices.push(t)}j=0;for(l=z.length;j<l;){k=z[j++];o=k&1;e=k&2;q=k&4;h=k&8;m=k&16;t=k&32;B=k&64;k&=128;if(o){o=new THREE.Face4;o.a=z[j++];o.b=z[j++];o.c=z[j++];o.d=z[j++];nVertices=4}else{o=new THREE.Face3;o.a=
-z[j++];o.b=z[j++];o.c=z[j++];nVertices=3}if(e){materialIndex=z[j++];o.materials=f.materials[materialIndex]}if(q)for(e=0;e<n;e++){uvLayer=a.uvs[e];uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];f.faceUvs[e].push(new THREE.UV(u,v))}if(h)for(e=0;e<n;e++){uvLayer=a.uvs[e];uvs=[];for(h=0;h<nVertices;h++){uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[h]=new THREE.UV(u,v)}f.faceVertexUvs[e].push(uvs)}if(m){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=x[normalIndex++];
-normal.y=x[normalIndex++];normal.z=x[normalIndex];o.normal=normal}if(t)for(e=0;e<nVertices;e++){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=x[normalIndex++];normal.y=x[normalIndex++];normal.z=x[normalIndex];o.vertexNormals.push(normal)}if(B){color=new THREE.Color(z[j++]);o.color=color}if(k)for(e=0;e<nVertices;e++){colorIndex=z[j++];color=new THREE.Color(y[colorIndex]);o.vertexColors.push(color)}f.faces.push(o)}}})();(function(){var e,h,j,l;if(a.skinWeights){e=0;for(h=a.skinWeights.length;e<
-h;e+=2){j=a.skinWeights[e];l=a.skinWeights[e+1];f.skinWeights.push(new THREE.Vector4(j,l,0,0))}}if(a.skinIndices){e=0;for(h=a.skinIndices.length;e<h;e+=2){j=a.skinIndices[e];l=a.skinIndices[e+1];f.skinIndices.push(new THREE.Vector4(j,l,0,0))}}f.bones=a.bones;f.animation=a.animation})();this.computeCentroids();this.computeFaceNormals()};c.prototype=new THREE.Geometry;c.prototype.constructor=c;d(new c(b))}};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,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=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(e){THREE.BinaryLoader.prototype.loadAjaxBuffers(e.data.buffers,e.data.materials,b,g,c,f)};d.onerror=function(e){alert("worker.onerror: "+e.message+"\n"+e.data);e.preventDefault()};
-d.postMessage(a)},loadAjaxBuffers:function(a,d,b,c,g,f){var e=new XMLHttpRequest,h=c+"/"+a,j=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,g,d):alert("Couldn't load ["+h+"] ["+e.status+"]");else if(e.readyState==3){if(f){j==0&&(j=e.getResponseHeader("Content-Length"));f({total:j,loaded:e.responseText.length})}}else e.readyState==2&&(j=e.getResponseHeader("Content-Length"))};e.open("GET",h,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
-e.setRequestHeader("Content-Type","text/plain");e.send(null)},createBinModel:function(a,d,b,c){var g=function(f){function e(p,w){var A=k(p,w),C=k(p,w+1),G=k(p,w+2),N=k(p,w+3),R=(N<<1&255|G>>7)-127;A|=(G&127)<<16|C<<8;if(A==0&&R==-127)return 0;return(1-2*(N>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,R)}function h(p,w){var A=k(p,w),C=k(p,w+1),G=k(p,w+2);return(k(p,w+3)<<24)+(G<<16)+(C<<8)+A}function j(p,w){var A=k(p,w);return(k(p,w+1)<<8)+A}function l(p,w){var A=k(p,w);return A>127?A-256:A}function k(p,
-w){return p.charCodeAt(w)&255}function o(p){var w,A,C;w=h(a,p);A=h(a,p+M);C=h(a,p+E);p=j(a,p+J);THREE.BinaryLoader.prototype.f3(x,w,A,C,p)}function q(p){var w,A,C,G,N,R;w=h(a,p);A=h(a,p+M);C=h(a,p+E);G=j(a,p+J);N=h(a,p+H);R=h(a,p+K);p=h(a,p+L);THREE.BinaryLoader.prototype.f3n(x,I,w,A,C,G,N,R,p)}function m(p){var w,A,C,G;w=h(a,p);A=h(a,p+Q);C=h(a,p+F);G=h(a,p+P);p=j(a,p+O);THREE.BinaryLoader.prototype.f4(x,w,A,C,G,p)}function t(p){var w,A,C,G,N,R,aa,ba;w=h(a,p);A=h(a,p+Q);C=h(a,p+F);G=h(a,p+P);N=j(a,
-p+O);R=h(a,p+Z);aa=h(a,p+$);ba=h(a,p+T);p=h(a,p+ca);THREE.BinaryLoader.prototype.f4n(x,I,w,A,C,G,N,R,aa,ba,p)}function B(p){var w,A;w=h(a,p);A=h(a,p+da);p=h(a,p+ea);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],D[w*2],D[w*2+1],D[A*2],D[A*2+1],D[p*2],D[p*2+1])}function z(p){var w,A,C;w=h(a,p);A=h(a,p+fa);C=h(a,p+ga);p=h(a,p+ha);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],D[w*2],D[w*2+1],D[A*2],D[A*2+1],D[C*2],D[C*2+1],D[p*2],D[p*2+1])}var x=this,y=0,n,I=[],D=[],M,E,J,H,K,L,Q,F,P,O,Z,
-$,T,ca,da,ea,fa,ga,ha,U,V,W,X,Y,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,c,f);n={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+=n.header_bytes;M=n.vertex_index_bytes;E=n.vertex_index_bytes*2;J=n.vertex_index_bytes*3;H=n.vertex_index_bytes*3+n.material_index_bytes;K=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;Q=n.vertex_index_bytes;F=n.vertex_index_bytes*2;P=n.vertex_index_bytes*3;O=n.vertex_index_bytes*4;Z=n.vertex_index_bytes*
-4+n.material_index_bytes;$=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;T=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;ca=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;da=n.uv_index_bytes;ea=n.uv_index_bytes*2;fa=n.uv_index_bytes;ga=n.uv_index_bytes*2;ha=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;S=n.vertex_index_bytes*4+n.material_index_bytes;U=n.ntri_flat*f;V=n.ntri_smooth*(f+n.normal_index_bytes*3);W=n.ntri_flat_uv*
-(f+n.uv_index_bytes*3);X=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);Y=n.nquad_flat*S;f=n.nquad_smooth*(S+n.normal_index_bytes*4);S=n.nquad_flat_uv*(S+n.uv_index_bytes*4);y+=function(p){for(var w,A,C,G=n.vertex_coordinate_bytes*3,N=p+n.nvertices*G;p<N;p+=G){w=e(a,p);A=e(a,p+n.vertex_coordinate_bytes);C=e(a,p+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(x,w,A,C)}return n.nvertices*G}(y);y+=function(p){for(var w,A,C,G=n.normal_coordinate_bytes*3,N=p+n.nnormals*G;p<
-N;p+=G){w=l(a,p);A=l(a,p+n.normal_coordinate_bytes);C=l(a,p+n.normal_coordinate_bytes*2);I.push(w/127,A/127,C/127)}return n.nnormals*G}(y);y+=function(p){for(var w,A,C=n.uv_coordinate_bytes*2,G=p+n.nuvs*C;p<G;p+=C){w=e(a,p);A=e(a,p+n.uv_coordinate_bytes);D.push(w,A)}return n.nuvs*C}(y);U=y+U;V=U+V;W=V+W;X=W+X;Y=X+Y;f=Y+f;S=f+S;(function(p){var w,A=n.vertex_index_bytes*3+n.material_index_bytes,C=A+n.uv_index_bytes*3,G=p+n.ntri_flat_uv*C;for(w=p;w<G;w+=C){o(w);B(w+A)}return G-p})(V);(function(p){var w,
-A=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,C=A+n.uv_index_bytes*3,G=p+n.ntri_smooth_uv*C;for(w=p;w<G;w+=C){q(w);B(w+A)}return G-p})(W);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes,C=A+n.uv_index_bytes*4,G=p+n.nquad_flat_uv*C;for(w=p;w<G;w+=C){m(w);z(w+A)}return G-p})(f);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,C=A+n.uv_index_bytes*4,G=p+n.nquad_smooth_uv*C;for(w=p;w<G;w+=C){t(w);z(w+A)}return G-p})(S);
-(function(p){var w,A=n.vertex_index_bytes*3+n.material_index_bytes,C=p+n.ntri_flat*A;for(w=p;w<C;w+=A)o(w);return C-p})(y);(function(p){var w,A=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,C=p+n.ntri_smooth*A;for(w=p;w<C;w+=A)q(w);return C-p})(U);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes,C=p+n.nquad_flat*A;for(w=p;w<C;w+=A)m(w);return C-p})(X);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,C=p+n.nquad_smooth*
-A;for(w=p;w<C;w+=A)t(w);return C-p})(Y);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(b))},v:function(a,d,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(d,b,c)))},f3:function(a,d,b,c,g){a.faces.push(new THREE.Face3(d,b,c,null,null,a.materials[g]))},f4:function(a,d,b,c,g,f){a.faces.push(new THREE.Face4(d,b,c,g,null,null,a.materials[f]))},f3n:function(a,d,b,c,g,f,e,h,j){f=a.materials[f];var l=d[h*3],k=d[h*3+1];h=d[h*3+2];
-var o=d[j*3],q=d[j*3+1];j=d[j*3+2];a.faces.push(new THREE.Face3(b,c,g,[new THREE.Vector3(d[e*3],d[e*3+1],d[e*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(o,q,j)],f))},f4n:function(a,d,b,c,g,f,e,h,j,l,k){e=a.materials[e];var o=d[j*3],q=d[j*3+1];j=d[j*3+2];var m=d[l*3],t=d[l*3+1];l=d[l*3+2];var B=d[k*3],z=d[k*3+1];k=d[k*3+2];a.faces.push(new THREE.Face4(b,c,g,f,[new THREE.Vector3(d[h*3],d[h*3+1],d[h*3+2]),new THREE.Vector3(o,q,j),new THREE.Vector3(m,t,l),new THREE.Vector3(B,z,k)],e))},uv3:function(a,
-d,b,c,g,f,e){var h=[];h.push(new THREE.UV(d,b));h.push(new THREE.UV(c,g));h.push(new THREE.UV(f,e));a.push(h)},uv4:function(a,d,b,c,g,f,e,h,j){var l=[];l.push(new THREE.UV(d,b));l.push(new THREE.UV(c,g));l.push(new THREE.UV(f,e));l.push(new THREE.UV(h,j));a.push(l)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
-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,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,f,e,h,j,l,k,o){e=(e-k)/(o-k);k=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=j;c[f+2]=l;g[f]=this.lerp(k[b],k[b+3],e);g[f+1]=this.lerp(k[b+1],k[b+4],e);g[f+2]=this.lerp(k[b+2],k[b+5],e)};this.VIntY=function(b,c,g,f,e,h,j,l,k,o){e=(e-k)/(o-k);k=this.normal_cache;c[f]=h;c[f+1]=j+e*this.delta;c[f+
-2]=l;c=b+this.yd*3;g[f]=this.lerp(k[b],k[c],e);g[f+1]=this.lerp(k[b+1],k[c+1],e);g[f+2]=this.lerp(k[b+2],k[c+2],e)};this.VIntZ=function(b,c,g,f,e,h,j,l,k,o){e=(e-k)/(o-k);k=this.normal_cache;c[f]=h;c[f+1]=j;c[f+2]=l+e*this.delta;c=b+this.zd*3;g[f]=this.lerp(k[b],k[c],e);g[f+1]=this.lerp(k[b+1],k[c+1],e);g[f+2]=this.lerp(k[b+2],k[c+2],e)};this.compNorm=function(b){var c=b*3;if(this.normal_cache[c]==0){this.normal_cache[c]=this.field[b-1]-this.field[b+1];this.normal_cache[c+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,c,g,f,e,h){var j=f+1,l=f+this.yd,k=f+this.zd,o=j+this.yd,q=j+this.zd,m=f+this.yd+this.zd,t=j+this.yd+this.zd,B=0,z=this.field[f],x=this.field[j],y=this.field[l],n=this.field[o],I=this.field[k],D=this.field[q],M=this.field[m],E=this.field[t];z<e&&(B|=1);x<e&&(B|=2);y<e&&(B|=8);n<e&&(B|=4);I<e&&(B|=16);D<e&&(B|=32);M<e&&(B|=128);E<e&&(B|=64);var J=THREE.edgeTable[B];if(J==0)return 0;
-var H=this.delta,K=b+H,L=c+H;H=g+H;if(J&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,e,b,c,g,z,x)}if(J&2){this.compNorm(j);this.compNorm(o);this.VIntY(j*3,this.vlist,this.nlist,3,e,K,c,g,x,n)}if(J&4){this.compNorm(l);this.compNorm(o);this.VIntX(l*3,this.vlist,this.nlist,6,e,b,L,g,y,n)}if(J&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,e,b,c,g,z,y)}if(J&16){this.compNorm(k);this.compNorm(q);this.VIntX(k*3,this.vlist,this.nlist,12,e,b,c,H,
-I,D)}if(J&32){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,15,e,K,c,H,D,E)}if(J&64){this.compNorm(m);this.compNorm(t);this.VIntX(m*3,this.vlist,this.nlist,18,e,b,L,H,M,E)}if(J&128){this.compNorm(k);this.compNorm(m);this.VIntY(k*3,this.vlist,this.nlist,21,e,b,c,H,I,M)}if(J&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,e,b,c,g,z,I)}if(J&512){this.compNorm(j);this.compNorm(q);this.VIntZ(j*3,this.vlist,this.nlist,27,e,K,c,g,x,D)}if(J&1024){this.compNorm(o);
-this.compNorm(t);this.VIntZ(o*3,this.vlist,this.nlist,30,e,K,L,g,n,E)}if(J&2048){this.compNorm(l);this.compNorm(m);this.VIntZ(l*3,this.vlist,this.nlist,33,e,b,L,g,y,M)}B<<=4;for(e=f=0;THREE.triTable[B+e]!=-1;){b=B+e;c=b+1;g=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],h);e+=3;f++}return f};this.posnormtriv=function(b,c,g,f,e,h){var j=this.count*3;this.positionArray[j]=b[g];this.positionArray[j+1]=b[g+1];this.positionArray[j+2]=b[g+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[e];this.positionArray[j+7]=b[e+1];this.positionArray[j+8]=b[e+2];this.normalArray[j]=c[g];this.normalArray[j+1]=c[g+1];this.normalArray[j+2]=c[g+2];this.normalArray[j+3]=c[f];this.normalArray[j+4]=c[f+1];this.normalArray[j+5]=c[f+2];this.normalArray[j+6]=c[e];this.normalArray[j+7]=c[e+1];this.normalArray[j+8]=c[e+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 c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,f,e){var h=this.size*Math.sqrt(f/e),j=g*this.size,l=c*this.size,k=b*this.size,o=Math.floor(j-h);o<1&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var q=Math.floor(l-h);q<1&&(q=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var t,B,z,x,y,n;o<j;o++){k=this.size2*o;B=o/this.size-g;y=B*B;for(B=q;B<l;B++){z=k+this.size*B;t=B/this.size-c;n=t*t;for(t=m;t<h;t++){x=t/this.size-b;x=f/(1.0E-6+x*x+n+y)-e;x>0&&(this.field[z+t]+=x)}}}};this.addPlaneX=function(b,c){var g,f,e,h,j,l=this.size,k=this.yd,o=this.zd,q=this.field,m=l*Math.sqrt(b/c);m>l&&(m=l);for(g=0;g<m;g++){f=g/l;f*=f;h=b/(1.0E-4+f)-c;if(h>0)for(f=0;f<l;f++){j=g+f*k;for(e=0;e<l;e++)q[o*e+j]+=h}}};this.addPlaneY=function(b,c){var g,f,
-e,h,j,l,k=this.size,o=this.yd,q=this.zd,m=this.field,t=k*Math.sqrt(b/c);t>k&&(t=k);for(f=0;f<t;f++){g=f/k;g*=g;h=b/(1.0E-4+g)-c;if(h>0){j=f*o;for(g=0;g<k;g++){l=j+g;for(e=0;e<k;e++)m[q*e+l]+=h}}}};this.addPlaneZ=function(b,c){var g,f,e,h,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(e=0;e<dist;e++){g=e/size;g*=g;h=b/(1.0E-4+g)-c;if(h>0){j=zd*e;for(f=0;f<size;f++){l=j+f*yd;for(g=0;g<size;g++)field[l+g]+=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 c,g,f,e,h,j,l,k,o,q=this.size-2;for(e=1;e<q;e++){o=this.size2*e;l=(e-this.halfsize)/this.halfsize;for(f=1;f<q;f++){k=o+this.size*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<q;g++){h=(g-this.halfsize)/this.halfsize;c=k+g;this.polygonize(h,j,l,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry;this.render(function(g){var f,e,h,j,l,k,o,q;for(f=
-0;f<g.count;f++){l=f*3;o=l+1;q=l+2;e=g.positionArray[l];h=g.positionArray[o];j=g.positionArray[q];k=new THREE.Vector3(e,h,j);e=g.normalArray[l];h=g.normalArray[o];j=g.normalArray[q];l=new THREE.Vector3(e,h,j);l.normalize();l=new THREE.Vertex(k,l);c.vertices.push(l)}nfaces=g.count/3;for(f=0;f<nfaces;f++){l=(b+f)*3;o=l+1;q=l+2;k=c.vertices[l].normal;e=c.vertices[o].normal;h=c.vertices[q].normal;l=new THREE.Face3(l,o,q,[k,e,h]);c.faces.push(l)}b+=nfaces;g.count=0});return c};this.init(a)};
+THREE.JSONLoader.prototype={load:function(a){var e=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);e.onmessage=function(g){THREE.JSONLoader.prototype.createModel(g.data,b,c)};e.postMessage(a)},createModel:function(a,e,b){var c=function(g){var f=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f,a.materials,g);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
+else{var d,h,j,l,k,o,q,m,t,B,z=a.faces;m=a.vertices;var x=a.normals,y=a.colors,n=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&n++;for(d=0;d<n;d++){f.faceUvs[d]=[];f.faceVertexUvs[d]=[]}j=0;for(l=m.length;j<l;){t=new THREE.Vertex;t.position.x=m[j++];t.position.y=m[j++];t.position.z=m[j++];f.vertices.push(t)}j=0;for(l=z.length;j<l;){k=z[j++];o=k&1;d=k&2;q=k&4;h=k&8;m=k&16;t=k&32;B=k&64;k&=128;if(o){o=new THREE.Face4;o.a=z[j++];o.b=z[j++];o.c=z[j++];o.d=z[j++];nVertices=4}else{o=new THREE.Face3;o.a=
+z[j++];o.b=z[j++];o.c=z[j++];nVertices=3}if(d){materialIndex=z[j++];o.materials=f.materials[materialIndex]}if(q)for(d=0;d<n;d++){uvLayer=a.uvs[d];uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];f.faceUvs[d].push(new THREE.UV(u,v))}if(h)for(d=0;d<n;d++){uvLayer=a.uvs[d];uvs=[];for(h=0;h<nVertices;h++){uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[h]=new THREE.UV(u,v)}f.faceVertexUvs[d].push(uvs)}if(m){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=x[normalIndex++];
+normal.y=x[normalIndex++];normal.z=x[normalIndex];o.normal=normal}if(t)for(d=0;d<nVertices;d++){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=x[normalIndex++];normal.y=x[normalIndex++];normal.z=x[normalIndex];o.vertexNormals.push(normal)}if(B){color=new THREE.Color(z[j++]);o.color=color}if(k)for(d=0;d<nVertices;d++){colorIndex=z[j++];color=new THREE.Color(y[colorIndex]);o.vertexColors.push(color)}f.faces.push(o)}}})();(function(){var d,h,j,l;if(a.skinWeights){d=0;for(h=a.skinWeights.length;d<
+h;d+=2){j=a.skinWeights[d];l=a.skinWeights[d+1];f.skinWeights.push(new THREE.Vector4(j,l,0,0))}}if(a.skinIndices){d=0;for(h=a.skinIndices.length;d<h;d+=2){j=a.skinIndices[d];l=a.skinIndices[d+1];f.skinIndices.push(new THREE.Vector4(j,l,0,0))}}f.bones=a.bones;f.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var d,h,j,l;d=0;for(h=a.morphTargets.length;d<h;d++){f.morphTargets[d]={};f.morphTargets[d].name=a.morphTargets[d].name;f.morphTargets[d].vertices=[];dstVertices=f.morphTargets[d].vertices;
+srcVertices=a.morphTargets[d].vertices;j=0;for(l=srcVertices.length;j<l;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();this.computeCentroids();this.computeFaceNormals()};c.prototype=new THREE.Geometry;c.prototype.constructor=c;e(new c(b))}};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 e=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(e),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;e.onmessage=function(d){THREE.BinaryLoader.prototype.loadAjaxBuffers(d.data.buffers,d.data.materials,b,g,c,f)};e.onerror=function(d){alert("worker.onerror: "+d.message+"\n"+d.data);d.preventDefault()};
+e.postMessage(a)},loadAjaxBuffers:function(a,e,b,c,g,f){var d=new XMLHttpRequest,h=c+"/"+a,j=0;d.onreadystatechange=function(){if(d.readyState==4)d.status==200||d.status==0?THREE.BinaryLoader.prototype.createBinModel(d.responseText,b,g,e):alert("Couldn't load ["+h+"] ["+d.status+"]");else if(d.readyState==3){if(f){j==0&&(j=d.getResponseHeader("Content-Length"));f({total:j,loaded:d.responseText.length})}}else d.readyState==2&&(j=d.getResponseHeader("Content-Length"))};d.open("GET",h,!0);d.overrideMimeType("text/plain; charset=x-user-defined");
+d.setRequestHeader("Content-Type","text/plain");d.send(null)},createBinModel:function(a,e,b,c){var g=function(f){function d(p,w){var A=k(p,w),C=k(p,w+1),G=k(p,w+2),N=k(p,w+3),R=(N<<1&255|G>>7)-127;A|=(G&127)<<16|C<<8;if(A==0&&R==-127)return 0;return(1-2*(N>>7))*(1+A*Math.pow(2,-23))*Math.pow(2,R)}function h(p,w){var A=k(p,w),C=k(p,w+1),G=k(p,w+2);return(k(p,w+3)<<24)+(G<<16)+(C<<8)+A}function j(p,w){var A=k(p,w);return(k(p,w+1)<<8)+A}function l(p,w){var A=k(p,w);return A>127?A-256:A}function k(p,
+w){return p.charCodeAt(w)&255}function o(p){var w,A,C;w=h(a,p);A=h(a,p+M);C=h(a,p+F);p=j(a,p+J);THREE.BinaryLoader.prototype.f3(x,w,A,C,p)}function q(p){var w,A,C,G,N,R;w=h(a,p);A=h(a,p+M);C=h(a,p+F);G=j(a,p+J);N=h(a,p+I);R=h(a,p+K);p=h(a,p+L);THREE.BinaryLoader.prototype.f3n(x,H,w,A,C,G,N,R,p)}function m(p){var w,A,C,G;w=h(a,p);A=h(a,p+P);C=h(a,p+Q);G=h(a,p+E);p=j(a,p+O);THREE.BinaryLoader.prototype.f4(x,w,A,C,G,p)}function t(p){var w,A,C,G,N,R,aa,ba;w=h(a,p);A=h(a,p+P);C=h(a,p+Q);G=h(a,p+E);N=j(a,
+p+O);R=h(a,p+U);aa=h(a,p+$);ba=h(a,p+T);p=h(a,p+ca);THREE.BinaryLoader.prototype.f4n(x,H,w,A,C,G,N,R,aa,ba,p)}function B(p){var w,A;w=h(a,p);A=h(a,p+da);p=h(a,p+ea);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],D[w*2],D[w*2+1],D[A*2],D[A*2+1],D[p*2],D[p*2+1])}function z(p){var w,A,C;w=h(a,p);A=h(a,p+fa);C=h(a,p+ga);p=h(a,p+ha);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],D[w*2],D[w*2+1],D[A*2],D[A*2+1],D[C*2],D[C*2+1],D[p*2],D[p*2+1])}var x=this,y=0,n,H=[],D=[],M,F,J,I,K,L,P,Q,E,O,U,
+$,T,ca,da,ea,fa,ga,ha,V,W,X,Y,Z,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,c,f);n={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+=n.header_bytes;M=n.vertex_index_bytes;F=n.vertex_index_bytes*2;J=n.vertex_index_bytes*3;I=n.vertex_index_bytes*3+n.material_index_bytes;K=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;P=n.vertex_index_bytes;Q=n.vertex_index_bytes*2;E=n.vertex_index_bytes*3;O=n.vertex_index_bytes*4;U=n.vertex_index_bytes*
+4+n.material_index_bytes;$=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;T=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;ca=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;da=n.uv_index_bytes;ea=n.uv_index_bytes*2;fa=n.uv_index_bytes;ga=n.uv_index_bytes*2;ha=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;S=n.vertex_index_bytes*4+n.material_index_bytes;V=n.ntri_flat*f;W=n.ntri_smooth*(f+n.normal_index_bytes*3);X=n.ntri_flat_uv*
+(f+n.uv_index_bytes*3);Y=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);Z=n.nquad_flat*S;f=n.nquad_smooth*(S+n.normal_index_bytes*4);S=n.nquad_flat_uv*(S+n.uv_index_bytes*4);y+=function(p){for(var w,A,C,G=n.vertex_coordinate_bytes*3,N=p+n.nvertices*G;p<N;p+=G){w=d(a,p);A=d(a,p+n.vertex_coordinate_bytes);C=d(a,p+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(x,w,A,C)}return n.nvertices*G}(y);y+=function(p){for(var w,A,C,G=n.normal_coordinate_bytes*3,N=p+n.nnormals*G;p<
+N;p+=G){w=l(a,p);A=l(a,p+n.normal_coordinate_bytes);C=l(a,p+n.normal_coordinate_bytes*2);H.push(w/127,A/127,C/127)}return n.nnormals*G}(y);y+=function(p){for(var w,A,C=n.uv_coordinate_bytes*2,G=p+n.nuvs*C;p<G;p+=C){w=d(a,p);A=d(a,p+n.uv_coordinate_bytes);D.push(w,A)}return n.nuvs*C}(y);V=y+V;W=V+W;X=W+X;Y=X+Y;Z=Y+Z;f=Z+f;S=f+S;(function(p){var w,A=n.vertex_index_bytes*3+n.material_index_bytes,C=A+n.uv_index_bytes*3,G=p+n.ntri_flat_uv*C;for(w=p;w<G;w+=C){o(w);B(w+A)}return G-p})(W);(function(p){var w,
+A=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,C=A+n.uv_index_bytes*3,G=p+n.ntri_smooth_uv*C;for(w=p;w<G;w+=C){q(w);B(w+A)}return G-p})(X);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes,C=A+n.uv_index_bytes*4,G=p+n.nquad_flat_uv*C;for(w=p;w<G;w+=C){m(w);z(w+A)}return G-p})(f);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,C=A+n.uv_index_bytes*4,G=p+n.nquad_smooth_uv*C;for(w=p;w<G;w+=C){t(w);z(w+A)}return G-p})(S);
+(function(p){var w,A=n.vertex_index_bytes*3+n.material_index_bytes,C=p+n.ntri_flat*A;for(w=p;w<C;w+=A)o(w);return C-p})(y);(function(p){var w,A=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,C=p+n.ntri_smooth*A;for(w=p;w<C;w+=A)q(w);return C-p})(V);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes,C=p+n.nquad_flat*A;for(w=p;w<C;w+=A)m(w);return C-p})(Y);(function(p){var w,A=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,C=p+n.nquad_smooth*
+A;for(w=p;w<C;w+=A)t(w);return C-p})(Z);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;e(new g(b))},v:function(a,e,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(e,b,c)))},f3:function(a,e,b,c,g){a.faces.push(new THREE.Face3(e,b,c,null,null,a.materials[g]))},f4:function(a,e,b,c,g,f){a.faces.push(new THREE.Face4(e,b,c,g,null,null,a.materials[f]))},f3n:function(a,e,b,c,g,f,d,h,j){f=a.materials[f];var l=e[h*3],k=e[h*3+1];h=e[h*3+2];
+var o=e[j*3],q=e[j*3+1];j=e[j*3+2];a.faces.push(new THREE.Face3(b,c,g,[new THREE.Vector3(e[d*3],e[d*3+1],e[d*3+2]),new THREE.Vector3(l,k,h),new THREE.Vector3(o,q,j)],null,f))},f4n:function(a,e,b,c,g,f,d,h,j,l,k){d=a.materials[d];var o=e[j*3],q=e[j*3+1];j=e[j*3+2];var m=e[l*3],t=e[l*3+1];l=e[l*3+2];var B=e[k*3],z=e[k*3+1];k=e[k*3+2];a.faces.push(new THREE.Face4(b,c,g,f,[new THREE.Vector3(e[h*3],e[h*3+1],e[h*3+2]),new THREE.Vector3(o,q,j),new THREE.Vector3(m,t,l),new THREE.Vector3(B,z,k)],null,d))},
+uv3:function(a,e,b,c,g,f,d){var h=[];h.push(new THREE.UV(e,b));h.push(new THREE.UV(c,g));h.push(new THREE.UV(f,d));a.push(h)},uv4:function(a,e,b,c,g,f,d,h,j){var l=[];l.push(new THREE.UV(e,b));l.push(new THREE.UV(c,g));l.push(new THREE.UV(f,d));l.push(new THREE.UV(h,j));a.push(l)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+THREE.MarchingCubes=function(a,e){THREE.Object3D.call(this);this.materials=e instanceof Array?e:[e];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,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,f,d,h,j,l,k,o){d=(d-k)/(o-k);k=this.normal_cache;c[f]=h+d*this.delta;c[f+1]=j;c[f+2]=l;g[f]=this.lerp(k[b],k[b+3],d);g[f+1]=this.lerp(k[b+1],k[b+4],d);g[f+2]=this.lerp(k[b+2],k[b+5],d)};this.VIntY=function(b,c,g,f,d,h,j,l,k,o){d=(d-k)/(o-k);k=this.normal_cache;c[f]=h;c[f+1]=j+d*this.delta;c[f+
+2]=l;c=b+this.yd*3;g[f]=this.lerp(k[b],k[c],d);g[f+1]=this.lerp(k[b+1],k[c+1],d);g[f+2]=this.lerp(k[b+2],k[c+2],d)};this.VIntZ=function(b,c,g,f,d,h,j,l,k,o){d=(d-k)/(o-k);k=this.normal_cache;c[f]=h;c[f+1]=j;c[f+2]=l+d*this.delta;c=b+this.zd*3;g[f]=this.lerp(k[b],k[c],d);g[f+1]=this.lerp(k[b+1],k[c+1],d);g[f+2]=this.lerp(k[b+2],k[c+2],d)};this.compNorm=function(b){var c=b*3;if(this.normal_cache[c]==0){this.normal_cache[c]=this.field[b-1]-this.field[b+1];this.normal_cache[c+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,c,g,f,d,h){var j=f+1,l=f+this.yd,k=f+this.zd,o=j+this.yd,q=j+this.zd,m=f+this.yd+this.zd,t=j+this.yd+this.zd,B=0,z=this.field[f],x=this.field[j],y=this.field[l],n=this.field[o],H=this.field[k],D=this.field[q],M=this.field[m],F=this.field[t];z<d&&(B|=1);x<d&&(B|=2);y<d&&(B|=8);n<d&&(B|=4);H<d&&(B|=16);D<d&&(B|=32);M<d&&(B|=128);F<d&&(B|=64);var J=THREE.edgeTable[B];if(J==0)return 0;
+var I=this.delta,K=b+I,L=c+I;I=g+I;if(J&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,d,b,c,g,z,x)}if(J&2){this.compNorm(j);this.compNorm(o);this.VIntY(j*3,this.vlist,this.nlist,3,d,K,c,g,x,n)}if(J&4){this.compNorm(l);this.compNorm(o);this.VIntX(l*3,this.vlist,this.nlist,6,d,b,L,g,y,n)}if(J&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,d,b,c,g,z,y)}if(J&16){this.compNorm(k);this.compNorm(q);this.VIntX(k*3,this.vlist,this.nlist,12,d,b,c,I,
+H,D)}if(J&32){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,15,d,K,c,I,D,F)}if(J&64){this.compNorm(m);this.compNorm(t);this.VIntX(m*3,this.vlist,this.nlist,18,d,b,L,I,M,F)}if(J&128){this.compNorm(k);this.compNorm(m);this.VIntY(k*3,this.vlist,this.nlist,21,d,b,c,I,H,M)}if(J&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,d,b,c,g,z,H)}if(J&512){this.compNorm(j);this.compNorm(q);this.VIntZ(j*3,this.vlist,this.nlist,27,d,K,c,g,x,D)}if(J&1024){this.compNorm(o);
+this.compNorm(t);this.VIntZ(o*3,this.vlist,this.nlist,30,d,K,L,g,n,F)}if(J&2048){this.compNorm(l);this.compNorm(m);this.VIntZ(l*3,this.vlist,this.nlist,33,d,b,L,g,y,M)}B<<=4;for(d=f=0;THREE.triTable[B+d]!=-1;){b=B+d;c=b+1;g=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],h);d+=3;f++}return f};this.posnormtriv=function(b,c,g,f,d,h){var j=this.count*3;this.positionArray[j]=b[g];this.positionArray[j+1]=b[g+1];this.positionArray[j+2]=b[g+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[d];this.positionArray[j+7]=b[d+1];this.positionArray[j+8]=b[d+2];this.normalArray[j]=c[g];this.normalArray[j+1]=c[g+1];this.normalArray[j+2]=c[g+2];this.normalArray[j+3]=c[f];this.normalArray[j+4]=c[f+1];this.normalArray[j+5]=c[f+2];this.normalArray[j+6]=c[d];this.normalArray[j+7]=c[d+1];this.normalArray[j+8]=c[d+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 c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,f,d){var h=this.size*Math.sqrt(f/d),j=g*this.size,l=c*this.size,k=b*this.size,o=Math.floor(j-h);o<1&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var q=Math.floor(l-h);q<1&&(q=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);
+h>this.size-1&&(h=this.size-1);for(var t,B,z,x,y,n;o<j;o++){k=this.size2*o;B=o/this.size-g;y=B*B;for(B=q;B<l;B++){z=k+this.size*B;t=B/this.size-c;n=t*t;for(t=m;t<h;t++){x=t/this.size-b;x=f/(1.0E-6+x*x+n+y)-d;x>0&&(this.field[z+t]+=x)}}}};this.addPlaneX=function(b,c){var g,f,d,h,j,l=this.size,k=this.yd,o=this.zd,q=this.field,m=l*Math.sqrt(b/c);m>l&&(m=l);for(g=0;g<m;g++){f=g/l;f*=f;h=b/(1.0E-4+f)-c;if(h>0)for(f=0;f<l;f++){j=g+f*k;for(d=0;d<l;d++)q[o*d+j]+=h}}};this.addPlaneY=function(b,c){var g,f,
+d,h,j,l,k=this.size,o=this.yd,q=this.zd,m=this.field,t=k*Math.sqrt(b/c);t>k&&(t=k);for(f=0;f<t;f++){g=f/k;g*=g;h=b/(1.0E-4+g)-c;if(h>0){j=f*o;for(g=0;g<k;g++){l=j+g;for(d=0;d<k;d++)m[q*d+l]+=h}}}};this.addPlaneZ=function(b,c){var g,f,d,h,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(d=0;d<dist;d++){g=d/size;g*=g;h=b/(1.0E-4+g)-c;if(h>0){j=zd*d;for(f=0;f<size;f++){l=j+f*yd;for(g=0;g<size;g++)field[l+g]+=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 c,g,f,d,h,j,l,k,o,q=this.size-2;for(d=1;d<q;d++){o=this.size2*d;l=(d-this.halfsize)/this.halfsize;for(f=1;f<q;f++){k=o+this.size*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<q;g++){h=(g-this.halfsize)/this.halfsize;c=k+g;this.polygonize(h,j,l,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry;this.render(function(g){var f,d,h,j,l,k,o,q;for(f=
+0;f<g.count;f++){l=f*3;o=l+1;q=l+2;d=g.positionArray[l];h=g.positionArray[o];j=g.positionArray[q];k=new THREE.Vector3(d,h,j);d=g.normalArray[l];h=g.normalArray[o];j=g.normalArray[q];l=new THREE.Vector3(d,h,j);l.normalize();l=new THREE.Vertex(k,l);c.vertices.push(l)}nfaces=g.count/3;for(f=0;f<nfaces;f++){l=(b+f)*3;o=l+1;q=l+2;k=c.vertices[l].normal;d=c.vertices[o].normal;h=c.vertices[q].normal;l=new THREE.Face3(l,o,q,[k,d,h]);c.faces.push(l)}b+=nfaces;g.count=0});return c};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,

+ 38 - 38
build/custom/ThreeSVG.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):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(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(y,u,I,q){q=q.clone().subSelf(u);I=I.clone().subSelf(u);var n=y.clone().subSelf(u);y=q.dot(q);u=q.dot(I);q=q.dot(n);var D=I.dot(I);I=I.dot(n);n=1/(y*D-u*u);D=(D*q-u*I)*n;y=(y*I-u*q)*n;return D>0&&y>0&&D+y<1}var c,e,d,f,g,i,h,j,o,m,
-l,k=a.geometry,r=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];m=this.origin.clone();l=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(r[d.a].position.clone());g=h.multiplyVector3(r[d.b].position.clone());i=h.multiplyVector3(r[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(r[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());o=l.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,m))/o;m=m.addSelf(l.multiplyScalar(j));
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,d=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(d=d.concat(this.intersectObject(c)))}d.sort(function(f,g){return f.distance-g.distance});return d},intersectObject:function(a){function b(z,u,I,q){q=q.clone().subSelf(u);I=I.clone().subSelf(u);var n=z.clone().subSelf(u);z=q.dot(q);u=q.dot(I);q=q.dot(n);var D=I.dot(I);I=I.dot(n);n=1/(z*D-u*u);D=(D*q-u*I)*n;z=(z*I-u*q)*n;return D>0&&z>0&&D+z<1}var c,e,d,f,g,i,h,j,o,m,
+l,k=a.geometry,s=k.vertices,p=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];m=this.origin.clone();l=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(s[d.a].position.clone());g=h.multiplyVector3(s[d.b].position.clone());i=h.multiplyVector3(s[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(s[d.d].position.clone()):null;j=a.matrixRotationWorld.multiplyVector3(d.normal.clone());o=l.dot(j);if(o<0){j=j.dot((new THREE.Vector3).sub(f,m))/o;m=m.addSelf(l.multiplyScalar(j));
 if(d instanceof THREE.Face3){if(b(m,f,g,i)){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}else if(d instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,i,h))){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};p.push(d)}}}return p}};
 THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,f,g,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return d};this.set=function(h,j,o,m){i=!1;b=h;c=j;e=o;d=m;a()};this.addPoint=function(h,j){if(i){i=!1;b=h;c=j;e=h;d=j}else{b=b<h?b:h;c=c<j?c:j;e=e>h?e:h;d=d>j?d:j}a()};
 this.add3Points=function(h,j,o,m,l,k){if(i){i=!1;b=h<o?h<l?h:l:o<l?o:l;c=j<m?j<k?j:k:m<k?m:k;e=h>o?h>l?h:l:o>l?o:l;d=j>m?j>k?j:k:m>k?m:k}else{b=h<o?h<l?h<b?h:b:l<b?l:b:o<l?o<b?o:b:l<b?l:b;c=j<m?j<k?j<c?j:c:k<c?k:c:m<k?m<c?m:c:k<c?k:c;e=h>o?h>l?h>e?h:e:l>e?l:e:o>l?o>e?o:e:l>e?l:e;d=j>m?j>k?j>d?j:d:k>d?k:d:m>k?m>d?m:d:k>d?k:d}a()};this.addRectangle=function(h){if(i){i=!1;b=h.getLeft();c=h.getTop();e=h.getRight();d=h.getBottom()}else{b=b<h.getLeft()?b:h.getLeft();c=c<h.getTop()?c:h.getTop();e=e>h.getRight()?
 e:h.getRight();d=d>h.getBottom()?d:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;e+=h;d+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();d=d<h.getBottom()?d:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(d,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;d=e=c=b=0;a()};this.isEmpty=function(){return i}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,r,p){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,o||1,m||0,l||0,k||0,r||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,r,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=m;this.n41=l;this.n42=k;this.n43=r;this.n44=p;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,s,p){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,o||1,m||0,l||0,k||0,s||0,p||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,i,h,j,o,m,l,k,s,p){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=o;this.n34=m;this.n41=l;this.n42=k;this.n43=s;this.n44=p;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
 d=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();if(e.length()===0){f.x+=1.0E-4;e.cross(c,f).normalize()}d.cross(f,e).normalize();this.n11=e.x;this.n12=d.x;this.n13=f.x;this.n21=e.y;this.n22=d.y;this.n23=f.y;this.n31=e.z;this.n32=d.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,d=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*d;a.y=(this.n21*b+this.n22*c+this.n23*
 e+this.n24)*d;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*d;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,d=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*d;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*d;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*d;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*d;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,l=a.n33,k=a.n34,r=a.n41,p=a.n42,y=a.n43,u=a.n44,I=b.n11,q=b.n12,n=b.n13,D=b.n14,H=b.n21,L=b.n22,
-M=b.n23,R=b.n24,z=b.n31,A=b.n32,O=b.n33,w=b.n34;this.n11=c*I+e*H+d*z;this.n12=c*q+e*L+d*A;this.n13=c*n+e*M+d*O;this.n14=c*D+e*R+d*w+f;this.n21=g*I+i*H+h*z;this.n22=g*q+i*L+h*A;this.n23=g*n+i*M+h*O;this.n24=g*D+i*R+h*w+j;this.n31=o*I+m*H+l*z;this.n32=o*q+m*L+l*A;this.n33=o*n+m*M+l*O;this.n34=o*D+m*R+l*w+k;this.n41=r*I+p*H+y*z;this.n42=r*q+p*L+y*A;this.n43=r*n+p*M+y*O;this.n44=r*D+p*R+y*w+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,l=a.n33,k=a.n34,s=a.n41,p=a.n42,z=a.n43,u=a.n44,I=b.n11,q=b.n12,n=b.n13,D=b.n14,H=b.n21,N=b.n22,
+O=b.n23,A=b.n24,w=b.n31,P=b.n32,J=b.n33,y=b.n34;this.n11=c*I+e*H+d*w;this.n12=c*q+e*N+d*P;this.n13=c*n+e*O+d*J;this.n14=c*D+e*A+d*y+f;this.n21=g*I+i*H+h*w;this.n22=g*q+i*N+h*P;this.n23=g*n+i*O+h*J;this.n24=g*D+i*A+h*y+j;this.n31=o*I+m*H+l*w;this.n32=o*q+m*N+l*P;this.n33=o*n+m*O+l*J;this.n34=o*D+m*A+l*y+k;this.n41=s*I+p*H+z*w;this.n42=s*q+p*N+z*P;this.n43=s*n+p*O+z*J;this.n44=s*D+p*A+z*y+u;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);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(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
-this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,m=this.n34,l=this.n41,k=this.n42,r=this.n43,p=this.n44;return e*g*j*l-c*i*j*l-e*f*o*l+b*i*o*l+c*f*m*l-b*g*m*l-e*g*h*k+c*i*h*k+e*d*o*k-a*i*o*k-c*d*m*k+a*g*m*k+e*f*h*r-b*i*h*r-e*d*j*r+a*i*j*r+b*d*m*r-a*f*m*r-c*f*h*p+b*g*h*p+c*d*j*p-a*g*j*p-b*d*o*p+a*f*o*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
+this.n11,b=this.n12,c=this.n13,e=this.n14,d=this.n21,f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,o=this.n33,m=this.n34,l=this.n41,k=this.n42,s=this.n43,p=this.n44;return e*g*j*l-c*i*j*l-e*f*o*l+b*i*o*l+c*f*m*l-b*g*m*l-e*g*h*k+c*i*h*k+e*d*o*k-a*i*o*k-c*d*m*k+a*g*m*k+e*f*h*s-b*i*h*s-e*d*j*s+a*i*j*s+b*d*m*s-a*f*m*s-c*f*h*p+b*g*h*p+c*d*j*p-a*g*j*p-b*d*o*p+a*f*o*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
 this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
 this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
@@ -34,8 +34,8 @@ b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:functio
 f+c,h*g-e*i,h*i+e*g,0,h*g+e*i,j*g+c,j*i-e*f,0,h*i-e*g,j*i+e*f,d*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var d=Math.cos(c);c=Math.sin(c);var f=Math.cos(e);e=Math.sin(e);var g=a*c,i=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=i*f+a*e;this.n22=-i*e+a*f;this.n23=-b*d;this.n31=-g*f+b*e;this.n32=g*e+b*f;this.n33=a*d;return this},setRotationFromQuaternion:function(a){var b=
 a.x,c=a.y,e=a.z,d=a.w,f=b+b,g=c+c,i=e+e;a=b*f;var h=b*g;b*=i;var j=c*g;c*=i;e*=i;f*=d;g*=d;d*=i;this.n11=1-(j+e);this.n12=h-d;this.n13=b+g;this.n21=h+d;this.n22=1-(a+e);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
 a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,d=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*d;this.n23=a.n23*d;this.n33=a.n33*d}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,l=a.n33,k=a.n34,r=a.n41,p=a.n42,y=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*l*p+j*m*y-i*k*y-h*m*u+i*l*u;b.n12=f*l*p-d*k*p-f*m*y+e*k*y+d*m*u-e*l*u;b.n13=d*j*p-f*h*p+f*i*y-e*j*y-d*i*u+e*h*u;b.n14=f*h*m-d*j*m-f*i*l+e*j*l+d*i*k-e*h*k;b.n21=j*l*r-h*k*r-j*o*y+g*k*y+h*o*u-g*l*u;b.n22=d*k*r-f*l*r+f*o*y-c*k*y-d*o*u+c*l*u;b.n23=f*h*r-d*j*r-f*g*y+c*j*y+d*g*u-c*h*u;
-b.n24=d*j*o-f*h*o+f*g*l-c*j*l-d*g*k+c*h*k;b.n31=i*k*r-j*m*r+j*o*p-g*k*p-i*o*u+g*m*u;b.n32=f*m*r-e*k*r-f*o*p+c*k*p+e*o*u-c*m*u;b.n33=d*j*r-f*i*r+f*g*p-c*j*p-e*g*u+c*i*u;b.n34=f*i*o-e*j*o-f*g*m+c*j*m+e*g*k-c*i*k;b.n41=h*m*r-i*l*r-h*o*p+g*l*p+i*o*y-g*m*y;b.n42=e*l*r-d*m*r+d*o*p-c*l*p-e*o*y+c*m*y;b.n43=d*i*r-e*h*r-d*g*p+c*h*p+e*g*y-c*i*y;b.n44=e*h*o-d*i*o+d*g*m-c*h*m-e*g*l+c*i*l;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,d=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,o=a.n31,m=a.n32,l=a.n33,k=a.n34,s=a.n41,p=a.n42,z=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*p-j*l*p+j*m*z-i*k*z-h*m*u+i*l*u;b.n12=f*l*p-d*k*p-f*m*z+e*k*z+d*m*u-e*l*u;b.n13=d*j*p-f*h*p+f*i*z-e*j*z-d*i*u+e*h*u;b.n14=f*h*m-d*j*m-f*i*l+e*j*l+d*i*k-e*h*k;b.n21=j*l*s-h*k*s-j*o*z+g*k*z+h*o*u-g*l*u;b.n22=d*k*s-f*l*s+f*o*z-c*k*z-d*o*u+c*l*u;b.n23=f*h*s-d*j*s-f*g*z+c*j*z+d*g*u-c*h*u;
+b.n24=d*j*o-f*h*o+f*g*l-c*j*l-d*g*k+c*h*k;b.n31=i*k*s-j*m*s+j*o*p-g*k*p-i*o*u+g*m*u;b.n32=f*m*s-e*k*s-f*o*p+c*k*p+e*o*u-c*m*u;b.n33=d*j*s-f*i*s+f*g*p-c*j*p-e*g*u+c*i*u;b.n34=f*i*o-e*j*o-f*g*m+c*j*m+e*g*k-c*i*k;b.n41=h*m*s-i*l*s-h*o*p+g*l*p+i*o*z-g*m*z;b.n42=e*l*s-d*m*s+d*o*p-c*l*p-e*o*z+c*m*z;b.n43=d*i*s-e*h*s-d*g*p+c*h*p+e*g*z-c*i*z;b.n44=e*h*o-d*i*o+d*g*m-c*h*m-e*g*l+c*i*l;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,d=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*d;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*o;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,d,f){var g;g=new THREE.Matrix4;g.n11=2*d/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*d/(e-c);g.n23=(e+c)/(e-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+d)/(f-d);g.n34=-2*f*d/(f-d);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,e){var d;a=c*Math.tan(a*Math.PI/360);d=-a;return THREE.Matrix4.makeFrustum(d*b,a*b,d,a,c,e)};
 THREE.Matrix4.makeOrtho=function(a,b,c,e,d,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-e;j=f-d;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+e)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+d)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
@@ -56,10 +56,10 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,d,f,g,i=new THREE.Vector3,h=new THREE.Vector3;e=0;for(d=this.faces.length;e<d;e++){f=this.faces[e];if(a&&f.vertexNormals.length){i.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)i.addSelf(f.vertexNormals[b]);i.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];g=this.vertices[f.c];i.sub(g.position,c.position);h.sub(b.position,c.position);i.crossSelf(h)}i.isZero()||
 i.normalize();f.normal.copy(i)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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{e=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);
-c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(w,P,N,E,G,B,x){f=w.vertices[P].position;g=w.vertices[N].position;i=w.vertices[E].position;h=d[G];j=d[B];o=d[x];m=g.x-f.x;l=i.x-f.x;k=g.y-f.y;r=i.y-f.y;p=g.z-f.z;y=i.z-f.z;u=j.u-h.u;I=o.u-h.u;q=j.v-h.v;n=o.v-h.v;D=1/(u*n-I*q);M.set((n*
-m-q*l)*D,(n*k-q*r)*D,(n*p-q*y)*D);R.set((u*l-I*m)*D,(u*r-I*k)*D,(u*y-I*p)*D);H[P].addSelf(M);H[N].addSelf(M);H[E].addSelf(M);L[P].addSelf(R);L[N].addSelf(R);L[E].addSelf(R)}var b,c,e,d,f,g,i,h,j,o,m,l,k,r,p,y,u,I,q,n,D,H=[],L=[],M=new THREE.Vector3,R=new THREE.Vector3,z=new THREE.Vector3,A=new THREE.Vector3,O=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){H[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];d=this.faceVertexUvs[b][0];if(e instanceof
+c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(y,M,E,L,Q,v,B){f=y.vertices[M].position;g=y.vertices[E].position;i=y.vertices[L].position;h=d[Q];j=d[v];o=d[B];m=g.x-f.x;l=i.x-f.x;k=g.y-f.y;s=i.y-f.y;p=g.z-f.z;z=i.z-f.z;u=j.u-h.u;I=o.u-h.u;q=j.v-h.v;n=o.v-h.v;D=1/(u*n-I*q);O.set((n*
+m-q*l)*D,(n*k-q*s)*D,(n*p-q*z)*D);A.set((u*l-I*m)*D,(u*s-I*k)*D,(u*z-I*p)*D);H[M].addSelf(O);H[E].addSelf(O);H[L].addSelf(O);N[M].addSelf(A);N[E].addSelf(A);N[L].addSelf(A)}var b,c,e,d,f,g,i,h,j,o,m,l,k,s,p,z,u,I,q,n,D,H=[],N=[],O=new THREE.Vector3,A=new THREE.Vector3,w=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){H[b]=new THREE.Vector3;N[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];d=this.faceVertexUvs[b][0];if(e instanceof
 THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<
-c;b++){O.copy(this.vertices[b].normal);e=H[b];z.copy(e);z.subSelf(O.multiplyScalar(O.dot(e))).normalize();A.cross(this.vertices[b].normal,e);e=A.dot(L[b]);e=e<0?-1:1;this.vertices[b].tangent.set(z.x,z.y,z.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=
+c;b++){J.copy(this.vertices[b].normal);e=H[b];w.copy(e);w.subSelf(J.multiplyScalar(J.dot(e))).normalize();P.cross(this.vertices[b].normal,e);e=P.dot(N[b]);e=e<0?-1:1;this.vertices[b].tangent.set(w.x,w.y,w.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=
 1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},
 computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var f=0;f<a.length;f++)a[f].update(d)};c.addToUpdate=function(d){a.indexOf(d)===-1&&a.push(d)};c.removeFromUpdate=function(d){d=a.indexOf(d);d!==-1&&a.splice(d,1)};c.add=function(d){b[d.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+d.name+" already exists in library. Overwriting.");b[d.name]=d;if(d.initialized!==!0){for(var f=0;f<d.hierarchy.length;f++){for(var g=0;g<d.hierarchy[f].keys.length;g++){if(d.hierarchy[f].keys[g].time<
@@ -71,7 +71,7 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 d instanceof THREE.Bone?d.skinMatrix:d.matrix}var f=d.animationCache.prevKey;d=d.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];d.pos=this.getNextKeyWith("pos",c,1);d.rot=this.getNextKeyWith("rot",c,1);d.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 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 b=["pos","rot","scl"],c,e,d,f,g,i,h,j,o=this.data.JIT.hierarchy,m,l;this.currentTime+=a*this.timeScale;l=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,r=this.hierarchy.length;k<r;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,o=this.data.JIT.hierarchy,m,l;this.currentTime+=a*this.timeScale;l=this.currentTime;m=this.currentTime%=this.data.length;j=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,s=this.hierarchy.length;k<s;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&o[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=o[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
 !1}else{a.matrix=o[k][j];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 p=0;p<3;p++){c=b[p];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=l){if(m<l)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<m;){g=i;i=this.getNextKeyWith(c,k,i.index+1)}}else{this.stop();return}else{do{g=i;i=this.getNextKeyWith(c,k,i.index+1)}while(i.time<
 m)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(i.time-g.time);d=g[c];f=i[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+k);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=d[0]+(f[0]-d[0])*e;c.y=d[1]+(f[1]-d[1])*e;c.z=d[2]+(f[2]-d[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",k,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",k,i.index+1).pos;e=e*0.33+0.33;d=this.interpolateCatmullRom(this.points,e);c.x=d[0];c.y=d[1];c.z=d[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(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
@@ -121,31 +121,31 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.f
 THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 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.Projector=function(){function a(){var z=h[i]=h[i]||new THREE.RenderableVertex;i++;return z}function b(z,A){return A.z-z.z}function c(z,A){var O=0,w=1,P=z.z+z.w,N=A.z+A.w,E=-z.z+z.w,G=-A.z+A.w;if(P>=0&&N>=0&&E>=0&&G>=0)return!0;else if(P<0&&N<0||E<0&&G<0)return!1;else{if(P<0)O=Math.max(O,P/(P-N));else N<0&&(w=Math.min(w,P/(P-N)));if(E<0)O=Math.max(O,E/(E-G));else G<0&&(w=Math.min(w,E/(E-G)));if(w<O)return!1;else{z.lerpSelf(A,O);A.lerpSelf(z,1-w);return!0}}}var e,d,f=[],g,i,h=[],j,o,m=[],l,k,
-r=[],p,y,u=[],I=new THREE.Vector4,q=new THREE.Vector4,n=new THREE.Matrix4,D=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,M=new THREE.Vector4,R;this.projectVector=function(z,A){n.multiply(A.projectionMatrix,A.matrixWorldInverse);n.multiplyVector3(z);return z};this.unprojectVector=function(z,A){n.multiply(THREE.Matrix4.makeInvert(A.projectionMatrix),A.matrixWorld);n.multiplyVector3(z);return z};
-this.projectObjects=function(z,A,O){A=[];var w,P,N;d=0;P=z.objects;z=0;for(w=P.length;z<w;z++){N=P[z];var E;if(!(E=!N.visible))if(E=N instanceof THREE.Mesh){a:{E=void 0;for(var G=N.matrixWorld,B=-N.geometry.boundingSphere.radius*Math.max(N.scale.x,Math.max(N.scale.y,N.scale.z)),x=0;x<6;x++){E=H[x].x*G.n14+H[x].y*G.n24+H[x].z*G.n34+H[x].w;if(E<=B){E=!1;break a}}E=!0}E=!E}if(!E){E=f[d]=f[d]||new THREE.RenderableObject;d++;e=E;I.copy(N.position);n.multiplyVector3(I);e.object=N;e.z=I.z;A.push(e)}}O&&
-A.sort(b);return A};this.projectScene=function(z,A,O){var w=[],P=A.near,N=A.far,E,G,B,x,F,C,t,s,J,S,v,K,Q,T;y=k=o=0;A.matrixAutoUpdate&&A.updateMatrix();z.update(undefined,!1,A);n.multiply(A.projectionMatrix,A.matrixWorldInverse);H[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);H[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);H[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);H[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);H[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-
-n.n33,n.n44-n.n34);H[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);for(E=0;E<6;E++){F=H[E];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}F=this.projectObjects(z,A,!0);z=0;for(E=F.length;z<E;z++){C=F[z].object;if(C.visible){t=C.matrixWorld;J=C.matrixRotationWorld;s=C.materials;i=0;if(C instanceof THREE.Mesh){S=C.geometry;v=S.vertices;K=S.faces;G=0;for(B=v.length;G<B;G++){g=a();g.positionWorld.copy(v[G].position);t.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);
-n.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>P&&g.positionScreen.z<N}G=0;for(B=K.length;G<B;G++){v=K[G];if(v instanceof THREE.Face3){x=h[v.a];Q=h[v.b];T=h[v.c];if(x.visible&&Q.visible&&T.visible&&(C.doubleSided||C.flipSided!=(T.positionScreen.x-x.positionScreen.x)*(Q.positionScreen.y-x.positionScreen.y)-(T.positionScreen.y-x.positionScreen.y)*(Q.positionScreen.x-x.positionScreen.x)<0)){var U=m[o]=m[o]||
-new THREE.RenderableFace3;o++;j=U;j.v1.copy(x);j.v2.copy(Q);j.v3.copy(T);j.normalWorld.copy(v.normal);J.multiplyVector3(j.normalWorld);j.centroidWorld.copy(v.centroid);t.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);n.multiplyVector3(j.centroidScreen);Q=v.vertexNormals;R=j.vertexNormalsWorld;for(x=0;x<3;x++){T=R[x];T.copy(Q[x]);J.multiplyVector3(T)}if(x=S.faceVertexUvs[0][G]){j.uvs[0]=x[0];j.uvs[1]=x[1];j.uvs[2]=x[2]}j.meshMaterials=s;j.faceMaterials=v.materials;j.z=j.centroidScreen.z;
-w.push(j)}}}}else if(C instanceof THREE.Line){D.multiply(n,t);v=C.geometry.vertices;x=a();x.positionScreen.copy(v[0].position);D.multiplyVector4(x.positionScreen);G=1;for(B=v.length;G<B;G++){x=a();x.positionScreen.copy(v[G].position);D.multiplyVector4(x.positionScreen);Q=h[i-2];L.copy(x.positionScreen);M.copy(Q.positionScreen);if(c(L,M)){L.multiplyScalar(1/L.w);M.multiplyScalar(1/M.w);t=r[k]=r[k]||new THREE.RenderableLine;k++;l=t;l.v1.positionScreen.copy(L);l.v2.positionScreen.copy(M);l.z=Math.max(L.z,
-M.z);l.materials=C.materials;w.push(l)}}}else if(C instanceof THREE.Particle){q.set(C.position.x,C.position.y,C.position.z,1);n.multiplyVector4(q);q.z/=q.w;if(q.z>0&&q.z<1){t=u[y]=u[y]||new THREE.RenderableParticle;y++;p=t;p.x=q.x/q.w;p.y=q.y/q.w;p.z=q.z;p.rotation=C.rotation.z;p.scale.x=C.scale.x*Math.abs(p.x-(q.x+A.projectionMatrix.n11)/(q.w+A.projectionMatrix.n14));p.scale.y=C.scale.y*Math.abs(p.y-(q.y+A.projectionMatrix.n22)/(q.w+A.projectionMatrix.n24));p.materials=C.materials;w.push(p)}}}}O&&
-w.sort(b);return w}};
-THREE.SVGRenderer=function(){function a(B,x,F){var C,t,s,J;C=0;for(t=B.lights.length;C<t;C++){s=B.lights[C];if(s instanceof THREE.DirectionalLight){J=x.normalWorld.dot(s.position)*s.intensity;if(J>0){F.r+=s.color.r*J;F.g+=s.color.g*J;F.b+=s.color.b*J}}else if(s instanceof THREE.PointLight){R.sub(s.position,x.centroidWorld);R.normalize();J=x.normalWorld.dot(R)*s.intensity;if(J>0){F.r+=s.color.r*J;F.g+=s.color.g*J;F.b+=s.color.b*J}}}}function b(B,x,F,C,t,s){w=e(P++);w.setAttribute("d","M "+B.positionScreen.x+
-" "+B.positionScreen.y+" L "+x.positionScreen.x+" "+x.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(s,C,n);q.r=t.color.r*n.r;q.g=t.color.g*n.g;q.b=t.color.b*n.b;q.updateStyleString()}else q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){M=1-t.__2near/(t.__farPlusNear-C.z*t.__farMinusNear);
-q.setRGB(M,M,M)}else t instanceof THREE.MeshNormalMaterial&&q.setRGB(d(C.normalWorld.x),d(C.normalWorld.y),d(C.normalWorld.z));t.wireframe?w.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):w.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+t.opacity);i.appendChild(w)}function c(B,x,F,C,t,s,J){w=e(P++);w.setAttribute("d",
-"M "+B.positionScreen.x+" "+B.positionScreen.y+" L "+x.positionScreen.x+" "+x.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)q.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(J,t,n);q.r=s.color.r*n.r;q.g=s.color.g*n.g;q.b=s.color.b*n.b;q.updateStyleString()}else q.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){M=
-1-s.__2near/(s.__farPlusNear-t.z*s.__farMinusNear);q.setRGB(M,M,M)}else s instanceof THREE.MeshNormalMaterial&&q.setRGB(d(t.normalWorld.x),d(t.normalWorld.y),d(t.normalWorld.z));s.wireframe?w.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+s.wireframeLinewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframeLinecap+"; stroke-linejoin: "+s.wireframeLinejoin):w.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+s.opacity);i.appendChild(w)}
-function e(B){if(z[B]==null){z[B]=document.createElementNS("http://www.w3.org/2000/svg","path");G==0&&z[B].setAttribute("shape-rendering","crispEdges")}return z[B]}function d(B){return B<0?Math.min((1+B)*0.5,0.5):0.5+Math.min(B*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,o,m,l,k,r,p,y=new THREE.Rectangle,u=new THREE.Rectangle,I=!1,q=new THREE.Color(16777215),n=new THREE.Color(16777215),D=new THREE.Color(0),H=new THREE.Color(0),L=new THREE.Color(0),
-M,R=new THREE.Vector3,z=[],A=[],O=[],w,P,N,E,G=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(B){switch(B){case "high":G=1;break;case "low":G=0}};this.setSize=function(B,x){h=B;j=x;o=h/2;m=j/2;i.setAttribute("viewBox",-o+" "+-m+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);y.set(-o,-m,o,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(B,x){var F,C,t,s,J,S,v,K;this.autoClear&&
-this.clear();f=g.projectScene(B,x,this.sortElements);E=N=P=0;if(I=B.lights.length>0){v=B.lights;D.setRGB(0,0,0);H.setRGB(0,0,0);L.setRGB(0,0,0);F=0;for(C=v.length;F<C;F++){t=v[F];s=t.color;if(t instanceof THREE.AmbientLight){D.r+=s.r;D.g+=s.g;D.b+=s.b}else if(t instanceof THREE.DirectionalLight){H.r+=s.r;H.g+=s.g;H.b+=s.b}else if(t instanceof THREE.PointLight){L.r+=s.r;L.g+=s.g;L.b+=s.b}}}F=0;for(C=f.length;F<C;F++){v=f[F];u.empty();if(v instanceof THREE.RenderableParticle){l=v;l.x*=o;l.y*=-m;t=0;
-for(s=v.materials.length;t<s;t++)if(K=v.materials[t]){J=l;S=v;var Q=N++;if(A[Q]==null){A[Q]=document.createElementNS("http://www.w3.org/2000/svg","circle");G==0&&A[Q].setAttribute("shape-rendering","crispEdges")}w=A[Q];w.setAttribute("cx",J.x);w.setAttribute("cy",J.y);w.setAttribute("r",S.scale.x*o);if(K instanceof THREE.ParticleCircleMaterial){if(I){n.r=D.r+H.r+L.r;n.g=D.g+H.g+L.g;n.b=D.b+H.b+L.b;q.r=K.color.r*n.r;q.g=K.color.g*n.g;q.b=K.color.b*n.b;q.updateStyleString()}else q=K.color;w.setAttribute("style",
-"fill: "+q.__styleString)}i.appendChild(w)}}else if(v instanceof THREE.RenderableLine){l=v.v1;k=v.v2;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);if(y.instersects(u)){t=0;for(s=v.materials.length;t<s;)if(K=v.materials[t++]){J=l;S=k;Q=E++;if(O[Q]==null){O[Q]=document.createElementNS("http://www.w3.org/2000/svg","line");G==0&&O[Q].setAttribute("shape-rendering",
-"crispEdges")}w=O[Q];w.setAttribute("x1",J.positionScreen.x);w.setAttribute("y1",J.positionScreen.y);w.setAttribute("x2",S.positionScreen.x);w.setAttribute("y2",S.positionScreen.y);if(K instanceof THREE.LineBasicMaterial){q.__styleString=K.color.__styleString;w.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin);i.appendChild(w)}}}}else if(v instanceof THREE.RenderableFace3){l=
-v.v1;k=v.v2;r=v.v3;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;r.positionScreen.x*=o;r.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(r.positionScreen.x,r.positionScreen.y);if(y.instersects(u)){t=0;for(s=v.meshMaterials.length;t<s;){K=v.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){J=0;for(S=v.faceMaterials.length;J<S;)(K=v.faceMaterials[J++])&&b(l,k,r,v,
-K,B)}else K&&b(l,k,r,v,K,B)}}}else if(v instanceof THREE.RenderableFace4){l=v.v1;k=v.v2;r=v.v3;p=v.v4;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;r.positionScreen.x*=o;r.positionScreen.y*=-m;p.positionScreen.x*=o;p.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(r.positionScreen.x,r.positionScreen.y);u.addPoint(p.positionScreen.x,p.positionScreen.y);if(y.instersects(u)){t=
-0;for(s=v.meshMaterials.length;t<s;){K=v.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){J=0;for(S=v.faceMaterials.length;J<S;)(K=v.faceMaterials[J++])&&c(l,k,r,p,v,K,B)}else K&&c(l,k,r,p,v,K,B)}}}}}};
+THREE.Projector=function(){function a(){var A=h[i]=h[i]||new THREE.RenderableVertex;i++;return A}function b(A,w){return w.z-A.z}function c(A,w){var P=0,J=1,y=A.z+A.w,M=w.z+w.w,E=-A.z+A.w,L=-w.z+w.w;if(y>=0&&M>=0&&E>=0&&L>=0)return!0;else if(y<0&&M<0||E<0&&L<0)return!1;else{if(y<0)P=Math.max(P,y/(y-M));else M<0&&(J=Math.min(J,y/(y-M)));if(E<0)P=Math.max(P,E/(E-L));else L<0&&(J=Math.min(J,E/(E-L)));if(J<P)return!1;else{A.lerpSelf(w,P);w.lerpSelf(A,1-J);return!0}}}var e,d,f=[],g,i,h=[],j,o,m=[],l,k,
+s=[],p,z,u=[],I=new THREE.Vector4,q=new THREE.Vector4,n=new THREE.Matrix4,D=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(A,w){n.multiply(w.projectionMatrix,w.matrixWorldInverse);n.multiplyVector3(A);return A};this.unprojectVector=function(A,w){n.multiply(THREE.Matrix4.makeInvert(w.projectionMatrix),w.matrixWorld);n.multiplyVector3(A);return A};this.projectObjects=
+function(A,w,P){w=[];var J,y,M;d=0;y=A.objects;A=0;for(J=y.length;A<J;A++){M=y[A];var E;if(!(E=!M.visible))if(E=M instanceof THREE.Mesh){a:{E=void 0;for(var L=M.matrixWorld,Q=-M.geometry.boundingSphere.radius*Math.max(M.scale.x,Math.max(M.scale.y,M.scale.z)),v=0;v<6;v++){E=H[v].x*L.n14+H[v].y*L.n24+H[v].z*L.n34+H[v].w;if(E<=Q){E=!1;break a}}E=!0}E=!E}if(!E){E=f[d]=f[d]||new THREE.RenderableObject;d++;e=E;I.copy(M.position);n.multiplyVector3(I);e.object=M;e.z=I.z;w.push(e)}}P&&w.sort(b);return w};
+this.projectScene=function(A,w,P){var J=[],y=w.near,M=w.far,E,L,Q,v,B,F,G,t,r,x,R,C,K,S,T,U,V;z=k=o=0;w.matrixAutoUpdate&&w.updateMatrix();A.update(undefined,!1,w);n.multiply(w.projectionMatrix,w.matrixWorldInverse);H[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);H[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);H[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);H[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);H[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);
+H[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);for(E=0;E<6;E++){r=H[E];r.divideScalar(Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z))}r=this.projectObjects(A,w,!0);A=0;for(E=r.length;A<E;A++){x=r[A].object;if(x.visible){R=x.matrixWorld;C=x.matrixRotationWorld;K=x.materials;S=x.overdraw;i=0;if(x instanceof THREE.Mesh){T=x.geometry;v=T.vertices;U=T.faces;T=T.faceVertexUvs;L=0;for(Q=v.length;L<Q;L++){g=a();g.positionWorld.copy(v[L].position);R.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);
+n.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>y&&g.positionScreen.z<M}v=0;for(L=U.length;v<L;v++){Q=U[v];if(Q instanceof THREE.Face3){B=h[Q.a];F=h[Q.b];G=h[Q.c];if(B.visible&&F.visible&&G.visible&&(x.doubleSided||x.flipSided!=(G.positionScreen.x-B.positionScreen.x)*(F.positionScreen.y-B.positionScreen.y)-(G.positionScreen.y-B.positionScreen.y)*(F.positionScreen.x-B.positionScreen.x)<0)){t=m[o]=m[o]||new THREE.RenderableFace3;
+o++;j=t;j.v1.copy(B);j.v2.copy(F);j.v3.copy(G);j.normalWorld.copy(Q.normal);C.multiplyVector3(j.normalWorld);j.centroidWorld.copy(Q.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);n.multiplyVector3(j.centroidScreen);G=Q.vertexNormals;B=0;for(F=G.length;B<F;B++){t=j.vertexNormalsWorld[B];t.copy(G[B]);C.multiplyVector3(t)}B=0;for(F=T.length;B<F;B++)if(V=T[B][v]){G=0;for(t=V.length;G<t;G++)j.uvs[B][G]=V[G]}j.meshMaterials=K;j.faceMaterials=Q.materials;j.overdraw=S;
+j.z=j.centroidScreen.z;J.push(j)}}}}else if(x instanceof THREE.Line){D.multiply(n,R);v=x.geometry.vertices;B=a();B.positionScreen.copy(v[0].position);D.multiplyVector4(B.positionScreen);L=1;for(Q=v.length;L<Q;L++){B=a();B.positionScreen.copy(v[L].position);D.multiplyVector4(B.positionScreen);F=h[i-2];N.copy(B.positionScreen);O.copy(F.positionScreen);if(c(N,O)){N.multiplyScalar(1/N.w);O.multiplyScalar(1/O.w);R=s[k]=s[k]||new THREE.RenderableLine;k++;l=R;l.v1.positionScreen.copy(N);l.v2.positionScreen.copy(O);
+l.z=Math.max(N.z,O.z);l.materials=x.materials;J.push(l)}}}else if(x instanceof THREE.Particle){q.set(x.position.x,x.position.y,x.position.z,1);n.multiplyVector4(q);q.z/=q.w;if(q.z>0&&q.z<1){R=u[z]=u[z]||new THREE.RenderableParticle;z++;p=R;p.x=q.x/q.w;p.y=q.y/q.w;p.z=q.z;p.rotation=x.rotation.z;p.scale.x=x.scale.x*Math.abs(p.x-(q.x+w.projectionMatrix.n11)/(q.w+w.projectionMatrix.n14));p.scale.y=x.scale.y*Math.abs(p.y-(q.y+w.projectionMatrix.n22)/(q.w+w.projectionMatrix.n24));p.materials=x.materials;
+J.push(p)}}}}P&&J.sort(b);return J}};
+THREE.SVGRenderer=function(){function a(v,B,F){var G,t,r,x;G=0;for(t=v.lights.length;G<t;G++){r=v.lights[G];if(r instanceof THREE.DirectionalLight){x=B.normalWorld.dot(r.position)*r.intensity;if(x>0){F.r+=r.color.r*x;F.g+=r.color.g*x;F.b+=r.color.b*x}}else if(r instanceof THREE.PointLight){A.sub(r.position,B.centroidWorld);A.normalize();x=B.normalWorld.dot(A)*r.intensity;if(x>0){F.r+=r.color.r*x;F.g+=r.color.g*x;F.b+=r.color.b*x}}}}function b(v,B,F,G,t,r){y=e(M++);y.setAttribute("d","M "+v.positionScreen.x+
+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(r,G,n);q.r=t.color.r*n.r;q.g=t.color.g*n.g;q.b=t.color.b*n.b;q.updateStyleString()}else q.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){O=1-t.__2near/(t.__farPlusNear-G.z*t.__farMinusNear);
+q.setRGB(O,O,O)}else t instanceof THREE.MeshNormalMaterial&&q.setRGB(d(G.normalWorld.x),d(G.normalWorld.y),d(G.normalWorld.z));t.wireframe?y.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):y.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+t.opacity);i.appendChild(y)}function c(v,B,F,G,t,r,x){y=e(M++);y.setAttribute("d",
+"M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+F.positionScreen.x+","+F.positionScreen.y+" L "+G.positionScreen.x+","+G.positionScreen.y+"z");if(r instanceof THREE.MeshBasicMaterial)q.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshLambertMaterial)if(I){n.r=D.r;n.g=D.g;n.b=D.b;a(x,t,n);q.r=r.color.r*n.r;q.g=r.color.g*n.g;q.b=r.color.b*n.b;q.updateStyleString()}else q.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshDepthMaterial){O=
+1-r.__2near/(r.__farPlusNear-t.z*r.__farMinusNear);q.setRGB(O,O,O)}else r instanceof THREE.MeshNormalMaterial&&q.setRGB(d(t.normalWorld.x),d(t.normalWorld.y),d(t.normalWorld.z));r.wireframe?y.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):y.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+r.opacity);i.appendChild(y)}
+function e(v){if(w[v]==null){w[v]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&w[v].setAttribute("shape-rendering","crispEdges")}return w[v]}function d(v){return v<0?Math.min((1+v)*0.5,0.5):0.5+Math.min(v*0.5,0.5)}var f=null,g=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,j,o,m,l,k,s,p,z=new THREE.Rectangle,u=new THREE.Rectangle,I=!1,q=new THREE.Color(16777215),n=new THREE.Color(16777215),D=new THREE.Color(0),H=new THREE.Color(0),N=new THREE.Color(0),
+O,A=new THREE.Vector3,w=[],P=[],J=[],y,M,E,L,Q=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(v){switch(v){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(v,B){h=v;j=B;o=h/2;m=j/2;i.setAttribute("viewBox",-o+" "+-m+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);z.set(-o,-m,o,m)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(v,B){var F,G,t,r,x,R,C,K;this.autoClear&&
+this.clear();f=g.projectScene(v,B,this.sortElements);L=E=M=0;if(I=v.lights.length>0){C=v.lights;D.setRGB(0,0,0);H.setRGB(0,0,0);N.setRGB(0,0,0);F=0;for(G=C.length;F<G;F++){t=C[F];r=t.color;if(t instanceof THREE.AmbientLight){D.r+=r.r;D.g+=r.g;D.b+=r.b}else if(t instanceof THREE.DirectionalLight){H.r+=r.r;H.g+=r.g;H.b+=r.b}else if(t instanceof THREE.PointLight){N.r+=r.r;N.g+=r.g;N.b+=r.b}}}F=0;for(G=f.length;F<G;F++){C=f[F];u.empty();if(C instanceof THREE.RenderableParticle){l=C;l.x*=o;l.y*=-m;t=0;
+for(r=C.materials.length;t<r;t++)if(K=C.materials[t]){x=l;R=C;var S=E++;if(P[S]==null){P[S]=document.createElementNS("http://www.w3.org/2000/svg","circle");Q==0&&P[S].setAttribute("shape-rendering","crispEdges")}y=P[S];y.setAttribute("cx",x.x);y.setAttribute("cy",x.y);y.setAttribute("r",R.scale.x*o);if(K instanceof THREE.ParticleCircleMaterial){if(I){n.r=D.r+H.r+N.r;n.g=D.g+H.g+N.g;n.b=D.b+H.b+N.b;q.r=K.color.r*n.r;q.g=K.color.g*n.g;q.b=K.color.b*n.b;q.updateStyleString()}else q=K.color;y.setAttribute("style",
+"fill: "+q.__styleString)}i.appendChild(y)}}else if(C instanceof THREE.RenderableLine){l=C.v1;k=C.v2;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);if(z.instersects(u)){t=0;for(r=C.materials.length;t<r;)if(K=C.materials[t++]){x=l;R=k;S=L++;if(J[S]==null){J[S]=document.createElementNS("http://www.w3.org/2000/svg","line");Q==0&&J[S].setAttribute("shape-rendering",
+"crispEdges")}y=J[S];y.setAttribute("x1",x.positionScreen.x);y.setAttribute("y1",x.positionScreen.y);y.setAttribute("x2",R.positionScreen.x);y.setAttribute("y2",R.positionScreen.y);if(K instanceof THREE.LineBasicMaterial){q.__styleString=K.color.__styleString;y.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin);i.appendChild(y)}}}}else if(C instanceof THREE.RenderableFace3){l=
+C.v1;k=C.v2;s=C.v3;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;s.positionScreen.x*=o;s.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(s.positionScreen.x,s.positionScreen.y);if(z.instersects(u)){t=0;for(r=C.meshMaterials.length;t<r;){K=C.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){x=0;for(R=C.faceMaterials.length;x<R;)(K=C.faceMaterials[x++])&&b(l,k,s,C,
+K,v)}else K&&b(l,k,s,C,K,v)}}}else if(C instanceof THREE.RenderableFace4){l=C.v1;k=C.v2;s=C.v3;p=C.v4;l.positionScreen.x*=o;l.positionScreen.y*=-m;k.positionScreen.x*=o;k.positionScreen.y*=-m;s.positionScreen.x*=o;s.positionScreen.y*=-m;p.positionScreen.x*=o;p.positionScreen.y*=-m;u.addPoint(l.positionScreen.x,l.positionScreen.y);u.addPoint(k.positionScreen.x,k.positionScreen.y);u.addPoint(s.positionScreen.x,s.positionScreen.y);u.addPoint(p.positionScreen.x,p.positionScreen.y);if(z.instersects(u)){t=
+0;for(r=C.meshMaterials.length;t<r;){K=C.meshMaterials[t++];if(K instanceof THREE.MeshFaceMaterial){x=0;for(R=C.faceMaterials.length;x<R;)(K=C.faceMaterials[x++])&&c(l,k,s,p,C,K,v)}else K&&c(l,k,s,p,C,K,v)}}}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,d=c.length;for(e=0;e<d;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
-THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.uvs=[];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
+THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};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};

+ 77 - 77
build/custom/ThreeWebGL.js

@@ -12,21 +12,21 @@ this.length();a>0?this.multiplyScalar(1/a):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(a,b,c,e){this.set(a||0,b||0,c||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(i,j){return i.distance-j.distance});return f},intersectObject:function(a){function b(M,O,ia,R){R=R.clone().subSelf(O);ia=ia.clone().subSelf(O);var B=M.clone().subSelf(O);M=R.dot(R);O=R.dot(ia);R=R.dot(B);var la=ia.dot(ia);ia=ia.dot(B);B=1/(M*la-O*O);la=(la*R-O*ia)*B;M=(M*ia-O*R)*B;return la>0&&M>0&&la+M<1}var c,e,
-f,i,j,p,n,s,z,A,D,y=a.geometry,K=y.vertices,H=[];c=0;for(e=y.faces.length;c<e;c++){f=y.faces[c];A=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;i=n.multiplyVector3(K[f.a].position.clone());j=n.multiplyVector3(K[f.b].position.clone());p=n.multiplyVector3(K[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(K[f.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(f.normal.clone());z=D.dot(s);if(z<0){s=s.dot((new THREE.Vector3).sub(i,A))/z;A=A.addSelf(D.multiplyScalar(s));
-if(f instanceof THREE.Face3){if(b(A,i,j,p)){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};H.push(f)}}else if(f instanceof THREE.Face4&&(b(A,i,j,n)||b(A,j,p,n))){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};H.push(f)}}}return H}};
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(i,j){return i.distance-j.distance});return f},intersectObject:function(a){function b(N,O,ja,R){R=R.clone().subSelf(O);ja=ja.clone().subSelf(O);var B=N.clone().subSelf(O);N=R.dot(R);O=R.dot(ja);R=R.dot(B);var la=ja.dot(ja);ja=ja.dot(B);B=1/(N*la-O*O);la=(la*R-O*ja)*B;N=(N*ja-O*R)*B;return la>0&&N>0&&la+N<1}var c,e,
+f,i,j,p,n,s,z,A,D,y=a.geometry,K=y.vertices,I=[];c=0;for(e=y.faces.length;c<e;c++){f=y.faces[c];A=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;i=n.multiplyVector3(K[f.a].position.clone());j=n.multiplyVector3(K[f.b].position.clone());p=n.multiplyVector3(K[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(K[f.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(f.normal.clone());z=D.dot(s);if(z<0){s=s.dot((new THREE.Vector3).sub(i,A))/z;A=A.addSelf(D.multiplyScalar(s));
+if(f instanceof THREE.Face3){if(b(A,i,j,p)){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};I.push(f)}}else if(f instanceof THREE.Face4&&(b(A,i,j,n)||b(A,j,p,n))){f={distance:this.origin.distanceTo(A),point:A,face:f,object:a};I.push(f)}}}return I}};
 THREE.Rectangle=function(){function a(){i=e-b;j=f-c}var b,c,e,f,i,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(n,s,z,A){p=!1;b=n;c=s;e=z;f=A;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;e=n;f=s}else{b=b<n?b:n;c=c<s?c:s;e=e>n?e:n;f=f>s?f:s}a()};
 this.add3Points=function(n,s,z,A,D,y){if(p){p=!1;b=n<z?n<D?n:D:z<D?z:D;c=s<A?s<y?s:y:A<y?A:y;e=n>z?n>D?n:D:z>D?z:D;f=s>A?s>y?s:y:A>y?A:y}else{b=n<z?n<D?n<b?n:b:D<b?D:b:z<D?z<b?z:b:D<b?D:b;c=s<A?s<y?s<c?s:c:y<c?y:c:A<y?A<c?A:c:y<c?y:c;e=n>z?n>D?n>e?n:e:D>e?D:e:z>D?z>e?z:e:D>e?D:e;f=s>A?s>y?s>f?s:f:y>f?y:f:A>y?A>f?A:f:y>f?y:f}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();e=n.getRight();f=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();e=e>n.getRight()?
 e:n.getRight();f=f>n.getBottom()?f:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;e+=n;f+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();e=e<n.getRight()?e:n.getRight();f=f<n.getBottom()?f:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(f,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;f=e=c=b=0;a()};this.isEmpty=function(){return p}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,H){this.set(a||1,b||0,c||0,e||0,f||0,i||1,j||0,p||0,n||0,s||0,z||1,A||0,D||0,y||0,K||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,H){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=i;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=z;this.n34=A;this.n41=D;this.n42=y;this.n43=K;this.n44=H;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
+THREE.Matrix4=function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,I){this.set(a||1,b||0,c||0,e||0,f||0,i||1,j||0,p||0,n||0,s||0,z||1,A||0,D||0,y||0,K||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,f,i,j,p,n,s,z,A,D,y,K,I){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=i;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=z;this.n34=A;this.n41=D;this.n42=y;this.n43=K;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__v1,
 f=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(a,b).normalize();if(i.length()===0)i.z=1;e.cross(c,i).normalize();if(e.length()===0){i.x+=1.0E-4;e.cross(c,i).normalize()}f.cross(i,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=i.x;this.n21=e.y;this.n22=f.y;this.n23=i.y;this.n31=e.z;this.n32=f.z;this.n33=i.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*
 e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();
-return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,H=a.n42,M=a.n43,O=a.n44,ia=b.n11,R=b.n12,B=b.n13,la=b.n14,V=b.n21,ma=b.n22,
-d=b.n23,Ea=b.n24,N=b.n31,P=b.n32,sa=b.n33,ja=b.n34;this.n11=c*ia+e*V+f*N;this.n12=c*R+e*ma+f*P;this.n13=c*B+e*d+f*sa;this.n14=c*la+e*Ea+f*ja+i;this.n21=j*ia+p*V+n*N;this.n22=j*R+p*ma+n*P;this.n23=j*B+p*d+n*sa;this.n24=j*la+p*Ea+n*ja+s;this.n31=z*ia+A*V+D*N;this.n32=z*R+A*ma+D*P;this.n33=z*B+A*d+D*sa;this.n34=z*la+A*Ea+D*ja+y;this.n41=K*ia+H*V+M*N;this.n42=K*R+H*ma+M*P;this.n43=K*B+H*d+M*sa;this.n44=K*la+H*Ea+M*ja+O;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=
+return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,I=a.n42,N=a.n43,O=a.n44,ja=b.n11,R=b.n12,B=b.n13,la=b.n14,T=b.n21,ma=b.n22,
+d=b.n23,P=b.n24,M=b.n31,ya=b.n32,ka=b.n33,na=b.n34;this.n11=c*ja+e*T+f*M;this.n12=c*R+e*ma+f*ya;this.n13=c*B+e*d+f*ka;this.n14=c*la+e*P+f*na+i;this.n21=j*ja+p*T+n*M;this.n22=j*R+p*ma+n*ya;this.n23=j*B+p*d+n*ka;this.n24=j*la+p*P+n*na+s;this.n31=z*ja+A*T+D*M;this.n32=z*R+A*ma+D*ya;this.n33=z*B+A*d+D*ka;this.n34=z*la+A*P+D*na+y;this.n41=K*ja+I*T+N*M;this.n42=K*R+I*ma+N*ya;this.n43=K*B+I*d+N*ka;this.n44=K*la+I*P+N*na+O;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);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(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
-a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,i=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,z=this.n33,A=this.n34,D=this.n41,y=this.n42,K=this.n43,H=this.n44;return e*j*s*D-c*p*s*D-e*i*z*D+b*p*z*D+c*i*A*D-b*j*A*D-e*j*n*y+c*p*n*y+e*f*z*y-a*p*z*y-c*f*A*y+a*j*A*y+e*i*n*K-b*p*n*K-e*f*s*K+a*p*s*K+b*f*A*K-a*i*A*K-c*i*n*H+b*j*n*H+c*f*s*H-a*j*s*H-b*f*z*H+a*i*z*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
+a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,i=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,z=this.n33,A=this.n34,D=this.n41,y=this.n42,K=this.n43,I=this.n44;return e*j*s*D-c*p*s*D-e*i*z*D+b*p*z*D+c*i*A*D-b*j*A*D-e*j*n*y+c*p*n*y+e*f*z*y-a*p*z*y-c*f*A*y+a*j*A*y+e*i*n*K-b*p*n*K-e*f*s*K+a*p*s*K+b*f*A*K-a*i*A*K-c*i*n*I+b*j*n*I+c*f*s*I-a*j*s*I-b*f*z*I+a*i*z*I},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},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(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,
@@ -34,8 +34,8 @@ a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=t
 1-c,i=a.x,j=a.y,p=a.z,n=f*i,s=f*j;this.set(n*i+c,n*j-e*p,n*p+e*j,0,n*j+e*p,s*j+c,s*p-e*i,0,n*p-e*j,s*p+e*i,f*p*p+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var i=Math.cos(e);e=Math.sin(e);var j=a*c,p=b*c;this.n11=f*i;this.n12=-f*e;this.n13=c;this.n21=p*i+a*e;this.n22=-p*e+a*i;this.n23=-b*f;this.n31=-j*i+b*e;this.n32=j*e+b*i;this.n33=
 a*f;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,i=b+b,j=c+c,p=e+e;a=b*i;var n=b*j;b*=p;var s=c*j;c*=p;e*=p;i*=f;j*=f;f*=p;this.n11=1-(s+e);this.n12=n-f;this.n13=b+j;this.n21=n+f;this.n22=1-(a+e);this.n23=c-i;this.n31=b-j;this.n32=c+i;this.n33=1-(a+s);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
 a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,H=a.n42,M=a.n43,O=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*H-s*D*H+s*A*M-p*y*M-n*A*O+p*D*O;b.n12=i*D*H-f*y*H-i*A*M+e*y*M+f*A*O-e*D*O;b.n13=f*s*H-i*n*H+i*p*M-e*s*M-f*p*O+e*n*O;b.n14=i*n*A-f*s*A-i*p*D+e*s*D+f*p*y-e*n*y;b.n21=s*D*K-n*y*K-s*z*M+j*y*M+n*z*O-j*D*O;b.n22=f*y*K-i*D*K+i*z*M-c*y*M-f*z*O+c*D*O;b.n23=i*n*K-f*s*K-i*j*M+c*s*M+f*j*O-c*n*O;
-b.n24=f*s*z-i*n*z+i*j*D-c*s*D-f*j*y+c*n*y;b.n31=p*y*K-s*A*K+s*z*H-j*y*H-p*z*O+j*A*O;b.n32=i*A*K-e*y*K-i*z*H+c*y*H+e*z*O-c*A*O;b.n33=f*s*K-i*p*K+i*j*H-c*s*H-e*j*O+c*p*O;b.n34=i*p*z-e*s*z-i*j*A+c*s*A+e*j*y-c*p*y;b.n41=n*A*K-p*D*K-n*z*H+j*D*H+p*z*M-j*A*M;b.n42=e*D*K-f*A*K+f*z*H-c*D*H-e*z*M+c*A*M;b.n43=f*p*K-e*n*K-f*j*H+c*n*H+e*j*M-c*p*M;b.n44=e*n*z-f*p*z+f*j*A-c*n*A-e*j*D+c*p*D;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,i=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,z=a.n31,A=a.n32,D=a.n33,y=a.n34,K=a.n41,I=a.n42,N=a.n43,O=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*I-s*D*I+s*A*N-p*y*N-n*A*O+p*D*O;b.n12=i*D*I-f*y*I-i*A*N+e*y*N+f*A*O-e*D*O;b.n13=f*s*I-i*n*I+i*p*N-e*s*N-f*p*O+e*n*O;b.n14=i*n*A-f*s*A-i*p*D+e*s*D+f*p*y-e*n*y;b.n21=s*D*K-n*y*K-s*z*N+j*y*N+n*z*O-j*D*O;b.n22=f*y*K-i*D*K+i*z*N-c*y*N-f*z*O+c*D*O;b.n23=i*n*K-f*s*K-i*j*N+c*s*N+f*j*O-c*n*O;
+b.n24=f*s*z-i*n*z+i*j*D-c*s*D-f*j*y+c*n*y;b.n31=p*y*K-s*A*K+s*z*I-j*y*I-p*z*O+j*A*O;b.n32=i*A*K-e*y*K-i*z*I+c*y*I+e*z*O-c*A*O;b.n33=f*s*K-i*p*K+i*j*I-c*s*I-e*j*O+c*p*O;b.n34=i*p*z-e*s*z-i*j*A+c*s*A+e*j*y-c*p*y;b.n41=n*A*K-p*D*K-n*z*I+j*D*I+p*z*N-j*A*N;b.n42=e*D*K-f*A*K+f*z*I-c*D*I-e*z*N+c*A*N;b.n43=f*p*K-e*n*K-f*j*I+c*n*I+e*j*N-c*p*N;b.n44=e*n*z-f*p*z+f*j*A-c*n*A-e*j*D+c*p*D;b.multiplyScalar(1/a.determinant());return b};
 THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,z=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*i;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*z;c[8]=a*A;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,e,f,i){var j;j=new THREE.Matrix4;j.n11=2*f/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*f/(e-c);j.n23=(e+c)/(e-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+f)/(i-f);j.n34=-2*i*f/(i-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,e){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
 THREE.Matrix4.makeOrtho=function(a,b,c,e,f,i){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-e;s=i-f;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+e)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((i+f)/s);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;
@@ -56,10 +56,10 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,f,i,j,p=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){i=this.faces[e];if(a&&i.vertexNormals.length){p.set(0,0,0);b=0;for(c=i.vertexNormals.length;b<c;b++)p.addSelf(i.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[i.a];c=this.vertices[i.b];j=this.vertices[i.c];p.sub(j.position,c.position);n.sub(b.position,c.position);p.crossSelf(n)}p.isZero()||
 p.normalize();i.normal.copy(p)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];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{e=
 this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);
-c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(ja,wa,na,U,ca,Ga,T){i=ja.vertices[wa].position;j=ja.vertices[na].position;p=ja.vertices[U].position;n=f[ca];s=f[Ga];z=f[T];A=j.x-i.x;D=p.x-i.x;y=j.y-i.y;K=p.y-i.y;H=j.z-i.z;M=p.z-i.z;O=s.u-n.u;ia=z.u-n.u;R=s.v-n.v;B=z.v-n.v;la=1/(O*B-
-ia*R);d.set((B*A-R*D)*la,(B*y-R*K)*la,(B*H-R*M)*la);Ea.set((O*D-ia*A)*la,(O*K-ia*y)*la,(O*M-ia*H)*la);V[wa].addSelf(d);V[na].addSelf(d);V[U].addSelf(d);ma[wa].addSelf(Ea);ma[na].addSelf(Ea);ma[U].addSelf(Ea)}var b,c,e,f,i,j,p,n,s,z,A,D,y,K,H,M,O,ia,R,B,la,V=[],ma=[],d=new THREE.Vector3,Ea=new THREE.Vector3,N=new THREE.Vector3,P=new THREE.Vector3,sa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){V[b]=new THREE.Vector3;ma[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];
+c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(na,oa,U,ha,wa,pa,X){i=na.vertices[oa].position;j=na.vertices[U].position;p=na.vertices[ha].position;n=f[wa];s=f[pa];z=f[X];A=j.x-i.x;D=p.x-i.x;y=j.y-i.y;K=p.y-i.y;I=j.z-i.z;N=p.z-i.z;O=s.u-n.u;ja=z.u-n.u;R=s.v-n.v;B=z.v-n.v;la=1/(O*B-
+ja*R);d.set((B*A-R*D)*la,(B*y-R*K)*la,(B*I-R*N)*la);P.set((O*D-ja*A)*la,(O*K-ja*y)*la,(O*N-ja*I)*la);T[oa].addSelf(d);T[U].addSelf(d);T[ha].addSelf(d);ma[oa].addSelf(P);ma[U].addSelf(P);ma[ha].addSelf(P)}var b,c,e,f,i,j,p,n,s,z,A,D,y,K,I,N,O,ja,R,B,la,T=[],ma=[],d=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,ya=new THREE.Vector3,ka=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){T[b]=new THREE.Vector3;ma[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];
 f=this.faceVertexUvs[b][0];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=
-0;for(c=this.vertices.length;b<c;b++){sa.copy(this.vertices[b].normal);e=V[b];N.copy(e);N.subSelf(sa.multiplyScalar(sa.dot(e))).normalize();P.cross(this.vertices[b].normal,e);e=P.dot(ma[b]);e=e<0?-1:1;this.vertices[b].tangent.set(N.x,N.y,N.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;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]};
+0;for(c=this.vertices.length;b<c;b++){ka.copy(this.vertices[b].normal);e=T[b];M.copy(e);M.subSelf(ka.multiplyScalar(ka.dot(e))).normalize();ya.cross(this.vertices[b].normal,e);e=ya.dot(ma[b]);e=e<0?-1:1;this.vertices[b].tangent.set(M.x,M.y,M.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=
 a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(f){for(var i=0;i<a.length;i++)a[i].update(f)};c.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};c.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};c.add=function(f){b[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");b[f.name]=f;if(f.initialized!==!0){for(var i=0;i<f.hierarchy.length;i++){for(var j=0;j<f.hierarchy[i].keys.length;j++){if(f.hierarchy[i].keys[j].time<
@@ -72,7 +72,7 @@ f instanceof THREE.Bone?f.skinMatrix:f.matrix}var i=f.animationCache.prevKey;f=f
 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 b=["pos","rot","scl"],c,e,f,i,j,p,n,s,z=this.data.JIT.hierarchy,A,D;this.currentTime+=a*this.timeScale;D=this.currentTime;A=this.currentTime%=this.data.length;s=parseInt(Math.min(A*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,K=this.hierarchy.length;y<K;y++){a=this.hierarchy[y];n=a.animationCache;if(this.JITCompile&&z[y][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=z[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=z[y][s];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 H=0;H<3;H++){c=b[H];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=D){if(A<D)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<A;){j=p;p=this.getNextKeyWith(c,y,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,y,p.index+1)}while(p.time<
+!1}else{a.matrix=z[y][s];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 I=0;I<3;I++){c=b[I];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=D){if(A<D)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<A;){j=p;p=this.getNextKeyWith(c,y,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,y,p.index+1)}while(p.time<
 A)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(A-j.time)/(p.time-j.time);f=j[c];i=p[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+y);e=e<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
 this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",y,p.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);c.x=f[0];c.y=f[1];c.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(c);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(c===
 "rot")THREE.Quaternion.slerp(f,i,a.quaternion,e);else if(c==="scl"){c=a.scale;c.x=f[0]+(i[0]-f[0])*e;c.y=f[1]+(i[1]-f[1])*e;c.z=f[2]+(i[2]-f[2])*e}}}}if(this.JITCompile&&z[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)z[y][s]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
@@ -139,16 +139,16 @@ THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 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(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
-THREE.Projector=function(){function a(){var N=n[p]=n[p]||new THREE.RenderableVertex;p++;return N}function b(N,P){return P.z-N.z}function c(N,P){var sa=0,ja=1,wa=N.z+N.w,na=P.z+P.w,U=-N.z+N.w,ca=-P.z+P.w;if(wa>=0&&na>=0&&U>=0&&ca>=0)return!0;else if(wa<0&&na<0||U<0&&ca<0)return!1;else{if(wa<0)sa=Math.max(sa,wa/(wa-na));else na<0&&(ja=Math.min(ja,wa/(wa-na)));if(U<0)sa=Math.max(sa,U/(U-ca));else ca<0&&(ja=Math.min(ja,U/(U-ca)));if(ja<sa)return!1;else{N.lerpSelf(P,sa);P.lerpSelf(N,1-ja);return!0}}}var e,
-f,i=[],j,p,n=[],s,z,A=[],D,y,K=[],H,M,O=[],ia=new THREE.Vector4,R=new THREE.Vector4,B=new THREE.Matrix4,la=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Vector4,d=new THREE.Vector4,Ea;this.projectVector=function(N,P){B.multiply(P.projectionMatrix,P.matrixWorldInverse);B.multiplyVector3(N);return N};this.unprojectVector=function(N,P){B.multiply(THREE.Matrix4.makeInvert(P.projectionMatrix),P.matrixWorld);
-B.multiplyVector3(N);return N};this.projectObjects=function(N,P,sa){P=[];var ja,wa,na;f=0;wa=N.objects;N=0;for(ja=wa.length;N<ja;N++){na=wa[N];var U;if(!(U=!na.visible))if(U=na instanceof THREE.Mesh){a:{U=void 0;for(var ca=na.matrixWorld,Ga=-na.geometry.boundingSphere.radius*Math.max(na.scale.x,Math.max(na.scale.y,na.scale.z)),T=0;T<6;T++){U=V[T].x*ca.n14+V[T].y*ca.n24+V[T].z*ca.n34+V[T].w;if(U<=Ga){U=!1;break a}}U=!0}U=!U}if(!U){U=i[f]=i[f]||new THREE.RenderableObject;f++;e=U;ia.copy(na.position);
-B.multiplyVector3(ia);e.object=na;e.z=ia.z;P.push(e)}}sa&&P.sort(b);return P};this.projectScene=function(N,P,sa){var ja=[],wa=P.near,na=P.far,U,ca,Ga,T,pa,ka,Ka,Ua,Ma,Qa,ya,Va,Ja,g;M=y=z=0;P.matrixAutoUpdate&&P.updateMatrix();N.update(undefined,!1,P);B.multiply(P.projectionMatrix,P.matrixWorldInverse);V[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);V[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);V[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);V[3].set(B.n41-B.n21,B.n42-
-B.n22,B.n43-B.n23,B.n44-B.n24);V[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);V[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(U=0;U<6;U++){pa=V[U];pa.divideScalar(Math.sqrt(pa.x*pa.x+pa.y*pa.y+pa.z*pa.z))}pa=this.projectObjects(N,P,!0);N=0;for(U=pa.length;N<U;N++){ka=pa[N].object;if(ka.visible){Ka=ka.matrixWorld;Ma=ka.matrixRotationWorld;Ua=ka.materials;p=0;if(ka instanceof THREE.Mesh){Qa=ka.geometry;ya=Qa.vertices;Va=Qa.faces;ca=0;for(Ga=ya.length;ca<Ga;ca++){j=a();j.positionWorld.copy(ya[ca].position);
-Ka.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);B.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>wa&&j.positionScreen.z<na}ca=0;for(Ga=Va.length;ca<Ga;ca++){ya=Va[ca];if(ya instanceof THREE.Face3){T=n[ya.a];Ja=n[ya.b];g=n[ya.c];if(T.visible&&Ja.visible&&g.visible&&(ka.doubleSided||ka.flipSided!=(g.positionScreen.x-T.positionScreen.x)*(Ja.positionScreen.y-T.positionScreen.y)-(g.positionScreen.y-
-T.positionScreen.y)*(Ja.positionScreen.x-T.positionScreen.x)<0)){var m=A[z]=A[z]||new THREE.RenderableFace3;z++;s=m;s.v1.copy(T);s.v2.copy(Ja);s.v3.copy(g);s.normalWorld.copy(ya.normal);Ma.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ya.centroid);Ka.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);B.multiplyVector3(s.centroidScreen);Ja=ya.vertexNormals;Ea=s.vertexNormalsWorld;for(T=0;T<3;T++){g=Ea[T];g.copy(Ja[T]);Ma.multiplyVector3(g)}if(T=Qa.faceVertexUvs[0][ca]){s.uvs[0]=
-T[0];s.uvs[1]=T[1];s.uvs[2]=T[2]}s.meshMaterials=Ua;s.faceMaterials=ya.materials;s.z=s.centroidScreen.z;ja.push(s)}}}}else if(ka instanceof THREE.Line){la.multiply(B,Ka);ya=ka.geometry.vertices;T=a();T.positionScreen.copy(ya[0].position);la.multiplyVector4(T.positionScreen);ca=1;for(Ga=ya.length;ca<Ga;ca++){T=a();T.positionScreen.copy(ya[ca].position);la.multiplyVector4(T.positionScreen);Ja=n[p-2];ma.copy(T.positionScreen);d.copy(Ja.positionScreen);if(c(ma,d)){ma.multiplyScalar(1/ma.w);d.multiplyScalar(1/
-d.w);Ka=K[y]=K[y]||new THREE.RenderableLine;y++;D=Ka;D.v1.positionScreen.copy(ma);D.v2.positionScreen.copy(d);D.z=Math.max(ma.z,d.z);D.materials=ka.materials;ja.push(D)}}}else if(ka instanceof THREE.Particle){R.set(ka.position.x,ka.position.y,ka.position.z,1);B.multiplyVector4(R);R.z/=R.w;if(R.z>0&&R.z<1){Ka=O[M]=O[M]||new THREE.RenderableParticle;M++;H=Ka;H.x=R.x/R.w;H.y=R.y/R.w;H.z=R.z;H.rotation=ka.rotation.z;H.scale.x=ka.scale.x*Math.abs(H.x-(R.x+P.projectionMatrix.n11)/(R.w+P.projectionMatrix.n14));
-H.scale.y=ka.scale.y*Math.abs(H.y-(R.y+P.projectionMatrix.n22)/(R.w+P.projectionMatrix.n24));H.materials=ka.materials;ja.push(H)}}}}sa&&ja.sort(b);return ja}};
+THREE.Projector=function(){function a(){var P=n[p]=n[p]||new THREE.RenderableVertex;p++;return P}function b(P,M){return M.z-P.z}function c(P,M){var ya=0,ka=1,na=P.z+P.w,oa=M.z+M.w,U=-P.z+P.w,ha=-M.z+M.w;if(na>=0&&oa>=0&&U>=0&&ha>=0)return!0;else if(na<0&&oa<0||U<0&&ha<0)return!1;else{if(na<0)ya=Math.max(ya,na/(na-oa));else oa<0&&(ka=Math.min(ka,na/(na-oa)));if(U<0)ya=Math.max(ya,U/(U-ha));else ha<0&&(ka=Math.min(ka,U/(U-ha)));if(ka<ya)return!1;else{P.lerpSelf(M,ya);M.lerpSelf(P,1-ka);return!0}}}var e,
+f,i=[],j,p,n=[],s,z,A=[],D,y,K=[],I,N,O=[],ja=new THREE.Vector4,R=new THREE.Vector4,B=new THREE.Matrix4,la=new THREE.Matrix4,T=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Vector4,d=new THREE.Vector4;this.projectVector=function(P,M){B.multiply(M.projectionMatrix,M.matrixWorldInverse);B.multiplyVector3(P);return P};this.unprojectVector=function(P,M){B.multiply(THREE.Matrix4.makeInvert(M.projectionMatrix),M.matrixWorld);B.multiplyVector3(P);
+return P};this.projectObjects=function(P,M,ya){M=[];var ka,na,oa;f=0;na=P.objects;P=0;for(ka=na.length;P<ka;P++){oa=na[P];var U;if(!(U=!oa.visible))if(U=oa instanceof THREE.Mesh){a:{U=void 0;for(var ha=oa.matrixWorld,wa=-oa.geometry.boundingSphere.radius*Math.max(oa.scale.x,Math.max(oa.scale.y,oa.scale.z)),pa=0;pa<6;pa++){U=T[pa].x*ha.n14+T[pa].y*ha.n24+T[pa].z*ha.n34+T[pa].w;if(U<=wa){U=!1;break a}}U=!0}U=!U}if(!U){U=i[f]=i[f]||new THREE.RenderableObject;f++;e=U;ja.copy(oa.position);B.multiplyVector3(ja);
+e.object=oa;e.z=ja.z;M.push(e)}}ya&&M.sort(b);return M};this.projectScene=function(P,M,ya){var ka=[],na=M.near,oa=M.far,U,ha,wa,pa,X,ra,Aa,Ma,Ga,ia,Ka,Ta,Wa,Xa,g,m,o;N=y=z=0;M.matrixAutoUpdate&&M.updateMatrix();P.update(undefined,!1,M);B.multiply(M.projectionMatrix,M.matrixWorldInverse);T[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);T[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);T[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);T[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-
+B.n23,B.n44-B.n24);T[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);T[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(U=0;U<6;U++){Ga=T[U];Ga.divideScalar(Math.sqrt(Ga.x*Ga.x+Ga.y*Ga.y+Ga.z*Ga.z))}Ga=this.projectObjects(P,M,!0);P=0;for(U=Ga.length;P<U;P++){ia=Ga[P].object;if(ia.visible){Ka=ia.matrixWorld;Ta=ia.matrixRotationWorld;Wa=ia.materials;Xa=ia.overdraw;p=0;if(ia instanceof THREE.Mesh){g=ia.geometry;pa=g.vertices;m=g.faces;g=g.faceVertexUvs;ha=0;for(wa=pa.length;ha<wa;ha++){j=
+a();j.positionWorld.copy(pa[ha].position);Ka.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);B.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>na&&j.positionScreen.z<oa}pa=0;for(ha=m.length;pa<ha;pa++){wa=m[pa];if(wa instanceof THREE.Face3){X=n[wa.a];ra=n[wa.b];Aa=n[wa.c];if(X.visible&&ra.visible&&Aa.visible&&(ia.doubleSided||ia.flipSided!=(Aa.positionScreen.x-X.positionScreen.x)*(ra.positionScreen.y-
+X.positionScreen.y)-(Aa.positionScreen.y-X.positionScreen.y)*(ra.positionScreen.x-X.positionScreen.x)<0)){Ma=A[z]=A[z]||new THREE.RenderableFace3;z++;s=Ma;s.v1.copy(X);s.v2.copy(ra);s.v3.copy(Aa);s.normalWorld.copy(wa.normal);Ta.multiplyVector3(s.normalWorld);s.centroidWorld.copy(wa.centroid);Ka.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);B.multiplyVector3(s.centroidScreen);Aa=wa.vertexNormals;X=0;for(ra=Aa.length;X<ra;X++){Ma=s.vertexNormalsWorld[X];Ma.copy(Aa[X]);Ta.multiplyVector3(Ma)}X=
+0;for(ra=g.length;X<ra;X++)if(o=g[X][pa]){Aa=0;for(Ma=o.length;Aa<Ma;Aa++)s.uvs[X][Aa]=o[Aa]}s.meshMaterials=Wa;s.faceMaterials=wa.materials;s.overdraw=Xa;s.z=s.centroidScreen.z;ka.push(s)}}}}else if(ia instanceof THREE.Line){la.multiply(B,Ka);pa=ia.geometry.vertices;X=a();X.positionScreen.copy(pa[0].position);la.multiplyVector4(X.positionScreen);ha=1;for(wa=pa.length;ha<wa;ha++){X=a();X.positionScreen.copy(pa[ha].position);la.multiplyVector4(X.positionScreen);ra=n[p-2];ma.copy(X.positionScreen);
+d.copy(ra.positionScreen);if(c(ma,d)){ma.multiplyScalar(1/ma.w);d.multiplyScalar(1/d.w);Ka=K[y]=K[y]||new THREE.RenderableLine;y++;D=Ka;D.v1.positionScreen.copy(ma);D.v2.positionScreen.copy(d);D.z=Math.max(ma.z,d.z);D.materials=ia.materials;ka.push(D)}}}else if(ia instanceof THREE.Particle){R.set(ia.position.x,ia.position.y,ia.position.z,1);B.multiplyVector4(R);R.z/=R.w;if(R.z>0&&R.z<1){Ka=O[N]=O[N]||new THREE.RenderableParticle;N++;I=Ka;I.x=R.x/R.w;I.y=R.y/R.w;I.z=R.z;I.rotation=ia.rotation.z;I.scale.x=
+ia.scale.x*Math.abs(I.x-(R.x+M.projectionMatrix.n11)/(R.w+M.projectionMatrix.n14));I.scale.y=ia.scale.y*Math.abs(I.y-(R.y+M.projectionMatrix.n22)/(R.w+M.projectionMatrix.n24));I.materials=ia.materials;ka.push(I)}}}}ya&&ka.sort(b);return ka}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var e,f=c.length;for(e=0;e<f;e++){a=c[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
@@ -174,18 +174,18 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(g,m,o){var h,k,t,q=g.vertices,r=q.length,E=g.colors,x=E.length,v=g.__vertexArray,L=g.__colorArray,W=g.__sortArray,I=g.__dirtyVertices,Q=g.__dirtyColors;if(o.sortParticles){ka.multiplySelf(o.matrixWorld);for(h=0;h<r;h++){k=q[h].position;Ma.copy(k);ka.multiplyVector3(Ma);W[h]=[Ma.z,h]}W.sort(function(J,Y){return Y[0]-J[0]});for(h=0;h<r;h++){k=q[W[h][1]].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(h=0;h<x;h++){t=h*3;color=E[W[h][1]];L[t]=color.r;L[t+1]=
-color.g;L[t+2]=color.b}}else{if(I)for(h=0;h<r;h++){k=q[h].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(Q)for(h=0;h<x;h++){color=E[h];t=h*3;L[t]=color.r;L[t+1]=color.g;L[t+2]=color.b}}if(I||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(Q||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,L,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
-function e(g,m,o,h,k){h.program||P.initMaterial(h,m,o,k);var t=h.program,q=t.uniforms,r=h.uniforms;if(t!=Ea){d.useProgram(t);Ea=t}d.uniformMatrix4fv(q.projectionMatrix,!1,Ka);if(o&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
-THREE.FogExp2)r.fogDensity.value=o.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var E,x,v=0,L=0,W=0,I,Q,J,Y=Qa,Aa=Y.directional.colors,S=Y.directional.positions,Z=Y.point.colors,w=Y.point.positions,va=0,X=0;o=x=x=0;for(E=m.length;o<E;o++){x=m[o];I=x.color;Q=x.position;J=x.intensity;if(x instanceof THREE.AmbientLight){v+=I.r;L+=I.g;W+=I.b}else if(x instanceof THREE.DirectionalLight){x=va*3;Aa[x]=I.r*J;Aa[x+1]=I.g*J;Aa[x+2]=I.b*J;S[x]=Q.x;S[x+1]=
-Q.y;S[x+2]=Q.z;va+=1}else if(x instanceof THREE.PointLight){x=X*3;Z[x]=I.r*J;Z[x+1]=I.g*J;Z[x+2]=I.b*J;w[x]=Q.x;w[x+1]=Q.y;w[x+2]=Q.z;X+=1}}for(o=va*3;o<Aa.length;o++)Aa[o]=0;for(o=X*3;o<Z.length;o++)Z[o]=0;Y.point.length=X;Y.directional.length=va;Y.ambient[0]=v;Y.ambient[1]=L;Y.ambient[2]=W;m=Qa;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
+THREE.WebGLRenderer=function(a){function b(g,m,o){var h,k,t,q=g.vertices,r=q.length,E=g.colors,x=E.length,v=g.__vertexArray,L=g.__colorArray,V=g.__sortArray,H=g.__dirtyVertices,Q=g.__dirtyColors;if(o.sortParticles){Aa.multiplySelf(o.matrixWorld);for(h=0;h<r;h++){k=q[h].position;ia.copy(k);Aa.multiplyVector3(ia);V[h]=[ia.z,h]}V.sort(function(J,Y){return Y[0]-J[0]});for(h=0;h<r;h++){k=q[V[h][1]].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(h=0;h<x;h++){t=h*3;color=E[V[h][1]];L[t]=color.r;L[t+1]=
+color.g;L[t+2]=color.b}}else{if(H)for(h=0;h<r;h++){k=q[h].position;t=h*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(Q)for(h=0;h<x;h++){color=E[h];t=h*3;L[t]=color.r;L[t+1]=color.g;L[t+2]=color.b}}if(H||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(Q||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,L,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
+function e(g,m,o,h,k){h.program||ya.initMaterial(h,m,o,k);var t=h.program,q=t.uniforms,r=h.uniforms;if(t!=P){d.useProgram(t);P=t}d.uniformMatrix4fv(q.projectionMatrix,!1,Ma);if(o&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
+THREE.FogExp2)r.fogDensity.value=o.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var E,x,v=0,L=0,V=0,H,Q,J,Y=Ka,Ca=Y.directional.colors,S=Y.directional.positions,Z=Y.point.colors,w=Y.point.positions,xa=0,W=0;o=x=x=0;for(E=m.length;o<E;o++){x=m[o];H=x.color;Q=x.position;J=x.intensity;if(x instanceof THREE.AmbientLight){v+=H.r;L+=H.g;V+=H.b}else if(x instanceof THREE.DirectionalLight){x=xa*3;Ca[x]=H.r*J;Ca[x+1]=H.g*J;Ca[x+2]=H.b*J;S[x]=Q.x;S[x+1]=
+Q.y;S[x+2]=Q.z;xa+=1}else if(x instanceof THREE.PointLight){x=W*3;Z[x]=H.r*J;Z[x+1]=H.g*J;Z[x+2]=H.b*J;w[x]=Q.x;w[x+1]=Q.y;w[x+2]=Q.z;W+=1}}for(o=xa*3;o<Ca.length;o++)Ca[o]=0;for(o=W*3;o<Z.length;o++)Z[o]=0;Y.point.length=W;Y.directional.length=xa;Y.ambient[0]=v;Y.ambient[1]=L;Y.ambient[2]=V;m=Ka;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
 r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.map.texture=h.map;r.lightMap.texture=h.lightMap;r.envMap.texture=h.envMap;r.reflectivity.value=h.reflectivity;r.refractionRatio.value=h.refractionRatio;r.combine.value=h.combine;r.useRefract.value=
 h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);r.opacity.value=h.opacity;r.size.value=h.size;r.scale.value=ma.height/2;r.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(h.ambient.r,
-h.ambient.g,h.ambient.b);r.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);r.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)r.opacity.value=h.opacity;for(var Ba in r)if(v=t.uniforms[Ba]){o=r[Ba];E=o.type;m=o.value;if(E=="i")d.uniform1i(v,m);else if(E=="f")d.uniform1f(v,m);else if(E=="fv1")d.uniform1fv(v,m);else if(E=="fv")d.uniform3fv(v,m);else if(E==
+h.ambient.g,h.ambient.b);r.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);r.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)r.opacity.value=h.opacity;for(var Da in r)if(v=t.uniforms[Da]){o=r[Da];E=o.type;m=o.value;if(E=="i")d.uniform1i(v,m);else if(E=="f")d.uniform1f(v,m);else if(E=="fv1")d.uniform1fv(v,m);else if(E=="fv")d.uniform3fv(v,m);else if(E==
 "v2")d.uniform2f(v,m.x,m.y);else if(E=="v3")d.uniform3f(v,m.x,m.y,m.z);else if(E=="c")d.uniform3f(v,m.r,m.g,m.b);else if(E=="t"){d.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image[E])}else{o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
-o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[E]);o.__wasSetOnce=!0}ia(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
-d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ia(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
-h.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,Ua);if(h.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,Ua);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
+o.image.__webGLTextureCube);for(E=0;E<6;++E)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[E]);o.__wasSetOnce=!0}ja(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
+d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ja(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||
+h.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,Ga);if(h.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,Ga);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
 function f(g,m,o,h,k,t){if(h.opacity!=0){g=e(g,m,o,h,t).attributes;if(h.morphTargets){m=h.program.attributes;t.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[t.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(m.position,3,d.FLOAT,!1,0,0);if(t.morphTargetForcedOrder.length){o=0;for(var q=t.morphTargetForcedOrder,r=t.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<q.length;){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
 d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var E=-1,x=0;r=t.morphTargetInfluences;var v,L=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(v=0;v<L;v++)if(!q[v]&&r[v]>E){x=v;E=r[x]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[x]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=E;q[x]=1;E=-1;o++}}d.uniform1fv(h.program.uniforms.morphTargetInfluences,
 t.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(g.position,3,d.FLOAT,!1,0,0)}if(g.color>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,!1,0,0)}if(g.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,!1,0,0)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,
@@ -193,22 +193,22 @@ k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAt
 4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);d.vertexAttribPointer(g.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);d.vertexAttribPointer(g.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);d.vertexAttribPointer(g.skinWeight,4,d.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(h.wireframe){d.lineWidth(h.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);d.drawElements(d.LINES,
 k.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,k.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(h.linewidth);d.drawArrays(t,0,k.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,k.__webGLParticleCount);else t instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function i(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
 d.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=d.createBuffer();if(g.hasPos){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,g.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(g.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,g.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,
-3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(sa!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);sa=g.doubleSided}if(ja!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);ja=g.flipSided}}function p(g){if(na!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);na=g}}function n(g){pa[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);pa[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);pa[2].set(g.n41+g.n21,g.n42+g.n22,
-g.n43+g.n23,g.n44+g.n24);pa[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);pa[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);pa[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=pa[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),h=0;h<6;h++){g=pa[h].x*m.n14+pa[h].y*m.n24+pa[h].z*m.n34+pa[h].w;if(g<=o)return!1}return!0}function z(g,
+3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(ka!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ka=g.doubleSided}if(na!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);na=g.flipSided}}function p(g){if(U!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);U=g}}function n(g){ra[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);ra[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);ra[2].set(g.n41+g.n21,g.n42+g.n22,
+g.n43+g.n23,g.n44+g.n24);ra[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);ra[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);ra[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=ra[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),h=0;h<6;h++){g=ra[h].x*m.n14+ra[h].y*m.n24+ra[h].z*m.n34+ra[h].w;if(g<=o)return!1}return!0}function z(g,
 m){g.list[g.count]=m;g.count+=1}function A(g){var m,o,h=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=h.materials.length;g<m;g++){o=h.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?z(t,o):z(k,o)}}function D(g){var m,o,h,k,t=g.object,q=g.buffer,r=g.opaque,E=g.transparent;E.count=0;g=r.count=0;for(h=t.materials.length;g<h;g++){m=t.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
-1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k)}}}function y(g,m){return m.z-g.z}function K(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function H(g){function m(W){var I=[];o=0;for(h=W.length;o<h;o++)W[o]==undefined?I.push("undefined"):I.push(W[o].id);return I.join("_")}var o,
+1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?z(E,k):z(r,k)}}}function y(g,m){return m.z-g.z}function K(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function I(g){function m(V){var H=[];o=0;for(h=V.length;o<h;o++)V[o]==undefined?H.push("undefined"):H.push(V[o].id);return H.join("_")}var o,
 h,k,t,q,r,E,x,v={},L=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(t=g.faces.length;k<t;k++){q=g.faces[k];r=q.materials;E=m(r);v[E]==undefined&&(v[E]={hash:E,counter:0});x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]={faces:[],materials:r,vertices:0,numMorphTargets:L});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[x].vertices+q>65535){v[E].counter+=1;x=v[E].hash+"_"+v[E].counter;g.geometryGroups[x]==undefined&&(g.geometryGroups[x]=
-{faces:[],materials:r,vertices:0,numMorphTargets:L})}g.geometryGroups[x].faces.push(k);g.geometryGroups[x].vertices+=q}}function M(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(g){if(g!=wa){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
-break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}wa=g}}function ia(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,V(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,V(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,V(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,V(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
+{faces:[],materials:r,vertices:0,numMorphTargets:L})}g.geometryGroups[x].faces.push(k);g.geometryGroups[x].vertices+=q}}function N(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(g){if(g!=oa){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
+break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}oa=g}}function ja(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,T(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,T(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,T(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,T(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
 d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,la(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,la(m.minFilter))}}function R(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D,
-g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,V(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,V(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,V(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,V(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,V(g.format),g.width,g.height,0,V(g.format),V(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
-d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=Ga;g=T}if(m!=N){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(U,ca,o,g);N=m}}function B(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
-d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function la(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function V(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
+g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,T(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,T(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,T(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,T(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,T(g.format),g.width,g.height,0,T(g.format),T(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
+d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=pa;g=X}if(m!=M){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(ha,wa,o,g);M=m}}function B(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
+d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function la(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function T(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
 case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
-case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var ma=document.createElement("canvas"),d,Ea=null,N=null,P=this,sa=null,ja=null,wa=null,na=null,U=0,ca=0,Ga=0,T=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,Ka=new Float32Array(16),Ua=new Float32Array(16),Ma=new THREE.Vector4,Qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},ya=!0,Va=new THREE.Color(0),Ja=0;if(a){if(a.antialias!==undefined)ya=a.antialias;a.clearColor!==undefined&&Va.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ja=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ma;this.autoClear=!0;this.sortObjects=
-!0;(function(g,m,o){try{if(!(d=ma.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(h){console.error(h)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(ya,Va,Ja);this.context=d;this.setSize=function(g,m){ma.width=g;ma.height=m;this.setViewport(0,0,ma.width,ma.height)};
-this.setViewport=function(g,m,o,h){U=g;ca=m;Ga=o;T=h;d.viewport(U,ca,Ga,T)};this.setScissor=function(g,m,o,h){d.scissor(g,m,o,h)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
+case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var ma=document.createElement("canvas"),d,P=null,M=null,ya=this,ka=null,na=null,oa=null,U=null,ha=0,wa=0,pa=0,X=0,ra=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,Ma=new Float32Array(16),Ga=new Float32Array(16),ia=new THREE.Vector4,Ka={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ta=!0,Wa=new THREE.Color(0),Xa=0;if(a){if(a.antialias!==undefined)Ta=a.antialias;a.clearColor!==undefined&&Wa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Xa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ma;this.autoClear=!0;this.sortObjects=
+!0;(function(g,m,o){try{if(!(d=ma.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(h){console.error(h)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(Ta,Wa,Xa);this.context=d;this.setSize=function(g,m){ma.width=g;ma.height=m;this.setViewport(0,0,ma.width,ma.height)};
+this.setViewport=function(g,m,o,h){ha=g;wa=m;pa=o;X=h;d.viewport(ha,wa,pa,X)};this.setScissor=function(g,m,o,h){d.scissor(g,m,o,h)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
 function(g,m,o,h){var k,t,q;if(g instanceof THREE.MeshDepthMaterial)c(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)c(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)c(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)c(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)c(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)c(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&&
 c(g,THREE.ShaderLib.particle_basic);var r,E,x,v;q=x=v=0;for(r=m.length;q<r;q++){E=m[q];E instanceof THREE.DirectionalLight&&x++;E instanceof THREE.PointLight&&v++}if(v+x<=4)m=x;else{m=Math.ceil(4*x/(v+x));v=4-m}q={directional:m,point:v};r=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)r=h.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,morphTargets:g.morphTargets,
 maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=d.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
@@ -217,36 +217,36 @@ d.attachShader(o,B("fragment",q+v));d.attachShader(o,B("vertex",r+m));d.linkProg
 k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=d.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(t in g.attributes)o.push(t);t=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];t.attributes[m]=d.getAttribLocation(t,m)}t=g.program.attributes;d.enableVertexAttribArray(t.position);t.color>=0&&d.enableVertexAttribArray(t.color);t.normal>=0&&d.enableVertexAttribArray(t.normal);
 t.tangent>=0&&d.enableVertexAttribArray(t.tangent);if(g.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0){d.enableVertexAttribArray(t.skinVertexA);d.enableVertexAttribArray(t.skinVertexB);d.enableVertexAttribArray(t.skinIndex);d.enableVertexAttribArray(t.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(t.morphTarget0>=0){d.enableVertexAttribArray(t.morphTarget0);g.numSupportedMorphTargets++}if(t.morphTarget1>=0){d.enableVertexAttribArray(t.morphTarget1);
 g.numSupportedMorphTargets++}if(t.morphTarget2>=0){d.enableVertexAttribArray(t.morphTarget2);g.numSupportedMorphTargets++}if(t.morphTarget3>=0){d.enableVertexAttribArray(t.morphTarget3);g.numSupportedMorphTargets++}if(t.morphTarget4>=0){d.enableVertexAttribArray(t.morphTarget4);g.numSupportedMorphTargets++}if(t.morphTarget5>=0){d.enableVertexAttribArray(t.morphTarget5);g.numSupportedMorphTargets++}if(t.morphTarget6>=0){d.enableVertexAttribArray(t.morphTarget6);g.numSupportedMorphTargets++}if(t.morphTarget7>=
-0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)h.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,h){var k,t,q,r,E,x,v,L,W=g.lights,I=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(Ua);m.projectionMatrix.flattenToArray(Ka);ka.multiply(m.projectionMatrix,m.matrixWorldInverse);n(ka);this.initWebGLObjects(g);
-R(o);(this.autoClear||h)&&this.clear();E=g.__webglObjects.length;for(h=0;h<E;h++){k=g.__webglObjects[h];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);D(k);k.render=!0;if(this.sortObjects){Ma.copy(v.position);ka.multiplyVector3(Ma);k.z=Ma.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);x=g.__webglObjectsImmediate.length;for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){v.matrixAutoUpdate&&
-v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);A(k)}}O(THREE.NormalBlending);for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,W,I,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=e(m,W,I,r,v);v.render(function(Q){i(Q,t)})}}}for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;
-q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);f(m,W,I,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);t=e(m,W,I,r,v);v.render(function(Q){i(Q,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,h=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&H(k);for(h in k.geometryGroups){t=
+0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}h.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)h.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,h){var k,t,q,r,E,x,v,L,V=g.lights,H=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(Ga);m.projectionMatrix.flattenToArray(Ma);Aa.multiply(m.projectionMatrix,m.matrixWorldInverse);n(Aa);this.initWebGLObjects(g);
+R(o);(this.autoClear||h)&&this.clear();E=g.__webglObjects.length;for(h=0;h<E;h++){k=g.__webglObjects[h];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);D(k);k.render=!0;if(this.sortObjects){ia.copy(v.position);Aa.multiplyVector3(ia);k.z=ia.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);x=g.__webglObjectsImmediate.length;for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){v.matrixAutoUpdate&&
+v.matrixWorld.flattenToArray(v._objectMatrixArray);K(v,m);A(k)}}O(THREE.NormalBlending);for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,V,H,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=e(m,V,H,r,v);v.render(function(Q){i(Q,t)})}}}for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;L=k.buffer;
+q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);f(m,V,H,r,L,v)}}}for(h=0;h<x;h++){k=g.__webglObjectsImmediate[h];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];O(r.blending);p(r.depthTest);t=e(m,V,H,r,v);v.render(function(Q){i(Q,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
+function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,h=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&I(k);for(h in k.geometryGroups){t=
 k.geometryGroups[h];if(!t.__webGLVertexBuffer){var q=t;q.__webGLVertexBuffer=d.createBuffer();q.__webGLNormalBuffer=d.createBuffer();q.__webGLTangentBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q.__webGLUVBuffer=d.createBuffer();q.__webGLUV2Buffer=d.createBuffer();q.__webGLSkinVertexABuffer=d.createBuffer();q.__webGLSkinVertexBBuffer=d.createBuffer();q.__webGLSkinIndicesBuffer=d.createBuffer();q.__webGLSkinWeightsBuffer=d.createBuffer();q.__webGLFaceBuffer=d.createBuffer();q.__webGLLineBuffer=
-d.createBuffer();if(q.numMorphTargets){var r=void 0,E=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(E=q.numMorphTargets;r<E;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var x=m,v=void 0,L=void 0,W=E=r=0;v=void 0;L=void 0;var I=void 0;L=void 0;var Q=x.geometry;I=Q.faces;var J=q.faces;v=0;for(L=J.length;v<L;v++){fi=J[v];face=I[fi];if(face instanceof THREE.Face3){r+=3;E+=1;W+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;W+=4}}v=q;L=x;I=void 0;J=void 0;var Y=void 0,Aa=void 0;Y=void 0;
-var S=[];I=0;for(J=L.materials.length;I<J;I++){Y=L.materials[I];if(Y instanceof THREE.MeshFaceMaterial){Y=0;for(l=v.materials.length;Y<l;Y++)(Aa=v.materials[Y])&&S.push(Aa)}else(Aa=Y)&&S.push(Aa)}L=S;a:{v=void 0;I=void 0;J=L.length;for(v=0;v<J;v++){I=L[v];if(I.map||I.lightMap){v=!0;break a}}v=!1}a:{I=void 0;J=void 0;S=L.length;for(I=0;I<S;I++){J=L[I];if(!(J instanceof THREE.MeshBasicMaterial||J instanceof THREE.MeshDepthMaterial)){I=J&&J.shading!=undefined&&J.shading==THREE.SmoothShading?THREE.SmoothShading:
-THREE.FlatShading;break a}}I=!1}a:{J=void 0;S=void 0;Y=L.length;for(J=0;J<Y;J++){S=L[J];if(S.vertexColors){L=S.vertexColors;break a}}L=!1}q.__vertexArray=new Float32Array(r*3);if(I)q.__normalArray=new Float32Array(r*3);if(Q.hasTangents)q.__tangentArray=new Float32Array(r*4);if(L)q.__colorArray=new Float32Array(r*3);if(v){if(Q.faceUvs.length>0||Q.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(Q.faceUvs.length>1||Q.faceVertexUvs.length>1)q.__uv2Array=new Float32Array(r*2)}if(x.geometry.skinWeights.length&&
-x.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(W*2);if(q.numMorphTargets){x=void 0;Q=void 0;q.__morphTargetsArrays=[];x=0;for(Q=q.numMorphTargets;x<Q;x++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=I==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=
-L;q.__normalType=I;q.__webGLFaceCount=E*3;q.__webGLLineCount=W*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}M(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLVertexCount=
-t;k.__dirtyVertices=!0;k.__dirtyColors=!0}M(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}M(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=
-d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__sortArray=[];h.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}M(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];
-o=g;k=void 0;h=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){h=o.__webglObjects[k].object;m==h&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){h=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(h instanceof THREE.Mesh){k=h.geometry;for(t in k.geometryGroups){q=k.geometryGroups[t];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;E=void 0;
-W=void 0;var Z=void 0,w=void 0;Z=void 0;var va=void 0,X=void 0,Ba=void 0;x=void 0;Q=void 0;v=void 0;L=void 0;I=void 0;var C=void 0,F=void 0,G=void 0,$=void 0;X=void 0;Ba=void 0;C=void 0;w=void 0;C=void 0;F=void 0;G=void 0;X=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;w=void 0;va=void 0;Z=void 0;Z=void 0;var xa=void 0,Wa=void 0,qa=void 0,La=Aa=Y=S=J=0,Ca=0,aa=0,Da=0,oa=0,u=0,ra=0,ta=q.__vertexArray,
-Ya=q.__uvArray,Za=q.__uv2Array,Ia=q.__normalArray,da=q.__tangentArray,ua=q.__colorArray,ea=q.__skinVertexAArray,fa=q.__skinVertexBArray,ga=q.__skinIndexArray,ha=q.__skinWeightArray,$a=q.__morphTargetsArrays,Na=q.__faceArray,Fa=q.__lineArray,gb=q.__needsSmoothNormals;Q=q.__vertexColorType;x=q.__uvType;v=q.__normalType;var za=h.geometry,ab=za.__dirtyVertices,bb=za.__dirtyElements,Xa=za.__dirtyUvs,cb=za.__dirtyNormals,db=za.__dirtyTangents,eb=za.__dirtyColors,fb=za.__dirtyMorphTargets,Ha=za.vertices,
-hb=q.faces,kb=za.faces,ib=za.faceVertexUvs[0],jb=za.faceVertexUvs[1],Ra=za.skinVerticesA,Sa=za.skinVerticesB,Ta=za.skinIndices,Pa=za.skinWeights,Oa=za.morphTargets;E=0;for(W=hb.length;E<W;E++){Z=hb[E];w=kb[Z];ib&&(L=ib[Z]);jb&&(I=jb[Z]);Z=w.vertexNormals;va=w.normal;X=w.vertexColors;Ba=w.color;if(w instanceof THREE.Face3){if(ab){C=Ha[w.a].position;F=Ha[w.b].position;G=Ha[w.c].position;ta[S]=C.x;ta[S+1]=C.y;ta[S+2]=C.z;ta[S+3]=F.x;ta[S+4]=F.y;ta[S+5]=F.z;ta[S+6]=G.x;ta[S+7]=G.y;ta[S+8]=G.z;S+=9}if(fb){xa=
-0;for(Wa=Oa.length;xa<Wa;xa++){C=Oa[xa].vertices[w.a].position;F=Oa[xa].vertices[w.b].position;G=Oa[xa].vertices[w.c].position;qa=$a[xa];qa[ra+0]=C.x;qa[ra+1]=C.y;qa[ra+2]=C.z;qa[ra+3]=F.x;qa[ra+4]=F.y;qa[ra+5]=F.z;qa[ra+6]=G.x;qa[ra+7]=G.y;qa[ra+8]=G.z}ra+=9}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];ha[u]=C.x;ha[u+1]=C.y;ha[u+2]=C.z;ha[u+3]=C.w;ha[u+4]=F.x;ha[u+5]=F.y;ha[u+6]=F.z;ha[u+7]=F.w;ha[u+8]=G.x;ha[u+9]=G.y;ha[u+10]=G.z;ha[u+11]=G.w;C=Ta[w.a];F=Ta[w.b];G=Ta[w.c];ga[u]=C.x;ga[u+1]=C.y;ga[u+
-2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;ga[u+11]=G.w;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+10]=G.z;ea[u+11]=1;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=1;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=1;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=1;u+=12}if(eb&&Q){if(X.length==3&&Q==THREE.VertexColors){C=
-X[0];F=X[1];G=X[2]}else G=F=C=Ba;ua[oa]=C.r;ua[oa+1]=C.g;ua[oa+2]=C.b;ua[oa+3]=F.r;ua[oa+4]=F.g;ua[oa+5]=F.b;ua[oa+6]=G.r;ua[oa+7]=G.g;ua[oa+8]=G.b;oa+=9}if(db&&za.hasTangents){X=Ha[w.a].tangent;Ba=Ha[w.b].tangent;C=Ha[w.c].tangent;da[aa]=X.x;da[aa+1]=X.y;da[aa+2]=X.z;da[aa+3]=X.w;da[aa+4]=Ba.x;da[aa+5]=Ba.y;da[aa+6]=Ba.z;da[aa+7]=Ba.w;da[aa+8]=C.x;da[aa+9]=C.y;da[aa+10]=C.z;da[aa+11]=C.w;aa+=12}if(cb&&v)if(Z.length==3&&gb)for(w=0;w<3;w++){va=Z[w];Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}else for(w=
-0;w<3;w++){Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}if(Xa&&L!==undefined&&x)for(w=0;w<3;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&I!==undefined&&x)for(w=0;w<3;w++){Z=I[w];Za[Aa]=Z.u;Za[Aa+1]=Z.v;Aa+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;La+=3;Fa[Da]=J;Fa[Da+1]=J+1;Fa[Da+2]=J;Fa[Da+3]=J+2;Fa[Da+4]=J+1;Fa[Da+5]=J+2;Da+=6;J+=3}}else if(w instanceof THREE.Face4){if(ab){C=Ha[w.a].position;F=Ha[w.b].position;G=Ha[w.c].position;$=Ha[w.d].position;ta[S]=C.x;ta[S+1]=C.y;ta[S+2]=C.z;ta[S+3]=
-F.x;ta[S+4]=F.y;ta[S+5]=F.z;ta[S+6]=G.x;ta[S+7]=G.y;ta[S+8]=G.z;ta[S+9]=$.x;ta[S+10]=$.y;ta[S+11]=$.z;S+=12}if(fb){xa=0;for(Wa=Oa.length;xa<Wa;xa++){C=Oa[xa].vertices[w.a].position;F=Oa[xa].vertices[w.b].position;G=Oa[xa].vertices[w.c].position;$=Oa[xa].vertices[w.d].position;qa=$a[xa];qa[ra+0]=C.x;qa[ra+1]=C.y;qa[ra+2]=C.z;qa[ra+3]=F.x;qa[ra+4]=F.y;qa[ra+5]=F.z;qa[ra+6]=G.x;qa[ra+7]=G.y;qa[ra+8]=G.z;qa[ra+9]=$.x;qa[ra+10]=$.y;qa[ra+11]=$.z}ra+=12}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];$=Pa[w.d];
-ha[u]=C.x;ha[u+1]=C.y;ha[u+2]=C.z;ha[u+3]=C.w;ha[u+4]=F.x;ha[u+5]=F.y;ha[u+6]=F.z;ha[u+7]=F.w;ha[u+8]=G.x;ha[u+9]=G.y;ha[u+10]=G.z;ha[u+11]=G.w;ha[u+12]=$.x;ha[u+13]=$.y;ha[u+14]=$.z;ha[u+15]=$.w;C=Ta[w.a];F=Ta[w.b];G=Ta[w.c];$=Ta[w.d];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;ga[u+11]=G.w;ga[u+12]=$.x;ga[u+13]=$.y;ga[u+14]=$.z;ga[u+15]=$.w;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];$=Ra[w.d];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=
-C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+10]=G.z;ea[u+11]=1;ea[u+12]=$.x;ea[u+13]=$.y;ea[u+14]=$.z;ea[u+15]=1;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];$=Sa[w.d];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=1;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=1;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=1;fa[u+12]=$.x;fa[u+13]=$.y;fa[u+14]=$.z;fa[u+15]=1;u+=16}if(eb&&Q){if(X.length==4&&Q==THREE.VertexColors){C=X[0];F=X[1];G=X[2];X=X[3]}else X=G=F=C=Ba;ua[oa]=C.r;ua[oa+
-1]=C.g;ua[oa+2]=C.b;ua[oa+3]=F.r;ua[oa+4]=F.g;ua[oa+5]=F.b;ua[oa+6]=G.r;ua[oa+7]=G.g;ua[oa+8]=G.b;ua[oa+9]=X.r;ua[oa+10]=X.g;ua[oa+11]=X.b;oa+=12}if(db&&za.hasTangents){X=Ha[w.a].tangent;Ba=Ha[w.b].tangent;C=Ha[w.c].tangent;w=Ha[w.d].tangent;da[aa]=X.x;da[aa+1]=X.y;da[aa+2]=X.z;da[aa+3]=X.w;da[aa+4]=Ba.x;da[aa+5]=Ba.y;da[aa+6]=Ba.z;da[aa+7]=Ba.w;da[aa+8]=C.x;da[aa+9]=C.y;da[aa+10]=C.z;da[aa+11]=C.w;da[aa+12]=w.x;da[aa+13]=w.y;da[aa+14]=w.z;da[aa+15]=w.w;aa+=16}if(cb&&v)if(Z.length==4&&gb)for(w=0;w<
-4;w++){va=Z[w];Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}else for(w=0;w<4;w++){Ia[Ca]=va.x;Ia[Ca+1]=va.y;Ia[Ca+2]=va.z;Ca+=3}if(Xa&&L!==undefined&&x)for(w=0;w<4;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&I!==undefined&&x)for(w=0;w<4;w++){Z=I[w];Za[Aa]=Z.u;Za[Aa+1]=Z.v;Aa+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;Na[La+3]=J;Na[La+4]=J+2;Na[La+5]=J+3;La+=6;Fa[Da]=J;Fa[Da+1]=J+1;Fa[Da+2]=J;Fa[Da+3]=J+3;Fa[Da+4]=J+1;Fa[Da+5]=J+2;Fa[Da+6]=J+2;Fa[Da+7]=J+3;Da+=8;J+=4}}}if(ab){d.bindBuffer(d.ARRAY_BUFFER,
-q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ta,r)}if(fb){xa=0;for(Wa=Oa.length;xa<Wa;xa++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[xa]);d.bufferData(d.ARRAY_BUFFER,$a[xa],r)}}if(eb&&oa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,ua,r)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ia,r)}if(db&&za.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,da,r)}if(Xa&&
-Y>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ya,r)}if(Xa&&Aa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(bb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Na,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Fa,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,
-q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ha,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;
-x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;I=h.__vertexArray;W=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;I[q]=Q.x;I[q+1]=Q.y;I[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,W,t)}}k.__dirtyVertices=!1;k.__dirtyColors=
-!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;I=h.__vertexArray;W=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;I[q]=Q.x;I[q+1]=Q.y;I[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*3;W[q]=color.r;W[q+1]=color.g;W[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,
-h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,W,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){k=h.geometry;(k.__dirtyVertices||k.__dirtyColors||h.sortParticles)&&b(k,d.DYNAMIC_DRAW,h);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};
-this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+d.createBuffer();if(q.numMorphTargets){var r=void 0,E=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(E=q.numMorphTargets;r<E;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var x=m,v=void 0,L=void 0,V=E=r=0;v=void 0;L=void 0;var H=void 0;L=void 0;var Q=x.geometry;H=Q.faces;var J=q.faces;v=0;for(L=J.length;v<L;v++){fi=J[v];face=H[fi];if(face instanceof THREE.Face3){r+=3;E+=1;V+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;V+=4}}v=q;L=x;H=void 0;J=void 0;var Y=void 0,Ca=void 0;Y=void 0;
+var S=[];H=0;for(J=L.materials.length;H<J;H++){Y=L.materials[H];if(Y instanceof THREE.MeshFaceMaterial){Y=0;for(l=v.materials.length;Y<l;Y++)(Ca=v.materials[Y])&&S.push(Ca)}else(Ca=Y)&&S.push(Ca)}L=S;a:{v=void 0;H=void 0;J=L.length;for(v=0;v<J;v++){H=L[v];if(H.map||H.lightMap||H instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{H=void 0;J=void 0;S=L.length;for(H=0;H<S;H++){J=L[H];if(!(J instanceof THREE.MeshBasicMaterial&&!J.envMap||J instanceof THREE.MeshDepthMaterial)){H=J&&J.shading!=
+undefined&&J.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}H=!1}a:{J=void 0;S=void 0;Y=L.length;for(J=0;J<Y;J++){S=L[J];if(S.vertexColors){L=S.vertexColors;break a}}L=!1}q.__vertexArray=new Float32Array(r*3);if(H)q.__normalArray=new Float32Array(r*3);if(Q.hasTangents)q.__tangentArray=new Float32Array(r*4);if(L)q.__colorArray=new Float32Array(r*3);if(v){if(Q.faceUvs.length>0||Q.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(Q.faceUvs.length>1||Q.faceVertexUvs.length>
+1)q.__uv2Array=new Float32Array(r*2)}if(x.geometry.skinWeights.length&&x.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(E*3);q.__lineArray=new Uint16Array(V*2);if(q.numMorphTargets){x=void 0;Q=void 0;q.__morphTargetsArrays=[];x=0;for(Q=q.numMorphTargets;x<Q;x++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
+H==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=L;q.__normalType=H;q.__webGLFaceCount=E*3;q.__webGLLineCount=V*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}N(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*
+3);h.__colorArray=new Float32Array(t*3);h.__webGLVertexCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}N(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}N(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=
+m.geometry;if(!k.__webGLVertexBuffer){h=k;h.__webGLVertexBuffer=d.createBuffer();h.__webGLColorBuffer=d.createBuffer();h=k;t=h.vertices.length;h.__vertexArray=new Float32Array(t*3);h.__colorArray=new Float32Array(t*3);h.__sortArray=[];h.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}N(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,
+1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];o=g;k=void 0;h=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){h=o.__webglObjects[k].object;m==h&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){h=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(h instanceof THREE.Mesh){k=h.geometry;for(t in k.geometryGroups){q=k.geometryGroups[t];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||
+k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;E=void 0;V=void 0;var Z=void 0,w=void 0;Z=void 0;var xa=void 0,W=void 0,Da=void 0;x=void 0;Q=void 0;v=void 0;L=void 0;H=void 0;var C=void 0,F=void 0,G=void 0,$=void 0;W=void 0;Da=void 0;C=void 0;w=void 0;C=void 0;F=void 0;G=void 0;W=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;C=void 0;F=void 0;G=void 0;$=void 0;w=void 0;xa=void 0;Z=void 0;Z=void 0;var za=void 0,Ua=void 0,sa=
+void 0,La=Ca=Y=S=J=0,Ea=0,aa=0,Fa=0,qa=0,u=0,ta=0,ua=q.__vertexArray,Ya=q.__uvArray,Za=q.__uv2Array,Ja=q.__normalArray,ca=q.__tangentArray,va=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,$a=q.__morphTargetsArrays,Na=q.__faceArray,Ha=q.__lineArray,gb=q.__needsSmoothNormals;Q=q.__vertexColorType;x=q.__uvType;v=q.__normalType;var Ba=h.geometry,ab=Ba.__dirtyVertices,bb=Ba.__dirtyElements,Va=Ba.__dirtyUvs,cb=Ba.__dirtyNormals,db=Ba.__dirtyTangents,
+eb=Ba.__dirtyColors,fb=Ba.__dirtyMorphTargets,Ia=Ba.vertices,hb=q.faces,kb=Ba.faces,ib=Ba.faceVertexUvs[0],jb=Ba.faceVertexUvs[1],Qa=Ba.skinVerticesA,Ra=Ba.skinVerticesB,Sa=Ba.skinIndices,Pa=Ba.skinWeights,Oa=Ba.morphTargets;E=0;for(V=hb.length;E<V;E++){Z=hb[E];w=kb[Z];ib&&(L=ib[Z]);jb&&(H=jb[Z]);Z=w.vertexNormals;xa=w.normal;W=w.vertexColors;Da=w.color;if(w instanceof THREE.Face3){if(ab){C=Ia[w.a].position;F=Ia[w.b].position;G=Ia[w.c].position;ua[S]=C.x;ua[S+1]=C.y;ua[S+2]=C.z;ua[S+3]=F.x;ua[S+4]=
+F.y;ua[S+5]=F.z;ua[S+6]=G.x;ua[S+7]=G.y;ua[S+8]=G.z;S+=9}if(fb){za=0;for(Ua=Oa.length;za<Ua;za++){C=Oa[za].vertices[w.a].position;F=Oa[za].vertices[w.b].position;G=Oa[za].vertices[w.c].position;sa=$a[za];sa[ta+0]=C.x;sa[ta+1]=C.y;sa[ta+2]=C.z;sa[ta+3]=F.x;sa[ta+4]=F.y;sa[ta+5]=F.z;sa[ta+6]=G.x;sa[ta+7]=G.y;sa[ta+8]=G.z}ta+=9}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;
+ga[u+11]=G.w;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=C.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=G.w;C=Qa[w.a];F=Qa[w.b];G=Qa[w.c];da[u]=C.x;da[u+1]=C.y;da[u+2]=C.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=G.x;da[u+9]=G.y;da[u+10]=G.z;da[u+11]=1;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+
+10]=G.z;ea[u+11]=1;u+=12}if(eb&&Q){if(W.length==3&&Q==THREE.VertexColors){C=W[0];F=W[1];G=W[2]}else G=F=C=Da;va[qa]=C.r;va[qa+1]=C.g;va[qa+2]=C.b;va[qa+3]=F.r;va[qa+4]=F.g;va[qa+5]=F.b;va[qa+6]=G.r;va[qa+7]=G.g;va[qa+8]=G.b;qa+=9}if(db&&Ba.hasTangents){W=Ia[w.a].tangent;Da=Ia[w.b].tangent;C=Ia[w.c].tangent;ca[aa]=W.x;ca[aa+1]=W.y;ca[aa+2]=W.z;ca[aa+3]=W.w;ca[aa+4]=Da.x;ca[aa+5]=Da.y;ca[aa+6]=Da.z;ca[aa+7]=Da.w;ca[aa+8]=C.x;ca[aa+9]=C.y;ca[aa+10]=C.z;ca[aa+11]=C.w;aa+=12}if(cb&&v)if(Z.length==3&&gb)for(w=
+0;w<3;w++){xa=Z[w];Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}else for(w=0;w<3;w++){Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}if(Va&&L!==undefined&&x)for(w=0;w<3;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Va&&H!==undefined&&x)for(w=0;w<3;w++){Z=H[w];Za[Ca]=Z.u;Za[Ca+1]=Z.v;Ca+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;La+=3;Ha[Fa]=J;Ha[Fa+1]=J+1;Ha[Fa+2]=J;Ha[Fa+3]=J+2;Ha[Fa+4]=J+1;Ha[Fa+5]=J+2;Fa+=6;J+=3}}else if(w instanceof THREE.Face4){if(ab){C=Ia[w.a].position;F=Ia[w.b].position;G=Ia[w.c].position;
+$=Ia[w.d].position;ua[S]=C.x;ua[S+1]=C.y;ua[S+2]=C.z;ua[S+3]=F.x;ua[S+4]=F.y;ua[S+5]=F.z;ua[S+6]=G.x;ua[S+7]=G.y;ua[S+8]=G.z;ua[S+9]=$.x;ua[S+10]=$.y;ua[S+11]=$.z;S+=12}if(fb){za=0;for(Ua=Oa.length;za<Ua;za++){C=Oa[za].vertices[w.a].position;F=Oa[za].vertices[w.b].position;G=Oa[za].vertices[w.c].position;$=Oa[za].vertices[w.d].position;sa=$a[za];sa[ta+0]=C.x;sa[ta+1]=C.y;sa[ta+2]=C.z;sa[ta+3]=F.x;sa[ta+4]=F.y;sa[ta+5]=F.z;sa[ta+6]=G.x;sa[ta+7]=G.y;sa[ta+8]=G.z;sa[ta+9]=$.x;sa[ta+10]=$.y;sa[ta+11]=
+$.z}ta+=12}if(Pa.length){C=Pa[w.a];F=Pa[w.b];G=Pa[w.c];$=Pa[w.d];ga[u]=C.x;ga[u+1]=C.y;ga[u+2]=C.z;ga[u+3]=C.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=G.x;ga[u+9]=G.y;ga[u+10]=G.z;ga[u+11]=G.w;ga[u+12]=$.x;ga[u+13]=$.y;ga[u+14]=$.z;ga[u+15]=$.w;C=Sa[w.a];F=Sa[w.b];G=Sa[w.c];$=Sa[w.d];fa[u]=C.x;fa[u+1]=C.y;fa[u+2]=C.z;fa[u+3]=C.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=G.x;fa[u+9]=G.y;fa[u+10]=G.z;fa[u+11]=G.w;fa[u+12]=$.x;fa[u+13]=$.y;fa[u+14]=$.z;fa[u+15]=$.w;C=Qa[w.a];
+F=Qa[w.b];G=Qa[w.c];$=Qa[w.d];da[u]=C.x;da[u+1]=C.y;da[u+2]=C.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=G.x;da[u+9]=G.y;da[u+10]=G.z;da[u+11]=1;da[u+12]=$.x;da[u+13]=$.y;da[u+14]=$.z;da[u+15]=1;C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];$=Ra[w.d];ea[u]=C.x;ea[u+1]=C.y;ea[u+2]=C.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=G.x;ea[u+9]=G.y;ea[u+10]=G.z;ea[u+11]=1;ea[u+12]=$.x;ea[u+13]=$.y;ea[u+14]=$.z;ea[u+15]=1;u+=16}if(eb&&Q){if(W.length==4&&Q==THREE.VertexColors){C=
+W[0];F=W[1];G=W[2];W=W[3]}else W=G=F=C=Da;va[qa]=C.r;va[qa+1]=C.g;va[qa+2]=C.b;va[qa+3]=F.r;va[qa+4]=F.g;va[qa+5]=F.b;va[qa+6]=G.r;va[qa+7]=G.g;va[qa+8]=G.b;va[qa+9]=W.r;va[qa+10]=W.g;va[qa+11]=W.b;qa+=12}if(db&&Ba.hasTangents){W=Ia[w.a].tangent;Da=Ia[w.b].tangent;C=Ia[w.c].tangent;w=Ia[w.d].tangent;ca[aa]=W.x;ca[aa+1]=W.y;ca[aa+2]=W.z;ca[aa+3]=W.w;ca[aa+4]=Da.x;ca[aa+5]=Da.y;ca[aa+6]=Da.z;ca[aa+7]=Da.w;ca[aa+8]=C.x;ca[aa+9]=C.y;ca[aa+10]=C.z;ca[aa+11]=C.w;ca[aa+12]=w.x;ca[aa+13]=w.y;ca[aa+14]=w.z;
+ca[aa+15]=w.w;aa+=16}if(cb&&v)if(Z.length==4&&gb)for(w=0;w<4;w++){xa=Z[w];Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}else for(w=0;w<4;w++){Ja[Ea]=xa.x;Ja[Ea+1]=xa.y;Ja[Ea+2]=xa.z;Ea+=3}if(Va&&L!==undefined&&x)for(w=0;w<4;w++){Z=L[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Va&&H!==undefined&&x)for(w=0;w<4;w++){Z=H[w];Za[Ca]=Z.u;Za[Ca+1]=Z.v;Ca+=2}if(bb){Na[La]=J;Na[La+1]=J+1;Na[La+2]=J+2;Na[La+3]=J;Na[La+4]=J+2;Na[La+5]=J+3;La+=6;Ha[Fa]=J;Ha[Fa+1]=J+1;Ha[Fa+2]=J;Ha[Fa+3]=J+3;Ha[Fa+4]=J+1;Ha[Fa+5]=J+2;Ha[Fa+
+6]=J+2;Ha[Fa+7]=J+3;Fa+=8;J+=4}}}if(ab){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ua,r)}if(fb){za=0;for(Ua=Oa.length;za<Ua;za++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[za]);d.bufferData(d.ARRAY_BUFFER,$a[za],r)}}if(eb&&qa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,va,r)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ja,r)}if(db&&Ba.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
+q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Va&&Y>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ya,r)}if(Va&&Ca>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(bb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Na,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ha,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);
+d.bufferData(d.ARRAY_BUFFER,da,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||
+k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;H=h.__vertexArray;V=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;H[q]=Q.x;H[q+1]=Q.y;H[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*3;V[q]=color.r;V[q+1]=color.g;V[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
+V,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;t=d.DYNAMIC_DRAW;x=void 0;x=void 0;Q=void 0;q=void 0;v=h.vertices;r=h.colors;L=v.length;E=r.length;H=h.__vertexArray;V=h.__colorArray;J=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<L;x++){Q=v[x].position;q=x*3;H[q]=Q.x;H[q+1]=Q.y;H[q+2]=Q.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(J){for(x=0;x<E;x++){color=r[x];q=x*
+3;V[q]=color.r;V[q+1]=color.g;V[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,V,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem){k=h.geometry;(k.__dirtyVertices||k.__dirtyColors||h.sortParticles)&&b(k,d.DYNAMIC_DRAW,h);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):
+d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};

+ 5 - 3
examples/misc_lights_test.html

@@ -164,9 +164,11 @@
 				bwebgl.addEventListener("click", toggleWebGL, false);
 
 
-				var loader = new THREE.Loader();
-				//loader.loadAscii( { model: "obj/torus/Torus_slim.js", callback: function( geometry ) { createMesh( geometry ) } } );
-				loader.loadBinary( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createMesh( geometry ) } } );
+				//var loader = new THREE.JSONLoader();
+				//loader.load( { model: "obj/torus/Torus_slim.js", callback: function( geometry ) { createMesh( geometry ) } } );
+				
+				var loader = new THREE.BinaryLoader();
+				loader.load( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createMesh( geometry ) } } );
 
 			}
 

+ 4 - 3
examples/misc_materials_multimaterials.html

@@ -159,11 +159,12 @@
 				bcanvas.addEventListener("click", toggleCanvas, false);
 				bwebgl.addEventListener("click", toggleWebGL, false);
 
-				var loader = new THREE.Loader(),
+				//var loader = new THREE.BinaryLoader(),
+				var loader = new THREE.JSONLoader(),
 					callback = function( geometry ) { createScene( geometry) };
 
-				loader.loadAscii( { model: "obj/female02/Female02_slim.js", callback: callback } );
-				//loader.loadBinary( { model: "obj/female02/Female02_bin.js", callback: callback } );
+				loader.load( { model: "obj/female02/Female02_slim.js", callback: callback } );
+				//loader.load( { model: "obj/female02/Female02_bin.js", callback: callback } );
 
 			}
 

+ 2 - 2
examples/webgl_geometry_dynamic.html

@@ -95,9 +95,9 @@
 
 				}
 
-				for( i = 0; i < geometry.uvs.length; i++ ) {
+				for( i = 0; i < geometry.faceVertexUvs[ 0 ].length; i++ ) {
 
-					var uvs = geometry.uvs[ i ];
+					var uvs = geometry.faceVertexUvs[ 0 ][ i ];
 					for ( j = 0, jl = uvs.length; j < jl; j++ ) {
 
 						uvs[ j ].u *= 5;

+ 4 - 3
examples/webgl_lights_pointlights.html

@@ -69,7 +69,8 @@
 
 				scene = new THREE.Scene();
 
-				loader = new THREE.Loader( true );
+				//loader = new THREE.JSONLoader( true );
+				loader = new THREE.BinaryLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 
 				var callback = function( geometry ) {
@@ -83,8 +84,8 @@
 
 				};
 
-				//loader.loadAscii( { model: "obj/walt/WaltHead_slim.js", callback: callback } );
-				loader.loadBinary( { model: "obj/walt/WaltHead_bin.js", callback: callback } );
+				//loader.load( { model: "obj/walt/WaltHead_slim.js", callback: callback } );
+				loader.load( { model: "obj/walt/WaltHead_bin.js", callback: callback } );
 
 				/*
 				var directionalLight = new THREE.DirectionalLight( 0x111111, 0.9 );

+ 3 - 3
examples/webgl_materials_cars.html

@@ -151,7 +151,7 @@
 			var windowHalfX = window.innerWidth / 2;
 			var windowHalfY = window.innerHeight / 2;
 
-			var loader = new THREE.Loader( true );
+			var loader = new THREE.BinaryLoader( true );
 			document.body.appendChild( loader.statusDomElement );
 
 			init();
@@ -449,7 +449,7 @@
 
 				}
 
-				loader.loadBinary( { model: CARS[ "veyron" ].url, callback: function( geometry ) { createScene( geometry, "veyron" ) } } );
+				loader.load( { model: CARS[ "veyron" ].url, callback: function( geometry ) { createScene( geometry, "veyron" ) } } );
 
 				for( var c in CARS ) initCarButton( c );
 
@@ -462,7 +462,7 @@
 					if ( ! CARS[ car ].object ) {
 
 						loader.statusDomElement.style.display = "block";
-						loader.loadBinary( { model: CARS[ car ].url, callback: function( geometry ) { createScene( geometry, car ) } } );
+						loader.load( { model: CARS[ car ].url, callback: function( geometry ) { createScene( geometry, car ) } } );
 
 					} else {
 

+ 2 - 2
examples/webgl_materials_cars_camaro.html

@@ -144,8 +144,8 @@
 				camaroMaterials.body.push( [ "Bronze", new THREE.MeshPhongMaterial( { color: 0x150505, specular:0xee6600, shininess:10, envMap: textureCube, combine: THREE.MixOperation, reflectivity: 0.5 } ) ] );
 				camaroMaterials.body.push( [ "Chrome", new THREE.MeshPhongMaterial( { color: 0xffffff, specular:0xffffff, envMap: textureCube, combine: THREE.MultiplyOperation } ) ] );
 
-				var loader = new THREE.Loader();
-				loader.loadBinary( { model: "obj/camaro/CamaroNoUv_bin.js", callback: function( geometry ) { createScene( geometry, camaroMaterials ) } } );
+				var loader = new THREE.BinaryLoader();
+				loader.load( { model: "obj/camaro/CamaroNoUv_bin.js", callback: function( geometry ) { createScene( geometry, camaroMaterials ) } } );
 
 			}
 

+ 2 - 2
examples/webgl_materials_cubemap.html

@@ -126,10 +126,10 @@
 				stats.domElement.style.zIndex = 100;
 				container.appendChild( stats.domElement );
 
-				loader = new THREE.Loader( true );
+				loader = new THREE.BinaryLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 
-				loader.loadBinary( { model: "obj/walt/WaltHead_bin.js", callback: function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } } );
+				loader.load( { model: "obj/walt/WaltHead_bin.js", callback: function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } } );
 
 			}
 

+ 2 - 2
examples/webgl_materials_cubemap_refraction.html

@@ -123,10 +123,10 @@
 				stats.domElement.style.zIndex = 100;
 				container.appendChild( stats.domElement );
 
-				loader = new THREE.Loader( true );
+				loader = new THREE.BinaryLoader( true );
 				document.body.appendChild( loader.statusDomElement );
 
-				loader.loadBinary( { model: 'obj/lucy/Lucy100k_bin.js', callback: function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } } );
+				loader.load( { model: 'obj/lucy/Lucy100k_bin.js', callback: function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } } );
 
 				document.addEventListener('mousemove', onDocumentMouseMove, false);
 

+ 1 - 1
examples/webgl_materials_normalmap.html

@@ -187,7 +187,7 @@
 
 			function createScene( geometry, scale, material1, material2 ) {
 
-				//geometry.computeTangents();
+				geometry.computeTangents();
 
 				//mesh1 = SceneUtils.addMesh( scene, geometry, scale, -scale * 12, 0, 0, 0,0,0, material1 );
 				mesh2 = SceneUtils.addMesh( scene, geometry, scale,  scale * 12, 0, 0, 0,0,0, material2 );

+ 86 - 2
examples/webgl_materials_normalmap2.html

@@ -52,8 +52,92 @@
 			</div>
 		</div>
 
+<!--
 		<script type="text/javascript" src="../build/Three.js"></script>
-
+-->
+		<script type="text/javascript" src="../src/Three.js"></script>
+		<script type="text/javascript" src="../src/core/Color.js"></script>
+		<script type="text/javascript" src="../src/core/Vector2.js"></script>
+		<script type="text/javascript" src="../src/core/Vector3.js"></script>
+		<script type="text/javascript" src="../src/core/Vector4.js"></script>
+		<script type="text/javascript" src="../src/core/Ray.js"></script>
+		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
+		<script type="text/javascript" src="../src/core/Matrix3.js"></script>
+		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
+		<script type="text/javascript" src="../src/core/Object3D.js"></script>
+		<script type="text/javascript" src="../src/core/Quaternion.js"></script>
+		<script type="text/javascript" src="../src/core/Vertex.js"></script>
+		<script type="text/javascript" src="../src/core/Face3.js"></script>
+		<script type="text/javascript" src="../src/core/Face4.js"></script>
+		<script type="text/javascript" src="../src/core/UV.js"></script>
+		<script type="text/javascript" src="../src/core/Geometry.js"></script>
+		<script type="text/javascript" src="../src/core/Spline.js"></script>
+		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
+		<script type="text/javascript" src="../src/animation/Animation.js"></script>
+		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
+		<script type="text/javascript" src="../src/lights/Light.js"></script>
+		<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
+		<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
+		<script type="text/javascript" src="../src/lights/PointLight.js"></script>
+		<script type="text/javascript" src="../src/materials/Material.js"></script>
+		<script type="text/javascript" src="../src/materials/Mappings.js"></script>
+		<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/Texture.js"></script>
+		<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
+		<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
+		<script type="text/javascript" src="../src/objects/Particle.js"></script>
+		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
+		<script type="text/javascript" src="../src/objects/Line.js"></script>
+		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Bone.js"></script>
+		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
+		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
+		<script type="text/javascript" src="../src/objects/Sound.js"></script>
+		<script type="text/javascript" src="../src/objects/LOD.js"></script>
+		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
+		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
+		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
+		<script type="text/javascript" src="../src/renderers/Projector.js"></script>
+		<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
+		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
+		<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
+		<script type="text/javascript" src="../src/extras/cameras/QuakeCamera.js"></script>
+		<script type="text/javascript" src="../src/extras/cameras/PathCamera.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/Cube.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/Cylinder.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/Icosahedron.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/Lathe.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/Plane.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/Sphere.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/Torus.js"></script>
+		<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
+		<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
+		<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
+		<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
+		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
+		
 		<script type="text/javascript" src="js/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
@@ -166,7 +250,7 @@
 
 			function createScene( geometry, scale, material ) {
 
-				//geometry.computeTangents();
+				geometry.computeTangents();
 
 				material = new THREE.MeshFaceMaterial();
 				mesh1 = SceneUtils.addMesh( scene, geometry, scale, 0, - 50, 0, 0, 0, 0, material );

+ 5 - 3
examples/webgl_materials_shaders.html

@@ -187,9 +187,11 @@
 				bcanvas.addEventListener("click", toggleCanvas, false);
 				bwebgl.addEventListener("click", toggleWebGL, false);
 
-				var loader = new THREE.Loader();
-				loader.loadAscii( { model: "obj/torus/Torus_slim.js", callback: function( geometry ) { createScene( geometry ) } } );
-				//loader.loadBinary( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createScene( geometry ) } } );
+				var loader = new THREE.JSONLoader();
+				loader.load( { model: "obj/torus/Torus_slim.js", callback: function( geometry ) { createScene( geometry ) } } );
+				
+				//var loader = new THREE.BinaryLoader();
+				//loader.load( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createScene( geometry ) } } );
 
 				document.addEventListener('mousemove', onDocumentMouseMove, false);
 

+ 4 - 4
examples/webgl_materials_texture_filters.html

@@ -126,14 +126,14 @@
 				var i, j, uvs,
 					geometryRepeat = new Plane( 100, 100, 1, 1 );
 					
-				for( i = 0; i < geometryRepeat.uvs.length; i++ ) {
+				for( i = 0; i < geometryRepeat.faceVertexUvs[ 0 ].length; i++ ) {
 					
-					uvs = geometryRepeat.uvs[i];
+					uvs = geometryRepeat.faceVertexUvs[ 0 ][ i ];
 					
 					for ( j = 0; j < uvs.length; j++ ) {
 					
-						uvs[j].u *= 1000;
-						uvs[j].v *= 1000;
+						uvs[ j ].u *= 1000;
+						uvs[ j ].v *= 1000;
 
 					}
 

+ 2 - 2
examples/webgl_materials_video.html

@@ -180,9 +180,9 @@
 
 				var i, j, uv;
 
-				for ( i = 0; i < geometry.uvs.length; i++ ) {
+				for ( i = 0; i < geometry.faceVertexUvs[ 0 ].length; i++ ) {
 
-					uv = geometry.uvs[ i ];
+					uv = geometry.faceVertexUvs[ 0 ][ i ];
 
 					for ( j = 0; j < uv.length; j++ ) {
 

+ 1 - 1
examples/webgl_morphtargets.html

@@ -120,7 +120,7 @@
 					
 					for( var v = 0; v < geometry.vertices.length; v++ ) {
 						
-						vertices.push( new THREE.Vertex( geometry.vertices[ v ].position.clone(), geometry.vertices[ v ].normal.clone()))
+						vertices.push( new THREE.Vertex( geometry.vertices[ v ].position.clone() ) )
 						
 						if( v === i ) {
 							

+ 3 - 2
examples/webgl_objconvert_test.html

@@ -192,6 +192,7 @@
 				bcanvas.addEventListener("click", toggleCanvas, false);
 				bwebgl.addEventListener("click", toggleWebGL, false);
 
+				//var loader = new THREE.BinaryLoader(),
 				var loader = new THREE.JSONLoader(),
 					callbackMale   = function( geometry ) { createScene( geometry,  90, 50, FLOOR, 105 ) },
 					callbackFemale = function( geometry ) { createScene( geometry, -80, 50, FLOOR, 0 ) };
@@ -199,8 +200,8 @@
 				loader.load( { model: "obj/male02/Male02_slim.js", callback: callbackMale } );
 				loader.load( { model: "obj/female02/Female02_slim.js", callback: callbackFemale } );
 
-				//loader.loadBinary( { model: "obj/male02/Male02_bin.js", callback: callbackMale } );
-				//loader.loadBinary( { model: "obj/female02/Female02_bin.js", callback: callbackFemale } );
+				//loader.load( { model: "obj/male02/Male02_bin.js", callback: callbackMale } );
+				//loader.load( { model: "obj/female02/Female02_bin.js", callback: callbackFemale } );
 
 			}
 

+ 2 - 2
examples/webgl_postprocessing.html

@@ -176,9 +176,9 @@
 				quadBG.position.z = -500;
 				sceneBG.addObject( quadBG );
 
-				loader = new THREE.Loader( true );
+				loader = new THREE.JSONLoader( true );
 				document.body.appendChild( loader.statusDomElement );
-				loader.loadAscii( { model: "obj/leeperrysmith/LeePerrySmith.js", callback: function( geometry ) { createMesh( geometry, sceneModel, 100 ) } } );
+				loader.load( { model: "obj/leeperrysmith/LeePerrySmith.js", callback: function( geometry ) { createMesh( geometry, sceneModel, 100 ) } } );
 
 				quadScreen = new THREE.Mesh( plane, materialConvolution );
 				quadScreen.position.z = -100;

+ 2 - 2
examples/webgl_rtt.html

@@ -156,8 +156,8 @@
 				quad.position.z = -100;
 				sceneRTT.addObject( quad );
 
-				var loader = new THREE.Loader();
-				loader.loadBinary( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createMesh( geometry, sceneRTT ) } } );
+				var loader = new THREE.BinaryLoader();
+				loader.load( { model: "obj/torus/Torus_bin.js", callback: function( geometry ) { createMesh( geometry, sceneRTT ) } } );
 
 				quad = new THREE.Mesh( plane, materialScreen );
 				quad.position.z = -100;

+ 9 - 8
src/extras/SceneUtils.js

@@ -16,13 +16,14 @@ var SceneUtils = {
 				geometry, material, camera, fog,
 				texture, images,
 				materials,
-				data, loader,
+				data, binLoader, jsonLoader,
 				counter_models, counter_textures,
 				total_models, total_textures,
 				result;
 
 			data = event.data;
-			loader = new THREE.Loader();
+			binLoader = new THREE.BinaryLoader();
+			jsonLoader = new THREE.JSONLoader();
 
 			counter_models = 0;
 			counter_textures = 0;
@@ -290,15 +291,15 @@ var SceneUtils = {
 
 				} else if ( g.type == "bin_mesh" ) {
 
-					loader.loadBinary( { model: g.url,
-										 callback: create_callback( dg )
-										} );
+					binLoader.load( { model: g.url,
+									  callback: create_callback( dg )
+									} );
 
 				} else if ( g.type == "ascii_mesh" ) {
 
-					loader.loadAscii( { model: g.url,
-										callback: create_callback( dg )
-										} );
+					jsonLoader.load( { model: g.url,
+									   callback: create_callback( dg )
+									} );
 
 				}
 

+ 4 - 2
src/extras/io/BinaryLoader.js

@@ -711,7 +711,8 @@ THREE.BinaryLoader.prototype = {
 		scope.faces.push( new THREE.Face3( a, b, c, 
 						  [new THREE.Vector3( nax, nay, naz ), 
 						   new THREE.Vector3( nbx, nby, nbz ), 
-						   new THREE.Vector3( ncx, ncy, ncz )], 
+						   new THREE.Vector3( ncx, ncy, ncz )],
+						  null,
 						  material ) );
 
 	},
@@ -739,7 +740,8 @@ THREE.BinaryLoader.prototype = {
 						  [new THREE.Vector3( nax, nay, naz ), 
 						   new THREE.Vector3( nbx, nby, nbz ), 
 						   new THREE.Vector3( ncx, ncy, ncz ), 
-						   new THREE.Vector3( ndx, ndy, ndz )], 
+						   new THREE.Vector3( ndx, ndy, ndz )],
+						  null,
 						  material ) );
 
 	},

+ 28 - 0
src/extras/io/JSONLoader.js

@@ -53,6 +53,7 @@ THREE.JSONLoader.prototype = {
 			
 			parse();
 			init_skin();
+			init_morphing();
 
 			this.computeCentroids();
 			this.computeFaceNormals();
@@ -311,6 +312,33 @@ THREE.JSONLoader.prototype = {
 				
 			};
 			
+			function init_morphing() {
+
+				if( json.morphTargets !== undefined ) {
+					
+					var i, l, v, vl;
+					
+					for( i = 0, l = json.morphTargets.length; i < l; i++ ) {
+						
+						scope.morphTargets[ i ] = {};
+						scope.morphTargets[ i ].name = json.morphTargets[ i ].name;
+						scope.morphTargets[ i ].vertices = [];
+						
+						dstVertices = scope.morphTargets[ i ].vertices;
+						srcVertices = json.morphTargets [ i ].vertices;
+
+						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 ] ) ) );
+
+						}
+						
+					} 
+					
+				}
+
+			};
+			
 		};
 
 		Model.prototype = new THREE.Geometry();

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -3519,7 +3519,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			
 			m = materials[ i ];
 			
-			if ( m instanceof THREE.MeshBasicMaterial || m instanceof THREE.MeshDepthMaterial ) continue;
+			if ( ( m instanceof THREE.MeshBasicMaterial && !m.envMap ) || m instanceof THREE.MeshDepthMaterial ) continue;
 			
 			if ( materialNeedsSmoothNormals( m ) ) {
 				
@@ -3547,7 +3547,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			
 			m = materials[ i ];
 			
-			if ( m.map || m.lightMap ) {
+			if ( m.map || m.lightMap || m instanceof THREE.MeshShaderMaterial ) {
 				
 				return true;