Browse Source

Fixed tangents and UVs in Blender exporter.

Also updated docstring for OBJ converter.

All WebGL examples should now work.
alteredq 14 years ago
parent
commit
9db71a171a

+ 235 - 233
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r36 - http://github.com/mrdoob/three.js
 // Three.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 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,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();
+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,k,j;if(b==0)d=e=g=0;else{h=Math.floor(a*6);k=a*6-h;a=b*(1-c);j=b*(1-c*k);c=b*(1-c*(1-k));switch(h){case 1:d=j;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=j;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;g=j;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();
 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)}};
 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=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/
 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)};
 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*
 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};
 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(h,g){return h.distance-g.distance});return e},intersectObject:function(a){function c(I,E,H,z){z=z.clone().subSelf(E);H=H.clone().subSelf(E);var S=I.clone().subSelf(E);I=z.dot(z);E=z.dot(H);z=z.dot(S);var Q=H.dot(H);H=H.dot(S);S=1/(I*Q-E*E);Q=(Q*z-E*H)*S;I=(I*H-E*z)*S;return Q>0&&I>0&&Q+I<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()};
+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(H,E,I,z){z=z.clone().subSelf(E);I=I.clone().subSelf(E);var S=H.clone().subSelf(E);H=z.dot(z);E=z.dot(I);z=z.dot(S);var P=I.dot(I);I=I.dot(S);S=1/(H*P-E*E);P=(P*z-E*I)*S;H=(H*I-E*z)*S;return P>0&&H>0&&P+H<1}var b,d,e,g,h,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;g=j.multiplyVector3(A[e.a].position.clone());h=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(g,x))/t;x=x.addSelf(y.multiplyScalar(m));
+if(e instanceof THREE.Face3){if(c(x,g,h,k)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,j)||c(x,h,k,j))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};G.push(e)}}}return G}};
+THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,k=!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(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()?
 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}};
 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.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,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*
+THREE.Matrix4=function(a,c,b,d,e,g,h,k,j,m,t,x,y,q,A,G){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||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,g,h,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=g;this.n23=h;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,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*
 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();
 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,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,I=a.n43,E=a.n44,H=c.n11,z=c.n12,S=c.n13,Q=c.n14,N=c.n21,da=c.n22,
-f=c.n23,ja=c.n24,na=c.n31,aa=c.n32,Y=c.n33,Da=c.n34;this.n11=b*H+d*N+e*na;this.n12=b*z+d*da+e*aa;this.n13=b*S+d*f+e*Y;this.n14=b*Q+d*ja+e*Da+h;this.n21=g*H+k*N+j*na;this.n22=g*z+k*da+j*aa;this.n23=g*S+k*f+j*Y;this.n24=g*Q+k*ja+j*Da+m;this.n31=t*H+x*N+y*na;this.n32=t*z+x*da+y*aa;this.n33=t*S+x*f+y*Y;this.n34=t*Q+x*ja+y*Da+q;this.n41=A*H+G*N+I*na;this.n42=A*z+G*da+I*aa;this.n43=A*S+G*f+I*Y;this.n44=A*Q+G*ja+I*Da+E;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;
+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,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,H=a.n43,E=a.n44,I=c.n11,z=c.n12,S=c.n13,P=c.n14,O=c.n21,aa=c.n22,
+f=c.n23,ha=c.n24,oa=c.n31,$=c.n32,W=c.n33,Da=c.n34;this.n11=b*I+d*O+e*oa;this.n12=b*z+d*aa+e*$;this.n13=b*S+d*f+e*W;this.n14=b*P+d*ha+e*Da+g;this.n21=h*I+k*O+j*oa;this.n22=h*z+k*aa+j*$;this.n23=h*S+k*f+j*W;this.n24=h*P+k*ha+j*Da+m;this.n31=t*I+x*O+y*oa;this.n32=t*z+x*aa+y*$;this.n33=t*S+x*f+y*W;this.n34=t*P+x*ha+y*Da+q;this.n41=A*I+G*O+H*oa;this.n42=A*z+G*aa+H*$;this.n43=A*S+G*f+H*W;this.n44=A*P+G*ha+H*Da+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},
 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,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=
+determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=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*h*m*y-b*k*m*y-d*g*t*y+c*k*t*y+b*g*x*y-c*h*x*y-d*h*j*q+b*k*j*q+d*e*t*q-a*k*t*q-b*e*x*q+a*h*x*q+d*g*j*A-c*k*j*A-d*e*m*A+a*k*m*A+c*e*x*A-a*g*x*A-b*g*j*G+c*h*j*G+b*e*m*G-a*h*m*G-c*e*t*G+a*g*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;
 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;
 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},
 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,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=
+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,k=
+a.z,j=e*g,m=e*h;this.set(j*g+b,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+b,m*k-d*g,0,j*k-d*h,m*k+d*g,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 g=Math.cos(d);d=Math.sin(d);var h=a*b,k=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=k*g+a*d;this.n22=-k*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,k=d+d;a=c*g;var j=c*h;c*=k;var m=b*h;b*=k;d*=k;g*=e;h*=e;e*=k;this.n11=1-(m+d);this.n12=j-e;this.n13=c+h;this.n21=j+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;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}};
 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,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,I=a.n43,E=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*q*G-m*y*G+m*x*I-k*q*I-j*x*E+k*y*E;c.n12=h*y*G-e*q*G-h*x*I+d*q*I+e*x*E-d*y*E;c.n13=e*m*G-h*j*G+h*k*I-d*m*I-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*I+g*q*I+j*t*E-g*y*E;c.n22=e*q*A-h*y*A+h*t*I-b*q*I-e*t*E+b*y*E;c.n23=h*j*A-e*m*A-h*g*I+b*m*I+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*I-g*x*I;c.n42=d*y*A-e*x*A+e*t*G-b*y*G-d*t*I+b*x*I;c.n43=e*k*A-d*j*A-e*g*G+b*j*G+d*g*I-b*k*I;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.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=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,H=a.n43,E=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=j*q*G-m*y*G+m*x*H-k*q*H-j*x*E+k*y*E;c.n12=g*y*G-e*q*G-g*x*H+d*q*H+e*x*E-d*y*E;c.n13=e*m*G-g*j*G+g*k*H-d*m*H-e*k*E+d*j*E;c.n14=g*j*x-e*m*x-g*k*y+d*m*y+e*k*q-d*j*q;c.n21=m*y*A-j*q*A-m*t*H+h*q*H+j*t*E-h*y*E;c.n22=e*q*A-g*y*A+g*t*H-b*q*H-e*t*E+b*y*E;c.n23=g*j*A-e*m*A-g*h*H+b*m*H+e*h*E-b*j*E;
+c.n24=e*m*t-g*j*t+g*h*y-b*m*y-e*h*q+b*j*q;c.n31=k*q*A-m*x*A+m*t*G-h*q*G-k*t*E+h*x*E;c.n32=g*x*A-d*q*A-g*t*G+b*q*G+d*t*E-b*x*E;c.n33=e*m*A-g*k*A+g*h*G-b*m*G-d*h*E+b*k*E;c.n34=g*k*t-d*m*t-g*h*x+b*m*x+d*h*q-b*k*q;c.n41=j*x*A-k*y*A-j*t*G+h*y*G+k*t*H-h*x*H;c.n42=d*y*A-e*x*A+e*t*G-b*y*G-d*t*H+b*x*H;c.n43=e*k*A-d*j*A-e*h*G+b*j*G+d*h*H-b*k*H;c.n44=d*j*t-e*k*t+e*h*x-b*j*x-d*h*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,g=a.n32*a.n21-a.n31*a.n22,h=-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*h+a.n31*m;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*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,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,k,j,m;h=new THREE.Matrix4;k=c-a;j=b-d;m=g-e;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((b+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=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=
 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};
 !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!==
 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!==
 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,
 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)};
 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 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.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,k=d*e;this.w=h*g-k*b;this.x=h*b+k*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,k=a.z;a=a.w;this.x=c*a+e*g+b*k-d*h;this.y=b*a+e*h+d*g-c*k;this.z=d*a+e*k+c*h-b*g;this.w=e*a-c*g-b*h-d*k;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,k=this.z,j=this.w,m=j*b+h*e-k*d,t=j*d+k*b-g*e,x=j*e+g*d-h*b;b=-g*b-h*d-k*e;c.x=m*j+b*-g+t*-k-x*-h;c.y=t*j+b*-h+x*-g-m*-k;c.z=x*j+b*-k+m*-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.vertexTangents=[];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.vertexTangents=[];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.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);
 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,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=
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,b.position);j.sub(c.position,b.position);k.crossSelf(j)}k.isZero()||
+k.normalize();g.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]);
 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(Da,ea,Ea,ia,ra,oa,$){h=Da.vertices[ea].position;g=Da.vertices[Ea].position;k=Da.vertices[ia].position;j=e[ra];m=e[oa];t=e[$];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;I=k.z-h.z;E=m.u-j.u;H=t.u-j.u;z=m.v-j.v;S=t.v-j.v;Q=1/(E*S-
-H*z);f.set((S*x-z*y)*Q,(S*q-z*A)*Q,(S*G-z*I)*Q);ja.set((E*y-H*x)*Q,(E*A-H*q)*Q,(E*I-H*G)*Q);N[ea].addSelf(f);N[Ea].addSelf(f);N[ia].addSelf(f);da[ea].addSelf(ja);da[Ea].addSelf(ja);da[ia].addSelf(ja)}var c,b,d,e,h,g,k,j,m,t,x,y,q,A,G,I,E,H,z,S,Q,N=[],da=[],f=new THREE.Vector3,ja=new THREE.Vector3,na=new THREE.Vector3,aa=new THREE.Vector3,Y=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){N[c]=new THREE.Vector3;da[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++){Y.copy(this.vertices[c].normal);d=N[c];na.copy(d);na.subSelf(Y.multiplyScalar(Y.dot(d))).normalize();aa.cross(this.vertices[c].normal,d);d=aa.dot(da[c]);d=d<0?-1:1;this.vertices[c].tangent.set(na.x,na.y,na.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,G,I,E,H,z){q=(G-q)*0.5;I=(I-A)*0.5;return(2*(A-G)+q+I)*z+(-3*(A-G)-2*q-I)*H+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,I=[];for(q=0;q<G;q++){A=this.points[q];I[q]=[A.x,A.y,A.z]}return I};this.getLength=function(q){var A,G,I=A=A=0,E=new THREE.Vector3,H=new THREE.Vector3,z=[],S=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);H.copy(position);
-S+=H.distanceTo(E);E.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=I){z[A]=S;I=A}}z[z.length]=S;return{chunks:z,total:S}};this.reparametrizeByArcLength=function(q){var A,G,I,E,H,z,S=[],Q=new THREE.Vector3,N=this.getLength();S.push(Q.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=N.chunks[A]-N.chunks[A-1];z=Math.ceil(q*G/N.total);E=(A-1)/(this.points.length-1);H=A/(this.points.length-1);for(G=1;G<z-1;G++){I=E+G*(1/z)*(H-E);position=this.getPoint(I);S.push(Q.copy(position).clone())}S.push(Q.copy(this.points[A]).clone())}this.points=
+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(qa,ma,Z,Q,M,ea,ua){k=qa.vertices[ma].position;j=qa.vertices[Z].position;m=qa.vertices[Q].position;t=h[M];x=h[ea];y=h[ua];q=j.x-k.x;A=m.x-k.x;G=j.y-k.y;H=m.y-k.y;E=j.z-k.z;I=m.z-k.z;z=x.u-t.u;S=y.u-t.u;P=x.v-t.v;O=y.v-t.v;aa=1/(z*O-S*P);
+$.set((O*q-P*A)*aa,(O*G-P*H)*aa,(O*E-P*I)*aa);W.set((z*A-S*q)*aa,(z*H-S*G)*aa,(z*I-S*E)*aa);ha[ma].addSelf($);ha[Z].addSelf($);ha[Q].addSelf($);oa[ma].addSelf(W);oa[Z].addSelf(W);oa[Q].addSelf(W)}var c,b,d,e,g,h,k,j,m,t,x,y,q,A,G,H,E,I,z,S,P,O,aa,f,ha=[],oa=[],$=new THREE.Vector3,W=new THREE.Vector3,Da=new THREE.Vector3,da=new THREE.Vector3,Fa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){ha[c]=new THREE.Vector3;oa[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];
+h=this.faceVertexUvs[0][c];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var ja=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(d=0;d<g.vertexNormals.length;d++){Fa.copy(g.vertexNormals[d]);e=g[ja[d]];f=ha[e];Da.copy(f);Da.subSelf(Fa.multiplyScalar(Fa.dot(f))).normalize();da.cross(g.vertexNormals[d],f);e=da.dot(oa[e]);e=e<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(Da.x,Da.y,
+Da.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 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,G,H,E,I,z){q=(G-q)*0.5;H=(H-A)*0.5;return(2*(A-G)+q+H)*z+(-3*(A-G)-2*q-H)*I+q*E+A}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,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;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;m=this.points[b[0]];t=this.points[b[1]];
+x=this.points[b[2]];y=this.points[b[3]];k=h*h;j=h*k;d.x=c(m.x,t.x,x.x,y.x,h,k,j);d.y=c(m.y,t.y,x.y,y.y,h,k,j);d.z=c(m.z,t.z,x.z,y.z,h,k,j);return d};this.getControlPointsArray=function(){var q,A,G=this.points.length,H=[];for(q=0;q<G;q++){A=this.points[q];H[q]=[A.x,A.y,A.z]}return H};this.getLength=function(q){var A,G,H=A=A=0,E=new THREE.Vector3,I=new THREE.Vector3,z=[],S=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);I.copy(position);
+S+=I.distanceTo(E);E.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=H){z[A]=S;H=A}}z[z.length]=S;return{chunks:z,total:S}};this.reparametrizeByArcLength=function(q){var A,G,H,E,I,z,S=[],P=new THREE.Vector3,O=this.getLength();S.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=O.chunks[A]-O.chunks[A-1];z=Math.ceil(q*G/O.total);E=(A-1)/(this.points.length-1);I=A/(this.points.length-1);for(G=1;G<z-1;G++){H=E+G*(1/z)*(I-E);position=this.getPoint(H);S.push(P.copy(position).clone())}S.push(P.copy(this.points[A]).clone())}this.points=
 S}};
 S}};
-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=
+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 k=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(e.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(h=0;h<e.hierarchy[g].keys.length;h++)for(var j=0;j<e.hierarchy[g].keys[h].morphTargets.length;j++){var m=e.hierarchy[g].keys[h].morphTargets[j];k[m]=-1}e.hierarchy[g].usedMorphTargets=k;for(h=0;h<e.hierarchy[g].keys.length;h++){var t=
+{};for(m in k){for(j=0;j<e.hierarchy[g].keys[h].morphTargets.length;j++)if(e.hierarchy[g].keys[h].morphTargets[j]===m){t[m]=e.hierarchy[g].keys[h].morphTargetsInfluences[j];break}j===e.hierarchy[g].keys[h].morphTargets.length&&(t[m]=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=
 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};
 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=
 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 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)};
+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)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.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.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,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.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,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];h=j.prevKey[b];k=j.nextKey[b];if(k.time<=y){if(x<y)if(this.loop){h=this.data.hierarchy[q].keys[0];for(k=this.getNextKeyWith(b,q,1);k.time<x;){h=k;k=this.getNextKeyWith(b,q,k.index+1)}}else{this.stop();return}else{do{h=k;k=this.getNextKeyWith(b,q,k.index+1)}while(k.time<
+x)}j.prevKey[b]=h;j.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(k.time-h.time);e=h[b];g=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]+(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,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,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][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,g,h,k,j,m;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]];k=a[b[1]];j=a[b[2]];m=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],k[0],j[0],m[0],e,b,h);d[1]=this.interpolate(g[1],k[1],j[1],m[1],e,b,h);d[2]=this.interpolate(g[2],k[2],j[2],m[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.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.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=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)};
 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=
 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}};
 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.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,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.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.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.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.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};
 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=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,
 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;
 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,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];
+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,k;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;k=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;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;
 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,
 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};
 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,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.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.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.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=
 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;
 "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,55 +144,56 @@ 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.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.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.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 aa=j[k]=j[k]||new THREE.RenderableVertex;k++;return aa}function c(aa,Y){return Y.z-aa.z}function b(aa,Y){var Da=0,ea=1,Ea=aa.z+aa.w,ia=Y.z+Y.w,ra=-aa.z+aa.w,oa=-Y.z+Y.w;if(Ea>=0&&ia>=0&&ra>=0&&oa>=0)return!0;else if(Ea<0&&ia<0||ra<0&&oa<0)return!1;else{if(Ea<0)Da=Math.max(Da,Ea/(Ea-ia));else ia<0&&(ea=Math.min(ea,Ea/(Ea-ia)));if(ra<0)Da=Math.max(Da,ra/(ra-oa));else oa<0&&(ea=Math.min(ea,ra/(ra-oa)));if(ea<Da)return!1;else{aa.lerpSelf(Y,Da);Y.lerpSelf(aa,
-1-ea);return!0}}}var d,e,h=[],g,k,j=[],m,t,x=[],y,q=[],A,G,I=[],E,H,z=[],S=new THREE.Vector4,Q=new THREE.Vector4,N=new THREE.Matrix4,da=new THREE.Matrix4,f=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Vector4,na=new THREE.Vector4;this.projectVector=function(aa,Y){N.multiply(Y.projectionMatrix,Y.matrixWorldInverse);N.multiplyVector3(aa);return aa};this.unprojectVector=function(aa,Y){N.multiply(Y.matrixWorld,THREE.Matrix4.makeInvert(Y.projectionMatrix));
-N.multiplyVector3(aa);return aa};this.projectObjects=function(aa,Y,Da){Y=[];var ea,Ea,ia;e=0;Ea=aa.objects;aa=0;for(ea=Ea.length;aa<ea;aa++){ia=Ea[aa];var ra;if(!(ra=!ia.visible))if(ra=ia instanceof THREE.Mesh){a:{ra=void 0;for(var oa=ia.matrixWorld,$=-ia.geometry.boundingSphere.radius*Math.max(ia.scale.x,Math.max(ia.scale.y,ia.scale.z)),R=0;R<6;R++){ra=f[R].x*oa.n14+f[R].y*oa.n24+f[R].z*oa.n34+f[R].w;if(ra<=$){ra=!1;break a}}ra=!0}ra=!ra}if(!ra){ra=h[e]=h[e]||new THREE.RenderableObject;e++;d=ra;
-S.copy(ia.position);N.multiplyVector3(S);d.object=ia;d.z=S.z;Y.push(d)}}Da&&Y.sort(c);return Y};this.projectScene=function(aa,Y,Da){var ea=[],Ea=Y.near,ia=Y.far,ra,oa,$,R,O,ha,va,ka,ta,xa,Ma,ab,n,C,p,o,w;H=G=y=t=0;Y.matrixAutoUpdate&&Y.updateMatrix();aa.update(undefined,!1,Y);N.multiply(Y.projectionMatrix,Y.matrixWorldInverse);f[0].set(N.n41-N.n11,N.n42-N.n12,N.n43-N.n13,N.n44-N.n14);f[1].set(N.n41+N.n11,N.n42+N.n12,N.n43+N.n13,N.n44+N.n14);f[2].set(N.n41+N.n21,N.n42+N.n22,N.n43+N.n23,N.n44+N.n24);
-f[3].set(N.n41-N.n21,N.n42-N.n22,N.n43-N.n23,N.n44-N.n24);f[4].set(N.n41-N.n31,N.n42-N.n32,N.n43-N.n33,N.n44-N.n34);f[5].set(N.n41+N.n31,N.n42+N.n32,N.n43+N.n33,N.n44+N.n34);for(ra=0;ra<6;ra++){ta=f[ra];ta.divideScalar(Math.sqrt(ta.x*ta.x+ta.y*ta.y+ta.z*ta.z))}ta=this.projectObjects(aa,Y,!0);aa=0;for(ra=ta.length;aa<ra;aa++){xa=ta[aa].object;if(xa.visible){Ma=xa.matrixWorld;ab=xa.matrixRotationWorld;n=xa.materials;C=xa.overdraw;k=0;if(xa instanceof THREE.Mesh){p=xa.geometry;R=p.vertices;o=p.faces;
-p=p.faceVertexUvs;oa=0;for($=R.length;oa<$;oa++){g=a();g.positionWorld.copy(R[oa].position);Ma.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>Ea&&g.positionScreen.z<ia}R=0;for(oa=o.length;R<oa;R++){$=o[R];if($ instanceof THREE.Face3){O=j[$.a];ha=j[$.b];va=j[$.c];if(O.visible&&ha.visible&&va.visible&&(xa.doubleSided||xa.flipSided!=(va.positionScreen.x-
-O.positionScreen.x)*(ha.positionScreen.y-O.positionScreen.y)-(va.positionScreen.y-O.positionScreen.y)*(ha.positionScreen.x-O.positionScreen.x)<0)){ka=x[t]=x[t]||new THREE.RenderableFace3;t++;m=ka;m.v1.copy(O);m.v2.copy(ha);m.v3.copy(va)}else continue}else if($ instanceof THREE.Face4){O=j[$.a];ha=j[$.b];va=j[$.c];ka=j[$.d];if(O.visible&&ha.visible&&va.visible&&ka.visible&&(xa.doubleSided||xa.flipSided!=((ka.positionScreen.x-O.positionScreen.x)*(ha.positionScreen.y-O.positionScreen.y)-(ka.positionScreen.y-
-O.positionScreen.y)*(ha.positionScreen.x-O.positionScreen.x)<0||(ha.positionScreen.x-va.positionScreen.x)*(ka.positionScreen.y-va.positionScreen.y)-(ha.positionScreen.y-va.positionScreen.y)*(ka.positionScreen.x-va.positionScreen.x)<0))){w=q[y]=q[y]||new THREE.RenderableFace4;y++;m=w;m.v1.copy(O);m.v2.copy(ha);m.v3.copy(va);m.v4.copy(ka)}else continue}m.normalWorld.copy($.normal);ab.multiplyVector3(m.normalWorld);m.centroidWorld.copy($.centroid);Ma.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
-N.multiplyVector3(m.centroidScreen);va=$.vertexNormals;O=0;for(ha=va.length;O<ha;O++){ka=m.vertexNormalsWorld[O];ka.copy(va[O]);ab.multiplyVector3(ka)}O=0;for(ha=p.length;O<ha;O++)if(w=p[O][R]){va=0;for(ka=w.length;va<ka;va++)m.uvs[O][va]=w[va]}m.meshMaterials=n;m.faceMaterials=$.materials;m.overdraw=C;m.z=m.centroidScreen.z;ea.push(m)}}else if(xa instanceof THREE.Line){da.multiply(N,Ma);R=xa.geometry.vertices;O=a();O.positionScreen.copy(R[0].position);da.multiplyVector4(O.positionScreen);oa=1;for($=
-R.length;oa<$;oa++){O=a();O.positionScreen.copy(R[oa].position);da.multiplyVector4(O.positionScreen);ha=j[k-2];ja.copy(O.positionScreen);na.copy(ha.positionScreen);if(b(ja,na)){ja.multiplyScalar(1/ja.w);na.multiplyScalar(1/na.w);Ma=I[G]=I[G]||new THREE.RenderableLine;G++;A=Ma;A.v1.positionScreen.copy(ja);A.v2.positionScreen.copy(na);A.z=Math.max(ja.z,na.z);A.materials=xa.materials;ea.push(A)}}}else if(xa instanceof THREE.Particle){Q.set(xa.position.x,xa.position.y,xa.position.z,1);N.multiplyVector4(Q);
-Q.z/=Q.w;if(Q.z>0&&Q.z<1){Ma=z[H]=z[H]||new THREE.RenderableParticle;H++;E=Ma;E.x=Q.x/Q.w;E.y=Q.y/Q.w;E.z=Q.z;E.rotation=xa.rotation.z;E.scale.x=xa.scale.x*Math.abs(E.x-(Q.x+Y.projectionMatrix.n11)/(Q.w+Y.projectionMatrix.n14));E.scale.y=xa.scale.y*Math.abs(E.y-(Q.y+Y.projectionMatrix.n22)/(Q.w+Y.projectionMatrix.n24));E.materials=xa.materials;ea.push(E)}}}}Da&&ea.sort(c);return ea}};
-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(za){if(y!=za)m.globalAlpha=y=za}function c(za){if(q!=za){switch(za){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=za}}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,I=1,E,H,z,S,Q=new THREE.RenderableVertex,
-N=new THREE.RenderableVertex,da,f,ja,na,aa,Y,Da,ea,Ea,ia,ra,oa,$=new THREE.Color,R=new THREE.Color,O=new THREE.Color,ha=new THREE.Color,va=new THREE.Color,ka,ta,xa,Ma,ab,n,C,p,o,w,D=new THREE.Rectangle,B=new THREE.Rectangle,F=new THREE.Rectangle,V=!1,M=new THREE.Color,J=new THREE.Color,qa=new THREE.Color,Ca=new THREE.Color,W=new THREE.Vector3,wa,la,Ga,Na,ua,Ha,P=16;wa=document.createElement("canvas");wa.width=wa.height=2;la=wa.getContext("2d");la.fillStyle="rgba(0,0,0,1)";la.fillRect(0,0,2,2);Ga=
-la.getImageData(0,0,2,2);Na=Ga.data;ua=document.createElement("canvas");ua.width=ua.height=P;Ha=ua.getContext("2d");Ha.translate(-P/2,-P/2);Ha.scale(P,P);P--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(za,Aa){h=za;g=Aa;k=h/2;j=g/2;e.width=h;e.height=g;D.set(-k,-j,k,j);y=1;q=0;G=A=null;I=1};this.setClearColor=function(za,Aa){t=za;x=Aa};this.setClearColorHex=function(za,Aa){t.setHex(za);x=Aa};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!B.isEmpty()){B.inflate(1);
-B.minSelf(D);if(t.hex==0&&x==0)m.clearRect(B.getX(),B.getY(),B.getWidth(),B.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(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(za,Aa){function Wa(K){var ca,U,T,Fa=K.lights;J.setRGB(0,0,0);qa.setRGB(0,0,0);Ca.setRGB(0,0,0);K=0;for(ca=Fa.length;K<ca;K++){U=Fa[K];T=U.color;if(U instanceof THREE.AmbientLight){J.r+=T.r;J.g+=
-T.g;J.b+=T.b}else if(U instanceof THREE.DirectionalLight){qa.r+=T.r;qa.g+=T.g;qa.b+=T.b}else if(U instanceof THREE.PointLight){Ca.r+=T.r;Ca.g+=T.g;Ca.b+=T.b}}}function X(K,ca,U,T){var Fa,sa,ma,Z,ya=K.lights;K=0;for(Fa=ya.length;K<Fa;K++){sa=ya[K];ma=sa.color;Z=sa.intensity;if(sa instanceof THREE.DirectionalLight){sa=U.dot(sa.position)*Z;if(sa>0){T.r+=ma.r*sa;T.g+=ma.g*sa;T.b+=ma.b*sa}}else if(sa instanceof THREE.PointLight){W.sub(sa.position,ca);W.normalize();sa=U.dot(W)*Z;if(sa>0){T.r+=ma.r*sa;T.g+=
-ma.g*sa;T.b+=ma.b*sa}}}}function fa(K,ca,U){a(U.opacity);c(U.blending);var T,Fa,sa,ma,Z,ya;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){ma=U.map.image;Z=ma.width>>1;ya=ma.height>>1;U=ca.scale.x*k;sa=ca.scale.y*j;T=U*Z;Fa=sa*ya;F.set(K.x-T,K.y-Fa,K.x+T,K.y+Fa);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(U,-sa);m.translate(-Z,-ya);m.drawImage(ma,0,0);m.restore()}}}else if(U instanceof THREE.ParticleCanvasMaterial){if(V){M.r=J.r+qa.r+Ca.r;M.g=J.g+qa.g+
-Ca.g;M.b=J.b+qa.b+Ca.b;$.r=U.color.r*M.r;$.g=U.color.g*M.g;$.b=U.color.b*M.b;$.updateStyleString()}else $.__styleString=U.color.__styleString;T=ca.scale.x*k;Fa=ca.scale.y*j;F.set(K.x-T,K.y-Fa,K.x+T,K.y+Fa);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(T,Fa);U.program(m,$);m.restore()}}}function ga(K,ca,U,T){a(T.opacity);c(T.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ca.positionScreen.x,ca.positionScreen.y);m.closePath();if(T instanceof
-THREE.LineBasicMaterial){$.__styleString=T.color.__styleString;K=T.linewidth;if(I!=K)m.lineWidth=I=K;K=$.__styleString;if(A!=K)m.strokeStyle=A=K;m.stroke();F.inflate(T.linewidth*2)}}function Ia(K,ca,U,T,Fa,sa,ma,Z,ya){a(Z.opacity);c(Z.blending);da=K.positionScreen.x;f=K.positionScreen.y;ja=ca.positionScreen.x;na=ca.positionScreen.y;aa=U.positionScreen.x;Y=U.positionScreen.y;var Xa=da,Sa=f,Ta=ja,fb=na,$a=aa,bb=Y;m.beginPath();m.moveTo(Xa,Sa);m.lineTo(Ta,fb);m.lineTo($a,bb);m.lineTo(Xa,Sa);m.closePath();
-if(Z instanceof THREE.MeshBasicMaterial)if(Z.map){if(Z.map.mapping instanceof THREE.UVMapping){Ma=ma.uvs[0];Za(da,f,ja,na,aa,Y,Z.map.image,Ma[T].u,Ma[T].v,Ma[Fa].u,Ma[Fa].v,Ma[sa].u,Ma[sa].v)}}else if(Z.envMap){if(Z.envMap.mapping instanceof THREE.SphericalReflectionMapping){K=Aa.matrixWorldInverse;W.copy(ma.vertexNormalsWorld[0]);ab=(W.x*K.n11+W.y*K.n12+W.z*K.n13)*0.5+0.5;n=-(W.x*K.n21+W.y*K.n22+W.z*K.n23)*0.5+0.5;W.copy(ma.vertexNormalsWorld[1]);C=(W.x*K.n11+W.y*K.n12+W.z*K.n13)*0.5+0.5;p=-(W.x*
-K.n21+W.y*K.n22+W.z*K.n23)*0.5+0.5;W.copy(ma.vertexNormalsWorld[2]);o=(W.x*K.n11+W.y*K.n12+W.z*K.n13)*0.5+0.5;w=-(W.x*K.n21+W.y*K.n22+W.z*K.n23)*0.5+0.5;Za(da,f,ja,na,aa,Y,Z.envMap.image,ab,n,C,p,o,w)}}else Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString);else if(Z instanceof THREE.MeshLambertMaterial){if(Z.map&&!Z.wireframe){if(Z.map.mapping instanceof THREE.UVMapping){Ma=ma.uvs[0];Za(da,f,ja,na,aa,Y,Z.map.image,Ma[T].u,Ma[T].v,Ma[Fa].u,Ma[Fa].v,Ma[sa].u,Ma[sa].v)}c(THREE.SubtractiveBlending)}if(V)if(!Z.wireframe&&
-Z.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==3){R.r=O.r=ha.r=J.r;R.g=O.g=ha.g=J.g;R.b=O.b=ha.b=J.b;X(ya,ma.v1.positionWorld,ma.vertexNormalsWorld[0],R);X(ya,ma.v2.positionWorld,ma.vertexNormalsWorld[1],O);X(ya,ma.v3.positionWorld,ma.vertexNormalsWorld[2],ha);va.r=(O.r+ha.r)*0.5;va.g=(O.g+ha.g)*0.5;va.b=(O.b+ha.b)*0.5;xa=Ua(R,O,ha,va);Za(da,f,ja,na,aa,Y,xa,0,0,1,0,0,1)}else{M.r=J.r;M.g=J.g;M.b=J.b;X(ya,ma.centroidWorld,ma.normalWorld,M);$.r=Z.color.r*M.r;$.g=Z.color.g*M.g;$.b=Z.color.b*
-M.b;$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}else Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString)}else if(Z instanceof THREE.MeshDepthMaterial){ka=Aa.near;ta=Aa.far;R.r=R.g=R.b=1-Ja(K.positionScreen.z,ka,ta);O.r=O.g=O.b=1-Ja(ca.positionScreen.z,ka,ta);ha.r=ha.g=ha.b=1-Ja(U.positionScreen.z,ka,ta);va.r=(O.r+ha.r)*0.5;va.g=(O.g+ha.g)*0.5;va.b=(O.b+ha.b)*0.5;xa=Ua(R,O,ha,va);Za(da,f,ja,na,aa,Y,xa,0,0,1,0,0,1)}else if(Z instanceof
-THREE.MeshNormalMaterial){$.r=Qa(ma.normalWorld.x);$.g=Qa(ma.normalWorld.y);$.b=Qa(ma.normalWorld.z);$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}}function Ra(K,ca,U,T,Fa,sa,ma,Z,ya){a(Z.opacity);c(Z.blending);if(Z.map||Z.envMap){Ia(K,ca,T,0,1,3,ma,Z,ya);Ia(Fa,U,sa,1,2,3,ma,Z,ya)}else{da=K.positionScreen.x;f=K.positionScreen.y;ja=ca.positionScreen.x;na=ca.positionScreen.y;aa=U.positionScreen.x;Y=U.positionScreen.y;Da=T.positionScreen.x;ea=T.positionScreen.y;
-Ea=Fa.positionScreen.x;ia=Fa.positionScreen.y;ra=sa.positionScreen.x;oa=sa.positionScreen.y;Fa=da;sa=f;var Xa=ja,Sa=na,Ta=aa,fb=Y;m.beginPath();m.moveTo(Fa,sa);m.lineTo(Xa,Sa);m.lineTo(Ta,fb);m.lineTo(Da,ea);m.lineTo(Fa,sa);m.closePath();if(Z instanceof THREE.MeshBasicMaterial)Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString);else if(Z instanceof THREE.MeshLambertMaterial)if(V){M.r=J.r;M.g=J.g;M.b=J.b;X(ya,ma.centroidWorld,ma.normalWorld,M);$.r=Z.color.r*M.r;$.g=
-Z.color.g*M.g;$.b=Z.color.b*M.b;$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}else Z.wireframe?cb(Z.color.__styleString,Z.wireframeLinewidth):Oa(Z.color.__styleString);else if(Z instanceof THREE.MeshDepthMaterial){_2near=Z.__2near;_farPlusNear=Z.__farPlusNear;_farMinusNear=Z.__farMinusNear;R=~~((1-_2near/(_farPlusNear-K.positionScreen.z*_farMinusNear))*255);O=~~((1-_2near/(_farPlusNear-ca.positionScreen.z*_farMinusNear))*255);ha=~~((1-_2near/(_farPlusNear-
-U.positionScreen.z*_farMinusNear))*255);va=~~((1-_2near/(_farPlusNear-T.positionScreen.z*_farMinusNear))*255);xa=Ua([R,R,R],[O,O,O],[va,va,va],[ha,ha,ha]);_uv1.u=0;_uv1.v=0;_uv2.u=P;_uv2.v=0;_uv3.u=P;_uv3.v=P;_uv4.u=0;_uv4.v=P;drawTexturedTriangle(xa,da,f,ja,na,Da,ea,_uv1.u,_uv1.v,_uv2.u,_uv2.v,_uv4.u,_uv4.v);drawTexturedTriangle(xa,Ea,ia,aa,Y,ra,oa,_uv2.u,_uv2.v,_uv3.u,_uv3.v,_uv4.u,_uv4.v)}else if(Z instanceof THREE.MeshNormalMaterial){$.r=Qa(ma.normalWorld.x);$.g=Qa(ma.normalWorld.y);$.b=Qa(ma.normalWorld.z);
-$.updateStyleString();Z.wireframe?cb($.__styleString,Z.wireframeLinewidth):Oa($.__styleString)}}}function cb(K,ca){if(A!=K)m.strokeStyle=A=K;if(I!=ca)m.lineWidth=I=ca;m.stroke();F.inflate(ca*2)}function Oa(K){if(G!=K)m.fillStyle=G=K;m.fill()}function Za(K,ca,U,T,Fa,sa,ma,Z,ya,Xa,Sa,Ta,fb){var $a,bb;$a=ma.width-1;bb=ma.height-1;Z*=$a;ya*=bb;Xa*=$a;Sa*=bb;Ta*=$a;fb*=bb;U-=K;T-=ca;Fa-=K;sa-=ca;Xa-=Z;Sa-=ya;Ta-=Z;fb-=ya;$a=Xa*fb-Ta*Sa;if($a!=0){bb=1/$a;$a=(fb*U-Sa*Fa)*bb;Sa=(fb*T-Sa*sa)*bb;U=(Xa*Fa-Ta*
-U)*bb;T=(Xa*sa-Ta*T)*bb;K=K-$a*Z-U*ya;ca=ca-Sa*Z-T*ya;m.save();m.transform($a,Sa,U,T,K,ca);m.clip();m.drawImage(ma,0,0);m.restore()}}function Ua(K,ca,U,T){var Fa=~~(K.r*255),sa=~~(K.g*255);K=~~(K.b*255);var ma=~~(ca.r*255),Z=~~(ca.g*255);ca=~~(ca.b*255);var ya=~~(U.r*255),Xa=~~(U.g*255);U=~~(U.b*255);var Sa=~~(T.r*255),Ta=~~(T.g*255);T=~~(T.b*255);Na[0]=Fa<0?0:Fa>255?255:Fa;Na[1]=sa<0?0:sa>255?255:sa;Na[2]=K<0?0:K>255?255:K;Na[4]=ma<0?0:ma>255?255:ma;Na[5]=Z<0?0:Z>255?255:Z;Na[6]=ca<0?0:ca>255?255:
-ca;Na[8]=ya<0?0:ya>255?255:ya;Na[9]=Xa<0?0:Xa>255?255:Xa;Na[10]=U<0?0:U>255?255:U;Na[12]=Sa<0?0:Sa>255?255:Sa;Na[13]=Ta<0?0:Ta>255?255:Ta;Na[14]=T<0?0:T>255?255:T;la.putImageData(Ga,0,0);Ha.drawImage(wa,0,0);return ua}function Ja(K,ca,U){K=(K-ca)/(U-ca);return K*K*(3-2*K)}function Qa(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function La(K,ca){var U=ca.x-K.x,T=ca.y-K.y,Fa=1/Math.sqrt(U*U+T*T);U*=Fa;T*=Fa;ca.x+=U;ca.y+=T;K.x-=U;K.y-=T}var L,Pa,pa,Ya,db,Va,Ka,Ba;this.autoClear?this.clear():m.setTransform(1,
-0,0,-1,k,j);b=d.projectScene(za,Aa,this.sortElements);(V=za.lights.length>0)&&Wa(za);L=0;for(Pa=b.length;L<Pa;L++){pa=b[L];F.empty();if(pa instanceof THREE.RenderableParticle){E=pa;E.x*=k;E.y*=j;Ya=0;for(db=pa.materials.length;Ya<db;){Ba=pa.materials[Ya++];Ba.opacity!=0&&fa(E,pa,Ba,za)}}else if(pa instanceof THREE.RenderableLine){E=pa.v1;H=pa.v2;E.positionScreen.x*=k;E.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;F.addPoint(E.positionScreen.x,E.positionScreen.y);F.addPoint(H.positionScreen.x,
-H.positionScreen.y);if(D.instersects(F)){Ya=0;for(db=pa.materials.length;Ya<db;){Ba=pa.materials[Ya++];Ba.opacity!=0&&ga(E,H,pa,Ba,za)}}}else if(pa instanceof THREE.RenderableFace3){E=pa.v1;H=pa.v2;z=pa.v3;E.positionScreen.x*=k;E.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;if(pa.overdraw){La(E.positionScreen,H.positionScreen);La(H.positionScreen,z.positionScreen);La(z.positionScreen,E.positionScreen)}F.add3Points(E.positionScreen.x,E.positionScreen.y,
-H.positionScreen.x,H.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(D.instersects(F)){Ya=0;for(db=pa.meshMaterials.length;Ya<db;){Ba=pa.meshMaterials[Ya++];if(Ba instanceof THREE.MeshFaceMaterial){Va=0;for(Ka=pa.faceMaterials.length;Va<Ka;)(Ba=pa.faceMaterials[Va++])&&Ba.opacity!=0&&Ia(E,H,z,0,1,2,pa,Ba,za)}else Ba.opacity!=0&&Ia(E,H,z,0,1,2,pa,Ba,za)}}}else if(pa instanceof THREE.RenderableFace4){E=pa.v1;H=pa.v2;z=pa.v3;S=pa.v4;E.positionScreen.x*=k;E.positionScreen.y*=j;H.positionScreen.x*=
-k;H.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;S.positionScreen.x*=k;S.positionScreen.y*=j;Q.positionScreen.copy(H.positionScreen);N.positionScreen.copy(S.positionScreen);if(pa.overdraw){La(E.positionScreen,H.positionScreen);La(H.positionScreen,S.positionScreen);La(S.positionScreen,E.positionScreen);La(z.positionScreen,Q.positionScreen);La(z.positionScreen,N.positionScreen)}F.addPoint(E.positionScreen.x,E.positionScreen.y);F.addPoint(H.positionScreen.x,H.positionScreen.y);F.addPoint(z.positionScreen.x,
-z.positionScreen.y);F.addPoint(S.positionScreen.x,S.positionScreen.y);if(D.instersects(F)){Ya=0;for(db=pa.meshMaterials.length;Ya<db;){Ba=pa.meshMaterials[Ya++];if(Ba instanceof THREE.MeshFaceMaterial){Va=0;for(Ka=pa.faceMaterials.length;Va<Ka;)(Ba=pa.faceMaterials[Va++])&&Ba.opacity!=0&&Ra(E,H,z,S,Q,N,pa,Ba,za)}else Ba.opacity!=0&&Ra(E,H,z,S,Q,N,pa,Ba,za)}}}B.addRectangle(F)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ia,ra,oa){var $,R,O,ha;$=0;for(R=ia.lights.length;$<R;$++){O=ia.lights[$];if(O instanceof THREE.DirectionalLight){ha=ra.normalWorld.dot(O.position)*O.intensity;if(ha>0){oa.r+=O.color.r*ha;oa.g+=O.color.g*ha;oa.b+=O.color.b*ha}}else if(O instanceof THREE.PointLight){ja.sub(O.position,ra.centroidWorld);ja.normalize();ha=ra.normalWorld.dot(ja)*O.intensity;if(ha>0){oa.r+=O.color.r*ha;oa.g+=O.color.g*ha;oa.b+=O.color.b*ha}}}}function c(ia,ra,oa,$,R,O){Y=d(Da++);
-Y.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)z.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(H){S.r=Q.r;S.g=Q.g;S.b=Q.b;a(O,$,S);z.r=R.color.r*S.r;z.g=R.color.g*S.g;z.b=R.color.b*S.b;z.updateStyleString()}else z.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){f=
-1-R.__2near/(R.__farPlusNear-$.z*R.__farMinusNear);z.setRGB(f,f,f)}else R instanceof THREE.MeshNormalMaterial&&z.setRGB(e($.normalWorld.x),e($.normalWorld.y),e($.normalWorld.z));R.wireframe?Y.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+R.wireframeLinewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframeLinecap+"; stroke-linejoin: "+R.wireframeLinejoin):Y.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+R.opacity);k.appendChild(Y)}
-function b(ia,ra,oa,$,R,O,ha){Y=d(Da++);Y.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+oa.positionScreen.x+","+oa.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+"z");if(O instanceof THREE.MeshBasicMaterial)z.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshLambertMaterial)if(H){S.r=Q.r;S.g=Q.g;S.b=Q.b;a(ha,R,S);z.r=O.color.r*S.r;z.g=O.color.g*S.g;z.b=O.color.b*S.b;z.updateStyleString()}else z.__styleString=
-O.color.__styleString;else if(O instanceof THREE.MeshDepthMaterial){f=1-O.__2near/(O.__farPlusNear-R.z*O.__farMinusNear);z.setRGB(f,f,f)}else O instanceof THREE.MeshNormalMaterial&&z.setRGB(e(R.normalWorld.x),e(R.normalWorld.y),e(R.normalWorld.z));O.wireframe?Y.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+O.wireframeLinewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframeLinecap+"; stroke-linejoin: "+O.wireframeLinejoin):Y.setAttribute("style","fill: "+
-z.__styleString+"; fill-opacity: "+O.opacity);k.appendChild(Y)}function d(ia){if(na[ia]==null){na[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");Ea==0&&na[ia].setAttribute("shape-rendering","crispEdges")}return na[ia]}function e(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*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,I=new THREE.Rectangle,E=new THREE.Rectangle,H=!1,z=new THREE.Color(16777215),
-S=new THREE.Color(16777215),Q=new THREE.Color(0),N=new THREE.Color(0),da=new THREE.Color(0),f,ja=new THREE.Vector3,na=[],aa=[],Y,Da,ea,Ea=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":Ea=1;break;case "low":Ea=0}};this.setSize=function(ia,ra){j=ia;m=ra;t=j/2;x=m/2;k.setAttribute("viewBox",-t+" "+-x+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);I.set(-t,-x,t,x)};this.clear=function(){for(;k.childNodes.length>
-0;)k.removeChild(k.childNodes[0])};this.render=function(ia,ra){var oa,$,R,O,ha,va,ka,ta;this.autoClear&&this.clear();h=g.projectScene(ia,ra,this.sortElements);ea=Da=0;if(H=ia.lights.length>0){ka=ia.lights;Q.setRGB(0,0,0);N.setRGB(0,0,0);da.setRGB(0,0,0);oa=0;for($=ka.length;oa<$;oa++){R=ka[oa];O=R.color;if(R instanceof THREE.AmbientLight){Q.r+=O.r;Q.g+=O.g;Q.b+=O.b}else if(R instanceof THREE.DirectionalLight){N.r+=O.r;N.g+=O.g;N.b+=O.b}else if(R instanceof THREE.PointLight){da.r+=O.r;da.g+=O.g;da.b+=
-O.b}}}oa=0;for($=h.length;oa<$;oa++){ka=h[oa];E.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=t;y.y*=-x;R=0;for(O=ka.materials.length;R<O;)R++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;q=ka.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(I.instersects(E)){R=0;for(O=ka.materials.length;R<O;)if((ta=ka.materials[R++])&&ta.opacity!=
-0){ha=y;va=q;var xa=ea++;if(aa[xa]==null){aa[xa]=document.createElementNS("http://www.w3.org/2000/svg","line");Ea==0&&aa[xa].setAttribute("shape-rendering","crispEdges")}Y=aa[xa];Y.setAttribute("x1",ha.positionScreen.x);Y.setAttribute("y1",ha.positionScreen.y);Y.setAttribute("x2",va.positionScreen.x);Y.setAttribute("y2",va.positionScreen.y);if(ta instanceof THREE.LineBasicMaterial){z.__styleString=ta.color.__styleString;Y.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+
-ta.linewidth+"; stroke-opacity: "+ta.opacity+"; stroke-linecap: "+ta.linecap+"; stroke-linejoin: "+ta.linejoin);k.appendChild(Y)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;q=ka.v2;A=ka.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(I.instersects(E)){R=
-0;for(O=ka.meshMaterials.length;R<O;){ta=ka.meshMaterials[R++];if(ta instanceof THREE.MeshFaceMaterial){ha=0;for(va=ka.faceMaterials.length;ha<va;)(ta=ka.faceMaterials[ha++])&&ta.opacity!=0&&c(y,q,A,ka,ta,ia)}else ta&&ta.opacity!=0&&c(y,q,A,ka,ta,ia)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;q=ka.v2;A=ka.v3;G=ka.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(I.instersects(E)){R=0;for(O=ka.meshMaterials.length;R<O;){ta=ka.meshMaterials[R++];if(ta instanceof THREE.MeshFaceMaterial){ha=0;for(va=ka.faceMaterials.length;ha<va;)(ta=ka.faceMaterials[ha++])&&ta.opacity!=0&&b(y,q,A,G,ka,ta,ia)}else ta&&ta.opacity!=0&&b(y,q,A,G,ka,ta,ia)}}}}}};
+THREE.Projector=function(){function a(){var $=j[k]=j[k]||new THREE.RenderableVertex;k++;return $}function c($,W){return W.z-$.z}function b($,W){var Da=0,da=1,Fa=$.z+$.w,ja=W.z+W.w,qa=-$.z+$.w,ma=-W.z+W.w;if(Fa>=0&&ja>=0&&qa>=0&&ma>=0)return!0;else if(Fa<0&&ja<0||qa<0&&ma<0)return!1;else{if(Fa<0)Da=Math.max(Da,Fa/(Fa-ja));else ja<0&&(da=Math.min(da,Fa/(Fa-ja)));if(qa<0)Da=Math.max(Da,qa/(qa-ma));else ma<0&&(da=Math.min(da,qa/(qa-ma)));if(da<Da)return!1;else{$.lerpSelf(W,Da);W.lerpSelf($,1-da);return!0}}}
+var d,e,g=[],h,k,j=[],m,t,x=[],y,q=[],A,G,H=[],E,I,z=[],S=new THREE.Vector4,P=new THREE.Vector4,O=new THREE.Matrix4,aa=new THREE.Matrix4,f=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Vector4,oa=new THREE.Vector4;this.projectVector=function($,W){O.multiply(W.projectionMatrix,W.matrixWorldInverse);O.multiplyVector3($);return $};this.unprojectVector=function($,W){O.multiply(W.matrixWorld,THREE.Matrix4.makeInvert(W.projectionMatrix));
+O.multiplyVector3($);return $};this.projectObjects=function($,W,Da){W=[];var da,Fa,ja;e=0;Fa=$.objects;$=0;for(da=Fa.length;$<da;$++){ja=Fa[$];var qa;if(!(qa=!ja.visible))if(qa=ja instanceof THREE.Mesh){a:{qa=void 0;for(var ma=ja.matrixWorld,Z=-ja.geometry.boundingSphere.radius*Math.max(ja.scale.x,Math.max(ja.scale.y,ja.scale.z)),Q=0;Q<6;Q++){qa=f[Q].x*ma.n14+f[Q].y*ma.n24+f[Q].z*ma.n34+f[Q].w;if(qa<=Z){qa=!1;break a}}qa=!0}qa=!qa}if(!qa){qa=g[e]=g[e]||new THREE.RenderableObject;e++;d=qa;S.copy(ja.position);
+O.multiplyVector3(S);d.object=ja;d.z=S.z;W.push(d)}}Da&&W.sort(c);return W};this.projectScene=function($,W,Da){var da=[],Fa=W.near,ja=W.far,qa,ma,Z,Q,M,ea,ua,ka,va,za,La,$a,n,C,p,o,w;I=G=y=t=0;W.matrixAutoUpdate&&W.updateMatrix();$.update(undefined,!1,W);O.multiply(W.projectionMatrix,W.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(qa=0;qa<6;qa++){va=f[qa];va.divideScalar(Math.sqrt(va.x*va.x+va.y*va.y+va.z*va.z))}va=this.projectObjects($,W,!0);$=0;for(qa=va.length;$<qa;$++){za=va[$].object;if(za.visible){La=za.matrixWorld;$a=za.matrixRotationWorld;n=za.materials;C=za.overdraw;k=0;if(za instanceof THREE.Mesh){p=za.geometry;Q=p.vertices;o=p.faces;p=p.faceVertexUvs;ma=0;for(Z=
+Q.length;ma<Z;ma++){h=a();h.positionWorld.copy(Q[ma].position);La.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);O.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>Fa&&h.positionScreen.z<ja}Q=0;for(ma=o.length;Q<ma;Q++){Z=o[Q];if(Z instanceof THREE.Face3){M=j[Z.a];ea=j[Z.b];ua=j[Z.c];if(M.visible&&ea.visible&&ua.visible&&(za.doubleSided||za.flipSided!=(ua.positionScreen.x-M.positionScreen.x)*
+(ea.positionScreen.y-M.positionScreen.y)-(ua.positionScreen.y-M.positionScreen.y)*(ea.positionScreen.x-M.positionScreen.x)<0)){ka=x[t]=x[t]||new THREE.RenderableFace3;t++;m=ka;m.v1.copy(M);m.v2.copy(ea);m.v3.copy(ua)}else continue}else if(Z instanceof THREE.Face4){M=j[Z.a];ea=j[Z.b];ua=j[Z.c];ka=j[Z.d];if(M.visible&&ea.visible&&ua.visible&&ka.visible&&(za.doubleSided||za.flipSided!=((ka.positionScreen.x-M.positionScreen.x)*(ea.positionScreen.y-M.positionScreen.y)-(ka.positionScreen.y-M.positionScreen.y)*
+(ea.positionScreen.x-M.positionScreen.x)<0||(ea.positionScreen.x-ua.positionScreen.x)*(ka.positionScreen.y-ua.positionScreen.y)-(ea.positionScreen.y-ua.positionScreen.y)*(ka.positionScreen.x-ua.positionScreen.x)<0))){w=q[y]=q[y]||new THREE.RenderableFace4;y++;m=w;m.v1.copy(M);m.v2.copy(ea);m.v3.copy(ua);m.v4.copy(ka)}else continue}m.normalWorld.copy(Z.normal);$a.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Z.centroid);La.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
+O.multiplyVector3(m.centroidScreen);ua=Z.vertexNormals;M=0;for(ea=ua.length;M<ea;M++){ka=m.vertexNormalsWorld[M];ka.copy(ua[M]);$a.multiplyVector3(ka)}M=0;for(ea=p.length;M<ea;M++)if(w=p[M][Q]){ua=0;for(ka=w.length;ua<ka;ua++)m.uvs[M][ua]=w[ua]}m.meshMaterials=n;m.faceMaterials=Z.materials;m.overdraw=C;m.z=m.centroidScreen.z;da.push(m)}}else if(za instanceof THREE.Line){aa.multiply(O,La);Q=za.geometry.vertices;M=a();M.positionScreen.copy(Q[0].position);aa.multiplyVector4(M.positionScreen);ma=1;for(Z=
+Q.length;ma<Z;ma++){M=a();M.positionScreen.copy(Q[ma].position);aa.multiplyVector4(M.positionScreen);ea=j[k-2];ha.copy(M.positionScreen);oa.copy(ea.positionScreen);if(b(ha,oa)){ha.multiplyScalar(1/ha.w);oa.multiplyScalar(1/oa.w);La=H[G]=H[G]||new THREE.RenderableLine;G++;A=La;A.v1.positionScreen.copy(ha);A.v2.positionScreen.copy(oa);A.z=Math.max(ha.z,oa.z);A.materials=za.materials;da.push(A)}}}else if(za instanceof THREE.Particle){P.set(za.position.x,za.position.y,za.position.z,1);O.multiplyVector4(P);
+P.z/=P.w;if(P.z>0&&P.z<1){La=z[I]=z[I]||new THREE.RenderableParticle;I++;E=La;E.x=P.x/P.w;E.y=P.y/P.w;E.z=P.z;E.rotation=za.rotation.z;E.scale.x=za.scale.x*Math.abs(E.x-(P.x+W.projectionMatrix.n11)/(P.w+W.projectionMatrix.n14));E.scale.y=za.scale.y*Math.abs(E.y-(P.y+W.projectionMatrix.n22)/(P.w+W.projectionMatrix.n24));E.materials=za.materials;da.push(E)}}}}Da&&da.sort(c);return da}};
+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,k){b=h;d=k;e=b/2;g=d/2};this.render=function(h,k){var j,m,t,x,y,q,A,G;a=c.projectScene(h,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*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=G+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(Ba){if(y!=Ba)m.globalAlpha=y=Ba}function c(Ba){if(q!=Ba){switch(Ba){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=Ba}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,k,j,m=e.getContext("2d"),t=new THREE.Color(0),x=0,y=1,q=0,A=null,G=null,H=1,E,I,z,S,P=new THREE.RenderableVertex,
+O=new THREE.RenderableVertex,aa,f,ha,oa,$,W,Da,da,Fa,ja,qa,ma,Z=new THREE.Color,Q=new THREE.Color,M=new THREE.Color,ea=new THREE.Color,ua=new THREE.Color,ka,va,za,La,$a,n,C,p,o,w,D=new THREE.Rectangle,B=new THREE.Rectangle,F=new THREE.Rectangle,X=!1,N=new THREE.Color,J=new THREE.Color,sa=new THREE.Color,Ea=new THREE.Color,Y=new THREE.Vector3,ya,la,Ha,Ma,xa,Ia,U=16;ya=document.createElement("canvas");ya.width=ya.height=2;la=ya.getContext("2d");la.fillStyle="rgba(0,0,0,1)";la.fillRect(0,0,2,2);Ha=la.getImageData(0,
+0,2,2);Ma=Ha.data;xa=document.createElement("canvas");xa.width=xa.height=U;Ia=xa.getContext("2d");Ia.translate(-U/2,-U/2);Ia.scale(U,U);U--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(Ba,Ca){g=Ba;h=Ca;k=g/2;j=h/2;e.width=g;e.height=h;D.set(-k,-j,k,j);y=1;q=0;G=A=null;H=1};this.setClearColor=function(Ba,Ca){t=Ba;x=Ca};this.setClearColorHex=function(Ba,Ca){t.setHex(Ba);x=Ca};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!B.isEmpty()){B.inflate(1);
+B.minSelf(D);if(t.hex==0&&x==0)m.clearRect(B.getX(),B.getY(),B.getWidth(),B.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(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(Ba,Ca){function Va(K){var ca,V,T,ia=K.lights;J.setRGB(0,0,0);sa.setRGB(0,0,0);Ea.setRGB(0,0,0);K=0;for(ca=ia.length;K<ca;K++){V=ia[K];T=V.color;if(V instanceof THREE.AmbientLight){J.r+=T.r;J.g+=
+T.g;J.b+=T.b}else if(V instanceof THREE.DirectionalLight){sa.r+=T.r;sa.g+=T.g;sa.b+=T.b}else if(V instanceof THREE.PointLight){Ea.r+=T.r;Ea.g+=T.g;Ea.b+=T.b}}}function ta(K,ca,V,T){var ia,Aa,ra,R,Qa=K.lights;K=0;for(ia=Qa.length;K<ia;K++){Aa=Qa[K];ra=Aa.color;R=Aa.intensity;if(Aa instanceof THREE.DirectionalLight){Aa=V.dot(Aa.position)*R;if(Aa>0){T.r+=ra.r*Aa;T.g+=ra.g*Aa;T.b+=ra.b*Aa}}else if(Aa instanceof THREE.PointLight){Y.sub(Aa.position,ca);Y.normalize();Aa=V.dot(Y)*R;if(Aa>0){T.r+=ra.r*Aa;
+T.g+=ra.g*Aa;T.b+=ra.b*Aa}}}}function fa(K,ca,V){a(V.opacity);c(V.blending);var T,ia,Aa,ra,R,Qa;if(V instanceof THREE.ParticleBasicMaterial){if(V.map){ra=V.map.image;R=ra.width>>1;Qa=ra.height>>1;V=ca.scale.x*k;Aa=ca.scale.y*j;T=V*R;ia=Aa*Qa;F.set(K.x-T,K.y-ia,K.x+T,K.y+ia);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(V,-Aa);m.translate(-R,-Qa);m.drawImage(ra,0,0);m.restore()}}}else if(V instanceof THREE.ParticleCanvasMaterial){if(X){N.r=J.r+sa.r+Ea.r;N.g=J.g+
+sa.g+Ea.g;N.b=J.b+sa.b+Ea.b;Z.r=V.color.r*N.r;Z.g=V.color.g*N.g;Z.b=V.color.b*N.b;Z.updateStyleString()}else Z.__styleString=V.color.__styleString;T=ca.scale.x*k;ia=ca.scale.y*j;F.set(K.x-T,K.y-ia,K.x+T,K.y+ia);if(D.instersects(F)){m.save();m.translate(K.x,K.y);m.rotate(-ca.rotation);m.scale(T,ia);V.program(m,Z);m.restore()}}}function ga(K,ca,V,T){a(T.opacity);c(T.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ca.positionScreen.x,ca.positionScreen.y);m.closePath();
+if(T instanceof THREE.LineBasicMaterial){Z.__styleString=T.color.__styleString;K=T.linewidth;if(H!=K)m.lineWidth=H=K;K=Z.__styleString;if(A!=K)m.strokeStyle=A=K;m.stroke();F.inflate(T.linewidth*2)}}function na(K,ca,V,T,ia,Aa,ra,R,Qa){a(R.opacity);c(R.blending);aa=K.positionScreen.x;f=K.positionScreen.y;ha=ca.positionScreen.x;oa=ca.positionScreen.y;$=V.positionScreen.x;W=V.positionScreen.y;var Ka=aa,Ta=f,Xa=ha,Ya=oa,Za=$,ab=W;m.beginPath();m.moveTo(Ka,Ta);m.lineTo(Xa,Ya);m.lineTo(Za,ab);m.lineTo(Ka,
+Ta);m.closePath();if(R instanceof THREE.MeshBasicMaterial)if(R.map){if(R.map.mapping instanceof THREE.UVMapping){La=ra.uvs[0];Na(aa,f,ha,oa,$,W,R.map.image,La[T].u,La[T].v,La[ia].u,La[ia].v,La[Aa].u,La[Aa].v)}}else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.matrixWorldInverse;Y.copy(ra.vertexNormalsWorld[0]);$a=(Y.x*K.n11+Y.y*K.n12+Y.z*K.n13)*0.5+0.5;n=-(Y.x*K.n21+Y.y*K.n22+Y.z*K.n23)*0.5+0.5;Y.copy(ra.vertexNormalsWorld[1]);C=(Y.x*K.n11+Y.y*K.n12+Y.z*K.n13)*
+0.5+0.5;p=-(Y.x*K.n21+Y.y*K.n22+Y.z*K.n23)*0.5+0.5;Y.copy(ra.vertexNormalsWorld[2]);o=(Y.x*K.n11+Y.y*K.n12+Y.z*K.n13)*0.5+0.5;w=-(Y.x*K.n21+Y.y*K.n22+Y.z*K.n23)*0.5+0.5;Na(aa,f,ha,oa,$,W,R.envMap.image,$a,n,C,p,o,w)}}else R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){if(R.map.mapping instanceof THREE.UVMapping){La=ra.uvs[0];Na(aa,f,ha,oa,$,W,R.map.image,La[T].u,La[T].v,La[ia].u,La[ia].v,
+La[Aa].u,La[Aa].v)}c(THREE.SubtractiveBlending)}if(X)if(!R.wireframe&&R.shading==THREE.SmoothShading&&ra.vertexNormalsWorld.length==3){Q.r=M.r=ea.r=J.r;Q.g=M.g=ea.g=J.g;Q.b=M.b=ea.b=J.b;ta(Qa,ra.v1.positionWorld,ra.vertexNormalsWorld[0],Q);ta(Qa,ra.v2.positionWorld,ra.vertexNormalsWorld[1],M);ta(Qa,ra.v3.positionWorld,ra.vertexNormalsWorld[2],ea);ua.r=(M.r+ea.r)*0.5;ua.g=(M.g+ea.g)*0.5;ua.b=(M.b+ea.b)*0.5;za=cb(Q,M,ea,ua);Na(aa,f,ha,oa,$,W,za,0,0,1,0,0,1)}else{N.r=J.r;N.g=J.g;N.b=J.b;ta(Qa,ra.centroidWorld,
+ra.normalWorld,N);Z.r=R.color.r*N.r;Z.g=R.color.g*N.g;Z.b=R.color.b*N.b;Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}else R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString)}else if(R instanceof THREE.MeshDepthMaterial){ka=Ca.near;va=Ca.far;Q.r=Q.g=Q.b=1-Ua(K.positionScreen.z,ka,va);M.r=M.g=M.b=1-Ua(ca.positionScreen.z,ka,va);ea.r=ea.g=ea.b=1-Ua(V.positionScreen.z,ka,va);ua.r=(M.r+ea.r)*0.5;ua.g=(M.g+ea.g)*0.5;ua.b=
+(M.b+ea.b)*0.5;za=cb(Q,M,ea,ua);Na(aa,f,ha,oa,$,W,za,0,0,1,0,0,1)}else if(R instanceof THREE.MeshNormalMaterial){Z.r=Ga(ra.normalWorld.x);Z.g=Ga(ra.normalWorld.y);Z.b=Ga(ra.normalWorld.z);Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}}function Ra(K,ca,V,T,ia,Aa,ra,R,Qa){a(R.opacity);c(R.blending);if(R.map||R.envMap){na(K,ca,T,0,1,3,ra,R,Qa);na(ia,V,Aa,1,2,3,ra,R,Qa)}else{aa=K.positionScreen.x;f=K.positionScreen.y;ha=ca.positionScreen.x;oa=ca.positionScreen.y;
+$=V.positionScreen.x;W=V.positionScreen.y;Da=T.positionScreen.x;da=T.positionScreen.y;Fa=ia.positionScreen.x;ja=ia.positionScreen.y;qa=Aa.positionScreen.x;ma=Aa.positionScreen.y;ia=aa;Aa=f;var Ka=ha,Ta=oa,Xa=$,Ya=W;m.beginPath();m.moveTo(ia,Aa);m.lineTo(Ka,Ta);m.lineTo(Xa,Ya);m.lineTo(Da,da);m.lineTo(ia,Aa);m.closePath();if(R instanceof THREE.MeshBasicMaterial)R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString);else if(R instanceof THREE.MeshLambertMaterial)if(X){N.r=
+J.r;N.g=J.g;N.b=J.b;ta(Qa,ra.centroidWorld,ra.normalWorld,N);Z.r=R.color.r*N.r;Z.g=R.color.g*N.g;Z.b=R.color.b*N.b;Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}else R.wireframe?Oa(R.color.__styleString,R.wireframeLinewidth):bb(R.color.__styleString);else if(R instanceof THREE.MeshDepthMaterial){_2near=R.__2near;_farPlusNear=R.__farPlusNear;_farMinusNear=R.__farMinusNear;Q=~~((1-_2near/(_farPlusNear-K.positionScreen.z*_farMinusNear))*255);M=~~((1-_2near/
+(_farPlusNear-ca.positionScreen.z*_farMinusNear))*255);ea=~~((1-_2near/(_farPlusNear-V.positionScreen.z*_farMinusNear))*255);ua=~~((1-_2near/(_farPlusNear-T.positionScreen.z*_farMinusNear))*255);za=cb([Q,Q,Q],[M,M,M],[ua,ua,ua],[ea,ea,ea]);_uv1.u=0;_uv1.v=0;_uv2.u=U;_uv2.v=0;_uv3.u=U;_uv3.v=U;_uv4.u=0;_uv4.v=U;drawTexturedTriangle(za,aa,f,ha,oa,Da,da,_uv1.u,_uv1.v,_uv2.u,_uv2.v,_uv4.u,_uv4.v);drawTexturedTriangle(za,Fa,ja,$,W,qa,ma,_uv2.u,_uv2.v,_uv3.u,_uv3.v,_uv4.u,_uv4.v)}else if(R instanceof THREE.MeshNormalMaterial){Z.r=
+Ga(ra.normalWorld.x);Z.g=Ga(ra.normalWorld.y);Z.b=Ga(ra.normalWorld.z);Z.updateStyleString();R.wireframe?Oa(Z.__styleString,R.wireframeLinewidth):bb(Z.__styleString)}}}function Oa(K,ca){if(A!=K)m.strokeStyle=A=K;if(H!=ca)m.lineWidth=H=ca;m.stroke();F.inflate(ca*2)}function bb(K){if(G!=K)m.fillStyle=G=K;m.fill()}function Na(K,ca,V,T,ia,Aa,ra,R,Qa,Ka,Ta,Xa,Ya){var Za,ab;Za=ra.width-1;ab=ra.height-1;R*=Za;Qa*=ab;Ka*=Za;Ta*=ab;Xa*=Za;Ya*=ab;V-=K;T-=ca;ia-=K;Aa-=ca;Ka-=R;Ta-=Qa;Xa-=R;Ya-=Qa;Za=Ka*Ya-Xa*
+Ta;if(Za!=0){ab=1/Za;Za=(Ya*V-Ta*ia)*ab;Ta=(Ya*T-Ta*Aa)*ab;V=(Ka*ia-Xa*V)*ab;T=(Ka*Aa-Xa*T)*ab;K=K-Za*R-V*Qa;ca=ca-Ta*R-T*Qa;m.save();m.transform(Za,Ta,V,T,K,ca);m.clip();m.drawImage(ra,0,0);m.restore()}}function cb(K,ca,V,T){var ia=~~(K.r*255),Aa=~~(K.g*255);K=~~(K.b*255);var ra=~~(ca.r*255),R=~~(ca.g*255);ca=~~(ca.b*255);var Qa=~~(V.r*255),Ka=~~(V.g*255);V=~~(V.b*255);var Ta=~~(T.r*255),Xa=~~(T.g*255);T=~~(T.b*255);Ma[0]=ia<0?0:ia>255?255:ia;Ma[1]=Aa<0?0:Aa>255?255:Aa;Ma[2]=K<0?0:K>255?255:K;Ma[4]=
+ra<0?0:ra>255?255:ra;Ma[5]=R<0?0:R>255?255:R;Ma[6]=ca<0?0:ca>255?255:ca;Ma[8]=Qa<0?0:Qa>255?255:Qa;Ma[9]=Ka<0?0:Ka>255?255:Ka;Ma[10]=V<0?0:V>255?255:V;Ma[12]=Ta<0?0:Ta>255?255:Ta;Ma[13]=Xa<0?0:Xa>255?255:Xa;Ma[14]=T<0?0:T>255?255:T;la.putImageData(Ha,0,0);Ia.drawImage(ya,0,0);return xa}function Ua(K,ca,V){K=(K-ca)/(V-ca);return K*K*(3-2*K)}function Ga(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Sa(K,ca){var V=ca.x-K.x,T=ca.y-K.y,ia=1/Math.sqrt(V*V+T*T);V*=ia;T*=ia;ca.x+=V;ca.y+=T;K.x-=V;K.y-=T}var Pa,
+L,pa,Ja,db,eb,Wa,wa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);b=d.projectScene(Ba,Ca,this.sortElements);(X=Ba.lights.length>0)&&Va(Ba);Pa=0;for(L=b.length;Pa<L;Pa++){pa=b[Pa];F.empty();if(pa instanceof THREE.RenderableParticle){E=pa;E.x*=k;E.y*=j;Ja=0;for(db=pa.materials.length;Ja<db;){wa=pa.materials[Ja++];wa.opacity!=0&&fa(E,pa,wa,Ba)}}else if(pa instanceof THREE.RenderableLine){E=pa.v1;I=pa.v2;E.positionScreen.x*=k;E.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=
+j;F.addPoint(E.positionScreen.x,E.positionScreen.y);F.addPoint(I.positionScreen.x,I.positionScreen.y);if(D.instersects(F)){Ja=0;for(db=pa.materials.length;Ja<db;){wa=pa.materials[Ja++];wa.opacity!=0&&ga(E,I,pa,wa,Ba)}}}else if(pa instanceof THREE.RenderableFace3){E=pa.v1;I=pa.v2;z=pa.v3;E.positionScreen.x*=k;E.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;if(pa.overdraw){Sa(E.positionScreen,I.positionScreen);Sa(I.positionScreen,z.positionScreen);
+Sa(z.positionScreen,E.positionScreen)}F.add3Points(E.positionScreen.x,E.positionScreen.y,I.positionScreen.x,I.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(D.instersects(F)){Ja=0;for(db=pa.meshMaterials.length;Ja<db;){wa=pa.meshMaterials[Ja++];if(wa instanceof THREE.MeshFaceMaterial){eb=0;for(Wa=pa.faceMaterials.length;eb<Wa;)(wa=pa.faceMaterials[eb++])&&wa.opacity!=0&&na(E,I,z,0,1,2,pa,wa,Ba)}else wa.opacity!=0&&na(E,I,z,0,1,2,pa,wa,Ba)}}}else if(pa instanceof THREE.RenderableFace4){E=
+pa.v1;I=pa.v2;z=pa.v3;S=pa.v4;E.positionScreen.x*=k;E.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;z.positionScreen.x*=k;z.positionScreen.y*=j;S.positionScreen.x*=k;S.positionScreen.y*=j;P.positionScreen.copy(I.positionScreen);O.positionScreen.copy(S.positionScreen);if(pa.overdraw){Sa(E.positionScreen,I.positionScreen);Sa(I.positionScreen,S.positionScreen);Sa(S.positionScreen,E.positionScreen);Sa(z.positionScreen,P.positionScreen);Sa(z.positionScreen,O.positionScreen)}F.addPoint(E.positionScreen.x,
+E.positionScreen.y);F.addPoint(I.positionScreen.x,I.positionScreen.y);F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(S.positionScreen.x,S.positionScreen.y);if(D.instersects(F)){Ja=0;for(db=pa.meshMaterials.length;Ja<db;){wa=pa.meshMaterials[Ja++];if(wa instanceof THREE.MeshFaceMaterial){eb=0;for(Wa=pa.faceMaterials.length;eb<Wa;)(wa=pa.faceMaterials[eb++])&&wa.opacity!=0&&Ra(E,I,z,S,P,O,pa,wa,Ba)}else wa.opacity!=0&&Ra(E,I,z,S,P,O,pa,wa,Ba)}}}B.addRectangle(F)}m.setTransform(1,0,0,1,
+0,0)}};
+THREE.SVGRenderer=function(){function a(ja,qa,ma){var Z,Q,M,ea;Z=0;for(Q=ja.lights.length;Z<Q;Z++){M=ja.lights[Z];if(M instanceof THREE.DirectionalLight){ea=qa.normalWorld.dot(M.position)*M.intensity;if(ea>0){ma.r+=M.color.r*ea;ma.g+=M.color.g*ea;ma.b+=M.color.b*ea}}else if(M instanceof THREE.PointLight){ha.sub(M.position,qa.centroidWorld);ha.normalize();ea=qa.normalWorld.dot(ha)*M.intensity;if(ea>0){ma.r+=M.color.r*ea;ma.g+=M.color.g*ea;ma.b+=M.color.b*ea}}}}function c(ja,qa,ma,Z,Q,M){W=d(Da++);W.setAttribute("d",
+"M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");if(Q instanceof THREE.MeshBasicMaterial)z.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshLambertMaterial)if(I){S.r=P.r;S.g=P.g;S.b=P.b;a(M,Z,S);z.r=Q.color.r*S.r;z.g=Q.color.g*S.g;z.b=Q.color.b*S.b;z.updateStyleString()}else z.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshDepthMaterial){f=1-Q.__2near/(Q.__farPlusNear-
+Z.z*Q.__farMinusNear);z.setRGB(f,f,f)}else Q instanceof THREE.MeshNormalMaterial&&z.setRGB(e(Z.normalWorld.x),e(Z.normalWorld.y),e(Z.normalWorld.z));Q.wireframe?W.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+Q.wireframeLinewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframeLinecap+"; stroke-linejoin: "+Q.wireframeLinejoin):W.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+Q.opacity);k.appendChild(W)}function b(ja,qa,ma,Z,Q,M,ea){W=
+d(Da++);W.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+qa.positionScreen.x+" "+qa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)z.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(I){S.r=P.r;S.g=P.g;S.b=P.b;a(ea,Q,S);z.r=M.color.r*S.r;z.g=M.color.g*S.g;z.b=M.color.b*S.b;z.updateStyleString()}else z.__styleString=M.color.__styleString;
+else if(M instanceof THREE.MeshDepthMaterial){f=1-M.__2near/(M.__farPlusNear-Q.z*M.__farMinusNear);z.setRGB(f,f,f)}else M instanceof THREE.MeshNormalMaterial&&z.setRGB(e(Q.normalWorld.x),e(Q.normalWorld.y),e(Q.normalWorld.z));M.wireframe?W.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+M.wireframeLinewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframeLinecap+"; stroke-linejoin: "+M.wireframeLinejoin):W.setAttribute("style","fill: "+z.__styleString+
+"; fill-opacity: "+M.opacity);k.appendChild(W)}function d(ja){if(oa[ja]==null){oa[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");Fa==0&&oa[ja].setAttribute("shape-rendering","crispEdges")}return oa[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,t,x,y,q,A,G,H=new THREE.Rectangle,E=new THREE.Rectangle,I=!1,z=new THREE.Color(16777215),S=new THREE.Color(16777215),
+P=new THREE.Color(0),O=new THREE.Color(0),aa=new THREE.Color(0),f,ha=new THREE.Vector3,oa=[],$=[],W,Da,da,Fa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":Fa=1;break;case "low":Fa=0}};this.setSize=function(ja,qa){j=ja;m=qa;t=j/2;x=m/2;k.setAttribute("viewBox",-t+" "+-x+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);H.set(-t,-x,t,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(ja,qa){var ma,Z,Q,M,ea,ua,ka,va;this.autoClear&&this.clear();g=h.projectScene(ja,qa,this.sortElements);da=Da=0;if(I=ja.lights.length>0){ka=ja.lights;P.setRGB(0,0,0);O.setRGB(0,0,0);aa.setRGB(0,0,0);ma=0;for(Z=ka.length;ma<Z;ma++){Q=ka[ma];M=Q.color;if(Q instanceof THREE.AmbientLight){P.r+=M.r;P.g+=M.g;P.b+=M.b}else if(Q instanceof THREE.DirectionalLight){O.r+=M.r;O.g+=M.g;O.b+=M.b}else if(Q instanceof THREE.PointLight){aa.r+=M.r;aa.g+=M.g;aa.b+=M.b}}}ma=0;for(Z=g.length;ma<Z;ma++){ka=
+g[ma];E.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=t;y.y*=-x;Q=0;for(M=ka.materials.length;Q<M;)Q++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;q=ka.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(H.instersects(E)){Q=0;for(M=ka.materials.length;Q<M;)if((va=ka.materials[Q++])&&va.opacity!=0){ea=y;ua=q;var za=da++;if($[za]==null){$[za]=
+document.createElementNS("http://www.w3.org/2000/svg","line");Fa==0&&$[za].setAttribute("shape-rendering","crispEdges")}W=$[za];W.setAttribute("x1",ea.positionScreen.x);W.setAttribute("y1",ea.positionScreen.y);W.setAttribute("x2",ua.positionScreen.x);W.setAttribute("y2",ua.positionScreen.y);if(va instanceof THREE.LineBasicMaterial){z.__styleString=va.color.__styleString;W.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+va.linewidth+"; stroke-opacity: "+va.opacity+"; stroke-linecap: "+
+va.linecap+"; stroke-linejoin: "+va.linejoin);k.appendChild(W)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;q=ka.v2;A=ka.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(H.instersects(E)){Q=0;for(M=ka.meshMaterials.length;Q<M;){va=ka.meshMaterials[Q++];
+if(va instanceof THREE.MeshFaceMaterial){ea=0;for(ua=ka.faceMaterials.length;ea<ua;)(va=ka.faceMaterials[ea++])&&va.opacity!=0&&c(y,q,A,ka,va,ja)}else va&&va.opacity!=0&&c(y,q,A,ka,va,ja)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;q=ka.v2;A=ka.v3;G=ka.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(H.instersects(E)){Q=0;for(M=ka.meshMaterials.length;Q<M;){va=ka.meshMaterials[Q++];if(va instanceof THREE.MeshFaceMaterial){ea=0;for(ua=ka.faceMaterials.length;ea<ua;)(va=ka.faceMaterials[ea++])&&va.opacity!=0&&b(y,q,A,G,ka,va,ja)}else va&&va.opacity!=0&&b(y,q,A,G,ka,va,ja)}}}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -217,43 +218,43 @@ 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,
 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.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.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(n,C,p){var o,w,D,B=n.vertices,F=B.length,V=n.colors,M=V.length,J=n.__vertexArray,qa=n.__colorArray,Ca=n.__sortArray,W=n.__dirtyVertices,wa=n.__dirtyColors;if(p.sortParticles){O.multiplySelf(p.matrixWorld);for(o=0;o<F;o++){w=B[o].position;ka.copy(w);O.multiplyVector3(ka);Ca[o]=[ka.z,o]}Ca.sort(function(la,Ga){return Ga[0]-la[0]});for(o=0;o<F;o++){w=B[Ca[o][1]].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}for(o=0;o<M;o++){D=o*3;color=V[Ca[o][1]];qa[D]=color.r;
-qa[D+1]=color.g;qa[D+2]=color.b}}else{if(W)for(o=0;o<F;o++){w=B[o].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}if(wa)for(o=0;o<M;o++){color=V[o];D=o*3;qa[D]=color.r;qa[D+1]=color.g;qa[D+2]=color.b}}if(W||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,J,C)}if(wa||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,qa,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||aa.initMaterial(o,C,p,w);var D=o.program,B=D.uniforms,F=o.uniforms;if(D!=ja){f.useProgram(D);ja=D}f.uniformMatrix4fv(B.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)){F.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){F.fogNear.value=p.near;F.fogFar.value=
-p.far}else if(p instanceof THREE.FogExp2)F.fogDensity.value=p.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var V,M,J=0,qa=0,Ca=0,W,wa,la,Ga=ta,Na=Ga.directional.colors,ua=Ga.directional.positions,Ha=Ga.point.colors,P=Ga.point.positions,za=0,Aa=0;p=M=M=0;for(V=C.length;p<V;p++){M=C[p];W=M.color;wa=M.position;la=M.intensity;if(M instanceof THREE.AmbientLight){J+=W.r;qa+=W.g;Ca+=W.b}else if(M instanceof THREE.DirectionalLight){M=za*3;Na[M]=W.r*la;
-Na[M+1]=W.g*la;Na[M+2]=W.b*la;ua[M]=wa.x;ua[M+1]=wa.y;ua[M+2]=wa.z;za+=1}else if(M instanceof THREE.PointLight){M=Aa*3;Ha[M]=W.r*la;Ha[M+1]=W.g*la;Ha[M+2]=W.b*la;P[M]=wa.x;P[M+1]=wa.y;P[M+2]=wa.z;Aa+=1}}for(p=za*3;p<Na.length;p++)Na[p]=0;for(p=Aa*3;p<Ha.length;p++)Ha[p]=0;Ga.point.length=Aa;Ga.directional.length=za;Ga.ambient[0]=J;Ga.ambient[1]=qa;Ga.ambient[2]=Ca;C=ta;F.enableLighting.value=C.directional.length+C.point.length;F.ambientLightColor.value=C.ambient;F.directionalLightColor.value=C.directional.colors;
+THREE.WebGLRenderer=function(a){function c(n,C,p){var o,w,D,B=n.vertices,F=B.length,X=n.colors,N=X.length,J=n.__vertexArray,sa=n.__colorArray,Ea=n.__sortArray,Y=n.__dirtyVertices,ya=n.__dirtyColors;if(p.sortParticles){M.multiplySelf(p.matrixWorld);for(o=0;o<F;o++){w=B[o].position;ka.copy(w);M.multiplyVector3(ka);Ea[o]=[ka.z,o]}Ea.sort(function(la,Ha){return Ha[0]-la[0]});for(o=0;o<F;o++){w=B[Ea[o][1]].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}for(o=0;o<N;o++){D=o*3;color=X[Ea[o][1]];sa[D]=color.r;
+sa[D+1]=color.g;sa[D+2]=color.b}}else{if(Y)for(o=0;o<F;o++){w=B[o].position;D=o*3;J[D]=w.x;J[D+1]=w.y;J[D+2]=w.z}if(ya)for(o=0;o<N;o++){color=X[o];D=o*3;sa[D]=color.r;sa[D+1]=color.g;sa[D+2]=color.b}}if(Y||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,J,C)}if(ya||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,sa,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||$.initMaterial(o,C,p,w);var D=o.program,B=D.uniforms,F=o.uniforms;if(D!=ha){f.useProgram(D);ha=D}f.uniformMatrix4fv(B.projectionMatrix,!1,ea);if(p&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){F.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){F.fogNear.value=p.near;F.fogFar.value=
+p.far}else if(p instanceof THREE.FogExp2)F.fogDensity.value=p.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var X,N,J=0,sa=0,Ea=0,Y,ya,la,Ha=va,Ma=Ha.directional.colors,xa=Ha.directional.positions,Ia=Ha.point.colors,U=Ha.point.positions,Ba=0,Ca=0;p=N=N=0;for(X=C.length;p<X;p++){N=C[p];Y=N.color;ya=N.position;la=N.intensity;if(N instanceof THREE.AmbientLight){J+=Y.r;sa+=Y.g;Ea+=Y.b}else if(N instanceof THREE.DirectionalLight){N=Ba*3;Ma[N]=Y.r*la;
+Ma[N+1]=Y.g*la;Ma[N+2]=Y.b*la;xa[N]=ya.x;xa[N+1]=ya.y;xa[N+2]=ya.z;Ba+=1}else if(N instanceof THREE.PointLight){N=Ca*3;Ia[N]=Y.r*la;Ia[N+1]=Y.g*la;Ia[N+2]=Y.b*la;U[N]=ya.x;U[N+1]=ya.y;U[N+2]=ya.z;Ca+=1}}for(p=Ba*3;p<Ma.length;p++)Ma[p]=0;for(p=Ca*3;p<Ia.length;p++)Ia[p]=0;Ha.point.length=Ca;Ha.directional.length=Ba;Ha.ambient[0]=J;Ha.ambient[1]=sa;Ha.ambient[2]=Ea;C=va;F.enableLighting.value=C.directional.length+C.point.length;F.ambientLightColor.value=C.ambient;F.directionalLightColor.value=C.directional.colors;
 F.directionalLightDirection.value=C.directional.positions;F.pointLightColor.value=C.point.colors;F.pointLightPosition.value=C.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.map.texture=o.map;F.lightMap.texture=o.lightMap;F.envMap.texture=o.envMap;F.reflectivity.value=o.reflectivity;F.refractionRatio.value=
 F.directionalLightDirection.value=C.directional.positions;F.pointLightColor.value=C.point.colors;F.pointLightPosition.value=C.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.map.texture=o.map;F.lightMap.texture=o.lightMap;F.envMap.texture=o.envMap;F.reflectivity.value=o.reflectivity;F.refractionRatio.value=
-o.refractionRatio;F.combine.value=o.combine;F.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){F.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.size.value=o.size;F.scale.value=da.height/2;F.map.texture=o.map}else if(o instanceof
-THREE.MeshPhongMaterial){F.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);F.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);F.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)F.opacity.value=o.opacity;for(var Wa in F)if(J=D.uniforms[Wa]){p=F[Wa];V=p.type;C=p.value;if(V=="i")f.uniform1i(J,C);else if(V=="f")f.uniform1f(J,C);else if(V=="fv1")f.uniform1fv(J,
-C);else if(V=="fv")f.uniform3fv(J,C);else if(V=="v2")f.uniform2f(J,C.x,C.y);else if(V=="v3")f.uniform3f(J,C.x,C.y,C.z);else if(V=="c")f.uniform3f(J,C.r,C.g,C.b);else if(V=="t"){f.uniform1i(J,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(V=0;V<6;++V)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+V,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[V])}else{p.image.__webGLTextureCube=
-f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(V=0;V<6;++V)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+V,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[V]);p.__wasSetOnce=!0}H(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}H(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(B.modelViewMatrix,!1,w._modelViewMatrixArray);f.uniformMatrix3fv(B.normalMatrix,!1,w._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||
-o instanceof THREE.MeshPhongMaterial||o.envMap)&&f.uniform3f(B.cameraPosition,n.position.x,n.position.y,n.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&f.uniformMatrix4fv(B.objectMatrix,!1,w._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&f.uniformMatrix4fv(B.viewMatrix,!1,va);if(o.skinning){f.uniformMatrix4fv(B.cameraInverseMatrix,!1,va);f.uniformMatrix4fv(B.boneGlobalMatrices,
+o.refractionRatio;F.combine.value=o.combine;F.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){F.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.size.value=o.size;F.scale.value=aa.height/2;F.map.texture=o.map}else if(o instanceof
+THREE.MeshPhongMaterial){F.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);F.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);F.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){F.mNear.value=n.near;F.mFar.value=n.far;F.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)F.opacity.value=o.opacity;for(var Va in F)if(J=D.uniforms[Va]){p=F[Va];X=p.type;C=p.value;if(X=="i")f.uniform1i(J,C);else if(X=="f")f.uniform1f(J,C);else if(X=="fv1")f.uniform1fv(J,
+C);else if(X=="fv")f.uniform3fv(J,C);else if(X=="v2")f.uniform2f(J,C.x,C.y);else if(X=="v3")f.uniform3f(J,C.x,C.y,C.z);else if(X=="c")f.uniform3f(J,C.r,C.g,C.b);else if(X=="t"){f.uniform1i(J,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(X=0;X<6;++X)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[X])}else{p.image.__webGLTextureCube=
+f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(X=0;X<6;++X)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[X]);p.__wasSetOnce=!0}I(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}I(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(B.modelViewMatrix,!1,w._modelViewMatrixArray);f.uniformMatrix3fv(B.normalMatrix,!1,w._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||
+o instanceof THREE.MeshPhongMaterial||o.envMap)&&f.uniform3f(B.cameraPosition,n.position.x,n.position.y,n.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&f.uniformMatrix4fv(B.objectMatrix,!1,w._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&f.uniformMatrix4fv(B.viewMatrix,!1,ua);if(o.skinning){f.uniformMatrix4fv(B.cameraInverseMatrix,!1,ua);f.uniformMatrix4fv(B.boneGlobalMatrices,
 !1,w.boneMatrices)}return D}function e(n,C,p,o,w,D){if(o.opacity!=0){n=d(n,C,p,o,D).attributes;if(o.morphTargets){C=o.program.attributes;D.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[D.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(C.position,3,f.FLOAT,!1,0,0);if(D.morphTargetForcedOrder.length){p=0;for(var B=D.morphTargetForcedOrder,F=D.morphTargetInfluences;p<o.numSupportedMorphTargets&&p<B.length;){f.bindBuffer(f.ARRAY_BUFFER,
 !1,w.boneMatrices)}return D}function e(n,C,p,o,w,D){if(o.opacity!=0){n=d(n,C,p,o,D).attributes;if(o.morphTargets){C=o.program.attributes;D.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[D.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(C.position,3,f.FLOAT,!1,0,0);if(D.morphTargetForcedOrder.length){p=0;for(var B=D.morphTargetForcedOrder,F=D.morphTargetInfluences;p<o.numSupportedMorphTargets&&p<B.length;){f.bindBuffer(f.ARRAY_BUFFER,
-w.__webGLMorphTargetsBuffers[B[p]]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=F[B[p]];p++}}else{B=[];var V=-1,M=0;F=D.morphTargetInfluences;var J,qa=F.length;p=0;for(D.morphTargetBase!==-1&&(B[D.morphTargetBase]=!0);p<o.numSupportedMorphTargets;){for(J=0;J<qa;J++)if(!B[J]&&F[J]>V){M=J;V=F[M]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[M]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=V;B[M]=
-1;V=-1;p++}}f.uniform1fv(o.program.uniforms.morphTargetInfluences,D.__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);
+w.__webGLMorphTargetsBuffers[B[p]]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=F[B[p]];p++}}else{B=[];var X=-1,N=0;F=D.morphTargetInfluences;var J,sa=F.length;p=0;for(D.morphTargetBase!==-1&&(B[D.morphTargetBase]=!0);p<o.numSupportedMorphTargets;){for(J=0;J<sa;J++)if(!B[J]&&F[J]>X){N=J;X=F[N]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[N]);f.vertexAttribPointer(C["morphTarget"+p],3,f.FLOAT,!1,0,0);D.__webGLMorphTargetInfluences[p]=X;B[N]=
+1;X=-1;p++}}f.uniform1fv(o.program.uniforms.morphTargetInfluences,D.__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>=
 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(D instanceof THREE.Mesh)if(o.wireframe){f.lineWidth(o.wireframeLinewidth);
 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(D 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(D instanceof THREE.Line){D=D.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(o.linewidth);f.drawArrays(D,0,w.__webGLLineCount)}else if(D instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,w.__webGLParticleCount);else D instanceof THREE.Ribbon&&
 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(D instanceof THREE.Line){D=D.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(o.linewidth);f.drawArrays(D,0,w.__webGLLineCount)}else if(D instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,0,w.__webGLParticleCount);else D 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(Y!=n.doubleSided){n.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);Y=n.doubleSided}if(Da!=n.flipSided){n.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);Da=n.flipSided}}function k(n){if(Ea!=n){n?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);Ea=n}}function j(n){R[0].set(n.n41-
-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);R[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);R[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);R[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);R[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);R[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=R[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=R[o].x*C.n14+R[o].y*C.n24+R[o].z*C.n34+R[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,D=n.transparent;D.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(D,p):t(w,p)}}function y(n){var C,p,o,w,D=n.object,B=n.buffer,F=n.opaque,V=n.transparent;V.count=0;n=F.count=0;for(o=D.materials.length;n<o;n++){C=
-D.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(p=B.materials.length;C<p;C++)(w=B.materials[C])&&(w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(V,w):t(F,w))}else{w=C;w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(V,w):t(F,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(Ca){var W=
-[];p=0;for(o=Ca.length;p<o;p++)Ca[p]==undefined?W.push("undefined"):W.push(Ca[p].id);return W.join("_")}var p,o,w,D,B,F,V,M,J={},qa=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};w=0;for(D=n.faces.length;w<D;w++){B=n.faces[w];F=B.materials;V=C(F);J[V]==undefined&&(J[V]={hash:V,counter:0});M=J[V].hash+"_"+J[V].counter;n.geometryGroups[M]==undefined&&(n.geometryGroups[M]={faces:[],materials:F,vertices:0,numMorphTargets:qa});B=B instanceof THREE.Face3?3:4;if(n.geometryGroups[M].vertices+
-B>65535){J[V].counter+=1;M=J[V].hash+"_"+J[V].counter;n.geometryGroups[M]==undefined&&(n.geometryGroups[M]={faces:[],materials:F,vertices:0,numMorphTargets:qa})}n.geometryGroups[M].faces.push(w);n.geometryGroups[M].vertices+=B}}function I(n,C,p){n.push({buffer:C,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(n){if(n!=ea){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)}ea=n}}function H(n,C,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(n,f.TEXTURE_WRAP_S,N(C.wrapS));f.texParameteri(n,f.TEXTURE_WRAP_T,N(C.wrapT));f.texParameteri(n,f.TEXTURE_MAG_FILTER,
-N(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,N(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,Q(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,Q(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,N(n.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,N(n.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,N(n.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,N(n.minFilter));f.texImage2D(f.TEXTURE_2D,0,N(n.format),n.width,n.height,0,N(n.format),N(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=oa;n=$}if(C!=na){f.bindFramebuffer(f.FRAMEBUFFER,C);f.viewport(ia,ra,p,n);na=C}}function S(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 Q(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 N(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;
+f.drawArrays(f.TRIANGLE_STRIP,0,w.__webGLVertexCount)}}function g(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 h(n){if(W!=n.doubleSided){n.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);W=n.doubleSided}if(Da!=n.flipSided){n.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);Da=n.flipSided}}function k(n){if(Fa!=n){n?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);Fa=n}}function j(n){Q[0].set(n.n41-
+n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);Q[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);Q[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);Q[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);Q[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);Q[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=Q[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=Q[o].x*C.n14+Q[o].y*C.n24+Q[o].z*C.n34+Q[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,D=n.transparent;D.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(D,p):t(w,p)}}function y(n){var C,p,o,w,D=n.object,B=n.buffer,F=n.opaque,X=n.transparent;X.count=0;n=F.count=0;for(o=D.materials.length;n<o;n++){C=
+D.materials[n];if(C instanceof THREE.MeshFaceMaterial){C=0;for(p=B.materials.length;C<p;C++)(w=B.materials[C])&&(w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(X,w):t(F,w))}else{w=C;w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(X,w):t(F,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(Ea){var Y=
+[];p=0;for(o=Ea.length;p<o;p++)Ea[p]==undefined?Y.push("undefined"):Y.push(Ea[p].id);return Y.join("_")}var p,o,w,D,B,F,X,N,J={},sa=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};w=0;for(D=n.faces.length;w<D;w++){B=n.faces[w];F=B.materials;X=C(F);J[X]==undefined&&(J[X]={hash:X,counter:0});N=J[X].hash+"_"+J[X].counter;n.geometryGroups[N]==undefined&&(n.geometryGroups[N]={faces:[],materials:F,vertices:0,numMorphTargets:sa});B=B instanceof THREE.Face3?3:4;if(n.geometryGroups[N].vertices+
+B>65535){J[X].counter+=1;N=J[X].hash+"_"+J[X].counter;n.geometryGroups[N]==undefined&&(n.geometryGroups[N]={faces:[],materials:F,vertices:0,numMorphTargets:sa})}n.geometryGroups[N].faces.push(w);n.geometryGroups[N].vertices+=B}}function H(n,C,p){n.push({buffer:C,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function E(n){if(n!=da){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)}da=n}}function I(n,C,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(n,f.TEXTURE_WRAP_S,O(C.wrapS));f.texParameteri(n,f.TEXTURE_WRAP_T,O(C.wrapT));f.texParameteri(n,f.TEXTURE_MAG_FILTER,
+O(C.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,O(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,O(n.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,O(n.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,O(n.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,O(n.minFilter));f.texImage2D(f.TEXTURE_2D,0,O(n.format),n.width,n.height,0,O(n.format),O(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=ma;n=Z}if(C!=oa){f.bindFramebuffer(f.FRAMEBUFFER,C);f.viewport(ja,qa,p,n);oa=C}}function S(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 O(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}
 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 da=document.createElement("canvas"),f,ja=null,na=null,aa=this,Y=null,Da=null,ea=null,Ea=null,ia=0,ra=0,oa=0,$=0,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Matrix4,ha=new Float32Array(16),va=new Float32Array(16),ka=new THREE.Vector4,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},xa=!0,Ma=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)xa=a.antialias;
-a.clearColor!==undefined&&Ma.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(n,C,p){try{if(!(f=da.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})(xa,Ma,ab);this.context=f;this.setSize=function(n,C){da.width=n;da.height=C;this.setViewport(0,0,da.width,da.height)};this.setViewport=function(n,C,p,o){ia=n;ra=C;oa=p;$=o;f.viewport(ia,ra,oa,$)};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);
+var aa=document.createElement("canvas"),f,ha=null,oa=null,$=this,W=null,Da=null,da=null,Fa=null,ja=0,qa=0,ma=0,Z=0,Q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Matrix4,ea=new Float32Array(16),ua=new Float32Array(16),ka=new THREE.Vector4,va={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},za=!0,La=new THREE.Color(0),$a=0;if(a){if(a.antialias!==undefined)za=a.antialias;
+a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==undefined)$a=a.clearAlpha}this.maxMorphTargets=8;this.domElement=aa;this.autoClear=!0;this.sortObjects=!0;(function(n,C,p){try{if(!(f=aa.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})(za,La,$a);this.context=f;this.setSize=function(n,C){aa.width=n;aa.height=C;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(n,C,p,o){ja=n;qa=C;ma=p;Z=o;f.viewport(ja,qa,ma,Z)};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,D,B;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
 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,D,B;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 F,V,M,J;B=M=J=0;for(F=C.length;B<F;B++){V=C[B];V instanceof THREE.DirectionalLight&&M++;V instanceof THREE.PointLight&&J++}if(J+M<=4)C=M;else{C=Math.ceil(4*M/(J+M));J=4-C}B={directional:C,point:J};F=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)F=o.bones.length;J=n.fragmentShader;C=n.vertexShader;
+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 F,X,N,J;B=N=J=0;for(F=C.length;B<F;B++){X=C[B];X instanceof THREE.DirectionalLight&&N++;X instanceof THREE.PointLight&&J++}if(J+N<=4)C=N;else{C=Math.ceil(4*N/(J+N));J=4-C}B={directional:C,point:J};F=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)F=o.bones.length;J=n.fragmentShader;C=n.vertexShader;
 F={fog:p,map:n.map,envMap:n.envMap,lightMap:n.lightMap,vertexColors:n.vertexColors,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxDirLights:B.directional,maxPointLights:B.point,maxBones:F};p=f.createProgram();B=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,F.fog?"#define USE_FOG":"",F.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":
 F={fog:p,map:n.map,envMap:n.envMap,lightMap:n.lightMap,vertexColors:n.vertexColors,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxDirLights:B.directional,maxPointLights:B.point,maxBones:F};p=f.createProgram();B=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,F.fog?"#define USE_FOG":"",F.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":
 "",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");F=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,"#define MAX_BONES "+F.maxBones,F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"",F.skinning?"#define USE_SKINNING":
 "",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");F=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,"#define MAX_BONES "+F.maxBones,F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"",F.skinning?"#define USE_SKINNING":
 "",F.morphTargets?"#define USE_MORPHTARGETS":"",F.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.morphTargets?"#define USE_MORPHTARGETS":"",F.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");
@@ -261,58 +262,59 @@ f.attachShader(p,S("fragment",B+J));f.attachShader(p,S("vertex",F+C));f.linkProg
 w=n.program;J=0;for(C=p.length;J<C;J++){B=p[J];w.uniforms[B]=f.getUniformLocation(w,B)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)p.push("morphTarget"+w);for(D in n.attributes)p.push(D);D=n.program;w=p;p=0;for(J=w.length;p<J;p++){C=w[p];D.attributes[C]=f.getAttribLocation(D,C)}D=n.program.attributes;f.enableVertexAttribArray(D.position);D.color>=0&&f.enableVertexAttribArray(D.color);D.normal>=0&&f.enableVertexAttribArray(D.normal);
 w=n.program;J=0;for(C=p.length;J<C;J++){B=p[J];w.uniforms[B]=f.getUniformLocation(w,B)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)p.push("morphTarget"+w);for(D in n.attributes)p.push(D);D=n.program;w=p;p=0;for(J=w.length;p<J;p++){C=w[p];D.attributes[C]=f.getAttribLocation(D,C)}D=n.program.attributes;f.enableVertexAttribArray(D.position);D.color>=0&&f.enableVertexAttribArray(D.color);D.normal>=0&&f.enableVertexAttribArray(D.normal);
 D.tangent>=0&&f.enableVertexAttribArray(D.tangent);if(n.skinning&&D.skinVertexA>=0&&D.skinVertexB>=0&&D.skinIndex>=0&&D.skinWeight>=0){f.enableVertexAttribArray(D.skinVertexA);f.enableVertexAttribArray(D.skinVertexB);f.enableVertexAttribArray(D.skinIndex);f.enableVertexAttribArray(D.skinWeight)}if(n.morphTargets){n.numSupportedMorphTargets=0;if(D.morphTarget0>=0){f.enableVertexAttribArray(D.morphTarget0);n.numSupportedMorphTargets++}if(D.morphTarget1>=0){f.enableVertexAttribArray(D.morphTarget1);
 D.tangent>=0&&f.enableVertexAttribArray(D.tangent);if(n.skinning&&D.skinVertexA>=0&&D.skinVertexB>=0&&D.skinIndex>=0&&D.skinWeight>=0){f.enableVertexAttribArray(D.skinVertexA);f.enableVertexAttribArray(D.skinVertexB);f.enableVertexAttribArray(D.skinIndex);f.enableVertexAttribArray(D.skinWeight)}if(n.morphTargets){n.numSupportedMorphTargets=0;if(D.morphTarget0>=0){f.enableVertexAttribArray(D.morphTarget0);n.numSupportedMorphTargets++}if(D.morphTarget1>=0){f.enableVertexAttribArray(D.morphTarget1);
 n.numSupportedMorphTargets++}if(D.morphTarget2>=0){f.enableVertexAttribArray(D.morphTarget2);n.numSupportedMorphTargets++}if(D.morphTarget3>=0){f.enableVertexAttribArray(D.morphTarget3);n.numSupportedMorphTargets++}if(D.morphTarget4>=0){f.enableVertexAttribArray(D.morphTarget4);n.numSupportedMorphTargets++}if(D.morphTarget5>=0){f.enableVertexAttribArray(D.morphTarget5);n.numSupportedMorphTargets++}if(D.morphTarget6>=0){f.enableVertexAttribArray(D.morphTarget6);n.numSupportedMorphTargets++}if(D.morphTarget7>=
 n.numSupportedMorphTargets++}if(D.morphTarget2>=0){f.enableVertexAttribArray(D.morphTarget2);n.numSupportedMorphTargets++}if(D.morphTarget3>=0){f.enableVertexAttribArray(D.morphTarget3);n.numSupportedMorphTargets++}if(D.morphTarget4>=0){f.enableVertexAttribArray(D.morphTarget4);n.numSupportedMorphTargets++}if(D.morphTarget5>=0){f.enableVertexAttribArray(D.morphTarget5);n.numSupportedMorphTargets++}if(D.morphTarget6>=0){f.enableVertexAttribArray(D.morphTarget6);n.numSupportedMorphTargets++}if(D.morphTarget7>=
-0){f.enableVertexAttribArray(D.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,D,B,F,V,M,J,qa,Ca=n.lights,W=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(va);C.projectionMatrix.flattenToArray(ha);O.multiply(C.projectionMatrix,C.matrixWorldInverse);j(O);this.initWebGLObjects(n);
-z(p);(this.autoClear||o)&&this.clear();V=n.__webglObjects.length;for(o=0;o<V;o++){w=n.__webglObjects[o];J=w.object;if(J.visible)if(!(J instanceof THREE.Mesh)||m(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);y(w);w.render=!0;if(this.sortObjects){ka.copy(J.position);O.multiplyVector3(ka);w.z=ka.z}}else w.render=!1;else w.render=!1}this.sortObjects&&n.__webglObjects.sort(q);M=n.__webglObjectsImmediate.length;for(o=0;o<M;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){J.matrixAutoUpdate&&
-J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);x(w)}}E(THREE.NormalBlending);for(o=0;o<V;o++){w=n.__webglObjects[o];if(w.render){J=w.object;qa=w.buffer;B=w.opaque;g(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);e(C,Ca,W,F,qa,J)}}}for(o=0;o<M;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.opaque;g(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);D=d(C,Ca,W,F,J);J.render(function(wa){h(wa,D)})}}}for(o=0;o<V;o++){w=n.__webglObjects[o];if(w.render){J=w.object;qa=
-w.buffer;B=w.transparent;g(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);e(C,Ca,W,F,qa,J)}}}for(o=0;o<M;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.transparent;g(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);D=d(C,Ca,W,F,J);J.render(function(wa){h(wa,D)})}}}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)}};
+0){f.enableVertexAttribArray(D.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,D,B,F,X,N,J,sa,Ea=n.lights,Y=n.fog;C.matrixAutoUpdate&&C.updateMatrix();n.update(undefined,!1,C);C.matrixWorldInverse.flattenToArray(ua);C.projectionMatrix.flattenToArray(ea);M.multiply(C.projectionMatrix,C.matrixWorldInverse);j(M);this.initWebGLObjects(n);
+z(p);(this.autoClear||o)&&this.clear();X=n.__webglObjects.length;for(o=0;o<X;o++){w=n.__webglObjects[o];J=w.object;if(J.visible)if(!(J instanceof THREE.Mesh)||m(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);y(w);w.render=!0;if(this.sortObjects){ka.copy(J.position);M.multiplyVector3(ka);w.z=ka.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];J=w.object;if(J.visible){J.matrixAutoUpdate&&
+J.matrixWorld.flattenToArray(J._objectMatrixArray);A(J,C);x(w)}}E(THREE.NormalBlending);for(o=0;o<X;o++){w=n.__webglObjects[o];if(w.render){J=w.object;sa=w.buffer;B=w.opaque;h(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);e(C,Ea,Y,F,sa,J)}}}for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.opaque;h(J);for(w=0;w<B.count;w++){F=B.list[w];k(F.depthTest);D=d(C,Ea,Y,F,J);J.render(function(ya){g(ya,D)})}}}for(o=0;o<X;o++){w=n.__webglObjects[o];if(w.render){J=w.object;sa=
+w.buffer;B=w.transparent;h(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);e(C,Ea,Y,F,sa,J)}}}for(o=0;o<N;o++){w=n.__webglObjectsImmediate[o];J=w.object;if(J.visible){B=w.transparent;h(J);for(w=0;w<B.count;w++){F=B.list[w];E(F.blending);k(F.depthTest);D=d(C,Ea,Y,F,J);J.render(function(ya){g(ya,D)})}}}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,D=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==
 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,D=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){D=w.geometryGroups[o];if(!D.__webGLVertexBuffer){var B=D;B.__webGLVertexBuffer=f.createBuffer();B.__webGLNormalBuffer=f.createBuffer();B.__webGLTangentBuffer=f.createBuffer();B.__webGLColorBuffer=f.createBuffer();B.__webGLUVBuffer=f.createBuffer();B.__webGLUV2Buffer=f.createBuffer();B.__webGLSkinVertexABuffer=f.createBuffer();B.__webGLSkinVertexBBuffer=f.createBuffer();B.__webGLSkinIndicesBuffer=f.createBuffer();B.__webGLSkinWeightsBuffer=f.createBuffer();
 undefined&&G(w);for(o in w.geometryGroups){D=w.geometryGroups[o];if(!D.__webGLVertexBuffer){var B=D;B.__webGLVertexBuffer=f.createBuffer();B.__webGLNormalBuffer=f.createBuffer();B.__webGLTangentBuffer=f.createBuffer();B.__webGLColorBuffer=f.createBuffer();B.__webGLUVBuffer=f.createBuffer();B.__webGLUV2Buffer=f.createBuffer();B.__webGLSkinVertexABuffer=f.createBuffer();B.__webGLSkinVertexBBuffer=f.createBuffer();B.__webGLSkinIndicesBuffer=f.createBuffer();B.__webGLSkinWeightsBuffer=f.createBuffer();
-B.__webGLFaceBuffer=f.createBuffer();B.__webGLLineBuffer=f.createBuffer();if(B.numMorphTargets){var F=void 0,V=void 0;B.__webGLMorphTargetsBuffers=[];F=0;for(V=B.numMorphTargets;F<V;F++)B.__webGLMorphTargetsBuffers.push(f.createBuffer())}B=D;var M=C,J=void 0,qa=void 0,Ca=V=F=0;J=void 0;qa=void 0;var W=void 0;qa=void 0;var wa=M.geometry;W=wa.faces;var la=B.faces;J=0;for(qa=la.length;J<qa;J++){fi=la[J];face=W[fi];if(face instanceof THREE.Face3){F+=3;V+=1;Ca+=3}else if(face instanceof THREE.Face4){F+=
-4;V+=2;Ca+=4}}J=B;qa=M;W=void 0;la=void 0;var Ga=void 0,Na=void 0;Ga=void 0;var ua=[];W=0;for(la=qa.materials.length;W<la;W++){Ga=qa.materials[W];if(Ga instanceof THREE.MeshFaceMaterial){Ga=0;for(l=J.materials.length;Ga<l;Ga++)(Na=J.materials[Ga])&&ua.push(Na)}else(Na=Ga)&&ua.push(Na)}qa=ua;a:{J=void 0;W=void 0;la=qa.length;for(J=0;J<la;J++){W=qa[J];if(W.map||W.lightMap||W instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{W=qa;la=void 0;ua=void 0;Ga=W.length;for(la=0;la<Ga;la++){ua=W[la];
-if(!(ua instanceof THREE.MeshBasicMaterial&&!ua.envMap||ua instanceof THREE.MeshDepthMaterial)){W=ua&&ua.shading!=undefined&&ua.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}W=!1}a:{la=void 0;ua=void 0;Ga=qa.length;for(la=0;la<Ga;la++){ua=qa[la];if(ua.vertexColors){qa=ua.vertexColors;break a}}qa=!1}B.__vertexArray=new Float32Array(F*3);if(W)B.__normalArray=new Float32Array(F*3);if(wa.hasTangents)B.__tangentArray=new Float32Array(F*4);if(qa)B.__colorArray=new Float32Array(F*
-3);if(J){if(wa.faceUvs.length>0||wa.faceVertexUvs.length>0)B.__uvArray=new Float32Array(F*2);if(wa.faceUvs.length>1||wa.faceVertexUvs.length>1)B.__uv2Array=new Float32Array(F*2)}if(M.geometry.skinWeights.length&&M.geometry.skinIndices.length){B.__skinVertexAArray=new Float32Array(F*4);B.__skinVertexBArray=new Float32Array(F*4);B.__skinIndexArray=new Float32Array(F*4);B.__skinWeightArray=new Float32Array(F*4)}B.__faceArray=new Uint16Array(V*3);B.__lineArray=new Uint16Array(Ca*2);if(B.numMorphTargets){M=
-void 0;wa=void 0;B.__morphTargetsArrays=[];M=0;for(wa=B.numMorphTargets;M<wa;M++)B.__morphTargetsArrays.push(new Float32Array(F*3))}B.__needsSmoothNormals=W==THREE.SmoothShading;B.__uvType=J;B.__vertexColorType=qa;B.__normalType=W;B.__webGLFaceCount=V*3;B.__webGLLineCount=Ca*2;w.__dirtyVertices=!0;w.__dirtyMorphTargets=!0;w.__dirtyElements=!0;w.__dirtyUvs=!0;w.__dirtyNormals=!0;w.__dirtyTangents=!0;w.__dirtyColors=!0}I(p.__webglObjects,D,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;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__webGLVertexCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}I(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;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*
-3);o.__webGLLineCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}I(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;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__sortArray=[];o.__webGLParticleCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}I(p.__webglObjects,w,C)}else THREE.MarchingCubes!==undefined&&C instanceof
+B.__webGLFaceBuffer=f.createBuffer();B.__webGLLineBuffer=f.createBuffer();if(B.numMorphTargets){var F=void 0,X=void 0;B.__webGLMorphTargetsBuffers=[];F=0;for(X=B.numMorphTargets;F<X;F++)B.__webGLMorphTargetsBuffers.push(f.createBuffer())}B=D;var N=C,J=void 0,sa=void 0,Ea=X=F=0;J=void 0;sa=void 0;var Y=void 0;sa=void 0;var ya=N.geometry;Y=ya.faces;var la=B.faces;J=0;for(sa=la.length;J<sa;J++){fi=la[J];face=Y[fi];if(face instanceof THREE.Face3){F+=3;X+=1;Ea+=3}else if(face instanceof THREE.Face4){F+=
+4;X+=2;Ea+=4}}J=B;sa=N;Y=void 0;la=void 0;var Ha=void 0,Ma=void 0;Ha=void 0;var xa=[];Y=0;for(la=sa.materials.length;Y<la;Y++){Ha=sa.materials[Y];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=J.materials.length;Ha<l;Ha++)(Ma=J.materials[Ha])&&xa.push(Ma)}else(Ma=Ha)&&xa.push(Ma)}sa=xa;a:{J=void 0;Y=void 0;la=sa.length;for(J=0;J<la;J++){Y=sa[J];if(Y.map||Y.lightMap||Y instanceof THREE.MeshShaderMaterial){J=!0;break a}}J=!1}a:{Y=sa;la=void 0;xa=void 0;Ha=Y.length;for(la=0;la<Ha;la++){xa=Y[la];
+if(!(xa instanceof THREE.MeshBasicMaterial&&!xa.envMap||xa instanceof THREE.MeshDepthMaterial)){Y=xa&&xa.shading!=undefined&&xa.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Y=!1}a:{la=void 0;xa=void 0;Ha=sa.length;for(la=0;la<Ha;la++){xa=sa[la];if(xa.vertexColors){sa=xa.vertexColors;break a}}sa=!1}B.__vertexArray=new Float32Array(F*3);if(Y)B.__normalArray=new Float32Array(F*3);if(ya.hasTangents)B.__tangentArray=new Float32Array(F*4);if(sa)B.__colorArray=new Float32Array(F*
+3);if(J){if(ya.faceUvs.length>0||ya.faceVertexUvs.length>0)B.__uvArray=new Float32Array(F*2);if(ya.faceUvs.length>1||ya.faceVertexUvs.length>1)B.__uv2Array=new Float32Array(F*2)}if(N.geometry.skinWeights.length&&N.geometry.skinIndices.length){B.__skinVertexAArray=new Float32Array(F*4);B.__skinVertexBArray=new Float32Array(F*4);B.__skinIndexArray=new Float32Array(F*4);B.__skinWeightArray=new Float32Array(F*4)}B.__faceArray=new Uint16Array(X*3);B.__lineArray=new Uint16Array(Ea*2);if(B.numMorphTargets){N=
+void 0;ya=void 0;B.__morphTargetsArrays=[];N=0;for(ya=B.numMorphTargets;N<ya;N++)B.__morphTargetsArrays.push(new Float32Array(F*3))}B.__needsSmoothNormals=Y==THREE.SmoothShading;B.__uvType=J;B.__vertexColorType=sa;B.__normalType=Y;B.__webGLFaceCount=X*3;B.__webGLLineCount=Ea*2;w.__dirtyVertices=!0;w.__dirtyMorphTargets=!0;w.__dirtyElements=!0;w.__dirtyUvs=!0;w.__dirtyNormals=!0;w.__dirtyTangents=!0;w.__dirtyColors=!0}H(p.__webglObjects,D,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;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__webGLVertexCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}H(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;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*
+3);o.__webGLLineCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}H(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;D=o.vertices.length;o.__vertexArray=new Float32Array(D*3);o.__colorArray=new Float32Array(D*3);o.__sortArray=[];o.__webGLParticleCount=D;w.__dirtyVertices=!0;w.__dirtyColors=!0}H(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;D=void 0;w=void 0;B=void 0;if(o instanceof THREE.Mesh){w=o.geometry;
 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;D=void 0;w=void 0;B=void 0;if(o instanceof THREE.Mesh){w=o.geometry;
-for(D in w.geometryGroups){B=w.geometryGroups[D];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){F=f.DYNAMIC_DRAW;V=void 0;Ca=void 0;var Ha=void 0,P=void 0;Ha=void 0;var za=void 0,Aa=void 0,Wa=void 0;M=void 0;wa=void 0;J=void 0;qa=void 0;W=void 0;var X=void 0,fa=void 0,ga=void 0,Ia=void 0;Aa=void 0;Wa=void 0;X=void 0;P=void 0;X=void 0;fa=void 0;ga=void 0;Aa=void 0;X=void 0;fa=void 0;ga=void 0;Ia=void 0;X=void 0;fa=
-void 0;ga=void 0;Ia=void 0;X=void 0;fa=void 0;ga=void 0;Ia=void 0;X=void 0;fa=void 0;ga=void 0;Ia=void 0;P=void 0;za=void 0;Ha=void 0;Ha=void 0;var Ra=void 0,cb=void 0,Oa=void 0,Za=Na=Ga=ua=la=0,Ua=0,Ja=0,Qa=0,La=0,L=0,Pa=0,pa=B.__vertexArray,Ya=B.__uvArray,db=B.__uv2Array,Va=B.__normalArray,Ka=B.__tangentArray,Ba=B.__colorArray,K=B.__skinVertexAArray,ca=B.__skinVertexBArray,U=B.__skinIndexArray,T=B.__skinWeightArray,Fa=B.__morphTargetsArrays,sa=B.__faceArray,ma=B.__lineArray,Z=B.__needsSmoothNormals;
-wa=B.__vertexColorType;M=B.__uvType;J=B.__normalType;var ya=o.geometry,Xa=ya.__dirtyVertices,Sa=ya.__dirtyElements,Ta=ya.__dirtyUvs,fb=ya.__dirtyNormals,$a=ya.__dirtyTangents,bb=ya.__dirtyColors,lb=ya.__dirtyMorphTargets,eb=ya.vertices,mb=B.faces,pb=ya.faces,nb=ya.faceVertexUvs[0],ob=ya.faceVertexUvs[1],ib=ya.skinVerticesA,jb=ya.skinVerticesB,kb=ya.skinIndices,hb=ya.skinWeights,gb=ya.morphTargets;V=0;for(Ca=mb.length;V<Ca;V++){Ha=mb[V];P=pb[Ha];nb&&(qa=nb[Ha]);ob&&(W=ob[Ha]);Ha=P.vertexNormals;za=
-P.normal;Aa=P.vertexColors;Wa=P.color;if(P instanceof THREE.Face3){if(Xa){X=eb[P.a].position;fa=eb[P.b].position;ga=eb[P.c].position;pa[ua]=X.x;pa[ua+1]=X.y;pa[ua+2]=X.z;pa[ua+3]=fa.x;pa[ua+4]=fa.y;pa[ua+5]=fa.z;pa[ua+6]=ga.x;pa[ua+7]=ga.y;pa[ua+8]=ga.z;ua+=9}if(lb){Ra=0;for(cb=gb.length;Ra<cb;Ra++){X=gb[Ra].vertices[P.a].position;fa=gb[Ra].vertices[P.b].position;ga=gb[Ra].vertices[P.c].position;Oa=Fa[Ra];Oa[Pa+0]=X.x;Oa[Pa+1]=X.y;Oa[Pa+2]=X.z;Oa[Pa+3]=fa.x;Oa[Pa+4]=fa.y;Oa[Pa+5]=fa.z;Oa[Pa+6]=ga.x;
-Oa[Pa+7]=ga.y;Oa[Pa+8]=ga.z}Pa+=9}if(hb.length){X=hb[P.a];fa=hb[P.b];ga=hb[P.c];T[L]=X.x;T[L+1]=X.y;T[L+2]=X.z;T[L+3]=X.w;T[L+4]=fa.x;T[L+5]=fa.y;T[L+6]=fa.z;T[L+7]=fa.w;T[L+8]=ga.x;T[L+9]=ga.y;T[L+10]=ga.z;T[L+11]=ga.w;X=kb[P.a];fa=kb[P.b];ga=kb[P.c];U[L]=X.x;U[L+1]=X.y;U[L+2]=X.z;U[L+3]=X.w;U[L+4]=fa.x;U[L+5]=fa.y;U[L+6]=fa.z;U[L+7]=fa.w;U[L+8]=ga.x;U[L+9]=ga.y;U[L+10]=ga.z;U[L+11]=ga.w;X=ib[P.a];fa=ib[P.b];ga=ib[P.c];K[L]=X.x;K[L+1]=X.y;K[L+2]=X.z;K[L+3]=1;K[L+4]=fa.x;K[L+5]=fa.y;K[L+6]=fa.z;K[L+
-7]=1;K[L+8]=ga.x;K[L+9]=ga.y;K[L+10]=ga.z;K[L+11]=1;X=jb[P.a];fa=jb[P.b];ga=jb[P.c];ca[L]=X.x;ca[L+1]=X.y;ca[L+2]=X.z;ca[L+3]=1;ca[L+4]=fa.x;ca[L+5]=fa.y;ca[L+6]=fa.z;ca[L+7]=1;ca[L+8]=ga.x;ca[L+9]=ga.y;ca[L+10]=ga.z;ca[L+11]=1;L+=12}if(bb&&wa){if(Aa.length==3&&wa==THREE.VertexColors){X=Aa[0];fa=Aa[1];ga=Aa[2]}else ga=fa=X=Wa;Ba[La]=X.r;Ba[La+1]=X.g;Ba[La+2]=X.b;Ba[La+3]=fa.r;Ba[La+4]=fa.g;Ba[La+5]=fa.b;Ba[La+6]=ga.r;Ba[La+7]=ga.g;Ba[La+8]=ga.b;La+=9}if($a&&ya.hasTangents){Aa=eb[P.a].tangent;Wa=eb[P.b].tangent;
-X=eb[P.c].tangent;Ka[Ja]=Aa.x;Ka[Ja+1]=Aa.y;Ka[Ja+2]=Aa.z;Ka[Ja+3]=Aa.w;Ka[Ja+4]=Wa.x;Ka[Ja+5]=Wa.y;Ka[Ja+6]=Wa.z;Ka[Ja+7]=Wa.w;Ka[Ja+8]=X.x;Ka[Ja+9]=X.y;Ka[Ja+10]=X.z;Ka[Ja+11]=X.w;Ja+=12}if(fb&&J)if(Ha.length==3&&Z)for(P=0;P<3;P++){za=Ha[P];Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}else for(P=0;P<3;P++){Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}if(Ta&&qa!==undefined&&M)for(P=0;P<3;P++){Ha=qa[P];Ya[Ga]=Ha.u;Ya[Ga+1]=Ha.v;Ga+=2}if(Ta&&W!==undefined&&M)for(P=0;P<3;P++){Ha=W[P];db[Na]=Ha.u;
-db[Na+1]=Ha.v;Na+=2}if(Sa){sa[Za]=la;sa[Za+1]=la+1;sa[Za+2]=la+2;Za+=3;ma[Qa]=la;ma[Qa+1]=la+1;ma[Qa+2]=la;ma[Qa+3]=la+2;ma[Qa+4]=la+1;ma[Qa+5]=la+2;Qa+=6;la+=3}}else if(P instanceof THREE.Face4){if(Xa){X=eb[P.a].position;fa=eb[P.b].position;ga=eb[P.c].position;Ia=eb[P.d].position;pa[ua]=X.x;pa[ua+1]=X.y;pa[ua+2]=X.z;pa[ua+3]=fa.x;pa[ua+4]=fa.y;pa[ua+5]=fa.z;pa[ua+6]=ga.x;pa[ua+7]=ga.y;pa[ua+8]=ga.z;pa[ua+9]=Ia.x;pa[ua+10]=Ia.y;pa[ua+11]=Ia.z;ua+=12}if(lb){Ra=0;for(cb=gb.length;Ra<cb;Ra++){X=gb[Ra].vertices[P.a].position;
-fa=gb[Ra].vertices[P.b].position;ga=gb[Ra].vertices[P.c].position;Ia=gb[Ra].vertices[P.d].position;Oa=Fa[Ra];Oa[Pa+0]=X.x;Oa[Pa+1]=X.y;Oa[Pa+2]=X.z;Oa[Pa+3]=fa.x;Oa[Pa+4]=fa.y;Oa[Pa+5]=fa.z;Oa[Pa+6]=ga.x;Oa[Pa+7]=ga.y;Oa[Pa+8]=ga.z;Oa[Pa+9]=Ia.x;Oa[Pa+10]=Ia.y;Oa[Pa+11]=Ia.z}Pa+=12}if(hb.length){X=hb[P.a];fa=hb[P.b];ga=hb[P.c];Ia=hb[P.d];T[L]=X.x;T[L+1]=X.y;T[L+2]=X.z;T[L+3]=X.w;T[L+4]=fa.x;T[L+5]=fa.y;T[L+6]=fa.z;T[L+7]=fa.w;T[L+8]=ga.x;T[L+9]=ga.y;T[L+10]=ga.z;T[L+11]=ga.w;T[L+12]=Ia.x;T[L+13]=
-Ia.y;T[L+14]=Ia.z;T[L+15]=Ia.w;X=kb[P.a];fa=kb[P.b];ga=kb[P.c];Ia=kb[P.d];U[L]=X.x;U[L+1]=X.y;U[L+2]=X.z;U[L+3]=X.w;U[L+4]=fa.x;U[L+5]=fa.y;U[L+6]=fa.z;U[L+7]=fa.w;U[L+8]=ga.x;U[L+9]=ga.y;U[L+10]=ga.z;U[L+11]=ga.w;U[L+12]=Ia.x;U[L+13]=Ia.y;U[L+14]=Ia.z;U[L+15]=Ia.w;X=ib[P.a];fa=ib[P.b];ga=ib[P.c];Ia=ib[P.d];K[L]=X.x;K[L+1]=X.y;K[L+2]=X.z;K[L+3]=1;K[L+4]=fa.x;K[L+5]=fa.y;K[L+6]=fa.z;K[L+7]=1;K[L+8]=ga.x;K[L+9]=ga.y;K[L+10]=ga.z;K[L+11]=1;K[L+12]=Ia.x;K[L+13]=Ia.y;K[L+14]=Ia.z;K[L+15]=1;X=jb[P.a];fa=
-jb[P.b];ga=jb[P.c];Ia=jb[P.d];ca[L]=X.x;ca[L+1]=X.y;ca[L+2]=X.z;ca[L+3]=1;ca[L+4]=fa.x;ca[L+5]=fa.y;ca[L+6]=fa.z;ca[L+7]=1;ca[L+8]=ga.x;ca[L+9]=ga.y;ca[L+10]=ga.z;ca[L+11]=1;ca[L+12]=Ia.x;ca[L+13]=Ia.y;ca[L+14]=Ia.z;ca[L+15]=1;L+=16}if(bb&&wa){if(Aa.length==4&&wa==THREE.VertexColors){X=Aa[0];fa=Aa[1];ga=Aa[2];Aa=Aa[3]}else Aa=ga=fa=X=Wa;Ba[La]=X.r;Ba[La+1]=X.g;Ba[La+2]=X.b;Ba[La+3]=fa.r;Ba[La+4]=fa.g;Ba[La+5]=fa.b;Ba[La+6]=ga.r;Ba[La+7]=ga.g;Ba[La+8]=ga.b;Ba[La+9]=Aa.r;Ba[La+10]=Aa.g;Ba[La+11]=Aa.b;
-La+=12}if($a&&ya.hasTangents){Aa=eb[P.a].tangent;Wa=eb[P.b].tangent;X=eb[P.c].tangent;P=eb[P.d].tangent;Ka[Ja]=Aa.x;Ka[Ja+1]=Aa.y;Ka[Ja+2]=Aa.z;Ka[Ja+3]=Aa.w;Ka[Ja+4]=Wa.x;Ka[Ja+5]=Wa.y;Ka[Ja+6]=Wa.z;Ka[Ja+7]=Wa.w;Ka[Ja+8]=X.x;Ka[Ja+9]=X.y;Ka[Ja+10]=X.z;Ka[Ja+11]=X.w;Ka[Ja+12]=P.x;Ka[Ja+13]=P.y;Ka[Ja+14]=P.z;Ka[Ja+15]=P.w;Ja+=16}if(fb&&J)if(Ha.length==4&&Z)for(P=0;P<4;P++){za=Ha[P];Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}else for(P=0;P<4;P++){Va[Ua]=za.x;Va[Ua+1]=za.y;Va[Ua+2]=za.z;Ua+=3}if(Ta&&
-qa!==undefined&&M)for(P=0;P<4;P++){Ha=qa[P];Ya[Ga]=Ha.u;Ya[Ga+1]=Ha.v;Ga+=2}if(Ta&&W!==undefined&&M)for(P=0;P<4;P++){Ha=W[P];db[Na]=Ha.u;db[Na+1]=Ha.v;Na+=2}if(Sa){sa[Za]=la;sa[Za+1]=la+1;sa[Za+2]=la+2;sa[Za+3]=la;sa[Za+4]=la+2;sa[Za+5]=la+3;Za+=6;ma[Qa]=la;ma[Qa+1]=la+1;ma[Qa+2]=la;ma[Qa+3]=la+3;ma[Qa+4]=la+1;ma[Qa+5]=la+2;ma[Qa+6]=la+2;ma[Qa+7]=la+3;Qa+=8;la+=4}}}if(Xa){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,pa,F)}if(lb){Ra=0;for(cb=gb.length;Ra<cb;Ra++){f.bindBuffer(f.ARRAY_BUFFER,
-B.__webGLMorphTargetsBuffers[Ra]);f.bufferData(f.ARRAY_BUFFER,Fa[Ra],F)}}if(bb&&La>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ba,F)}if(fb){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Va,F)}if($a&&ya.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ka,F)}if(Ta&&Ga>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);f.bufferData(f.ARRAY_BUFFER,Ya,F)}if(Ta&&Na>0){f.bindBuffer(f.ARRAY_BUFFER,
-B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,db,F)}if(Sa){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,sa,F);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ma,F)}if(L>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,K,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,ca,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);
-f.bufferData(f.ARRAY_BUFFER,U,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,T,F)}}}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;D=f.DYNAMIC_DRAW;M=void 0;M=void 0;wa=void 0;B=void 0;J=o.vertices;F=o.colors;qa=J.length;V=F.length;W=o.__vertexArray;Ca=o.__colorArray;la=o.__dirtyColors;
-if(o.__dirtyVertices){for(M=0;M<qa;M++){wa=J[M].position;B=M*3;W[B]=wa.x;W[B+1]=wa.y;W[B+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,W,D)}if(la){for(M=0;M<V;M++){color=F[M];B=M*3;Ca[B]=color.r;Ca[B+1]=color.g;Ca[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ca,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;M=
-void 0;M=void 0;wa=void 0;B=void 0;J=o.vertices;F=o.colors;qa=J.length;V=F.length;W=o.__vertexArray;Ca=o.__colorArray;la=o.__dirtyColors;if(o.__dirtyVertices){for(M=0;M<qa;M++){wa=J[M].position;B=M*3;W[B]=wa.x;W[B+1]=wa.y;W[B+2]=wa.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,W,D)}if(la){for(M=0;M<V;M++){color=F[M];B=M*3;Ca[B]=color.r;Ca[B+1]=color.g;Ca[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ca,D)}}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)}}}};
+for(D in w.geometryGroups){B=w.geometryGroups[D];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){F=f.DYNAMIC_DRAW;X=void 0;Ea=void 0;var Ia=void 0,U=void 0;Ia=void 0;var Ba=void 0,Ca=void 0,Va=void 0,ta=void 0;N=void 0;ya=void 0;J=void 0;sa=void 0;Y=void 0;var fa=void 0,ga=void 0,na=void 0,Ra=void 0;Ca=void 0;Va=void 0;U=void 0;ta=void 0;U=void 0;fa=void 0;ga=void 0;Ca=void 0;fa=void 0;ga=void 0;na=void 0;Ra=void 0;
+fa=void 0;ga=void 0;na=void 0;Ra=void 0;fa=void 0;ga=void 0;na=void 0;Ra=void 0;fa=void 0;ga=void 0;na=void 0;U=void 0;ta=void 0;Ba=void 0;Ia=void 0;Ia=void 0;var Oa=void 0,bb=void 0,Na=void 0,cb=Ma=Ha=xa=la=0,Ua=0,Ga=0,Sa=0,Pa=0,L=0,pa=0,Ja=B.__vertexArray,db=B.__uvArray,eb=B.__uv2Array,Wa=B.__normalArray,wa=B.__tangentArray,K=B.__colorArray,ca=B.__skinVertexAArray,V=B.__skinVertexBArray,T=B.__skinIndexArray,ia=B.__skinWeightArray,Aa=B.__morphTargetsArrays,ra=B.__faceArray,R=B.__lineArray,Qa=B.__needsSmoothNormals;
+ya=B.__vertexColorType;N=B.__uvType;J=B.__normalType;var Ka=o.geometry,Ta=Ka.__dirtyVertices,Xa=Ka.__dirtyElements,Ya=Ka.__dirtyUvs,Za=Ka.__dirtyNormals,ab=Ka.__dirtyTangents,lb=Ka.__dirtyColors,mb=Ka.__dirtyMorphTargets,hb=Ka.vertices,nb=B.faces,qb=Ka.faces,ob=Ka.faceVertexUvs[0],pb=Ka.faceVertexUvs[1],ib=Ka.skinVerticesA,jb=Ka.skinVerticesB,kb=Ka.skinIndices,gb=Ka.skinWeights,fb=Ka.morphTargets;X=0;for(Ea=nb.length;X<Ea;X++){Ia=nb[X];U=qb[Ia];ob&&(sa=ob[Ia]);pb&&(Y=pb[Ia]);Ia=U.vertexNormals;Ba=
+U.normal;Ca=U.vertexColors;Va=U.color;ta=U.vertexTangents;if(U instanceof THREE.Face3){if(Ta){fa=hb[U.a].position;ga=hb[U.b].position;na=hb[U.c].position;Ja[xa]=fa.x;Ja[xa+1]=fa.y;Ja[xa+2]=fa.z;Ja[xa+3]=ga.x;Ja[xa+4]=ga.y;Ja[xa+5]=ga.z;Ja[xa+6]=na.x;Ja[xa+7]=na.y;Ja[xa+8]=na.z;xa+=9}if(mb){Oa=0;for(bb=fb.length;Oa<bb;Oa++){fa=fb[Oa].vertices[U.a].position;ga=fb[Oa].vertices[U.b].position;na=fb[Oa].vertices[U.c].position;Na=Aa[Oa];Na[pa+0]=fa.x;Na[pa+1]=fa.y;Na[pa+2]=fa.z;Na[pa+3]=ga.x;Na[pa+4]=ga.y;
+Na[pa+5]=ga.z;Na[pa+6]=na.x;Na[pa+7]=na.y;Na[pa+8]=na.z}pa+=9}if(gb.length){fa=gb[U.a];ga=gb[U.b];na=gb[U.c];ia[L]=fa.x;ia[L+1]=fa.y;ia[L+2]=fa.z;ia[L+3]=fa.w;ia[L+4]=ga.x;ia[L+5]=ga.y;ia[L+6]=ga.z;ia[L+7]=ga.w;ia[L+8]=na.x;ia[L+9]=na.y;ia[L+10]=na.z;ia[L+11]=na.w;fa=kb[U.a];ga=kb[U.b];na=kb[U.c];T[L]=fa.x;T[L+1]=fa.y;T[L+2]=fa.z;T[L+3]=fa.w;T[L+4]=ga.x;T[L+5]=ga.y;T[L+6]=ga.z;T[L+7]=ga.w;T[L+8]=na.x;T[L+9]=na.y;T[L+10]=na.z;T[L+11]=na.w;fa=ib[U.a];ga=ib[U.b];na=ib[U.c];ca[L]=fa.x;ca[L+1]=fa.y;ca[L+
+2]=fa.z;ca[L+3]=1;ca[L+4]=ga.x;ca[L+5]=ga.y;ca[L+6]=ga.z;ca[L+7]=1;ca[L+8]=na.x;ca[L+9]=na.y;ca[L+10]=na.z;ca[L+11]=1;fa=jb[U.a];ga=jb[U.b];na=jb[U.c];V[L]=fa.x;V[L+1]=fa.y;V[L+2]=fa.z;V[L+3]=1;V[L+4]=ga.x;V[L+5]=ga.y;V[L+6]=ga.z;V[L+7]=1;V[L+8]=na.x;V[L+9]=na.y;V[L+10]=na.z;V[L+11]=1;L+=12}if(lb&&ya){if(Ca.length==3&&ya==THREE.VertexColors){U=Ca[0];fa=Ca[1];ga=Ca[2]}else ga=fa=U=Va;K[Pa]=U.r;K[Pa+1]=U.g;K[Pa+2]=U.b;K[Pa+3]=fa.r;K[Pa+4]=fa.g;K[Pa+5]=fa.b;K[Pa+6]=ga.r;K[Pa+7]=ga.g;K[Pa+8]=ga.b;Pa+=
+9}if(ab&&Ka.hasTangents){Ca=ta[0];Va=ta[1];U=ta[2];wa[Ga]=Ca.x;wa[Ga+1]=Ca.y;wa[Ga+2]=Ca.z;wa[Ga+3]=Ca.w;wa[Ga+4]=Va.x;wa[Ga+5]=Va.y;wa[Ga+6]=Va.z;wa[Ga+7]=Va.w;wa[Ga+8]=U.x;wa[Ga+9]=U.y;wa[Ga+10]=U.z;wa[Ga+11]=U.w;Ga+=12}if(Za&&J)if(Ia.length==3&&Qa)for(ta=0;ta<3;ta++){Ba=Ia[ta];Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}else for(ta=0;ta<3;ta++){Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}if(Ya&&sa!==undefined&&N)for(ta=0;ta<3;ta++){Ia=sa[ta];db[Ha]=Ia.u;db[Ha+1]=Ia.v;Ha+=2}if(Ya&&Y!==undefined&&
+N)for(ta=0;ta<3;ta++){Ia=Y[ta];eb[Ma]=Ia.u;eb[Ma+1]=Ia.v;Ma+=2}if(Xa){ra[cb]=la;ra[cb+1]=la+1;ra[cb+2]=la+2;cb+=3;R[Sa]=la;R[Sa+1]=la+1;R[Sa+2]=la;R[Sa+3]=la+2;R[Sa+4]=la+1;R[Sa+5]=la+2;Sa+=6;la+=3}}else if(U instanceof THREE.Face4){if(Ta){fa=hb[U.a].position;ga=hb[U.b].position;na=hb[U.c].position;Ra=hb[U.d].position;Ja[xa]=fa.x;Ja[xa+1]=fa.y;Ja[xa+2]=fa.z;Ja[xa+3]=ga.x;Ja[xa+4]=ga.y;Ja[xa+5]=ga.z;Ja[xa+6]=na.x;Ja[xa+7]=na.y;Ja[xa+8]=na.z;Ja[xa+9]=Ra.x;Ja[xa+10]=Ra.y;Ja[xa+11]=Ra.z;xa+=12}if(mb){Oa=
+0;for(bb=fb.length;Oa<bb;Oa++){fa=fb[Oa].vertices[U.a].position;ga=fb[Oa].vertices[U.b].position;na=fb[Oa].vertices[U.c].position;Ra=fb[Oa].vertices[U.d].position;Na=Aa[Oa];Na[pa+0]=fa.x;Na[pa+1]=fa.y;Na[pa+2]=fa.z;Na[pa+3]=ga.x;Na[pa+4]=ga.y;Na[pa+5]=ga.z;Na[pa+6]=na.x;Na[pa+7]=na.y;Na[pa+8]=na.z;Na[pa+9]=Ra.x;Na[pa+10]=Ra.y;Na[pa+11]=Ra.z}pa+=12}if(gb.length){fa=gb[U.a];ga=gb[U.b];na=gb[U.c];Ra=gb[U.d];ia[L]=fa.x;ia[L+1]=fa.y;ia[L+2]=fa.z;ia[L+3]=fa.w;ia[L+4]=ga.x;ia[L+5]=ga.y;ia[L+6]=ga.z;ia[L+
+7]=ga.w;ia[L+8]=na.x;ia[L+9]=na.y;ia[L+10]=na.z;ia[L+11]=na.w;ia[L+12]=Ra.x;ia[L+13]=Ra.y;ia[L+14]=Ra.z;ia[L+15]=Ra.w;fa=kb[U.a];ga=kb[U.b];na=kb[U.c];Ra=kb[U.d];T[L]=fa.x;T[L+1]=fa.y;T[L+2]=fa.z;T[L+3]=fa.w;T[L+4]=ga.x;T[L+5]=ga.y;T[L+6]=ga.z;T[L+7]=ga.w;T[L+8]=na.x;T[L+9]=na.y;T[L+10]=na.z;T[L+11]=na.w;T[L+12]=Ra.x;T[L+13]=Ra.y;T[L+14]=Ra.z;T[L+15]=Ra.w;fa=ib[U.a];ga=ib[U.b];na=ib[U.c];Ra=ib[U.d];ca[L]=fa.x;ca[L+1]=fa.y;ca[L+2]=fa.z;ca[L+3]=1;ca[L+4]=ga.x;ca[L+5]=ga.y;ca[L+6]=ga.z;ca[L+7]=1;ca[L+
+8]=na.x;ca[L+9]=na.y;ca[L+10]=na.z;ca[L+11]=1;ca[L+12]=Ra.x;ca[L+13]=Ra.y;ca[L+14]=Ra.z;ca[L+15]=1;fa=jb[U.a];ga=jb[U.b];na=jb[U.c];U=jb[U.d];V[L]=fa.x;V[L+1]=fa.y;V[L+2]=fa.z;V[L+3]=1;V[L+4]=ga.x;V[L+5]=ga.y;V[L+6]=ga.z;V[L+7]=1;V[L+8]=na.x;V[L+9]=na.y;V[L+10]=na.z;V[L+11]=1;V[L+12]=U.x;V[L+13]=U.y;V[L+14]=U.z;V[L+15]=1;L+=16}if(lb&&ya){if(Ca.length==4&&ya==THREE.VertexColors){U=Ca[0];fa=Ca[1];ga=Ca[2];Ca=Ca[3]}else Ca=ga=fa=U=Va;K[Pa]=U.r;K[Pa+1]=U.g;K[Pa+2]=U.b;K[Pa+3]=fa.r;K[Pa+4]=fa.g;K[Pa+5]=
+fa.b;K[Pa+6]=ga.r;K[Pa+7]=ga.g;K[Pa+8]=ga.b;K[Pa+9]=Ca.r;K[Pa+10]=Ca.g;K[Pa+11]=Ca.b;Pa+=12}if(ab&&Ka.hasTangents){Ca=ta[0];Va=ta[1];U=ta[2];ta=ta[3];wa[Ga]=Ca.x;wa[Ga+1]=Ca.y;wa[Ga+2]=Ca.z;wa[Ga+3]=Ca.w;wa[Ga+4]=Va.x;wa[Ga+5]=Va.y;wa[Ga+6]=Va.z;wa[Ga+7]=Va.w;wa[Ga+8]=U.x;wa[Ga+9]=U.y;wa[Ga+10]=U.z;wa[Ga+11]=U.w;wa[Ga+12]=ta.x;wa[Ga+13]=ta.y;wa[Ga+14]=ta.z;wa[Ga+15]=ta.w;Ga+=16}if(Za&&J)if(Ia.length==4&&Qa)for(ta=0;ta<4;ta++){Ba=Ia[ta];Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}else for(ta=0;ta<
+4;ta++){Wa[Ua]=Ba.x;Wa[Ua+1]=Ba.y;Wa[Ua+2]=Ba.z;Ua+=3}if(Ya&&sa!==undefined&&N)for(ta=0;ta<4;ta++){Ia=sa[ta];db[Ha]=Ia.u;db[Ha+1]=Ia.v;Ha+=2}if(Ya&&Y!==undefined&&N)for(ta=0;ta<4;ta++){Ia=Y[ta];eb[Ma]=Ia.u;eb[Ma+1]=Ia.v;Ma+=2}if(Xa){ra[cb]=la;ra[cb+1]=la+1;ra[cb+2]=la+2;ra[cb+3]=la;ra[cb+4]=la+2;ra[cb+5]=la+3;cb+=6;R[Sa]=la;R[Sa+1]=la+1;R[Sa+2]=la;R[Sa+3]=la+3;R[Sa+4]=la+1;R[Sa+5]=la+2;R[Sa+6]=la+2;R[Sa+7]=la+3;Sa+=8;la+=4}}}if(Ta){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
+Ja,F)}if(mb){Oa=0;for(bb=fb.length;Oa<bb;Oa++){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[Oa]);f.bufferData(f.ARRAY_BUFFER,Aa[Oa],F)}}if(lb&&Pa>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,K,F)}if(Za){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Wa,F)}if(ab&&Ka.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,wa,F)}if(Ya&&Ha>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUVBuffer);
+f.bufferData(f.ARRAY_BUFFER,db,F)}if(Ya&&Ma>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,eb,F)}if(Xa){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,ra,F);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,R,F)}if(L>0){f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,ca,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,
+V,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,T,F);f.bindBuffer(f.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,ia,F)}}}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;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;ya=void 0;B=void 0;J=o.vertices;F=o.colors;sa=
+J.length;X=F.length;Y=o.__vertexArray;Ea=o.__colorArray;la=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<sa;N++){ya=J[N].position;B=N*3;Y[B]=ya.x;Y[B+1]=ya.y;Y[B+2]=ya.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Y,D)}if(la){for(N=0;N<X;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ea,D)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=
+o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;D=f.DYNAMIC_DRAW;N=void 0;N=void 0;ya=void 0;B=void 0;J=o.vertices;F=o.colors;sa=J.length;X=F.length;Y=o.__vertexArray;Ea=o.__colorArray;la=o.__dirtyColors;if(o.__dirtyVertices){for(N=0;N<sa;N++){ya=J[N].position;B=N*3;Y[B]=ya.x;Y[B+1]=ya.y;Y[B+2]=ya.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,Y,D)}if(la){for(N=0;N<X;N++){color=F[N];B=N*3;Ea[B]=color.r;Ea[B+1]=color.g;Ea[B+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,
+o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Ea,D)}}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.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.overdraw=!1;this.uvs=[[]];this.z=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.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.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,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 da.objects)if(!ea.objects[t]){G=da.objects[t];if(z=ea.geometries[G.geometry]){N=[];for(i=0;i<G.materials.length;i++)N[i]=ea.materials[G.materials[i]];I=G.position;r=G.rotation;
-s=G.scale;object=new THREE.Mesh(z,N);object.position.set(I[0],I[1],I[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;ea.scene.addObject(object);ea.objects[t]=object}}}function g(Ea){return function(ia){ea.geometries[Ea]=ia;h();na-=1;k()}}function k(){d({total_models:Y,total_textures:Da,loaded_models:Y-na,loaded_textures:Da-aa},ea);na==0&&aa==0&&b(ea)}var j,m,t,x,y,q,A,G,I,E,H,z,S,Q,N,da,f,ja,na,aa,Y,Da,ea;da=e.data;f=new THREE.BinaryLoader;ja=new THREE.JSONLoader;
-aa=na=0;ea={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){aa-=1;k()};for(y in da.cameras){E=da.cameras[y];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){S=new THREE.Camera;S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}I=E.position;E=E.target;S.position.set(I[0],I[1],I[2]);S.target.position.set(E[0],E[1],E[2]);ea.cameras[y]=S}for(x in da.lights){y=
-da.lights[x];if(y.type=="directional"){I=y.direction;light=new THREE.DirectionalLight;light.position.set(I[0],I[1],I[2]);light.position.normalize()}else if(y.type=="point"){I=y.position;light=new THREE.PointLight;light.position.set(I[0],I[1],I[2])}E=y.color;i=y.intensity||1;light.color.setRGB(E[0]*i,E[1]*i,E[2]*i);ea.scene.addLight(light);ea.lights[x]=light}for(q in da.fogs){x=da.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));E=
-x.color;Q.color.setRGB(E[0],E[1],E[2]);ea.fogs[q]=Q}if(ea.cameras&&da.defaults.camera)ea.currentCamera=ea.cameras[da.defaults.camera];if(ea.fogs&&da.defaults.fog)ea.scene.fog=ea.fogs[da.defaults.fog];E=da.defaults.bgcolor;ea.bgColor=new THREE.Color;ea.bgColor.setRGB(E[0],E[1],E[2]);ea.bgColorAlpha=da.defaults.bgalpha;for(j in da.geometries){q=da.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")na+=1}Y=na;for(j in da.geometries){q=da.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);ea.geometries[j]=z}else if(q.type=="plane"){z=new Plane(q.width,q.height,q.segmentsWidth,q.segmentsHeight);ea.geometries[j]=z}else if(q.type=="sphere"){z=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);ea.geometries[j]=z}else if(q.type=="cylinder"){z=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);ea.geometries[j]=z}else if(q.type=="torus"){z=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);
-ea.geometries[j]=z}else if(q.type=="icosahedron"){z=new Icosahedron(q.subdivisions);ea.geometries[j]=z}else if(q.type=="bin_mesh")f.load({model:q.url,callback:g(j)});else q.type=="ascii_mesh"&&ja.load({model:q.url,callback:g(j)})}for(A in da.textures){j=da.textures[A];aa+=j.url instanceof Array?j.url.length:1}Da=aa;for(A in da.textures){j=da.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]}ea.textures[A]=q}for(m in da.materials){A=da.materials[m];for(H in A.parameters)if(H=="envMap"||H=="map"||H=="lightMap")A.parameters[H]=ea.textures[A.parameters[H]];else if(H=="shading")A.parameters[H]=A.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")A.parameters[H]=THREE[A.parameters[H]]?
-THREE[A.parameters[H]]:THREE.NormalBlending;else H=="combine"&&(A.parameters[H]=A.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);ea.materials[m]=A}h();c(ea)}},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=
+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,k=a.faces,j=e.faces,m=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=j.length;t<x;t++){h=j[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();k.push(q)}t=0;for(x=e.length;t<x;t++){d=e[t];k=[];b=0;for(g=d.length;b<g;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=[],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 aa.objects)if(!da.objects[t]){G=aa.objects[t];if(z=da.geometries[G.geometry]){O=[];for(i=0;i<G.materials.length;i++)O[i]=da.materials[G.materials[i]];H=G.position;r=G.rotation;
+s=G.scale;object=new THREE.Mesh(z,O);object.position.set(H[0],H[1],H[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;da.scene.addObject(object);da.objects[t]=object}}}function h(Fa){return function(ja){da.geometries[Fa]=ja;g();oa-=1;k()}}function k(){d({total_models:W,total_textures:Da,loaded_models:W-oa,loaded_textures:Da-$},da);oa==0&&$==0&&b(da)}var j,m,t,x,y,q,A,G,H,E,I,z,S,P,O,aa,f,ha,oa,$,W,Da,da;aa=e.data;f=new THREE.BinaryLoader;ha=new THREE.JSONLoader;
+$=oa=0;da={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){$-=1;k()};for(y in aa.cameras){E=aa.cameras[y];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){S=new THREE.Camera;S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}H=E.position;E=E.target;S.position.set(H[0],H[1],H[2]);S.target.position.set(E[0],E[1],E[2]);da.cameras[y]=S}for(x in aa.lights){y=
+aa.lights[x];if(y.type=="directional"){H=y.direction;light=new THREE.DirectionalLight;light.position.set(H[0],H[1],H[2]);light.position.normalize()}else if(y.type=="point"){H=y.position;light=new THREE.PointLight;light.position.set(H[0],H[1],H[2])}E=y.color;i=y.intensity||1;light.color.setRGB(E[0]*i,E[1]*i,E[2]*i);da.scene.addLight(light);da.lights[x]=light}for(q in aa.fogs){x=aa.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]);da.fogs[q]=P}if(da.cameras&&aa.defaults.camera)da.currentCamera=da.cameras[aa.defaults.camera];if(da.fogs&&aa.defaults.fog)da.scene.fog=da.fogs[aa.defaults.fog];E=aa.defaults.bgcolor;da.bgColor=new THREE.Color;da.bgColor.setRGB(E[0],E[1],E[2]);da.bgColorAlpha=aa.defaults.bgalpha;for(j in aa.geometries){q=aa.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")oa+=1}W=oa;for(j in aa.geometries){q=aa.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);da.geometries[j]=z}else if(q.type=="plane"){z=new Plane(q.width,q.height,q.segmentsWidth,q.segmentsHeight);da.geometries[j]=z}else if(q.type=="sphere"){z=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);da.geometries[j]=z}else if(q.type=="cylinder"){z=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);da.geometries[j]=z}else if(q.type=="torus"){z=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);
+da.geometries[j]=z}else if(q.type=="icosahedron"){z=new Icosahedron(q.subdivisions);da.geometries[j]=z}else if(q.type=="bin_mesh")f.load({model:q.url,callback:h(j)});else q.type=="ascii_mesh"&&ha.load({model:q.url,callback:h(j)})}for(A in aa.textures){j=aa.textures[A];$+=j.url instanceof Array?j.url.length:1}Da=$;for(A in aa.textures){j=aa.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]}da.textures[A]=q}for(m in aa.materials){A=aa.materials[m];for(I in A.parameters)if(I=="envMap"||I=="map"||I=="lightMap")A.parameters[I]=da.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?
+THREE[A.parameters[I]]:THREE.NormalBlending;else I=="combine"&&(A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);da.materials[m]=A}g();c(da)}},addMesh:function(a,c,b,d,e,g,h,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=g;c.rotation.x=h;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])}));
 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,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",
+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},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}",
 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}"},
 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},
 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},
@@ -322,7 +324,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}"},
 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}"},
 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}",
 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,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}};
+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}};
 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=
 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=
 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=
 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=
@@ -331,77 +333,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()},
 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;
 !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.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(m,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,G=t.getControlPointsArray(),I=t.getLength(),E=G.length,H=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++){H=y*I.chunks[A]/I.total;t.keys[A]={time:H,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,
+THREE.PathCamera=function(a){function c(m,t,x,y){var q={name:x,fps:0.6,length:y,hierarchy:[]},A,G=t.getControlPointsArray(),H=t.getLength(),E=G.length,I=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++){I=y*H.chunks[A]/H.total;t.keys[A]={time:I,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,
 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=
 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;
 !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=
 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,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.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(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)*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,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.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=
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=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,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(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;
 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(I,E,H,z,S,Q,N,da){var f,ja,na=d||1,aa=e||1,Y=S/2,Da=Q/2,ea=t.vertices.length;if(I=="x"&&E=="y"||I=="y"&&E=="x")f="z";else if(I=="x"&&E=="z"||I=="z"&&E=="x"){f="y";aa=h||1}else if(I=="z"&&E=="y"||I=="y"&&E=="z"){f="x";na=h||1}var Ea=na+1,ia=aa+1;S/=na;var ra=Q/aa;for(ja=0;ja<ia;ja++)for(Q=0;Q<Ea;Q++){var oa=new THREE.Vector3;oa[I]=(Q*S-Y)*H;oa[E]=(ja*ra-Da)*z;oa[f]=N;t.vertices.push(new THREE.Vertex(oa))}for(ja=0;ja<aa;ja++)for(Q=0;Q<na;Q++){t.faces.push(new THREE.Face4(Q+
-Ea*ja+ea,Q+Ea*(ja+1)+ea,Q+1+Ea*(ja+1)+ea,Q+1+Ea*ja+ea,null,null,da));t.faceVertexUvs[0].push([new THREE.UV(Q/na,ja/aa),new THREE.UV(Q/na,(ja+1)/aa),new THREE.UV((Q+1)/na,(ja+1)/aa),new THREE.UV((Q+1)/na,ja/aa)])}}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 I=[],E=[],H=0,z=t.vertices.length;H<z;H++){for(var S=t.vertices[H],Q=!1,N=0,da=I.length;N<da;N++){var f=
-I[N];if(S.position.x==f.position.x&&S.position.y==f.position.y&&S.position.z==f.position.z){E[H]=N;Q=!0;break}}if(!Q){E[H]=I.length;I.push(new THREE.Vertex(S.position.clone()))}}H=0;for(z=t.faces.length;H<z;H++){S=t.faces[H];S.a=E[S.a];S.b=E[S.b];S.c=E[S.c];S.d=E[S.d]}t.vertices=I})();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));
+var Cube=function(a,c,b,d,e,g,h,k,j){function m(H,E,I,z,S,P,O,aa){var f,ha,oa=d||1,$=e||1,W=S/2,Da=P/2,da=t.vertices.length;if(H=="x"&&E=="y"||H=="y"&&E=="x")f="z";else if(H=="x"&&E=="z"||H=="z"&&E=="x"){f="y";$=g||1}else if(H=="z"&&E=="y"||H=="y"&&E=="z"){f="x";oa=g||1}var Fa=oa+1,ja=$+1;S/=oa;var qa=P/$;for(ha=0;ha<ja;ha++)for(P=0;P<Fa;P++){var ma=new THREE.Vector3;ma[H]=(P*S-W)*I;ma[E]=(ha*qa-Da)*z;ma[f]=O;t.vertices.push(new THREE.Vertex(ma))}for(ha=0;ha<$;ha++)for(P=0;P<oa;P++){t.faces.push(new THREE.Face4(P+
+Fa*ha+da,P+Fa*(ha+1)+da,P+1+Fa*(ha+1)+da,P+1+Fa*ha+da,null,null,aa));t.faceVertexUvs[0].push([new THREE.UV(P/oa,ha/$),new THREE.UV(P/oa,(ha+1)/$),new THREE.UV((P+1)/oa,(ha+1)/$),new THREE.UV((P+1)/oa,ha/$)])}}THREE.Geometry.call(this);var t=this,x=a/2,y=c/2,q=b/2;k=k?-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(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 H=[],E=[],I=0,z=t.vertices.length;I<z;I++){for(var S=t.vertices[I],P=!1,O=0,aa=H.length;O<aa;O++){var f=
+H[O];if(S.position.x==f.position.x&&S.position.y==f.position.y&&S.position.z==f.position.z){E[I]=O;P=!0;break}}if(!P){E[I]=H.length;H.push(new THREE.Vertex(S.position.clone()))}}I=0;for(z=t.faces.length;I<z;I++){S=t.faces[I];S.a=E[S.a];S.b=E[S.b];S.c=E[S.c];S.d=E[S.d]}t.vertices=H})();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){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++)h(Math.sin(2*j*d/a)*c,Math.cos(2*j*d/a)*c,-m);for(d=0;d<a;d++)h(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){h(0,0,-m-(g||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){h(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;
 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()};
+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 k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),t=d(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,j,t,h);b(g.faces[k].b,m,j,h);b(g.faces[k].c,
+t,m,h);b(j,m,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=[],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]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=e);for(k=
+0;k<e.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[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=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 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-g,-(e*m-h),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;
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-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 I=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,I])}}}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,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var k=a*Math.cos(d*e),j=a*Math.sin(d*e),m=[],t=0;for(d=0;d<g;d++){var x=2*d/g,y=j*Math.sin(x*e);x=j*Math.cos(x*e);(b==0||b==h)&&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++){g=c[b].length;if(b>0)for(d=0;d<g;d++){m=d==g-1;h=c[b][m?0:d+1];k=c[b][m?g-1:d];j=c[b-1][m?g-1:d];m=c[b-1][m?
+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 H=new THREE.UV(1-A,q);if(b<c.length-1){q=this.vertices[h].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(h,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[h].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(h,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,H])}}}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=
 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 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,I){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,I*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,
+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 k(x,y,q,A,G,H){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,H*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=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 j=
+a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=k(j,h,this.q,this.p,this.radius,this.heightScale);j=k(j+0.01,h,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;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();j=this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=j*d.x+h*g.x;e.y+=j*d.y+h*g.y;e.z+=j*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);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([h,j,m]);this.faces.push(new THREE.Face3(g,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};
 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=
 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(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));
 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;
+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,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;
 THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 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 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,I=a.faces;q=a.vertices;var E=a.normals,H=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=I.length;j<m;){t=I[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=I[j++];x.b=I[j++];x.c=I[j++];x.d=I[j++];nVertices=4}else{x=new THREE.Face3;x.a=
-I[j++];x.b=I[j++];x.c=I[j++];nVertices=3}if(g){materialIndex=I[j++];x.materials=h.materials[materialIndex]}if(y)for(g=0;g<z;g++){uvLayer=a.uvs[g];uvIndex=I[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=I[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=I[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=I[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(I[j++]);x.color=color}if(t)for(g=0;g<nVertices;g++){colorIndex=I[j++];color=new THREE.Color(H[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.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,k,j,m,t,x,y,q,A,G,H=a.faces;q=a.vertices;var E=a.normals,I=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]=[]}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++];g.vertices.push(A)}j=0;for(m=H.length;j<m;){t=H[j++];x=t&1;h=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=H[j++];x.b=H[j++];x.c=H[j++];x.d=H[j++];nVertices=4}else{x=new THREE.Face3;x.a=
+H[j++];x.b=H[j++];x.c=H[j++];nVertices=3}if(h){materialIndex=H[j++];x.materials=g.materials[materialIndex]}if(y)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvIndex=H[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(k)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvs=[];for(k=0;k<nVertices;k++){uvIndex=H[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[k]=new THREE.UV(u,v)}g.faceVertexUvs[h].push(uvs)}if(q){normalIndex=H[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];
+normal.y=E[normalIndex++];normal.z=E[normalIndex];x.normal=normal}if(A)for(h=0;h<nVertices;h++){normalIndex=H[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(H[j++]);x.color=color}if(t)for(h=0;h<nVertices;h++){colorIndex=H[j++];color=new THREE.Color(I[colorIndex]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<
+k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(j,m,0,0))}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(j,m,0,0))}}g.bones=a.bones;g.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var h,k,j,m;h=0;for(k=a.morphTargets.length;h<k;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=[];dstVertices=g.morphTargets[h].vertices;
+srcVertices=a.morphTargets[h].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.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),D=t(p,o+1),B=t(p,o+2),F=t(p,o+3),V=(F<<1&255|B>>7)-127;w|=(B&127)<<16|D<<8;if(w==0&&V==-127)return 0;return(1-2*(F>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,V)}function k(p,o){var w=t(p,o),D=t(p,o+1),B=t(p,o+2);return(t(p,o+3)<<24)+(B<<16)+(D<<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,D;o=k(a,p);w=k(a,p+N);D=k(a,p+da);p=j(a,p+f);THREE.BinaryLoader.prototype.f3(E,o,w,D,p)}function y(p){var o,w,D,B,F,V;o=k(a,p);w=k(a,p+N);D=k(a,p+da);B=j(a,p+f);F=k(a,p+ja);V=k(a,p+na);p=k(a,p+aa);THREE.BinaryLoader.prototype.f3n(E,S,o,w,D,B,F,V,p)}function q(p){var o,w,D,B;o=k(a,p);w=k(a,p+Y);D=k(a,p+Da);B=k(a,p+ea);p=j(a,p+Ea);THREE.BinaryLoader.prototype.f4(E,o,w,D,B,p)}function A(p){var o,w,D,B,F,V,M,J;o=k(a,p);w=k(a,p+Y);D=k(a,p+Da);B=k(a,p+
-ea);F=j(a,p+Ea);V=k(a,p+ia);M=k(a,p+ra);J=k(a,p+oa);p=k(a,p+$);THREE.BinaryLoader.prototype.f4n(E,S,o,w,D,B,F,V,M,J,p)}function G(p){var o,w;o=k(a,p);w=k(a,p+R);p=k(a,p+O);THREE.BinaryLoader.prototype.uv3(E.faceVertexUvs[0],Q[o*2],Q[o*2+1],Q[w*2],Q[w*2+1],Q[p*2],Q[p*2+1])}function I(p){var o,w,D;o=k(a,p);w=k(a,p+ha);D=k(a,p+va);p=k(a,p+ka);THREE.BinaryLoader.prototype.uv4(E.faceVertexUvs[0],Q[o*2],Q[o*2+1],Q[w*2],Q[w*2+1],Q[D*2],Q[D*2+1],Q[p*2],Q[p*2+1])}var E=this,H=0,z,S=[],Q=[],N,da,f,ja,na,aa,
-Y,Da,ea,Ea,ia,ra,oa,$,R,O,ha,va,ka,ta,xa,Ma,ab,n,C;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,d,h);z={signature:a.substr(H,8),header_bytes:t(a,H+8),vertex_coordinate_bytes:t(a,H+9),normal_coordinate_bytes:t(a,H+10),uv_coordinate_bytes:t(a,H+11),vertex_index_bytes:t(a,H+12),normal_index_bytes:t(a,H+13),uv_index_bytes:t(a,H+14),material_index_bytes:t(a,H+15),nvertices:k(a,H+16),nnormals:k(a,H+16+4),nuvs:k(a,H+16+8),ntri_flat:k(a,H+16+12),ntri_smooth:k(a,H+16+16),ntri_flat_uv:k(a,
-H+16+20),ntri_smooth_uv:k(a,H+16+24),nquad_flat:k(a,H+16+28),nquad_smooth:k(a,H+16+32),nquad_flat_uv:k(a,H+16+36),nquad_smooth_uv:k(a,H+16+40)};H+=z.header_bytes;N=z.vertex_index_bytes;da=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;ja=z.vertex_index_bytes*3+z.material_index_bytes;na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;aa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;Y=z.vertex_index_bytes;Da=z.vertex_index_bytes*2;ea=z.vertex_index_bytes*3;
-Ea=z.vertex_index_bytes*4;ia=z.vertex_index_bytes*4+z.material_index_bytes;ra=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;oa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;$=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;R=z.uv_index_bytes;O=z.uv_index_bytes*2;ha=z.uv_index_bytes;va=z.uv_index_bytes*2;ka=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;ta=z.ntri_flat*
-h;xa=z.ntri_smooth*(h+z.normal_index_bytes*3);Ma=z.ntri_flat_uv*(h+z.uv_index_bytes*3);ab=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);H+=function(p){for(var o,w,D,B=z.vertex_coordinate_bytes*3,F=p+z.nvertices*B;p<F;p+=B){o=g(a,p);w=g(a,p+z.vertex_coordinate_bytes);D=g(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(E,o,w,D)}return z.nvertices*B}(H);H+=function(p){for(var o,
-w,D,B=z.normal_coordinate_bytes*3,F=p+z.nnormals*B;p<F;p+=B){o=m(a,p);w=m(a,p+z.normal_coordinate_bytes);D=m(a,p+z.normal_coordinate_bytes*2);S.push(o/127,w/127,D/127)}return z.nnormals*B}(H);H+=function(p){for(var o,w,D=z.uv_coordinate_bytes*2,B=p+z.nuvs*D;p<B;p+=D){o=g(a,p);w=g(a,p+z.uv_coordinate_bytes);Q.push(o,w)}return z.nuvs*D}(H);ta=H+ta;xa=ta+xa;Ma=xa+Ma;ab=Ma+ab;n=ab+n;h=n+h;C=h+C;(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=w+z.uv_index_bytes*3,B=p+z.ntri_flat_uv*
-D;for(o=p;o<B;o+=D){x(o);G(o+w)}return B-p})(xa);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=w+z.uv_index_bytes*3,B=p+z.ntri_smooth_uv*D;for(o=p;o<B;o+=D){y(o);G(o+w)}return B-p})(Ma);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=w+z.uv_index_bytes*4,B=p+z.nquad_flat_uv*D;for(o=p;o<B;o+=D){q(o);I(o+w)}return B-p})(h);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,D=w+z.uv_index_bytes*
-4,B=p+z.nquad_smooth_uv*D;for(o=p;o<B;o+=D){A(o);I(o+w)}return B-p})(C);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=p+z.ntri_flat*w;for(o=p;o<D;o+=w)x(o);return D-p})(H);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=p+z.ntri_smooth*w;for(o=p;o<D;o+=w)y(o);return D-p})(ta);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=p+z.nquad_flat*w;for(o=p;o<D;o+=w)q(o);return D-p})(ab);(function(p){var o,w=z.vertex_index_bytes*
-4+z.material_index_bytes+z.normal_index_bytes*4,D=p+z.nquad_smooth*w;for(o=p;o<D;o+=w)A(o);return D-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],I=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,I,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.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,k=d+"/"+a,j=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 ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!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,o){var w=t(p,o),D=t(p,o+1),B=t(p,o+2),F=t(p,o+3),X=(F<<1&255|B>>7)-127;w|=(B&127)<<16|D<<8;if(w==0&&X==-127)return 0;return(1-2*(F>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,X)}function k(p,o){var w=t(p,o),D=t(p,o+1),B=t(p,o+2);return(t(p,o+3)<<24)+(B<<16)+(D<<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,D;o=k(a,p);w=k(a,p+O);D=k(a,p+aa);p=j(a,p+f);THREE.BinaryLoader.prototype.f3(E,o,w,D,p)}function y(p){var o,w,D,B,F,X;o=k(a,p);w=k(a,p+O);D=k(a,p+aa);B=j(a,p+f);F=k(a,p+ha);X=k(a,p+oa);p=k(a,p+$);THREE.BinaryLoader.prototype.f3n(E,S,o,w,D,B,F,X,p)}function q(p){var o,w,D,B;o=k(a,p);w=k(a,p+W);D=k(a,p+Da);B=k(a,p+da);p=j(a,p+Fa);THREE.BinaryLoader.prototype.f4(E,o,w,D,B,p)}function A(p){var o,w,D,B,F,X,N,J;o=k(a,p);w=k(a,p+W);D=k(a,p+Da);B=k(a,p+
+da);F=j(a,p+Fa);X=k(a,p+ja);N=k(a,p+qa);J=k(a,p+ma);p=k(a,p+Z);THREE.BinaryLoader.prototype.f4n(E,S,o,w,D,B,F,X,N,J,p)}function G(p){var o,w;o=k(a,p);w=k(a,p+Q);p=k(a,p+M);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 H(p){var o,w,D;o=k(a,p);w=k(a,p+ea);D=k(a,p+ua);p=k(a,p+ka);THREE.BinaryLoader.prototype.uv4(E.faceVertexUvs[0],P[o*2],P[o*2+1],P[w*2],P[w*2+1],P[D*2],P[D*2+1],P[p*2],P[p*2+1])}var E=this,I=0,z,S=[],P=[],O,aa,f,ha,oa,$,
+W,Da,da,Fa,ja,qa,ma,Z,Q,M,ea,ua,ka,va,za,La,$a,n,C;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,d,g);z={signature:a.substr(I,8),header_bytes:t(a,I+8),vertex_coordinate_bytes:t(a,I+9),normal_coordinate_bytes:t(a,I+10),uv_coordinate_bytes:t(a,I+11),vertex_index_bytes:t(a,I+12),normal_index_bytes:t(a,I+13),uv_index_bytes:t(a,I+14),material_index_bytes:t(a,I+15),nvertices:k(a,I+16),nnormals:k(a,I+16+4),nuvs:k(a,I+16+8),ntri_flat:k(a,I+16+12),ntri_smooth:k(a,I+16+16),ntri_flat_uv:k(a,
+I+16+20),ntri_smooth_uv:k(a,I+16+24),nquad_flat:k(a,I+16+28),nquad_smooth:k(a,I+16+32),nquad_flat_uv:k(a,I+16+36),nquad_smooth_uv:k(a,I+16+40)};I+=z.header_bytes;O=z.vertex_index_bytes;aa=z.vertex_index_bytes*2;f=z.vertex_index_bytes*3;ha=z.vertex_index_bytes*3+z.material_index_bytes;oa=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;$=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;W=z.vertex_index_bytes;Da=z.vertex_index_bytes*2;da=z.vertex_index_bytes*3;
+Fa=z.vertex_index_bytes*4;ja=z.vertex_index_bytes*4+z.material_index_bytes;qa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;Z=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;Q=z.uv_index_bytes;M=z.uv_index_bytes*2;ea=z.uv_index_bytes;ua=z.uv_index_bytes*2;ka=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;C=z.vertex_index_bytes*4+z.material_index_bytes;va=z.ntri_flat*
+g;za=z.ntri_smooth*(g+z.normal_index_bytes*3);La=z.ntri_flat_uv*(g+z.uv_index_bytes*3);$a=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);n=z.nquad_flat*C;g=z.nquad_smooth*(C+z.normal_index_bytes*4);C=z.nquad_flat_uv*(C+z.uv_index_bytes*4);I+=function(p){for(var o,w,D,B=z.vertex_coordinate_bytes*3,F=p+z.nvertices*B;p<F;p+=B){o=h(a,p);w=h(a,p+z.vertex_coordinate_bytes);D=h(a,p+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(E,o,w,D)}return z.nvertices*B}(I);I+=function(p){for(var o,
+w,D,B=z.normal_coordinate_bytes*3,F=p+z.nnormals*B;p<F;p+=B){o=m(a,p);w=m(a,p+z.normal_coordinate_bytes);D=m(a,p+z.normal_coordinate_bytes*2);S.push(o/127,w/127,D/127)}return z.nnormals*B}(I);I+=function(p){for(var o,w,D=z.uv_coordinate_bytes*2,B=p+z.nuvs*D;p<B;p+=D){o=h(a,p);w=h(a,p+z.uv_coordinate_bytes);P.push(o,w)}return z.nuvs*D}(I);va=I+va;za=va+za;La=za+La;$a=La+$a;n=$a+n;g=n+g;C=g+C;(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=w+z.uv_index_bytes*3,B=p+z.ntri_flat_uv*
+D;for(o=p;o<B;o+=D){x(o);G(o+w)}return B-p})(za);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=w+z.uv_index_bytes*3,B=p+z.ntri_smooth_uv*D;for(o=p;o<B;o+=D){y(o);G(o+w)}return B-p})(La);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=w+z.uv_index_bytes*4,B=p+z.nquad_flat_uv*D;for(o=p;o<B;o+=D){q(o);H(o+w)}return B-p})(g);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,D=w+z.uv_index_bytes*
+4,B=p+z.nquad_smooth_uv*D;for(o=p;o<B;o+=D){A(o);H(o+w)}return B-p})(C);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes,D=p+z.ntri_flat*w;for(o=p;o<D;o+=w)x(o);return D-p})(I);(function(p){var o,w=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,D=p+z.ntri_smooth*w;for(o=p;o<D;o+=w)y(o);return D-p})(va);(function(p){var o,w=z.vertex_index_bytes*4+z.material_index_bytes,D=p+z.nquad_flat*w;for(o=p;o<D;o+=w)q(o);return D-p})($a);(function(p){var o,w=z.vertex_index_bytes*
+4+z.material_index_bytes+z.normal_index_bytes*4,D=p+z.nquad_smooth*w;for(o=p;o<D;o+=w)A(o);return D-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,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,k,j){g=a.materials[g];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[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,t,k),new THREE.Vector3(x,y,j)],null,g))},f4n:function(a,c,b,d,e,g,h,k,j,m,t){h=a.materials[h];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],H=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[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,H,t)],null,h))},uv3:function(a,c,b,d,e,g,h){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(d,e));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,c,b,d,e,g,h,k,j){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(g,h));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=
 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,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,I=this.field[h],E=this.field[j],H=this.field[m],z=this.field[x],S=this.field[t],Q=this.field[y],N=this.field[q],da=this.field[A];I<g&&(G|=1);E<g&&(G|=2);H<g&&(G|=8);z<g&&(G|=4);S<g&&(G|=16);Q<g&&(G|=32);N<g&&(G|=128);da<g&&(G|=64);var f=THREE.edgeTable[G];if(f==0)return 0;
-var ja=this.delta,na=b+ja,aa=d+ja;ja=e+ja;if(f&1){this.compNorm(h);this.compNorm(j);this.VIntX(h*3,this.vlist,this.nlist,0,g,b,d,e,I,E)}if(f&2){this.compNorm(j);this.compNorm(x);this.VIntY(j*3,this.vlist,this.nlist,3,g,na,d,e,E,z)}if(f&4){this.compNorm(m);this.compNorm(x);this.VIntX(m*3,this.vlist,this.nlist,6,g,b,aa,e,H,z)}if(f&8){this.compNorm(h);this.compNorm(m);this.VIntY(h*3,this.vlist,this.nlist,9,g,b,d,e,I,H)}if(f&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,12,
-g,b,d,ja,S,Q)}if(f&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,g,na,d,ja,Q,da)}if(f&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,g,b,aa,ja,N,da)}if(f&128){this.compNorm(t);this.compNorm(q);this.VIntY(t*3,this.vlist,this.nlist,21,g,b,d,ja,S,N)}if(f&256){this.compNorm(h);this.compNorm(t);this.VIntZ(h*3,this.vlist,this.nlist,24,g,b,d,e,I,S)}if(f&512){this.compNorm(j);this.compNorm(y);this.VIntZ(j*3,this.vlist,this.nlist,27,g,na,d,e,E,
-Q)}if(f&1024){this.compNorm(x);this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,g,na,aa,e,z,da)}if(f&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,g,b,aa,e,H,N)}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,I,E,H,z;x<j;x++){t=this.size2*x;G=x/this.size-e;H=G*G;for(G=y;G<m;G++){I=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+H)-g;E>0&&(this.field[I+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)};
+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,k,j,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;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,k,j,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
+2]=m;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,k,j,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+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,k){var j=g+1,m=g+this.yd,t=g+this.zd,x=j+this.yd,y=j+this.zd,q=g+this.yd+this.zd,A=j+this.yd+this.zd,G=0,H=this.field[g],E=this.field[j],I=this.field[m],z=this.field[x],S=this.field[t],P=this.field[y],O=this.field[q],aa=this.field[A];H<h&&(G|=1);E<h&&(G|=2);I<h&&(G|=8);z<h&&(G|=4);S<h&&(G|=16);P<h&&(G|=32);O<h&&(G|=128);aa<h&&(G|=64);var f=THREE.edgeTable[G];if(f==0)return 0;
+var ha=this.delta,oa=b+ha,$=d+ha;ha=e+ha;if(f&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,H,E)}if(f&2){this.compNorm(j);this.compNorm(x);this.VIntY(j*3,this.vlist,this.nlist,3,h,oa,d,e,E,z)}if(f&4){this.compNorm(m);this.compNorm(x);this.VIntX(m*3,this.vlist,this.nlist,6,h,b,$,e,I,z)}if(f&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,H,I)}if(f&16){this.compNorm(t);this.compNorm(y);this.VIntX(t*3,this.vlist,this.nlist,12,
+h,b,d,ha,S,P)}if(f&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,h,oa,d,ha,P,aa)}if(f&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,h,b,$,ha,O,aa)}if(f&128){this.compNorm(t);this.compNorm(q);this.VIntY(t*3,this.vlist,this.nlist,21,h,b,d,ha,S,O)}if(f&256){this.compNorm(g);this.compNorm(t);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,H,S)}if(f&512){this.compNorm(j);this.compNorm(y);this.VIntZ(j*3,this.vlist,this.nlist,27,h,oa,d,e,E,
+P)}if(f&1024){this.compNorm(x);this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,h,oa,$,e,z,aa)}if(f&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,$,e,I,O)}G<<=4;for(h=g=0;THREE.triTable[G+h]!=-1;){b=G+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],k);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,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[g];this.positionArray[j+4]=b[g+1];this.positionArray[j+5]=b[g+2];this.positionArray[j+6]=b[h];this.positionArray[j+7]=b[h+1];this.positionArray[j+8]=b[h+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[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+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,g,h){var k=this.size*Math.sqrt(g/h),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,H,E,I,z;x<j;x++){t=this.size2*x;G=x/this.size-e;I=G*G;for(G=y;G<m;G++){H=t+this.size*G;A=G/this.size-d;z=A*A;for(A=q;A<k;A++){E=A/this.size-b;E=g/(1.0E-6+E*E+z+I)-h;E>0&&(this.field[H+A]+=E)}}}};this.addPlaneX=function(b,d){var e,g,h,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++){g=e/m;g*=g;k=b/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=e+g*t;for(h=0;h<m;h++)y[x*h+j]+=k}}};this.addPlaneY=
+function(b,d){var e,g,h,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(g=0;g<A;g++){e=g/t;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=g*x;for(e=0;e<t;e++){m=j+e;for(h=0;h<t;h++)q[y*h+m]+=k}}}};this.addPlaneZ=function(b,d){var e,g,h,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(h=0;h<dist;h++){e=h/size;e*=e;k=b/(1.0E-4+e)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*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,g,h,k,j,m,t,x,y=this.size-2;for(h=1;h<y;h++){x=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){t=x+this.size*g;j=(g-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 g,h,k,
+j,m,t,x,y;for(g=0;g<e.count;g++){m=g*3;x=m+1;y=m+2;h=e.positionArray[m];k=e.positionArray[x];j=e.positionArray[y];t=new THREE.Vector3(h,k,j);h=e.normalArray[m];k=e.normalArray[x];j=e.normalArray[y];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(t,m);d.vertices.push(m)}nfaces=e.count/3;for(g=0;g<nfaces;g++){m=(b+g)*3;x=m+1;y=m+2;t=d.vertices[m].normal;h=d.vertices[x].normal;k=d.vertices[y].normal;m=new THREE.Face3(m,x,y,[t,h,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.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,

+ 100 - 101
build/custom/ThreeCanvas.js

@@ -1,85 +1,84 @@
 // ThreeCanvas.js r36 - http://github.com/mrdoob/three.js
 // ThreeCanvas.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,e,f,g,j,h;if(c==0)d=e=f=0;else{g=Math.floor(a*6);j=a*6-g;a=c*(1-b);h=c*(1-b*j);b=c*(1-b*(1-j));switch(g){case 1:d=h;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=h;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=h;break;case 6:case 0:d=c;e=b;f=a}}this.r=d;this.g=e;this.b=f;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,d,f,g,j,h;if(c==0)e=d=f=0;else{g=Math.floor(a*6);j=a*6-g;a=c*(1-b);h=c*(1-b*j);b=c*(1-b*(1-j));switch(g){case 1:e=h;d=c;f=a;break;case 2:e=a;d=c;f=b;break;case 3:e=a;d=h;f=c;break;case 4:e=b;d=a;f=c;break;case 5:e=c;d=a;f=h;break;case 6:case 0:e=c;d=b;f=a}}this.r=e;this.g=d;this.b=f;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)}};
 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,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.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/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.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/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.set(c*a.z-d*a.y,d*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.set(c*a.z-e*a.y,e*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-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*
+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};
 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(D,p,y,E){E=E.clone().subSelf(p);y=y.clone().subSelf(p);var O=D.clone().subSelf(p);D=E.dot(E);p=E.dot(y);E=E.dot(O);var G=y.dot(y);y=y.dot(O);O=1/(D*G-p*p);G=(G*E-p*y)*O;D=(D*y-p*E)*O;return G>0&&D>0&&G+D<1}var c,d,e,f,g,j,h,i,n,l,
-q,m=a.geometry,t=m.vertices,v=[];c=0;for(d=m.faces.length;c<d;c++){e=m.faces[c];l=this.origin.clone();q=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(t[e.a].position.clone());g=h.multiplyVector3(t[e.b].position.clone());j=h.multiplyVector3(t[e.c].position.clone());h=e instanceof THREE.Face4?h.multiplyVector3(t[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,l))/n;l=l.addSelf(q.multiplyScalar(i));
-if(e instanceof THREE.Face3){if(b(l,f,g,j)){e={distance:this.origin.distanceTo(l),point:l,face:e,object:a};v.push(e)}}else if(e instanceof THREE.Face4&&(b(l,f,g,h)||b(l,g,j,h))){e={distance:this.origin.distanceTo(l),point:l,face:e,object:a};v.push(e)}}}return v}};
-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,l){j=!1;b=h;c=i;d=n;e=l;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,l,q,m){if(j){j=!1;b=h<n?h<q?h:q:n<q?n:q;c=i<l?i<m?i:m:l<m?l:m;d=h>n?h>q?h:q:n>q?n:q;e=i>l?i>m?i:m:l>m?l:m}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<l?i<m?i<c?i:c:m<c?m:c:l<m?l<c?l:c:m<c?m: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>l?i>m?i>e?i:e:m>e?m:e:l>m?l>e?l:e:m>e?m: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.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(D,q,A,E){E=E.clone().subSelf(q);A=A.clone().subSelf(q);var O=D.clone().subSelf(q);D=E.dot(E);q=E.dot(A);E=E.dot(O);var H=A.dot(A);A=A.dot(O);O=1/(D*H-q*q);H=(H*E-q*A)*O;D=(D*A-q*E)*O;return H>0&&D>0&&H+D<1}var c,e,d,f,g,j,h,i,l,m,
+p,n=a.geometry,t=n.vertices,w=[];c=0;for(e=n.faces.length;c<e;c++){d=n.faces[c];m=this.origin.clone();p=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(t[d.a].position.clone());g=h.multiplyVector3(t[d.b].position.clone());j=h.multiplyVector3(t[d.c].position.clone());h=d instanceof THREE.Face4?h.multiplyVector3(t[d.d].position.clone()):null;i=a.matrixRotationWorld.multiplyVector3(d.normal.clone());l=p.dot(i);if(l<0){i=i.dot((new THREE.Vector3).sub(f,m))/l;m=m.addSelf(p.multiplyScalar(i));
+if(d instanceof THREE.Face3){if(b(m,f,g,j)){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};w.push(d)}}else if(d instanceof THREE.Face4&&(b(m,f,g,h)||b(m,g,j,h))){d={distance:this.origin.distanceTo(m),point:m,face:d,object:a};w.push(d)}}}return w}};
+THREE.Rectangle=function(){function a(){f=e-b;g=d-c}var b,c,e,d,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 e};this.getBottom=function(){return d};this.set=function(h,i,l,m){j=!1;b=h;c=i;e=l;d=m;a()};this.addPoint=function(h,i){if(j){j=!1;b=h;c=i;e=h;d=i}else{b=b<h?b:h;c=c<i?c:i;e=e>h?e:h;d=d>i?d:i}a()};
+this.add3Points=function(h,i,l,m,p,n){if(j){j=!1;b=h<l?h<p?h:p:l<p?l:p;c=i<m?i<n?i:n:m<n?m:n;e=h>l?h>p?h:p:l>p?l:p;d=i>m?i>n?i:n:m>n?m:n}else{b=h<l?h<p?h<b?h:b:p<b?p:b:l<p?l<b?l:b:p<b?p:b;c=i<m?i<n?i<c?i:c:n<c?n:c:m<n?m<c?m:c:n<c?n:c;e=h>l?h>p?h>e?h:e:p>e?p:e:l>p?l>e?l:e:p>e?p:e;d=i>m?i>n?i>d?i:d:n>d?n:d:m>n?m>d?m:d:n>d?n:d}a()};this.addRectangle=function(h){if(j){j=!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(){j=!0;d=e=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.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,l,q,m,t,v){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,n||1,l||0,q||0,m||0,t||0,v||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,l,q,m,t,v){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=l;this.n41=q;this.n42=m;this.n43=t;this.n44=v;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,l=a.n32,q=a.n33,m=a.n34,t=a.n41,v=a.n42,D=a.n43,p=a.n44,y=b.n11,E=b.n12,O=b.n13,G=b.n14,r=b.n21,S=b.n22,
-M=b.n23,R=b.n24,Q=b.n31,B=b.n32,x=b.n33,X=b.n34;this.n11=c*y+d*r+e*Q;this.n12=c*E+d*S+e*B;this.n13=c*O+d*M+e*x;this.n14=c*G+d*R+e*X+f;this.n21=g*y+j*r+h*Q;this.n22=g*E+j*S+h*B;this.n23=g*O+j*M+h*x;this.n24=g*G+j*R+h*X+i;this.n31=n*y+l*r+q*Q;this.n32=n*E+l*S+q*B;this.n33=n*O+l*M+q*x;this.n34=n*G+l*R+q*X+m;this.n41=t*y+v*r+D*Q;this.n42=t*E+v*S+D*B;this.n43=t*O+v*M+D*x;this.n44=t*G+v*R+D*X+p;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]=
+THREE.Matrix4=function(a,b,c,e,d,f,g,j,h,i,l,m,p,n,t,w){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,j||0,h||0,i||0,l||1,m||0,p||0,n||0,t||0,w||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,e,d,f,g,j,h,i,l,m,p,n,t,w){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=d;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=l;this.n34=m;this.n41=p;this.n42=n;this.n43=t;this.n44=w;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,j=a.n22,h=a.n23,i=a.n24,l=a.n31,m=a.n32,p=a.n33,n=a.n34,t=a.n41,w=a.n42,D=a.n43,q=a.n44,A=b.n11,E=b.n12,O=b.n13,H=b.n14,r=b.n21,S=b.n22,
+N=b.n23,Q=b.n24,R=b.n31,z=b.n32,x=b.n33,U=b.n34;this.n11=c*A+e*r+d*R;this.n12=c*E+e*S+d*z;this.n13=c*O+e*N+d*x;this.n14=c*H+e*Q+d*U+f;this.n21=g*A+j*r+h*R;this.n22=g*E+j*S+h*z;this.n23=g*O+j*N+h*x;this.n24=g*H+j*Q+h*U+i;this.n31=l*A+m*r+p*R;this.n32=l*E+m*S+p*z;this.n33=l*O+m*N+p*x;this.n34=l*H+m*Q+p*U+n;this.n41=t*A+w*r+D*R;this.n42=t*E+w*S+D*z;this.n43=t*O+w*N+D*x;this.n44=t*H+w*Q+D*U+q;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.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,l=this.n34,q=this.n41,m=this.n42,t=this.n43,v=this.n44;return d*g*i*q-c*j*i*q-d*f*n*q+b*j*n*q+c*f*l*q-b*g*l*q-d*g*h*m+c*j*h*m+d*e*n*m-a*j*n*m-c*e*l*m+a*g*l*m+d*f*h*t-b*j*h*t-d*e*i*t+a*j*i*t+b*e*l*t-a*f*l*t-c*f*h*v+b*g*h*v+c*e*i*v-a*g*i*v-b*e*n*v+a*f*n*v},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,j=this.n24,h=this.n31,i=this.n32,l=this.n33,m=this.n34,p=this.n41,n=this.n42,t=this.n43,w=this.n44;return e*g*i*p-c*j*i*p-e*f*l*p+b*j*l*p+c*f*m*p-b*g*m*p-e*g*h*n+c*j*h*n+e*d*l*n-a*j*l*n-c*d*m*n+a*g*m*n+e*f*h*t-b*j*h*t-e*d*i*t+a*j*i*t+b*d*m*t-a*f*m*t-c*f*h*w+b*g*h*w+c*d*i*w-a*g*i*w-b*d*l*w+a*f*l*w},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.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.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,
 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,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,j=a.z,h=e*f,i=e*g;this.set(h*
-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,l=a.n32,q=a.n33,m=a.n34,t=a.n41,v=a.n42,D=a.n43,p=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*m*v-i*q*v+i*l*D-j*m*D-h*l*p+j*q*p;b.n12=f*q*v-e*m*v-f*l*D+d*m*D+e*l*p-d*q*p;b.n13=e*i*v-f*h*v+f*j*D-d*i*D-e*j*p+d*h*p;b.n14=f*h*l-e*i*l-f*j*q+d*i*q+e*j*m-d*h*m;b.n21=i*q*t-h*m*t-i*n*D+g*m*D+h*n*p-g*q*p;b.n22=e*m*t-f*q*t+f*n*D-c*m*D-e*n*p+c*q*p;b.n23=f*h*t-e*i*t-f*g*D+c*i*D+e*g*p-c*h*p;
-b.n24=e*i*n-f*h*n+f*g*q-c*i*q-e*g*m+c*h*m;b.n31=j*m*t-i*l*t+i*n*v-g*m*v-j*n*p+g*l*p;b.n32=f*l*t-d*m*t-f*n*v+c*m*v+d*n*p-c*l*p;b.n33=e*i*t-f*j*t+f*g*v-c*i*v-d*g*p+c*j*p;b.n34=f*j*n-d*i*n-f*g*l+c*i*l+d*g*m-c*j*m;b.n41=h*l*t-j*q*t-h*n*v+g*q*v+j*n*D-g*l*D;b.n42=d*q*t-e*l*t+e*n*v-c*q*v-d*n*D+c*l*D;b.n43=e*j*t-d*h*t-e*g*v+c*h*v+d*g*D-c*j*D;b.n44=d*h*n-e*j*n+e*g*l-c*h*l-d*g*q+c*j*q;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,l=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*l;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;
+b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),d=1-c,f=a.x,g=a.y,j=a.z,h=d*f,i=d*g;this.set(h*
+f+c,h*g-e*j,h*j+e*g,0,h*g+e*j,i*g+c,i*j-e*f,0,h*j-e*g,i*j+e*f,d*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,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,j=b*c;this.n11=d*f;this.n12=-d*e;this.n13=c;this.n21=j*f+a*e;this.n22=-j*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,j=e+e;a=b*f;var h=b*g;b*=j;var i=c*g;c*=j;e*=j;f*=d;g*=d;d*=j;this.n11=1-(i+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+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,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,j=a.n22,h=a.n23,i=a.n24,l=a.n31,m=a.n32,p=a.n33,n=a.n34,t=a.n41,w=a.n42,D=a.n43,q=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*n*w-i*p*w+i*m*D-j*n*D-h*m*q+j*p*q;b.n12=f*p*w-d*n*w-f*m*D+e*n*D+d*m*q-e*p*q;b.n13=d*i*w-f*h*w+f*j*D-e*i*D-d*j*q+e*h*q;b.n14=f*h*m-d*i*m-f*j*p+e*i*p+d*j*n-e*h*n;b.n21=i*p*t-h*n*t-i*l*D+g*n*D+h*l*q-g*p*q;b.n22=d*n*t-f*p*t+f*l*D-c*n*D-d*l*q+c*p*q;b.n23=f*h*t-d*i*t-f*g*D+c*i*D+d*g*q-c*h*q;
+b.n24=d*i*l-f*h*l+f*g*p-c*i*p-d*g*n+c*h*n;b.n31=j*n*t-i*m*t+i*l*w-g*n*w-j*l*q+g*m*q;b.n32=f*m*t-e*n*t-f*l*w+c*n*w+e*l*q-c*m*q;b.n33=d*i*t-f*j*t+f*g*w-c*i*w-e*g*q+c*j*q;b.n34=f*j*l-e*i*l-f*g*m+c*i*m+e*g*n-c*j*n;b.n41=h*m*t-j*p*t-h*l*w+g*p*w+j*l*D-g*m*D;b.n42=e*p*t-d*m*t+d*l*w-c*p*w-e*l*D+c*m*D;b.n43=d*j*t-e*h*t-d*g*w+c*h*w+e*g*D-c*j*D;b.n44=e*h*l-d*j*l+d*g*m-c*h*m-e*g*p+c*j*p;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,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,l=-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*i;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*j;c[5]=a*h;c[6]=a*i;c[7]=a*l;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,j,h,i;g=new THREE.Matrix4;j=b-a;h=c-e;i=f-d;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+e)/h);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+d)/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;
 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=
 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};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.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!==
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.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 b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,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!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,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,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
-b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,n=h*d+j*c-f*e,l=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+n*-j-l*-g;b.y=n*h+c*-g+l*-f-i*-j;b.z=l*h+c*-j+i*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;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=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
-THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+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,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
+b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
+THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=e*d;this.w=g*f-j*c;this.x=g*c+j*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+d*f+c*j-e*g;this.y=c*a+d*g+e*f-b*j;this.z=e*a+d*j+b*g-c*f;this.w=d*a-b*f-c*g-e*j;return this},
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*d-j*e,l=h*e+j*c-f*d,m=h*d+f*e-g*c;c=-f*c-g*e-j*d;b.x=i*h+c*-f+l*-j-m*-g;b.y=l*h+c*-g+m*-f-i*-j;b.z=m*h+c*-j+i*-g-l*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
+THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-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(X,Y,aa,T,N,U,w){f=X.vertices[Y].position;g=X.vertices[aa].position;j=X.vertices[T].position;h=e[N];i=e[U];n=e[w];l=g.x-f.x;q=j.x-f.x;m=g.y-f.y;t=j.y-f.y;v=g.z-f.z;D=j.z-f.z;p=i.u-h.u;y=n.u-h.u;E=i.v-h.v;O=n.v-h.v;G=1/(p*O-y*E);M.set((O*
-l-E*q)*G,(O*m-E*t)*G,(O*v-E*D)*G);R.set((p*q-y*l)*G,(p*t-y*m)*G,(p*D-y*v)*G);r[Y].addSelf(M);r[aa].addSelf(M);r[T].addSelf(M);S[Y].addSelf(R);S[aa].addSelf(R);S[T].addSelf(R)}var b,c,d,e,f,g,j,h,i,n,l,q,m,t,v,D,p,y,E,O,G,r=[],S=[],M=new THREE.Vector3,R=new THREE.Vector3,Q=new THREE.Vector3,B=new THREE.Vector3,x=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){r[b]=new THREE.Vector3;S[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++){x.copy(this.vertices[b].normal);d=r[b];Q.copy(d);Q.subSelf(x.multiplyScalar(x.dot(d))).normalize();B.cross(this.vertices[b].normal,d);d=B.dot(S[b]);d=d<0?-1:1;this.vertices[b].tangent.set(Q.x,Q.y,Q.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<
-0)e.hierarchy[f].keys[g].time=0;if(e.hierarchy[f].keys[g].rot!==undefined&&!(e.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var j=e.hierarchy[f].keys[g].rot;e.hierarchy[f].keys[g].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(e.hierarchy[f].keys[0].morphTargets!==undefined){j={};for(g=0;g<e.hierarchy[f].keys.length;g++)for(var h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++){var i=e.hierarchy[f].keys[g].morphTargets[h];j[i]=-1}e.hierarchy[f].usedMorphTargets=j;for(g=0;g<e.hierarchy[f].keys.length;g++){var n=
-{};for(i in j){for(h=0;h<e.hierarchy[f].keys[g].morphTargets.length;h++)if(e.hierarchy[f].keys[g].morphTargets[h]===i){n[i]=e.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===e.hierarchy[f].keys[g].morphTargets.length&&(n[i]=0)}e.hierarchy[f].keys[g].morphTargetsInfluences=n}}for(g=1;g<e.hierarchy[f].keys.length;g++)if(e.hierarchy[f].keys[g].time===e.hierarchy[f].keys[g-1].time){e.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<e.hierarchy[f].keys.length;g++)e.hierarchy[f].keys[g].index=g}g=parseInt(e.length*
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(f=0;f<e.hierarchy.length;f++)e.JIT.hierarchy.push(Array(g));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var f=[];if(e instanceof THREE.SkinnedMesh)for(var g=0;g<e.bones.length;g++)f.push(e.bones[g]);else d(e,f);return f};var d=function(e,f){f.push(e);for(var g=0;g<e.children.length;g++)d(e.children[g],f)};c.LINEAR=
-0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];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 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)};
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,d,f,g,j=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){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,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(M,T,u,I,y,G,K){j=M.vertices[T].position;h=M.vertices[u].position;i=M.vertices[I].position;l=g[y];m=g[G];p=g[K];n=h.x-j.x;t=i.x-j.x;w=h.y-j.y;D=i.y-j.y;q=h.z-j.z;A=i.z-j.z;E=m.u-l.u;O=p.u-l.u;H=m.v-l.v;r=p.v-l.v;S=1/(E*r-O*H);z.set((r*
+n-H*t)*S,(r*w-H*D)*S,(r*q-H*A)*S);x.set((E*t-O*n)*S,(E*D-O*w)*S,(E*A-O*q)*S);Q[T].addSelf(z);Q[u].addSelf(z);Q[I].addSelf(z);R[T].addSelf(x);R[u].addSelf(x);R[I].addSelf(x)}var b,c,e,d,f,g,j,h,i,l,m,p,n,t,w,D,q,A,E,O,H,r,S,N,Q=[],R=[],z=new THREE.Vector3,x=new THREE.Vector3,U=new THREE.Vector3,Z=new THREE.Vector3,aa=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){Q[b]=new THREE.Vector3;R[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];
+if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3)}}var X=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(e=0;e<f.vertexNormals.length;e++){aa.copy(f.vertexNormals[e]);d=f[X[e]];N=Q[d];U.copy(N);U.subSelf(aa.multiplyScalar(aa.dot(N))).normalize();Z.cross(f.vertexNormals[e],N);d=Z.dot(R[d]);d=d<0?-1:1;f.vertexTangents[e]=new THREE.Vector4(U.x,U.y,U.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(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<
+0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var j=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){j={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var i=d.hierarchy[f].keys[g].morphTargets[h];j[i]=-1}d.hierarchy[f].usedMorphTargets=j;for(g=0;g<d.hierarchy[f].keys.length;g++){var l=
+{};for(i in j){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===i){l[i]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(l[i]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=l}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
+d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
+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.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.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,l,q;this.currentTime+=a*this.timeScale;q=this.currentTime;l=this.currentTime%=this.data.length;i=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,t=this.hierarchy.length;m<t;m++){a=this.hierarchy[m];h=a.animationCache;if(this.JITCompile&&n[m][i]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[m][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=n[m][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 v=0;v<3;v++){c=b[v];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=q){if(l<q)if(this.loop){g=this.data.hierarchy[m].keys[0];for(j=this.getNextKeyWith(c,m,1);j.time<l;){g=j;j=this.getNextKeyWith(c,m,j.index+1)}}else{this.stop();return}else{do{g=j;j=this.getNextKeyWith(c,m,j.index+1)}while(j.time<
-l)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(l-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 "+m);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",m,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",m,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(m=0;m<this.hierarchy.length;m++)n[m][i]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,j,h,i;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];j=a[c[1]];h=a[c[2]];i=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],j[0],h[0],i[0],e,c,g);d[1]=this.interpolate(f[1],j[1],h[1],i[1],e,c,g);d[2]=this.interpolate(f[2],j[2],h[2],i[2],e,c,g);return d};
-THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<d.length-1?c:d.length-1;else c%=d.length;for(;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
-THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||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.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,j,h,i,l=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 n=0,t=this.hierarchy.length;n<t;n++){a=this.hierarchy[n];h=a.animationCache;if(this.JITCompile&&l[n][i]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=l[n][i];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=l[n][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 w=0;w<3;w++){c=b[w];g=h.prevKey[c];j=h.nextKey[c];if(j.time<=p){if(m<p)if(this.loop){g=this.data.hierarchy[n].keys[0];for(j=this.getNextKeyWith(c,n,1);j.time<m;){g=j;j=this.getNextKeyWith(c,n,j.index+1)}}else{this.stop();return}else{do{g=j;j=this.getNextKeyWith(c,n,j.index+1)}while(j.time<
+m)}h.prevKey[c]=g;h.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(m-g.time)/(j.time-g.time);d=g[c];f=j[c];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+n);e=e<0?0:1}if(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",n,g.index-1).pos;this.points[1]=d;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",n,j.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===
+"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;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}}}}if(this.JITCompile&&l[0][i]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)l[n][i]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,f,g,j,h,i;d=(a.length-1)*b;f=Math.floor(d);d-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];j=a[c[1]];h=a[c[2]];i=a[c[3]];c=d*d;g=d*c;e[0]=this.interpolate(f[0],j[0],h[0],i[0],d,c,g);e[1]=this.interpolate(f[1],j[1],h[1],i[1],d,c,g);e[2]=this.interpolate(f[2],j[2],h[2],i[2],d,c,g);return e};
+THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*f+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
+THREE.Camera=function(a,b,c,e,d){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=d||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,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.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)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.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)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
@@ -107,60 +106,60 @@ undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=
 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=
 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}};
 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.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.Texture=function(a,b,c,d,e,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=f!==undefined?f: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,b,c,e,d,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=d!==undefined?d:THREE.LinearFilter;this.minFilter=f!==undefined?f: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.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.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;
 THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
 c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 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=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,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!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,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,d=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<d;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<d;e++)this.children[e].update(this.skinMatrix,
 b,c)};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}};
 b,c)};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}};
-THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c: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;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.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;
+THREE.Sound=function(a,b,c,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var d;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)d=
+"audio/mpeg";else if(b.indexOf(".ogg")!==-1)d="audio/ogg";else b.indexOf(".wav")!==-1&&(d="audio/wav");if(this.domElement.canPlayType(d)){d=document.createElement("source");d.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(d);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;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;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.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.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.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 B=h[j]=h[j]||new THREE.RenderableVertex;j++;return B}function b(B,x){return x.z-B.z}function c(B,x){var X=0,Y=1,aa=B.z+B.w,T=x.z+x.w,N=-B.z+B.w,U=-x.z+x.w;if(aa>=0&&T>=0&&N>=0&&U>=0)return!0;else if(aa<0&&T<0||N<0&&U<0)return!1;else{if(aa<0)X=Math.max(X,aa/(aa-T));else T<0&&(Y=Math.min(Y,aa/(aa-T)));if(N<0)X=Math.max(X,N/(N-U));else U<0&&(Y=Math.min(Y,N/(N-U)));if(Y<X)return!1;else{B.lerpSelf(x,X);x.lerpSelf(B,1-Y);return!0}}}var d,e,f=[],g,j,h=[],i,n,l=
-[],q,m=[],t,v,D=[],p,y,E=[],O=new THREE.Vector4,G=new THREE.Vector4,r=new THREE.Matrix4,S=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],R=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(B,x){r.multiply(x.projectionMatrix,x.matrixWorldInverse);r.multiplyVector3(B);return B};this.unprojectVector=function(B,x){r.multiply(x.matrixWorld,THREE.Matrix4.makeInvert(x.projectionMatrix));r.multiplyVector3(B);
-return B};this.projectObjects=function(B,x,X){x=[];var Y,aa,T;e=0;aa=B.objects;B=0;for(Y=aa.length;B<Y;B++){T=aa[B];var N;if(!(N=!T.visible))if(N=T instanceof THREE.Mesh){a:{N=void 0;for(var U=T.matrixWorld,w=-T.geometry.boundingSphere.radius*Math.max(T.scale.x,Math.max(T.scale.y,T.scale.z)),K=0;K<6;K++){N=M[K].x*U.n14+M[K].y*U.n24+M[K].z*U.n34+M[K].w;if(N<=w){N=!1;break a}}N=!0}N=!N}if(!N){N=f[e]=f[e]||new THREE.RenderableObject;e++;d=N;O.copy(T.position);r.multiplyVector3(O);d.object=T;d.z=O.z;
-x.push(d)}}X&&x.sort(b);return x};this.projectScene=function(B,x,X){var Y=[],aa=x.near,T=x.far,N,U,w,K,z,H,L,da,ga,P,Z,Ba,Fa,Ga,pa,Ca,ta;y=v=q=n=0;x.matrixAutoUpdate&&x.updateMatrix();B.update(undefined,!1,x);r.multiply(x.projectionMatrix,x.matrixWorldInverse);M[0].set(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);M[1].set(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);M[2].set(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);M[3].set(r.n41-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);M[4].set(r.n41-
-r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);M[5].set(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);for(N=0;N<6;N++){ga=M[N];ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z))}ga=this.projectObjects(B,x,!0);B=0;for(N=ga.length;B<N;B++){P=ga[B].object;if(P.visible){Z=P.matrixWorld;Ba=P.matrixRotationWorld;Fa=P.materials;Ga=P.overdraw;j=0;if(P instanceof THREE.Mesh){pa=P.geometry;K=pa.vertices;Ca=pa.faces;pa=pa.faceVertexUvs;U=0;for(w=K.length;U<w;U++){g=a();g.positionWorld.copy(K[U].position);
-Z.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);r.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>aa&&g.positionScreen.z<T}K=0;for(U=Ca.length;K<U;K++){w=Ca[K];if(w instanceof THREE.Face3){z=h[w.a];H=h[w.b];L=h[w.c];if(z.visible&&H.visible&&L.visible&&(P.doubleSided||P.flipSided!=(L.positionScreen.x-z.positionScreen.x)*(H.positionScreen.y-z.positionScreen.y)-(L.positionScreen.y-z.positionScreen.y)*
-(H.positionScreen.x-z.positionScreen.x)<0)){da=l[n]=l[n]||new THREE.RenderableFace3;n++;i=da;i.v1.copy(z);i.v2.copy(H);i.v3.copy(L)}else continue}else if(w instanceof THREE.Face4){z=h[w.a];H=h[w.b];L=h[w.c];da=h[w.d];if(z.visible&&H.visible&&L.visible&&da.visible&&(P.doubleSided||P.flipSided!=((da.positionScreen.x-z.positionScreen.x)*(H.positionScreen.y-z.positionScreen.y)-(da.positionScreen.y-z.positionScreen.y)*(H.positionScreen.x-z.positionScreen.x)<0||(H.positionScreen.x-L.positionScreen.x)*(da.positionScreen.y-
-L.positionScreen.y)-(H.positionScreen.y-L.positionScreen.y)*(da.positionScreen.x-L.positionScreen.x)<0))){ta=m[q]=m[q]||new THREE.RenderableFace4;q++;i=ta;i.v1.copy(z);i.v2.copy(H);i.v3.copy(L);i.v4.copy(da)}else continue}i.normalWorld.copy(w.normal);Ba.multiplyVector3(i.normalWorld);i.centroidWorld.copy(w.centroid);Z.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);L=w.vertexNormals;z=0;for(H=L.length;z<H;z++){da=i.vertexNormalsWorld[z];
-da.copy(L[z]);Ba.multiplyVector3(da)}z=0;for(H=pa.length;z<H;z++)if(ta=pa[z][K]){L=0;for(da=ta.length;L<da;L++)i.uvs[z][L]=ta[L]}i.meshMaterials=Fa;i.faceMaterials=w.materials;i.overdraw=Ga;i.z=i.centroidScreen.z;Y.push(i)}}else if(P instanceof THREE.Line){S.multiply(r,Z);K=P.geometry.vertices;z=a();z.positionScreen.copy(K[0].position);S.multiplyVector4(z.positionScreen);U=1;for(w=K.length;U<w;U++){z=a();z.positionScreen.copy(K[U].position);S.multiplyVector4(z.positionScreen);H=h[j-2];R.copy(z.positionScreen);
-Q.copy(H.positionScreen);if(c(R,Q)){R.multiplyScalar(1/R.w);Q.multiplyScalar(1/Q.w);Z=D[v]=D[v]||new THREE.RenderableLine;v++;t=Z;t.v1.positionScreen.copy(R);t.v2.positionScreen.copy(Q);t.z=Math.max(R.z,Q.z);t.materials=P.materials;Y.push(t)}}}else if(P instanceof THREE.Particle){G.set(P.position.x,P.position.y,P.position.z,1);r.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){Z=E[y]=E[y]||new THREE.RenderableParticle;y++;p=Z;p.x=G.x/G.w;p.y=G.y/G.w;p.z=G.z;p.rotation=P.rotation.z;p.scale.x=P.scale.x*
-Math.abs(p.x-(G.x+x.projectionMatrix.n11)/(G.w+x.projectionMatrix.n14));p.scale.y=P.scale.y*Math.abs(p.y-(G.y+x.projectionMatrix.n22)/(G.w+x.projectionMatrix.n24));p.materials=P.materials;Y.push(p)}}}}X&&Y.sort(b);return Y}};
-THREE.CanvasRenderer=function(){function a($){if(q!=$)i.globalAlpha=q=$}function b($){if(m!=$){switch($){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}m=$}}var c=null,d=new THREE.Projector,e=document.createElement("canvas"),f,g,j,h,i=e.getContext("2d"),n=new THREE.Color(0),l=0,q=1,m=0,t=null,v=null,D=1,p,y,E,O,G=new THREE.RenderableVertex,
-r=new THREE.RenderableVertex,S,M,R,Q,B,x,X,Y,aa,T,N,U,w=new THREE.Color,K=new THREE.Color,z=new THREE.Color,H=new THREE.Color,L=new THREE.Color,da,ga,P,Z,Ba,Fa,Ga,pa,Ca,ta,ya=new THREE.Rectangle,ja=new THREE.Rectangle,ea=new THREE.Rectangle,Ma=!1,ba=new THREE.Color,ha=new THREE.Color,za=new THREE.Color,Aa=new THREE.Color,W=new THREE.Vector3,Ha,Ia,Ra,ka,Ja,Na,qa=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Ra=Ia.getImageData(0,
-0,2,2);ka=Ra.data;Ja=document.createElement("canvas");Ja.width=Ja.height=qa;Na=Ja.getContext("2d");Na.translate(-qa/2,-qa/2);Na.scale(qa,qa);qa--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function($,ra){f=$;g=ra;j=f/2;h=g/2;e.width=f;e.height=g;ya.set(-j,-h,j,h);q=1;m=0;v=t=null;D=1};this.setClearColor=function($,ra){n=$;l=ra};this.setClearColorHex=function($,ra){n.setHex($);l=ra};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!ja.isEmpty()){ja.inflate(1);
-ja.minSelf(ya);if(n.hex==0&&l==0)i.clearRect(ja.getX(),ja.getY(),ja.getWidth(),ja.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)+","+l+")";i.fillRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight())}ja.empty()}};this.render=function($,ra){function Wa(k){var A,u,s,I=k.lights;ha.setRGB(0,0,0);za.setRGB(0,0,0);Aa.setRGB(0,0,0);k=0;for(A=I.length;k<A;k++){u=I[k];s=u.color;if(u instanceof THREE.AmbientLight){ha.r+=
-s.r;ha.g+=s.g;ha.b+=s.b}else if(u instanceof THREE.DirectionalLight){za.r+=s.r;za.g+=s.g;za.b+=s.b}else if(u instanceof THREE.PointLight){Aa.r+=s.r;Aa.g+=s.g;Aa.b+=s.b}}}function Ka(k,A,u,s){var I,F,C,o,V=k.lights;k=0;for(I=V.length;k<I;k++){F=V[k];C=F.color;o=F.intensity;if(F instanceof THREE.DirectionalLight){F=u.dot(F.position)*o;if(F>0){s.r+=C.r*F;s.g+=C.g*F;s.b+=C.b*F}}else if(F instanceof THREE.PointLight){W.sub(F.position,A);W.normalize();F=u.dot(W)*o;if(F>0){s.r+=C.r*F;s.g+=C.g*F;s.b+=C.b*
-F}}}}function Xa(k,A,u){a(u.opacity);b(u.blending);var s,I,F,C,o,V;if(u instanceof THREE.ParticleBasicMaterial){if(u.map){C=u.map.image;o=C.width>>1;V=C.height>>1;u=A.scale.x*j;F=A.scale.y*h;s=u*o;I=F*V;ea.set(k.x-s,k.y-I,k.x+s,k.y+I);if(ya.instersects(ea)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(u,-F);i.translate(-o,-V);i.drawImage(C,0,0);i.restore()}}}else if(u instanceof THREE.ParticleCanvasMaterial){if(Ma){ba.r=ha.r+za.r+Aa.r;ba.g=ha.g+za.g+Aa.g;ba.b=ha.b+za.b+Aa.b;w.r=u.color.r*
-ba.r;w.g=u.color.g*ba.g;w.b=u.color.b*ba.b;w.updateStyleString()}else w.__styleString=u.color.__styleString;s=A.scale.x*j;I=A.scale.y*h;ea.set(k.x-s,k.y-I,k.x+s,k.y+I);if(ya.instersects(ea)){i.save();i.translate(k.x,k.y);i.rotate(-A.rotation);i.scale(s,I);u.program(i,w);i.restore()}}}function Ya(k,A,u,s){a(s.opacity);b(s.blending);i.beginPath();i.moveTo(k.positionScreen.x,k.positionScreen.y);i.lineTo(A.positionScreen.x,A.positionScreen.y);i.closePath();if(s instanceof THREE.LineBasicMaterial){w.__styleString=
-s.color.__styleString;k=s.linewidth;if(D!=k)i.lineWidth=D=k;k=w.__styleString;if(t!=k)i.strokeStyle=t=k;i.stroke();ea.inflate(s.linewidth*2)}}function Oa(k,A,u,s,I,F,C,o,V){a(o.opacity);b(o.blending);S=k.positionScreen.x;M=k.positionScreen.y;R=A.positionScreen.x;Q=A.positionScreen.y;B=u.positionScreen.x;x=u.positionScreen.y;var ia=S,fa=M,la=R,sa=Q,ma=B,oa=x;i.beginPath();i.moveTo(ia,fa);i.lineTo(la,sa);i.lineTo(ma,oa);i.lineTo(ia,fa);i.closePath();if(o instanceof THREE.MeshBasicMaterial)if(o.map){if(o.map.mapping instanceof
-THREE.UVMapping){Z=C.uvs[0];La(S,M,R,Q,B,x,o.map.image,Z[s].u,Z[s].v,Z[I].u,Z[I].v,Z[F].u,Z[F].v)}}else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping){k=ra.matrixWorldInverse;W.copy(C.vertexNormalsWorld[0]);Ba=(W.x*k.n11+W.y*k.n12+W.z*k.n13)*0.5+0.5;Fa=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;W.copy(C.vertexNormalsWorld[1]);Ga=(W.x*k.n11+W.y*k.n12+W.z*k.n13)*0.5+0.5;pa=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;W.copy(C.vertexNormalsWorld[2]);Ca=(W.x*k.n11+W.y*k.n12+W.z*
-k.n13)*0.5+0.5;ta=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;La(S,M,R,Q,B,x,o.envMap.image,Ba,Fa,Ga,pa,Ca,ta)}}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshLambertMaterial){if(o.map&&!o.wireframe){if(o.map.mapping instanceof THREE.UVMapping){Z=C.uvs[0];La(S,M,R,Q,B,x,o.map.image,Z[s].u,Z[s].v,Z[I].u,Z[I].v,Z[F].u,Z[F].v)}b(THREE.SubtractiveBlending)}if(Ma)if(!o.wireframe&&o.shading==THREE.SmoothShading&&C.vertexNormalsWorld.length==
-3){K.r=z.r=H.r=ha.r;K.g=z.g=H.g=ha.g;K.b=z.b=H.b=ha.b;Ka(V,C.v1.positionWorld,C.vertexNormalsWorld[0],K);Ka(V,C.v2.positionWorld,C.vertexNormalsWorld[1],z);Ka(V,C.v3.positionWorld,C.vertexNormalsWorld[2],H);L.r=(z.r+H.r)*0.5;L.g=(z.g+H.g)*0.5;L.b=(z.b+H.b)*0.5;P=Sa(K,z,H,L);La(S,M,R,Q,B,x,P,0,0,1,0,0,1)}else{ba.r=ha.r;ba.g=ha.g;ba.b=ha.b;Ka(V,C.centroidWorld,C.normalWorld,ba);w.r=o.color.r*ba.r;w.g=o.color.g*ba.g;w.b=o.color.b*ba.b;w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):
-va(w.__styleString)}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString)}else if(o instanceof THREE.MeshDepthMaterial){da=ra.near;ga=ra.far;K.r=K.g=K.b=1-Ta(k.positionScreen.z,da,ga);z.r=z.g=z.b=1-Ta(A.positionScreen.z,da,ga);H.r=H.g=H.b=1-Ta(u.positionScreen.z,da,ga);L.r=(z.r+H.r)*0.5;L.g=(z.g+H.g)*0.5;L.b=(z.b+H.b)*0.5;P=Sa(K,z,H,L);La(S,M,R,Q,B,x,P,0,0,1,0,0,1)}else if(o instanceof THREE.MeshNormalMaterial){w.r=Da(C.normalWorld.x);w.g=Da(C.normalWorld.y);w.b=
-Da(C.normalWorld.z);w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):va(w.__styleString)}}function Ua(k,A,u,s,I,F,C,o,V){a(o.opacity);b(o.blending);if(o.map||o.envMap){Oa(k,A,s,0,1,3,C,o,V);Oa(I,u,F,1,2,3,C,o,V)}else{S=k.positionScreen.x;M=k.positionScreen.y;R=A.positionScreen.x;Q=A.positionScreen.y;B=u.positionScreen.x;x=u.positionScreen.y;X=s.positionScreen.x;Y=s.positionScreen.y;aa=I.positionScreen.x;T=I.positionScreen.y;N=F.positionScreen.x;U=F.positionScreen.y;I=S;F=
-M;var ia=R,fa=Q,la=B,sa=x;i.beginPath();i.moveTo(I,F);i.lineTo(ia,fa);i.lineTo(la,sa);i.lineTo(X,Y);i.lineTo(I,F);i.closePath();if(o instanceof THREE.MeshBasicMaterial)o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshLambertMaterial)if(Ma){ba.r=ha.r;ba.g=ha.g;ba.b=ha.b;Ka(V,C.centroidWorld,C.normalWorld,ba);w.r=o.color.r*ba.r;w.g=o.color.g*ba.g;w.b=o.color.b*ba.b;w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):
-va(w.__styleString)}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshDepthMaterial){_2near=o.__2near;_farPlusNear=o.__farPlusNear;_farMinusNear=o.__farMinusNear;K=~~((1-_2near/(_farPlusNear-k.positionScreen.z*_farMinusNear))*255);z=~~((1-_2near/(_farPlusNear-A.positionScreen.z*_farMinusNear))*255);H=~~((1-_2near/(_farPlusNear-u.positionScreen.z*_farMinusNear))*255);L=~~((1-_2near/(_farPlusNear-s.positionScreen.z*_farMinusNear))*
-255);P=Sa([K,K,K],[z,z,z],[L,L,L],[H,H,H]);_uv1.u=0;_uv1.v=0;_uv2.u=qa;_uv2.v=0;_uv3.u=qa;_uv3.v=qa;_uv4.u=0;_uv4.v=qa;drawTexturedTriangle(P,S,M,R,Q,X,Y,_uv1.u,_uv1.v,_uv2.u,_uv2.v,_uv4.u,_uv4.v);drawTexturedTriangle(P,aa,T,B,x,N,U,_uv2.u,_uv2.v,_uv3.u,_uv3.v,_uv4.u,_uv4.v)}else if(o instanceof THREE.MeshNormalMaterial){w.r=Da(C.normalWorld.x);w.g=Da(C.normalWorld.y);w.b=Da(C.normalWorld.z);w.updateStyleString();o.wireframe?ua(w.__styleString,o.wireframeLinewidth):va(w.__styleString)}}}function ua(k,
-A){if(t!=k)i.strokeStyle=t=k;if(D!=A)i.lineWidth=D=A;i.stroke();ea.inflate(A*2)}function va(k){if(v!=k)i.fillStyle=v=k;i.fill()}function La(k,A,u,s,I,F,C,o,V,ia,fa,la,sa){var ma,oa;ma=C.width-1;oa=C.height-1;o*=ma;V*=oa;ia*=ma;fa*=oa;la*=ma;sa*=oa;u-=k;s-=A;I-=k;F-=A;ia-=o;fa-=V;la-=o;sa-=V;ma=ia*sa-la*fa;if(ma!=0){oa=1/ma;ma=(sa*u-fa*I)*oa;fa=(sa*s-fa*F)*oa;u=(ia*I-la*u)*oa;s=(ia*F-la*s)*oa;k=k-ma*o-u*V;A=A-fa*o-s*V;i.save();i.transform(ma,fa,u,s,k,A);i.clip();i.drawImage(C,0,0);i.restore()}}function Sa(k,
-A,u,s){var I=~~(k.r*255),F=~~(k.g*255);k=~~(k.b*255);var C=~~(A.r*255),o=~~(A.g*255);A=~~(A.b*255);var V=~~(u.r*255),ia=~~(u.g*255);u=~~(u.b*255);var fa=~~(s.r*255),la=~~(s.g*255);s=~~(s.b*255);ka[0]=I<0?0:I>255?255:I;ka[1]=F<0?0:F>255?255:F;ka[2]=k<0?0:k>255?255:k;ka[4]=C<0?0:C>255?255:C;ka[5]=o<0?0:o>255?255:o;ka[6]=A<0?0:A>255?255:A;ka[8]=V<0?0:V>255?255:V;ka[9]=ia<0?0:ia>255?255:ia;ka[10]=u<0?0:u>255?255:u;ka[12]=fa<0?0:fa>255?255:fa;ka[13]=la<0?0:la>255?255:la;ka[14]=s<0?0:s>255?255:s;Ia.putImageData(Ra,
-0,0);Na.drawImage(Ha,0,0);return Ja}function Ta(k,A,u){k=(k-A)/(u-A);return k*k*(3-2*k)}function Da(k){k=(k+1)*0.5;return k<0?0:k>1?1:k}function wa(k,A){var u=A.x-k.x,s=A.y-k.y,I=1/Math.sqrt(u*u+s*s);u*=I;s*=I;A.x+=u;A.y+=s;k.x-=u;k.y-=s}var Pa,Va,J,na,xa,Ea,Qa,ca;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=d.projectScene($,ra,this.sortElements);(Ma=$.lights.length>0)&&Wa($);Pa=0;for(Va=c.length;Pa<Va;Pa++){J=c[Pa];ea.empty();if(J instanceof THREE.RenderableParticle){p=J;p.x*=j;p.y*=
-h;na=0;for(xa=J.materials.length;na<xa;){ca=J.materials[na++];ca.opacity!=0&&Xa(p,J,ca,$)}}else if(J instanceof THREE.RenderableLine){p=J.v1;y=J.v2;p.positionScreen.x*=j;p.positionScreen.y*=h;y.positionScreen.x*=j;y.positionScreen.y*=h;ea.addPoint(p.positionScreen.x,p.positionScreen.y);ea.addPoint(y.positionScreen.x,y.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=J.materials.length;na<xa;){ca=J.materials[na++];ca.opacity!=0&&Ya(p,y,J,ca,$)}}}else if(J instanceof THREE.RenderableFace3){p=J.v1;
-y=J.v2;E=J.v3;p.positionScreen.x*=j;p.positionScreen.y*=h;y.positionScreen.x*=j;y.positionScreen.y*=h;E.positionScreen.x*=j;E.positionScreen.y*=h;if(J.overdraw){wa(p.positionScreen,y.positionScreen);wa(y.positionScreen,E.positionScreen);wa(E.positionScreen,p.positionScreen)}ea.add3Points(p.positionScreen.x,p.positionScreen.y,y.positionScreen.x,y.positionScreen.y,E.positionScreen.x,E.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=J.meshMaterials.length;na<xa;){ca=J.meshMaterials[na++];if(ca instanceof
-THREE.MeshFaceMaterial){Ea=0;for(Qa=J.faceMaterials.length;Ea<Qa;)(ca=J.faceMaterials[Ea++])&&ca.opacity!=0&&Oa(p,y,E,0,1,2,J,ca,$)}else ca.opacity!=0&&Oa(p,y,E,0,1,2,J,ca,$)}}}else if(J instanceof THREE.RenderableFace4){p=J.v1;y=J.v2;E=J.v3;O=J.v4;p.positionScreen.x*=j;p.positionScreen.y*=h;y.positionScreen.x*=j;y.positionScreen.y*=h;E.positionScreen.x*=j;E.positionScreen.y*=h;O.positionScreen.x*=j;O.positionScreen.y*=h;G.positionScreen.copy(y.positionScreen);r.positionScreen.copy(O.positionScreen);
-if(J.overdraw){wa(p.positionScreen,y.positionScreen);wa(y.positionScreen,O.positionScreen);wa(O.positionScreen,p.positionScreen);wa(E.positionScreen,G.positionScreen);wa(E.positionScreen,r.positionScreen)}ea.addPoint(p.positionScreen.x,p.positionScreen.y);ea.addPoint(y.positionScreen.x,y.positionScreen.y);ea.addPoint(E.positionScreen.x,E.positionScreen.y);ea.addPoint(O.positionScreen.x,O.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=J.meshMaterials.length;na<xa;){ca=J.meshMaterials[na++];if(ca instanceof
-THREE.MeshFaceMaterial){Ea=0;for(Qa=J.faceMaterials.length;Ea<Qa;)(ca=J.faceMaterials[Ea++])&&ca.opacity!=0&&Ua(p,y,E,O,G,r,J,ca,$)}else ca.opacity!=0&&Ua(p,y,E,O,G,r,J,ca,$)}}}ja.addRectangle(ea)}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.Projector=function(){function a(){var z=h[j]=h[j]||new THREE.RenderableVertex;j++;return z}function b(z,x){return x.z-z.z}function c(z,x){var U=0,Z=1,aa=z.z+z.w,X=x.z+x.w,M=-z.z+z.w,T=-x.z+x.w;if(aa>=0&&X>=0&&M>=0&&T>=0)return!0;else if(aa<0&&X<0||M<0&&T<0)return!1;else{if(aa<0)U=Math.max(U,aa/(aa-X));else X<0&&(Z=Math.min(Z,aa/(aa-X)));if(M<0)U=Math.max(U,M/(M-T));else T<0&&(Z=Math.min(Z,M/(M-T)));if(Z<U)return!1;else{z.lerpSelf(x,U);x.lerpSelf(z,1-Z);return!0}}}var e,d,f=[],g,j,h=[],i,l,m=
+[],p,n=[],t,w,D=[],q,A,E=[],O=new THREE.Vector4,H=new THREE.Vector4,r=new THREE.Matrix4,S=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Q=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(z,x){r.multiply(x.projectionMatrix,x.matrixWorldInverse);r.multiplyVector3(z);return z};this.unprojectVector=function(z,x){r.multiply(x.matrixWorld,THREE.Matrix4.makeInvert(x.projectionMatrix));r.multiplyVector3(z);
+return z};this.projectObjects=function(z,x,U){x=[];var Z,aa,X;d=0;aa=z.objects;z=0;for(Z=aa.length;z<Z;z++){X=aa[z];var M;if(!(M=!X.visible))if(M=X instanceof THREE.Mesh){a:{M=void 0;for(var T=X.matrixWorld,u=-X.geometry.boundingSphere.radius*Math.max(X.scale.x,Math.max(X.scale.y,X.scale.z)),I=0;I<6;I++){M=N[I].x*T.n14+N[I].y*T.n24+N[I].z*T.n34+N[I].w;if(M<=u){M=!1;break a}}M=!0}M=!M}if(!M){M=f[d]=f[d]||new THREE.RenderableObject;d++;e=M;O.copy(X.position);r.multiplyVector3(O);e.object=X;e.z=O.z;
+x.push(e)}}U&&x.sort(b);return x};this.projectScene=function(z,x,U){var Z=[],aa=x.near,X=x.far,M,T,u,I,y,G,K,da,ga,P,Y,Ba,Fa,Ga,pa,Ca,ta;A=w=p=l=0;x.matrixAutoUpdate&&x.updateMatrix();z.update(undefined,!1,x);r.multiply(x.projectionMatrix,x.matrixWorldInverse);N[0].set(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);N[1].set(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);N[2].set(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);N[3].set(r.n41-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);N[4].set(r.n41-
+r.n31,r.n42-r.n32,r.n43-r.n33,r.n44-r.n34);N[5].set(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);for(M=0;M<6;M++){ga=N[M];ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z))}ga=this.projectObjects(z,x,!0);z=0;for(M=ga.length;z<M;z++){P=ga[z].object;if(P.visible){Y=P.matrixWorld;Ba=P.matrixRotationWorld;Fa=P.materials;Ga=P.overdraw;j=0;if(P instanceof THREE.Mesh){pa=P.geometry;I=pa.vertices;Ca=pa.faces;pa=pa.faceVertexUvs;T=0;for(u=I.length;T<u;T++){g=a();g.positionWorld.copy(I[T].position);
+Y.multiplyVector3(g.positionWorld);g.positionScreen.copy(g.positionWorld);r.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>aa&&g.positionScreen.z<X}I=0;for(T=Ca.length;I<T;I++){u=Ca[I];if(u instanceof THREE.Face3){y=h[u.a];G=h[u.b];K=h[u.c];if(y.visible&&G.visible&&K.visible&&(P.doubleSided||P.flipSided!=(K.positionScreen.x-y.positionScreen.x)*(G.positionScreen.y-y.positionScreen.y)-(K.positionScreen.y-y.positionScreen.y)*
+(G.positionScreen.x-y.positionScreen.x)<0)){da=m[l]=m[l]||new THREE.RenderableFace3;l++;i=da;i.v1.copy(y);i.v2.copy(G);i.v3.copy(K)}else continue}else if(u instanceof THREE.Face4){y=h[u.a];G=h[u.b];K=h[u.c];da=h[u.d];if(y.visible&&G.visible&&K.visible&&da.visible&&(P.doubleSided||P.flipSided!=((da.positionScreen.x-y.positionScreen.x)*(G.positionScreen.y-y.positionScreen.y)-(da.positionScreen.y-y.positionScreen.y)*(G.positionScreen.x-y.positionScreen.x)<0||(G.positionScreen.x-K.positionScreen.x)*(da.positionScreen.y-
+K.positionScreen.y)-(G.positionScreen.y-K.positionScreen.y)*(da.positionScreen.x-K.positionScreen.x)<0))){ta=n[p]=n[p]||new THREE.RenderableFace4;p++;i=ta;i.v1.copy(y);i.v2.copy(G);i.v3.copy(K);i.v4.copy(da)}else continue}i.normalWorld.copy(u.normal);Ba.multiplyVector3(i.normalWorld);i.centroidWorld.copy(u.centroid);Y.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);r.multiplyVector3(i.centroidScreen);K=u.vertexNormals;y=0;for(G=K.length;y<G;y++){da=i.vertexNormalsWorld[y];
+da.copy(K[y]);Ba.multiplyVector3(da)}y=0;for(G=pa.length;y<G;y++)if(ta=pa[y][I]){K=0;for(da=ta.length;K<da;K++)i.uvs[y][K]=ta[K]}i.meshMaterials=Fa;i.faceMaterials=u.materials;i.overdraw=Ga;i.z=i.centroidScreen.z;Z.push(i)}}else if(P instanceof THREE.Line){S.multiply(r,Y);I=P.geometry.vertices;y=a();y.positionScreen.copy(I[0].position);S.multiplyVector4(y.positionScreen);T=1;for(u=I.length;T<u;T++){y=a();y.positionScreen.copy(I[T].position);S.multiplyVector4(y.positionScreen);G=h[j-2];Q.copy(y.positionScreen);
+R.copy(G.positionScreen);if(c(Q,R)){Q.multiplyScalar(1/Q.w);R.multiplyScalar(1/R.w);Y=D[w]=D[w]||new THREE.RenderableLine;w++;t=Y;t.v1.positionScreen.copy(Q);t.v2.positionScreen.copy(R);t.z=Math.max(Q.z,R.z);t.materials=P.materials;Z.push(t)}}}else if(P instanceof THREE.Particle){H.set(P.position.x,P.position.y,P.position.z,1);r.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){Y=E[A]=E[A]||new THREE.RenderableParticle;A++;q=Y;q.x=H.x/H.w;q.y=H.y/H.w;q.z=H.z;q.rotation=P.rotation.z;q.scale.x=P.scale.x*
+Math.abs(q.x-(H.x+x.projectionMatrix.n11)/(H.w+x.projectionMatrix.n14));q.scale.y=P.scale.y*Math.abs(q.y-(H.y+x.projectionMatrix.n22)/(H.w+x.projectionMatrix.n24));q.materials=P.materials;Z.push(q)}}}}U&&Z.sort(b);return Z}};
+THREE.CanvasRenderer=function(){function a($){if(p!=$)i.globalAlpha=p=$}function b($){if(n!=$){switch($){case THREE.NormalBlending:i.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:i.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:i.globalCompositeOperation="darker"}n=$}}var c=null,e=new THREE.Projector,d=document.createElement("canvas"),f,g,j,h,i=d.getContext("2d"),l=new THREE.Color(0),m=0,p=1,n=0,t=null,w=null,D=1,q,A,E,O,H=new THREE.RenderableVertex,
+r=new THREE.RenderableVertex,S,N,Q,R,z,x,U,Z,aa,X,M,T,u=new THREE.Color,I=new THREE.Color,y=new THREE.Color,G=new THREE.Color,K=new THREE.Color,da,ga,P,Y,Ba,Fa,Ga,pa,Ca,ta,ya=new THREE.Rectangle,ja=new THREE.Rectangle,ea=new THREE.Rectangle,Ma=!1,ba=new THREE.Color,ha=new THREE.Color,za=new THREE.Color,Aa=new THREE.Color,W=new THREE.Vector3,Ha,Ia,Ra,ka,Ja,Na,qa=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;Ia=Ha.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Ra=Ia.getImageData(0,
+0,2,2);ka=Ra.data;Ja=document.createElement("canvas");Ja.width=Ja.height=qa;Na=Ja.getContext("2d");Na.translate(-qa/2,-qa/2);Na.scale(qa,qa);qa--;this.domElement=d;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function($,ra){f=$;g=ra;j=f/2;h=g/2;d.width=f;d.height=g;ya.set(-j,-h,j,h);p=1;n=0;w=t=null;D=1};this.setClearColor=function($,ra){l=$;m=ra};this.setClearColorHex=function($,ra){l.setHex($);m=ra};this.clear=function(){i.setTransform(1,0,0,-1,j,h);if(!ja.isEmpty()){ja.inflate(1);
+ja.minSelf(ya);if(l.hex==0&&m==0)i.clearRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight());else{b(THREE.NormalBlending);a(1);i.fillStyle="rgba("+Math.floor(l.r*255)+","+Math.floor(l.g*255)+","+Math.floor(l.b*255)+","+m+")";i.fillRect(ja.getX(),ja.getY(),ja.getWidth(),ja.getHeight())}ja.empty()}};this.render=function($,ra){function Wa(k){var B,v,s,J=k.lights;ha.setRGB(0,0,0);za.setRGB(0,0,0);Aa.setRGB(0,0,0);k=0;for(B=J.length;k<B;k++){v=J[k];s=v.color;if(v instanceof THREE.AmbientLight){ha.r+=
+s.r;ha.g+=s.g;ha.b+=s.b}else if(v instanceof THREE.DirectionalLight){za.r+=s.r;za.g+=s.g;za.b+=s.b}else if(v instanceof THREE.PointLight){Aa.r+=s.r;Aa.g+=s.g;Aa.b+=s.b}}}function Ka(k,B,v,s){var J,F,C,o,V=k.lights;k=0;for(J=V.length;k<J;k++){F=V[k];C=F.color;o=F.intensity;if(F instanceof THREE.DirectionalLight){F=v.dot(F.position)*o;if(F>0){s.r+=C.r*F;s.g+=C.g*F;s.b+=C.b*F}}else if(F instanceof THREE.PointLight){W.sub(F.position,B);W.normalize();F=v.dot(W)*o;if(F>0){s.r+=C.r*F;s.g+=C.g*F;s.b+=C.b*
+F}}}}function Xa(k,B,v){a(v.opacity);b(v.blending);var s,J,F,C,o,V;if(v instanceof THREE.ParticleBasicMaterial){if(v.map){C=v.map.image;o=C.width>>1;V=C.height>>1;v=B.scale.x*j;F=B.scale.y*h;s=v*o;J=F*V;ea.set(k.x-s,k.y-J,k.x+s,k.y+J);if(ya.instersects(ea)){i.save();i.translate(k.x,k.y);i.rotate(-B.rotation);i.scale(v,-F);i.translate(-o,-V);i.drawImage(C,0,0);i.restore()}}}else if(v instanceof THREE.ParticleCanvasMaterial){if(Ma){ba.r=ha.r+za.r+Aa.r;ba.g=ha.g+za.g+Aa.g;ba.b=ha.b+za.b+Aa.b;u.r=v.color.r*
+ba.r;u.g=v.color.g*ba.g;u.b=v.color.b*ba.b;u.updateStyleString()}else u.__styleString=v.color.__styleString;s=B.scale.x*j;J=B.scale.y*h;ea.set(k.x-s,k.y-J,k.x+s,k.y+J);if(ya.instersects(ea)){i.save();i.translate(k.x,k.y);i.rotate(-B.rotation);i.scale(s,J);v.program(i,u);i.restore()}}}function Ya(k,B,v,s){a(s.opacity);b(s.blending);i.beginPath();i.moveTo(k.positionScreen.x,k.positionScreen.y);i.lineTo(B.positionScreen.x,B.positionScreen.y);i.closePath();if(s instanceof THREE.LineBasicMaterial){u.__styleString=
+s.color.__styleString;k=s.linewidth;if(D!=k)i.lineWidth=D=k;k=u.__styleString;if(t!=k)i.strokeStyle=t=k;i.stroke();ea.inflate(s.linewidth*2)}}function Oa(k,B,v,s,J,F,C,o,V){a(o.opacity);b(o.blending);S=k.positionScreen.x;N=k.positionScreen.y;Q=B.positionScreen.x;R=B.positionScreen.y;z=v.positionScreen.x;x=v.positionScreen.y;var ia=S,fa=N,la=Q,sa=R,ma=z,oa=x;i.beginPath();i.moveTo(ia,fa);i.lineTo(la,sa);i.lineTo(ma,oa);i.lineTo(ia,fa);i.closePath();if(o instanceof THREE.MeshBasicMaterial)if(o.map){if(o.map.mapping instanceof
+THREE.UVMapping){Y=C.uvs[0];La(S,N,Q,R,z,x,o.map.image,Y[s].u,Y[s].v,Y[J].u,Y[J].v,Y[F].u,Y[F].v)}}else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping){k=ra.matrixWorldInverse;W.copy(C.vertexNormalsWorld[0]);Ba=(W.x*k.n11+W.y*k.n12+W.z*k.n13)*0.5+0.5;Fa=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;W.copy(C.vertexNormalsWorld[1]);Ga=(W.x*k.n11+W.y*k.n12+W.z*k.n13)*0.5+0.5;pa=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;W.copy(C.vertexNormalsWorld[2]);Ca=(W.x*k.n11+W.y*k.n12+W.z*
+k.n13)*0.5+0.5;ta=-(W.x*k.n21+W.y*k.n22+W.z*k.n23)*0.5+0.5;La(S,N,Q,R,z,x,o.envMap.image,Ba,Fa,Ga,pa,Ca,ta)}}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshLambertMaterial){if(o.map&&!o.wireframe){if(o.map.mapping instanceof THREE.UVMapping){Y=C.uvs[0];La(S,N,Q,R,z,x,o.map.image,Y[s].u,Y[s].v,Y[J].u,Y[J].v,Y[F].u,Y[F].v)}b(THREE.SubtractiveBlending)}if(Ma)if(!o.wireframe&&o.shading==THREE.SmoothShading&&C.vertexNormalsWorld.length==
+3){I.r=y.r=G.r=ha.r;I.g=y.g=G.g=ha.g;I.b=y.b=G.b=ha.b;Ka(V,C.v1.positionWorld,C.vertexNormalsWorld[0],I);Ka(V,C.v2.positionWorld,C.vertexNormalsWorld[1],y);Ka(V,C.v3.positionWorld,C.vertexNormalsWorld[2],G);K.r=(y.r+G.r)*0.5;K.g=(y.g+G.g)*0.5;K.b=(y.b+G.b)*0.5;P=Sa(I,y,G,K);La(S,N,Q,R,z,x,P,0,0,1,0,0,1)}else{ba.r=ha.r;ba.g=ha.g;ba.b=ha.b;Ka(V,C.centroidWorld,C.normalWorld,ba);u.r=o.color.r*ba.r;u.g=o.color.g*ba.g;u.b=o.color.b*ba.b;u.updateStyleString();o.wireframe?ua(u.__styleString,o.wireframeLinewidth):
+va(u.__styleString)}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString)}else if(o instanceof THREE.MeshDepthMaterial){da=ra.near;ga=ra.far;I.r=I.g=I.b=1-Ta(k.positionScreen.z,da,ga);y.r=y.g=y.b=1-Ta(B.positionScreen.z,da,ga);G.r=G.g=G.b=1-Ta(v.positionScreen.z,da,ga);K.r=(y.r+G.r)*0.5;K.g=(y.g+G.g)*0.5;K.b=(y.b+G.b)*0.5;P=Sa(I,y,G,K);La(S,N,Q,R,z,x,P,0,0,1,0,0,1)}else if(o instanceof THREE.MeshNormalMaterial){u.r=Da(C.normalWorld.x);u.g=Da(C.normalWorld.y);u.b=
+Da(C.normalWorld.z);u.updateStyleString();o.wireframe?ua(u.__styleString,o.wireframeLinewidth):va(u.__styleString)}}function Ua(k,B,v,s,J,F,C,o,V){a(o.opacity);b(o.blending);if(o.map||o.envMap){Oa(k,B,s,0,1,3,C,o,V);Oa(J,v,F,1,2,3,C,o,V)}else{S=k.positionScreen.x;N=k.positionScreen.y;Q=B.positionScreen.x;R=B.positionScreen.y;z=v.positionScreen.x;x=v.positionScreen.y;U=s.positionScreen.x;Z=s.positionScreen.y;aa=J.positionScreen.x;X=J.positionScreen.y;M=F.positionScreen.x;T=F.positionScreen.y;J=S;F=
+N;var ia=Q,fa=R,la=z,sa=x;i.beginPath();i.moveTo(J,F);i.lineTo(ia,fa);i.lineTo(la,sa);i.lineTo(U,Z);i.lineTo(J,F);i.closePath();if(o instanceof THREE.MeshBasicMaterial)o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshLambertMaterial)if(Ma){ba.r=ha.r;ba.g=ha.g;ba.b=ha.b;Ka(V,C.centroidWorld,C.normalWorld,ba);u.r=o.color.r*ba.r;u.g=o.color.g*ba.g;u.b=o.color.b*ba.b;u.updateStyleString();o.wireframe?ua(u.__styleString,o.wireframeLinewidth):
+va(u.__styleString)}else o.wireframe?ua(o.color.__styleString,o.wireframeLinewidth):va(o.color.__styleString);else if(o instanceof THREE.MeshDepthMaterial){_2near=o.__2near;_farPlusNear=o.__farPlusNear;_farMinusNear=o.__farMinusNear;I=~~((1-_2near/(_farPlusNear-k.positionScreen.z*_farMinusNear))*255);y=~~((1-_2near/(_farPlusNear-B.positionScreen.z*_farMinusNear))*255);G=~~((1-_2near/(_farPlusNear-v.positionScreen.z*_farMinusNear))*255);K=~~((1-_2near/(_farPlusNear-s.positionScreen.z*_farMinusNear))*
+255);P=Sa([I,I,I],[y,y,y],[K,K,K],[G,G,G]);_uv1.u=0;_uv1.v=0;_uv2.u=qa;_uv2.v=0;_uv3.u=qa;_uv3.v=qa;_uv4.u=0;_uv4.v=qa;drawTexturedTriangle(P,S,N,Q,R,U,Z,_uv1.u,_uv1.v,_uv2.u,_uv2.v,_uv4.u,_uv4.v);drawTexturedTriangle(P,aa,X,z,x,M,T,_uv2.u,_uv2.v,_uv3.u,_uv3.v,_uv4.u,_uv4.v)}else if(o instanceof THREE.MeshNormalMaterial){u.r=Da(C.normalWorld.x);u.g=Da(C.normalWorld.y);u.b=Da(C.normalWorld.z);u.updateStyleString();o.wireframe?ua(u.__styleString,o.wireframeLinewidth):va(u.__styleString)}}}function ua(k,
+B){if(t!=k)i.strokeStyle=t=k;if(D!=B)i.lineWidth=D=B;i.stroke();ea.inflate(B*2)}function va(k){if(w!=k)i.fillStyle=w=k;i.fill()}function La(k,B,v,s,J,F,C,o,V,ia,fa,la,sa){var ma,oa;ma=C.width-1;oa=C.height-1;o*=ma;V*=oa;ia*=ma;fa*=oa;la*=ma;sa*=oa;v-=k;s-=B;J-=k;F-=B;ia-=o;fa-=V;la-=o;sa-=V;ma=ia*sa-la*fa;if(ma!=0){oa=1/ma;ma=(sa*v-fa*J)*oa;fa=(sa*s-fa*F)*oa;v=(ia*J-la*v)*oa;s=(ia*F-la*s)*oa;k=k-ma*o-v*V;B=B-fa*o-s*V;i.save();i.transform(ma,fa,v,s,k,B);i.clip();i.drawImage(C,0,0);i.restore()}}function Sa(k,
+B,v,s){var J=~~(k.r*255),F=~~(k.g*255);k=~~(k.b*255);var C=~~(B.r*255),o=~~(B.g*255);B=~~(B.b*255);var V=~~(v.r*255),ia=~~(v.g*255);v=~~(v.b*255);var fa=~~(s.r*255),la=~~(s.g*255);s=~~(s.b*255);ka[0]=J<0?0:J>255?255:J;ka[1]=F<0?0:F>255?255:F;ka[2]=k<0?0:k>255?255:k;ka[4]=C<0?0:C>255?255:C;ka[5]=o<0?0:o>255?255:o;ka[6]=B<0?0:B>255?255:B;ka[8]=V<0?0:V>255?255:V;ka[9]=ia<0?0:ia>255?255:ia;ka[10]=v<0?0:v>255?255:v;ka[12]=fa<0?0:fa>255?255:fa;ka[13]=la<0?0:la>255?255:la;ka[14]=s<0?0:s>255?255:s;Ia.putImageData(Ra,
+0,0);Na.drawImage(Ha,0,0);return Ja}function Ta(k,B,v){k=(k-B)/(v-B);return k*k*(3-2*k)}function Da(k){k=(k+1)*0.5;return k<0?0:k>1?1:k}function wa(k,B){var v=B.x-k.x,s=B.y-k.y,J=1/Math.sqrt(v*v+s*s);v*=J;s*=J;B.x+=v;B.y+=s;k.x-=v;k.y-=s}var Pa,Va,L,na,xa,Ea,Qa,ca;this.autoClear?this.clear():i.setTransform(1,0,0,-1,j,h);c=e.projectScene($,ra,this.sortElements);(Ma=$.lights.length>0)&&Wa($);Pa=0;for(Va=c.length;Pa<Va;Pa++){L=c[Pa];ea.empty();if(L instanceof THREE.RenderableParticle){q=L;q.x*=j;q.y*=
+h;na=0;for(xa=L.materials.length;na<xa;){ca=L.materials[na++];ca.opacity!=0&&Xa(q,L,ca,$)}}else if(L instanceof THREE.RenderableLine){q=L.v1;A=L.v2;q.positionScreen.x*=j;q.positionScreen.y*=h;A.positionScreen.x*=j;A.positionScreen.y*=h;ea.addPoint(q.positionScreen.x,q.positionScreen.y);ea.addPoint(A.positionScreen.x,A.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=L.materials.length;na<xa;){ca=L.materials[na++];ca.opacity!=0&&Ya(q,A,L,ca,$)}}}else if(L instanceof THREE.RenderableFace3){q=L.v1;
+A=L.v2;E=L.v3;q.positionScreen.x*=j;q.positionScreen.y*=h;A.positionScreen.x*=j;A.positionScreen.y*=h;E.positionScreen.x*=j;E.positionScreen.y*=h;if(L.overdraw){wa(q.positionScreen,A.positionScreen);wa(A.positionScreen,E.positionScreen);wa(E.positionScreen,q.positionScreen)}ea.add3Points(q.positionScreen.x,q.positionScreen.y,A.positionScreen.x,A.positionScreen.y,E.positionScreen.x,E.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=L.meshMaterials.length;na<xa;){ca=L.meshMaterials[na++];if(ca instanceof
+THREE.MeshFaceMaterial){Ea=0;for(Qa=L.faceMaterials.length;Ea<Qa;)(ca=L.faceMaterials[Ea++])&&ca.opacity!=0&&Oa(q,A,E,0,1,2,L,ca,$)}else ca.opacity!=0&&Oa(q,A,E,0,1,2,L,ca,$)}}}else if(L instanceof THREE.RenderableFace4){q=L.v1;A=L.v2;E=L.v3;O=L.v4;q.positionScreen.x*=j;q.positionScreen.y*=h;A.positionScreen.x*=j;A.positionScreen.y*=h;E.positionScreen.x*=j;E.positionScreen.y*=h;O.positionScreen.x*=j;O.positionScreen.y*=h;H.positionScreen.copy(A.positionScreen);r.positionScreen.copy(O.positionScreen);
+if(L.overdraw){wa(q.positionScreen,A.positionScreen);wa(A.positionScreen,O.positionScreen);wa(O.positionScreen,q.positionScreen);wa(E.positionScreen,H.positionScreen);wa(E.positionScreen,r.positionScreen)}ea.addPoint(q.positionScreen.x,q.positionScreen.y);ea.addPoint(A.positionScreen.x,A.positionScreen.y);ea.addPoint(E.positionScreen.x,E.positionScreen.y);ea.addPoint(O.positionScreen.x,O.positionScreen.y);if(ya.instersects(ea)){na=0;for(xa=L.meshMaterials.length;na<xa;){ca=L.meshMaterials[na++];if(ca instanceof
+THREE.MeshFaceMaterial){Ea=0;for(Qa=L.faceMaterials.length;Ea<Qa;)(ca=L.faceMaterials[Ea++])&&ca.opacity!=0&&Ua(q,A,E,O,H,r,L,ca,$)}else ca.opacity!=0&&Ua(q,A,E,O,H,r,L,ca,$)}}}ja.addRectangle(ea)}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 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.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.overdraw=!1;this.uvs=[[]];this.z=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.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};

+ 3 - 2
build/custom/ThreeDOM.js

@@ -49,8 +49,9 @@ THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;thi
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,g=a.x,f=a.y,i=a.z;a=a.w;this.x=b*a+d*g+c*i-e*f;this.y=c*a+d*f+e*g-b*i;this.z=e*a+d*i+b*f-c*g;this.w=d*a-b*g-c*f-e*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-g;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,g=this.x,f=this.y,i=this.z,h=this.w,j=h*c+f*d-i*e,m=h*e+i*c-g*d,l=h*d+g*e-f*c;c=-g*c-f*e-i*d;b.x=j*h+c*-g+m*-i-l*-f;b.y=m*h+c*-f+l*-g-j*-i;b.z=l*h+c*-i+j*-f-m*-g;return b}};
 THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(d),f=Math.sqrt(1-d*d);if(Math.abs(f)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*g)/f;e=Math.sin(e*g)/f;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
+THREE.Face3=function(a,b,c,e,d,g){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,d,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
+THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var g=0;g<a.length;g++)a[g].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 g=0;g<d.hierarchy.length;g++){for(var f=0;f<d.hierarchy[g].keys.length;f++){if(d.hierarchy[g].keys[f].time<
 THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(d){for(var g=0;g<a.length;g++)a[g].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 g=0;g<d.hierarchy.length;g++){for(var f=0;f<d.hierarchy[g].keys.length;f++){if(d.hierarchy[g].keys[f].time<
 0)d.hierarchy[g].keys[f].time=0;if(d.hierarchy[g].keys[f].rot!==undefined&&!(d.hierarchy[g].keys[f].rot instanceof THREE.Quaternion)){var i=d.hierarchy[g].keys[f].rot;d.hierarchy[g].keys[f].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[g].keys[0].morphTargets!==undefined){i={};for(f=0;f<d.hierarchy[g].keys.length;f++)for(var h=0;h<d.hierarchy[g].keys[f].morphTargets.length;h++){var j=d.hierarchy[g].keys[f].morphTargets[h];i[j]=-1}d.hierarchy[g].usedMorphTargets=i;for(f=0;f<d.hierarchy[g].keys.length;f++){var m=
 0)d.hierarchy[g].keys[f].time=0;if(d.hierarchy[g].keys[f].rot!==undefined&&!(d.hierarchy[g].keys[f].rot instanceof THREE.Quaternion)){var i=d.hierarchy[g].keys[f].rot;d.hierarchy[g].keys[f].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[g].keys[0].morphTargets!==undefined){i={};for(f=0;f<d.hierarchy[g].keys.length;f++)for(var h=0;h<d.hierarchy[g].keys[f].morphTargets.length;h++){var j=d.hierarchy[g].keys[f].morphTargets[h];i[j]=-1}d.hierarchy[g].usedMorphTargets=i;for(f=0;f<d.hierarchy[g].keys.length;f++){var m=
 {};for(j in i){for(h=0;h<d.hierarchy[g].keys[f].morphTargets.length;h++)if(d.hierarchy[g].keys[f].morphTargets[h]===j){m[j]=d.hierarchy[g].keys[f].morphTargetsInfluences[h];break}h===d.hierarchy[g].keys[f].morphTargets.length&&(m[j]=0)}d.hierarchy[g].keys[f].morphTargetsInfluences=m}}for(f=1;f<d.hierarchy[g].keys.length;f++)if(d.hierarchy[g].keys[f].time===d.hierarchy[g].keys[f-1].time){d.hierarchy[g].keys.splice(f,1);f--}for(f=1;f<d.hierarchy[g].keys.length;f++)d.hierarchy[g].keys[f].index=f}f=parseInt(d.length*
 {};for(j in i){for(h=0;h<d.hierarchy[g].keys[f].morphTargets.length;h++)if(d.hierarchy[g].keys[f].morphTargets[h]===j){m[j]=d.hierarchy[g].keys[f].morphTargetsInfluences[h];break}h===d.hierarchy[g].keys[f].morphTargets.length&&(m[j]=0)}d.hierarchy[g].keys[f].morphTargetsInfluences=m}}for(f=1;f<d.hierarchy[g].keys.length;f++)if(d.hierarchy[g].keys[f].time===d.hierarchy[g].keys[f-1].time){d.hierarchy[g].keys.splice(f,1);f--}for(f=1;f<d.hierarchy[g].keys.length;f++)d.hierarchy[g].keys[f].index=f}f=parseInt(d.length*

+ 51 - 52
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)};
 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*
 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};
 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(A,s,I,x){x=x.clone().subSelf(s);I=I.clone().subSelf(s);var G=A.clone().subSelf(s);A=x.dot(x);s=x.dot(I);x=x.dot(G);var y=I.dot(I);I=I.dot(G);G=1/(A*y-s*s);y=(y*x-s*I)*G;A=(A*I-s*x)*G;return y>0&&A>0&&y+A<1}var c,e,d,f,g,i,h,j,n,l,
-m,k=a.geometry,q=k.vertices,t=[];c=0;for(e=k.faces.length;c<e;c++){d=k.faces[c];l=this.origin.clone();m=this.direction.clone();h=a.matrixWorld;f=h.multiplyVector3(q[d.a].position.clone());g=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());n=m.dot(j);if(n<0){j=j.dot((new THREE.Vector3).sub(f,l))/n;l=l.addSelf(m.multiplyScalar(j));
-if(d instanceof THREE.Face3){if(b(l,f,g,i)){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};t.push(d)}}else if(d instanceof THREE.Face4&&(b(l,f,g,h)||b(l,g,i,h))){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};t.push(d)}}}return t}};
-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,n,l){i=!1;b=h;c=j;e=n;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()};
-this.add3Points=function(h,j,n,l,m,k){if(i){i=!1;b=h<n?h<m?h:m:n<m?n:m;c=j<l?j<k?j:k:l<k?l:k;e=h>n?h>m?h:m:n>m?n:m;d=j>l?j>k?j:k:l>k?l:k}else{b=h<n?h<m?h<b?h:b:m<b?m:b:n<m?n<b?n:b:m<b?m:b;c=j<l?j<k?j<c?j:c:k<c?k:c:l<k?l<c?l:c:k<c?k:c;e=h>n?h>m?h>e?h:e:m>e?m:e:n>m?n>e?n:e:m>e?m:e;d=j>l?j>k?j>d?j:d:k>d?k:d:l>k?l>d?l: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()?
+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(B,t,K,x){x=x.clone().subSelf(t);K=K.clone().subSelf(t);var G=B.clone().subSelf(t);B=x.dot(x);t=x.dot(K);x=x.dot(G);var C=K.dot(K);K=K.dot(G);G=1/(B*C-t*t);C=(C*x-t*K)*G;B=(B*K-t*x)*G;return C>0&&B>0&&C+B<1}var c,e,d,f,g,i,h,j,m,l,
+n,k=a.geometry,r=k.vertices,u=[];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;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());m=n.dot(j);if(m<0){j=j.dot((new THREE.Vector3).sub(f,l))/m;l=l.addSelf(n.multiplyScalar(j));
+if(d instanceof THREE.Face3){if(b(l,f,g,i)){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};u.push(d)}}else if(d instanceof THREE.Face4&&(b(l,f,g,h)||b(l,g,i,h))){d={distance:this.origin.distanceTo(l),point:l,face:d,object:a};u.push(d)}}}return u}};
+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,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()};
+this.add3Points=function(h,j,m,l,n,k){if(i){i=!1;b=h<m?h<n?h:n:m<n?m:n;c=j<l?j<k?j:k:l<k?l:k;e=h>m?h>n?h:n:m>n?m:n;d=j>l?j>k?j:k:l>k?l:k}else{b=h<m?h<n?h<b?h:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b;c=j<l?j<k?j<c?j:c:k<c?k:c:l<k?l<c?l:c:k<c?k:c;e=h>m?h>n?h>e?h:e:n>e?n:e:m>n?m>e?m:e:n>e?n:e;d=j>l?j>k?j>d?j:d:k>d?k:d:l>k?l>d?l: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}};
 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.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,n,l,m,k,q,t){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,n||1,l||0,m||0,k||0,q||0,t||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,n,l,m,k,q,t){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=n;this.n34=l;this.n41=m;this.n42=k;this.n43=q;this.n44=t;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,m,l,n,k,r,u){this.set(a||1,b||0,c||0,e||0,d||0,f||1,g||0,i||0,h||0,j||0,m||1,l||0,n||0,k||0,r||0,u||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,m,l,n,k,r,u){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=m;this.n34=l;this.n41=n;this.n42=k;this.n43=r;this.n44=u;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*
 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();
 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,n=a.n31,l=a.n32,m=a.n33,k=a.n34,q=a.n41,t=a.n42,A=a.n43,s=a.n44,I=b.n11,x=b.n12,G=b.n13,y=b.n14,p=b.n21,Q=b.n22,
-H=b.n23,P=b.n24,M=b.n31,C=b.n32,u=b.n33,L=b.n34;this.n11=c*I+e*p+d*M;this.n12=c*x+e*Q+d*C;this.n13=c*G+e*H+d*u;this.n14=c*y+e*P+d*L+f;this.n21=g*I+i*p+h*M;this.n22=g*x+i*Q+h*C;this.n23=g*G+i*H+h*u;this.n24=g*y+i*P+h*L+j;this.n31=n*I+l*p+m*M;this.n32=n*x+l*Q+m*C;this.n33=n*G+l*H+m*u;this.n34=n*y+l*P+m*L+k;this.n41=q*I+t*p+A*M;this.n42=q*x+t*Q+A*C;this.n43=q*G+t*H+A*u;this.n44=q*y+t*P+A*L+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]=
+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,m=a.n31,l=a.n32,n=a.n33,k=a.n34,r=a.n41,u=a.n42,B=a.n43,t=a.n44,K=b.n11,x=b.n12,G=b.n13,C=b.n14,p=b.n21,O=b.n22,
+H=b.n23,P=b.n24,M=b.n31,A=b.n32,s=b.n33,L=b.n34;this.n11=c*K+e*p+d*M;this.n12=c*x+e*O+d*A;this.n13=c*G+e*H+d*s;this.n14=c*C+e*P+d*L+f;this.n21=g*K+i*p+h*M;this.n22=g*x+i*O+h*A;this.n23=g*G+i*H+h*s;this.n24=g*C+i*P+h*L+j;this.n31=m*K+l*p+n*M;this.n32=m*x+l*O+n*A;this.n33=m*G+l*H+n*s;this.n34=m*C+l*P+n*L+k;this.n41=r*K+u*p+B*M;this.n42=r*x+u*O+B*A;this.n43=r*G+u*H+B*s;this.n44=r*C+u*P+B*L+t;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.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,n=this.n33,l=this.n34,m=this.n41,k=this.n42,q=this.n43,t=this.n44;return e*g*j*m-c*i*j*m-e*f*n*m+b*i*n*m+c*f*l*m-b*g*l*m-e*g*h*k+c*i*h*k+e*d*n*k-a*i*n*k-c*d*l*k+a*g*l*k+e*f*h*q-b*i*h*q-e*d*j*q+a*i*j*q+b*d*l*q-a*f*l*q-c*f*h*t+b*g*h*t+c*d*j*t-a*g*j*t-b*d*n*t+a*f*n*t},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,m=this.n33,l=this.n34,n=this.n41,k=this.n42,r=this.n43,u=this.n44;return e*g*j*n-c*i*j*n-e*f*m*n+b*i*m*n+c*f*l*n-b*g*l*n-e*g*h*k+c*i*h*k+e*d*m*k-a*i*m*k-c*d*l*k+a*g*l*k+e*f*h*r-b*i*h*r-e*d*j*r+a*i*j*r+b*d*l*r-a*f*l*r-c*f*h*u+b*g*h*u+c*d*j*u-a*g*j*u-b*d*m*u+a*f*m*u},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.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.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,
 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,9 +34,9 @@ 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=
 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.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}};
 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,n=a.n31,l=a.n32,m=a.n33,k=a.n34,q=a.n41,t=a.n42,A=a.n43,s=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*t-j*m*t+j*l*A-i*k*A-h*l*s+i*m*s;b.n12=f*m*t-d*k*t-f*l*A+e*k*A+d*l*s-e*m*s;b.n13=d*j*t-f*h*t+f*i*A-e*j*A-d*i*s+e*h*s;b.n14=f*h*l-d*j*l-f*i*m+e*j*m+d*i*k-e*h*k;b.n21=j*m*q-h*k*q-j*n*A+g*k*A+h*n*s-g*m*s;b.n22=d*k*q-f*m*q+f*n*A-c*k*A-d*n*s+c*m*s;b.n23=f*h*q-d*j*q-f*g*A+c*j*A+d*g*s-c*h*s;
-b.n24=d*j*n-f*h*n+f*g*m-c*j*m-d*g*k+c*h*k;b.n31=i*k*q-j*l*q+j*n*t-g*k*t-i*n*s+g*l*s;b.n32=f*l*q-e*k*q-f*n*t+c*k*t+e*n*s-c*l*s;b.n33=d*j*q-f*i*q+f*g*t-c*j*t-e*g*s+c*i*s;b.n34=f*i*n-e*j*n-f*g*l+c*j*l+e*g*k-c*i*k;b.n41=h*l*q-i*m*q-h*n*t+g*m*t+i*n*A-g*l*A;b.n42=e*m*q-d*l*q+d*n*t-c*m*t-e*n*A+c*l*A;b.n43=d*i*q-e*h*q-d*g*t+c*h*t+e*g*A-c*i*A;b.n44=e*h*n-d*i*n+d*g*l-c*h*l-e*g*m+c*i*m;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,n=-a.n23*a.n11+a.n21*a.n13,l=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*n;c[8]=a*l;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,m=a.n31,l=a.n32,n=a.n33,k=a.n34,r=a.n41,u=a.n42,B=a.n43,t=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*k*u-j*n*u+j*l*B-i*k*B-h*l*t+i*n*t;b.n12=f*n*u-d*k*u-f*l*B+e*k*B+d*l*t-e*n*t;b.n13=d*j*u-f*h*u+f*i*B-e*j*B-d*i*t+e*h*t;b.n14=f*h*l-d*j*l-f*i*n+e*j*n+d*i*k-e*h*k;b.n21=j*n*r-h*k*r-j*m*B+g*k*B+h*m*t-g*n*t;b.n22=d*k*r-f*n*r+f*m*B-c*k*B-d*m*t+c*n*t;b.n23=f*h*r-d*j*r-f*g*B+c*j*B+d*g*t-c*h*t;
+b.n24=d*j*m-f*h*m+f*g*n-c*j*n-d*g*k+c*h*k;b.n31=i*k*r-j*l*r+j*m*u-g*k*u-i*m*t+g*l*t;b.n32=f*l*r-e*k*r-f*m*u+c*k*u+e*m*t-c*l*t;b.n33=d*j*r-f*i*r+f*g*u-c*j*u-e*g*t+c*i*t;b.n34=f*i*m-e*j*m-f*g*l+c*j*l+e*g*k-c*i*k;b.n41=h*l*r-i*n*r-h*m*u+g*n*u+i*m*B-g*l*B;b.n42=e*n*r-d*l*r+d*m*u-c*n*u-e*m*B+c*l*B;b.n43=d*i*r-e*h*r-d*g*u+c*h*u+e*g*B-c*i*B;b.n44=e*h*m-d*i*m+d*g*l-c*h*l-e*g*n+c*i*n;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,m=-a.n23*a.n11+a.n21*a.n13,l=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*m;c[8]=a*l;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.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;
 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;
 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=
 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=
@@ -47,35 +47,34 @@ undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b
 b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
 b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,d=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-d);d=Math.sin(-d);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=e*d;this.w=g*f-i*c;this.x=g*c+i*f;this.y=e*b*f+a*d*c;this.z=a*d*f-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,d=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+d*f+c*i-e*g;this.y=c*a+d*g+e*f-b*i;this.z=e*a+d*i+b*g-c*f;this.w=d*a-b*f-c*g-e*i;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,n=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+n*-i-l*-g;b.y=n*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-n*-f;return b}};
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,d=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*d-i*e,m=h*e+i*c-f*d,l=h*d+f*e-g*c;c=-f*c-g*e-i*d;b.x=j*h+c*-f+m*-i-l*-g;b.y=m*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-m*-f;return b}};
 THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Quaternion.slerp=function(a,b,c,e){var d=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(d)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(d),g=Math.sqrt(1-d*d);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}d=Math.sin((1-e)*f)/g;e=Math.sin(e*f)/g;c.w=a.w*d+b.w*e;c.x=a.x*d+b.x*e;c.y=a.y*d+b.y*e;c.z=a.z*d+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
-THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Face3=function(a,b,c,e,d,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=d instanceof THREE.Color?d:new THREE.Color;this.vertexColors=d instanceof Array?d:[];this.vertexTangents=[];this.materials=f instanceof Array?f:[f];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,d,f,g){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
+THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 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()||
 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=
 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]);
 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(L,N,O,v,B,z,D){f=L.vertices[N].position;g=L.vertices[O].position;i=L.vertices[v].position;h=d[B];j=d[z];n=d[D];l=g.x-f.x;m=i.x-f.x;k=g.y-f.y;q=i.y-f.y;t=g.z-f.z;A=i.z-f.z;s=j.u-h.u;I=n.u-h.u;x=j.v-h.v;G=n.v-h.v;y=1/(s*G-I*x);H.set((G*
-l-x*m)*y,(G*k-x*q)*y,(G*t-x*A)*y);P.set((s*m-I*l)*y,(s*q-I*k)*y,(s*A-I*t)*y);p[N].addSelf(H);p[O].addSelf(H);p[v].addSelf(H);Q[N].addSelf(P);Q[O].addSelf(P);Q[v].addSelf(P)}var b,c,e,d,f,g,i,h,j,n,l,m,k,q,t,A,s,I,x,G,y,p=[],Q=[],H=new THREE.Vector3,P=new THREE.Vector3,M=new THREE.Vector3,C=new THREE.Vector3,u=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){p[b]=new THREE.Vector3;Q[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++){u.copy(this.vertices[b].normal);e=p[b];M.copy(e);M.subSelf(u.multiplyScalar(u.dot(e))).normalize();C.cross(this.vertices[b].normal,e);e=C.dot(Q[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;
+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(z,y,D,q,o,E,I){i=z.vertices[y].position;h=z.vertices[D].position;j=z.vertices[q].position;m=g[o];l=g[E];n=g[I];k=h.x-i.x;r=j.x-i.x;u=h.y-i.y;B=j.y-i.y;t=h.z-i.z;K=j.z-i.z;x=l.u-m.u;G=n.u-m.u;C=l.v-m.v;p=n.v-m.v;O=1/(x*p-G*C);A.set((p*
+k-C*r)*O,(p*u-C*B)*O,(p*t-C*K)*O);s.set((x*r-G*k)*O,(x*B-G*u)*O,(x*K-G*t)*O);P[y].addSelf(A);P[D].addSelf(A);P[q].addSelf(A);M[y].addSelf(s);M[D].addSelf(s);M[q].addSelf(s)}var b,c,e,d,f,g,i,h,j,m,l,n,k,r,u,B,t,K,x,G,C,p,O,H,P=[],M=[],A=new THREE.Vector3,s=new THREE.Vector3,L=new THREE.Vector3,Q=new THREE.Vector3,N=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){P[b]=new THREE.Vector3;M[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];g=this.faceVertexUvs[0][b];
+if(f instanceof THREE.Face3)a(this,f.a,f.b,f.c,0,1,2);else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3)}}var v=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(e=0;e<f.vertexNormals.length;e++){N.copy(f.vertexNormals[e]);d=f[v[e]];H=P[d];L.copy(H);L.subSelf(N.multiplyScalar(N.dot(H))).normalize();Q.cross(f.vertexNormals[e],H);d=Q.dot(M[d]);d=d<0?-1:1;f.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.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(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<
 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<
-0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var n=
-{};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){n[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(n[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=n}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
+0)d.hierarchy[f].keys[g].time=0;if(d.hierarchy[f].keys[g].rot!==undefined&&!(d.hierarchy[f].keys[g].rot instanceof THREE.Quaternion)){var i=d.hierarchy[f].keys[g].rot;d.hierarchy[f].keys[g].rot=new THREE.Quaternion(i[0],i[1],i[2],i[3])}}if(d.hierarchy[f].keys[0].morphTargets!==undefined){i={};for(g=0;g<d.hierarchy[f].keys.length;g++)for(var h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++){var j=d.hierarchy[f].keys[g].morphTargets[h];i[j]=-1}d.hierarchy[f].usedMorphTargets=i;for(g=0;g<d.hierarchy[f].keys.length;g++){var m=
+{};for(j in i){for(h=0;h<d.hierarchy[f].keys[g].morphTargets.length;h++)if(d.hierarchy[f].keys[g].morphTargets[h]===j){m[j]=d.hierarchy[f].keys[g].morphTargetsInfluences[h];break}h===d.hierarchy[f].keys[g].morphTargets.length&&(m[j]=0)}d.hierarchy[f].keys[g].morphTargetsInfluences=m}}for(g=1;g<d.hierarchy[f].keys.length;g++)if(d.hierarchy[f].keys[g].time===d.hierarchy[f].keys[g-1].time){d.hierarchy[f].keys.splice(g,1);g--}for(g=1;g<d.hierarchy[f].keys.length;g++)d.hierarchy[f].keys[g].index=g}g=parseInt(d.length*
 d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};c.LINEAR=
 d.fps,10);d.JIT={};d.JIT.hierarchy=[];for(f=0;f<d.hierarchy.length;f++)d.JIT.hierarchy.push(Array(g));d.initialized=!0}};c.get=function(d){if(typeof d==="string")if(b[d])return b[d];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+d);return null}};c.parse=function(d){var f=[];if(d instanceof THREE.SkinnedMesh)for(var g=0;g<d.bones.length;g++)f.push(d.bones[g]);else e(d,f);return f};var e=function(d,f){f.push(d);for(var g=0;g<d.children.length;g++)e(d.children[g],f)};c.LINEAR=
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
 THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,d;for(c=0;c<e;c++){d=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)d.useQuaternion=!0;d.matrixAutoUpdate=!0;if(d.animationCache===undefined){d.animationCache={};d.animationCache.prevKey={pos:0,rot:0,scl:0};d.animationCache.nextKey={pos:0,rot:0,scl:0};d.animationCache.originalMatrix=
 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)};
 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.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.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,n=this.data.JIT.hierarchy,l,m;this.currentTime+=a*this.timeScale;m=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var k=0,q=this.hierarchy.length;k<q;k++){a=this.hierarchy[k];h=a.animationCache;if(this.JITCompile&&n[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=n[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 t=0;t<3;t++){c=b[t];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=m){if(l<m)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<l;){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<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,d,f,g,i,h,j,m=this.data.JIT.hierarchy,l,n;this.currentTime+=a*this.timeScale;n=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*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&&m[k][j]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=m[k][j];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=m[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 u=0;u<3;u++){c=b[u];g=h.prevKey[c];i=h.nextKey[c];if(i.time<=n){if(l<n)if(this.loop){g=this.data.hierarchy[k].keys[0];for(i=this.getNextKeyWith(c,k,1);i.time<l;){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<
 l)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(l-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]=
 l)}h.prevKey[c]=g;h.nextKey[c]=i}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(l-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===
 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===
-"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;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}}}}if(this.JITCompile&&n[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)n[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
+"rot")THREE.Quaternion.slerp(d,f,a.quaternion,e);else if(c==="scl"){c=a.scale;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}}}}if(this.JITCompile&&m[0][j]===undefined){this.hierarchy[0].update(undefined,!0);for(k=0;k<this.hierarchy.length;k++)m[k][j]=this.hierarchy[k]instanceof THREE.Bone?this.hierarchy[k].skinMatrix.clone():this.hierarchy[k].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,f,g,i,h,j;d=(a.length-1)*b;f=Math.floor(d);d-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=d*d;g=d*c;e[0]=this.interpolate(f[0],i[0],h[0],j[0],d,c,g);e[1]=this.interpolate(f[1],i[1],h[1],j[1],d,c,g);e[2]=this.interpolate(f[2],i[2],h[2],j[2],d,c,g);return e};
 THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],d,f,g,i,h,j;d=(a.length-1)*b;f=Math.floor(d);d-=f;c[0]=f==0?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];i=a[c[1]];h=a[c[2]];j=a[c[3]];c=d*d;g=d*c;e[0]=this.interpolate(f[0],i[0],h[0],j[0],d,c,g);e[1]=this.interpolate(f[1],i[1],h[1],j[1],d,c,g);e[2]=this.interpolate(f[2],i[2],h[2],j[2],d,c,g);return e};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*f+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.interpolate=function(a,b,c,e,d,f,g){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*g+(-3*(b-c)-2*a-e)*f+a*d+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
@@ -121,30 +120,30 @@ 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.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.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.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 C=h[i]=h[i]||new THREE.RenderableVertex;i++;return C}function b(C,u){return u.z-C.z}function c(C,u){var L=0,N=1,O=C.z+C.w,v=u.z+u.w,B=-C.z+C.w,z=-u.z+u.w;if(O>=0&&v>=0&&B>=0&&z>=0)return!0;else if(O<0&&v<0||B<0&&z<0)return!1;else{if(O<0)L=Math.max(L,O/(O-v));else v<0&&(N=Math.min(N,O/(O-v)));if(B<0)L=Math.max(L,B/(B-z));else z<0&&(N=Math.min(N,B/(B-z)));if(N<L)return!1;else{C.lerpSelf(u,L);u.lerpSelf(C,1-N);return!0}}}var e,d,f=[],g,i,h=[],j,n,l=[],m,k=
-[],q,t,A=[],s,I,x=[],G=new THREE.Vector4,y=new THREE.Vector4,p=new THREE.Matrix4,Q=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(C,u){p.multiply(u.projectionMatrix,u.matrixWorldInverse);p.multiplyVector3(C);return C};this.unprojectVector=function(C,u){p.multiply(u.matrixWorld,THREE.Matrix4.makeInvert(u.projectionMatrix));p.multiplyVector3(C);return C};
-this.projectObjects=function(C,u,L){u=[];var N,O,v;d=0;O=C.objects;C=0;for(N=O.length;C<N;C++){v=O[C];var B;if(!(B=!v.visible))if(B=v instanceof THREE.Mesh){a:{B=void 0;for(var z=v.matrixWorld,D=-v.geometry.boundingSphere.radius*Math.max(v.scale.x,Math.max(v.scale.y,v.scale.z)),r=0;r<6;r++){B=H[r].x*z.n14+H[r].y*z.n24+H[r].z*z.n34+H[r].w;if(B<=D){B=!1;break a}}B=!0}B=!B}if(!B){B=f[d]=f[d]||new THREE.RenderableObject;d++;e=B;G.copy(v.position);p.multiplyVector3(G);e.object=v;e.z=G.z;u.push(e)}}L&&
-u.sort(b);return u};this.projectScene=function(C,u,L){var N=[],O=u.near,v=u.far,B,z,D,r,o,E,J,w,F,K,R,U,W,X,S,V,T;I=t=m=n=0;u.matrixAutoUpdate&&u.updateMatrix();C.update(undefined,!1,u);p.multiply(u.projectionMatrix,u.matrixWorldInverse);H[0].set(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);H[1].set(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);H[2].set(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);H[3].set(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);H[4].set(p.n41-p.n31,p.n42-p.n32,
-p.n43-p.n33,p.n44-p.n34);H[5].set(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);for(B=0;B<6;B++){F=H[B];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}F=this.projectObjects(C,u,!0);C=0;for(B=F.length;C<B;C++){K=F[C].object;if(K.visible){R=K.matrixWorld;U=K.matrixRotationWorld;W=K.materials;X=K.overdraw;i=0;if(K instanceof THREE.Mesh){S=K.geometry;r=S.vertices;V=S.faces;S=S.faceVertexUvs;z=0;for(D=r.length;z<D;z++){g=a();g.positionWorld.copy(r[z].position);R.multiplyVector3(g.positionWorld);
-g.positionScreen.copy(g.positionWorld);p.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>O&&g.positionScreen.z<v}r=0;for(z=V.length;r<z;r++){D=V[r];if(D instanceof THREE.Face3){o=h[D.a];E=h[D.b];J=h[D.c];if(o.visible&&E.visible&&J.visible&&(K.doubleSided||K.flipSided!=(J.positionScreen.x-o.positionScreen.x)*(E.positionScreen.y-o.positionScreen.y)-(J.positionScreen.y-o.positionScreen.y)*(E.positionScreen.x-
-o.positionScreen.x)<0)){w=l[n]=l[n]||new THREE.RenderableFace3;n++;j=w;j.v1.copy(o);j.v2.copy(E);j.v3.copy(J)}else continue}else if(D instanceof THREE.Face4){o=h[D.a];E=h[D.b];J=h[D.c];w=h[D.d];if(o.visible&&E.visible&&J.visible&&w.visible&&(K.doubleSided||K.flipSided!=((w.positionScreen.x-o.positionScreen.x)*(E.positionScreen.y-o.positionScreen.y)-(w.positionScreen.y-o.positionScreen.y)*(E.positionScreen.x-o.positionScreen.x)<0||(E.positionScreen.x-J.positionScreen.x)*(w.positionScreen.y-J.positionScreen.y)-
-(E.positionScreen.y-J.positionScreen.y)*(w.positionScreen.x-J.positionScreen.x)<0))){T=k[m]=k[m]||new THREE.RenderableFace4;m++;j=T;j.v1.copy(o);j.v2.copy(E);j.v3.copy(J);j.v4.copy(w)}else continue}j.normalWorld.copy(D.normal);U.multiplyVector3(j.normalWorld);j.centroidWorld.copy(D.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);p.multiplyVector3(j.centroidScreen);J=D.vertexNormals;o=0;for(E=J.length;o<E;o++){w=j.vertexNormalsWorld[o];w.copy(J[o]);U.multiplyVector3(w)}o=
-0;for(E=S.length;o<E;o++)if(T=S[o][r]){J=0;for(w=T.length;J<w;J++)j.uvs[o][J]=T[J]}j.meshMaterials=W;j.faceMaterials=D.materials;j.overdraw=X;j.z=j.centroidScreen.z;N.push(j)}}else if(K instanceof THREE.Line){Q.multiply(p,R);r=K.geometry.vertices;o=a();o.positionScreen.copy(r[0].position);Q.multiplyVector4(o.positionScreen);z=1;for(D=r.length;z<D;z++){o=a();o.positionScreen.copy(r[z].position);Q.multiplyVector4(o.positionScreen);E=h[i-2];P.copy(o.positionScreen);M.copy(E.positionScreen);if(c(P,M)){P.multiplyScalar(1/
-P.w);M.multiplyScalar(1/M.w);R=A[t]=A[t]||new THREE.RenderableLine;t++;q=R;q.v1.positionScreen.copy(P);q.v2.positionScreen.copy(M);q.z=Math.max(P.z,M.z);q.materials=K.materials;N.push(q)}}}else if(K instanceof THREE.Particle){y.set(K.position.x,K.position.y,K.position.z,1);p.multiplyVector4(y);y.z/=y.w;if(y.z>0&&y.z<1){R=x[I]=x[I]||new THREE.RenderableParticle;I++;s=R;s.x=y.x/y.w;s.y=y.y/y.w;s.z=y.z;s.rotation=K.rotation.z;s.scale.x=K.scale.x*Math.abs(s.x-(y.x+u.projectionMatrix.n11)/(y.w+u.projectionMatrix.n14));
-s.scale.y=K.scale.y*Math.abs(s.y-(y.y+u.projectionMatrix.n22)/(y.w+u.projectionMatrix.n24));s.materials=K.materials;N.push(s)}}}}L&&N.sort(b);return N}};
-THREE.SVGRenderer=function(){function a(v,B,z){var D,r,o,E;D=0;for(r=v.lights.length;D<r;D++){o=v.lights[D];if(o instanceof THREE.DirectionalLight){E=B.normalWorld.dot(o.position)*o.intensity;if(E>0){z.r+=o.color.r*E;z.g+=o.color.g*E;z.b+=o.color.b*E}}else if(o instanceof THREE.PointLight){P.sub(o.position,B.centroidWorld);P.normalize();E=B.normalWorld.dot(P)*o.intensity;if(E>0){z.r+=o.color.r*E;z.g+=o.color.g*E;z.b+=o.color.b*E}}}}function b(v,B,z,D,r,o){u=e(L++);u.setAttribute("d","M "+v.positionScreen.x+
-" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+z.positionScreen.x+","+z.positionScreen.y+"z");if(r instanceof THREE.MeshBasicMaterial)x.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshLambertMaterial)if(I){G.r=y.r;G.g=y.g;G.b=y.b;a(o,D,G);x.r=r.color.r*G.r;x.g=r.color.g*G.g;x.b=r.color.b*G.b;x.updateStyleString()}else x.__styleString=r.color.__styleString;else if(r instanceof THREE.MeshDepthMaterial){H=1-r.__2near/(r.__farPlusNear-D.z*r.__farMinusNear);
-x.setRGB(H,H,H)}else r instanceof THREE.MeshNormalMaterial&&x.setRGB(d(D.normalWorld.x),d(D.normalWorld.y),d(D.normalWorld.z));r.wireframe?u.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+r.wireframeLinewidth+"; stroke-opacity: "+r.opacity+"; stroke-linecap: "+r.wireframeLinecap+"; stroke-linejoin: "+r.wireframeLinejoin):u.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+r.opacity);i.appendChild(u)}function c(v,B,z,D,r,o,E){u=e(L++);u.setAttribute("d",
-"M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+B.positionScreen.x+" "+B.positionScreen.y+" L "+z.positionScreen.x+","+z.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");if(o instanceof THREE.MeshBasicMaterial)x.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshLambertMaterial)if(I){G.r=y.r;G.g=y.g;G.b=y.b;a(E,r,G);x.r=o.color.r*G.r;x.g=o.color.g*G.g;x.b=o.color.b*G.b;x.updateStyleString()}else x.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshDepthMaterial){H=
-1-o.__2near/(o.__farPlusNear-r.z*o.__farMinusNear);x.setRGB(H,H,H)}else o instanceof THREE.MeshNormalMaterial&&x.setRGB(d(r.normalWorld.x),d(r.normalWorld.y),d(r.normalWorld.z));o.wireframe?u.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):u.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+o.opacity);i.appendChild(u)}
-function e(v){if(M[v]==null){M[v]=document.createElementNS("http://www.w3.org/2000/svg","path");O==0&&M[v].setAttribute("shape-rendering","crispEdges")}return M[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,n,l,m,k,q,t,A=new THREE.Rectangle,s=new THREE.Rectangle,I=!1,x=new THREE.Color(16777215),G=new THREE.Color(16777215),y=new THREE.Color(0),p=new THREE.Color(0),Q=new THREE.Color(0),
-H,P=new THREE.Vector3,M=[],C=[],u,L,N,O=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(v){switch(v){case "high":O=1;break;case "low":O=0}};this.setSize=function(v,B){h=v;j=B;n=h/2;l=j/2;i.setAttribute("viewBox",-n+" "+-l+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);A.set(-n,-l,n,l)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(v,B){var z,D,r,o,E,J,w,F;this.autoClear&&
-this.clear();f=g.projectScene(v,B,this.sortElements);N=L=0;if(I=v.lights.length>0){w=v.lights;y.setRGB(0,0,0);p.setRGB(0,0,0);Q.setRGB(0,0,0);z=0;for(D=w.length;z<D;z++){r=w[z];o=r.color;if(r instanceof THREE.AmbientLight){y.r+=o.r;y.g+=o.g;y.b+=o.b}else if(r instanceof THREE.DirectionalLight){p.r+=o.r;p.g+=o.g;p.b+=o.b}else if(r instanceof THREE.PointLight){Q.r+=o.r;Q.g+=o.g;Q.b+=o.b}}}z=0;for(D=f.length;z<D;z++){w=f[z];s.empty();if(w instanceof THREE.RenderableParticle){m=w;m.x*=n;m.y*=-l;r=0;for(o=
-w.materials.length;r<o;)r++}else if(w instanceof THREE.RenderableLine){m=w.v1;k=w.v2;m.positionScreen.x*=n;m.positionScreen.y*=-l;k.positionScreen.x*=n;k.positionScreen.y*=-l;s.addPoint(m.positionScreen.x,m.positionScreen.y);s.addPoint(k.positionScreen.x,k.positionScreen.y);if(A.instersects(s)){r=0;for(o=w.materials.length;r<o;)if((F=w.materials[r++])&&F.opacity!=0){E=m;J=k;var K=N++;if(C[K]==null){C[K]=document.createElementNS("http://www.w3.org/2000/svg","line");O==0&&C[K].setAttribute("shape-rendering",
-"crispEdges")}u=C[K];u.setAttribute("x1",E.positionScreen.x);u.setAttribute("y1",E.positionScreen.y);u.setAttribute("x2",J.positionScreen.x);u.setAttribute("y2",J.positionScreen.y);if(F instanceof THREE.LineBasicMaterial){x.__styleString=F.color.__styleString;u.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin);i.appendChild(u)}}}}else if(w instanceof THREE.RenderableFace3){m=
-w.v1;k=w.v2;q=w.v3;m.positionScreen.x*=n;m.positionScreen.y*=-l;k.positionScreen.x*=n;k.positionScreen.y*=-l;q.positionScreen.x*=n;q.positionScreen.y*=-l;s.addPoint(m.positionScreen.x,m.positionScreen.y);s.addPoint(k.positionScreen.x,k.positionScreen.y);s.addPoint(q.positionScreen.x,q.positionScreen.y);if(A.instersects(s)){r=0;for(o=w.meshMaterials.length;r<o;){F=w.meshMaterials[r++];if(F instanceof THREE.MeshFaceMaterial){E=0;for(J=w.faceMaterials.length;E<J;)(F=w.faceMaterials[E++])&&F.opacity!=
-0&&b(m,k,q,w,F,v)}else F&&F.opacity!=0&&b(m,k,q,w,F,v)}}}else if(w instanceof THREE.RenderableFace4){m=w.v1;k=w.v2;q=w.v3;t=w.v4;m.positionScreen.x*=n;m.positionScreen.y*=-l;k.positionScreen.x*=n;k.positionScreen.y*=-l;q.positionScreen.x*=n;q.positionScreen.y*=-l;t.positionScreen.x*=n;t.positionScreen.y*=-l;s.addPoint(m.positionScreen.x,m.positionScreen.y);s.addPoint(k.positionScreen.x,k.positionScreen.y);s.addPoint(q.positionScreen.x,q.positionScreen.y);s.addPoint(t.positionScreen.x,t.positionScreen.y);
-if(A.instersects(s)){r=0;for(o=w.meshMaterials.length;r<o;){F=w.meshMaterials[r++];if(F instanceof THREE.MeshFaceMaterial){E=0;for(J=w.faceMaterials.length;E<J;)(F=w.faceMaterials[E++])&&F.opacity!=0&&c(m,k,q,t,w,F,v)}else F&&F.opacity!=0&&c(m,k,q,t,w,F,v)}}}}}};
+THREE.Projector=function(){function a(){var A=h[i]=h[i]||new THREE.RenderableVertex;i++;return A}function b(A,s){return s.z-A.z}function c(A,s){var L=0,Q=1,N=A.z+A.w,v=s.z+s.w,z=-A.z+A.w,y=-s.z+s.w;if(N>=0&&v>=0&&z>=0&&y>=0)return!0;else if(N<0&&v<0||z<0&&y<0)return!1;else{if(N<0)L=Math.max(L,N/(N-v));else v<0&&(Q=Math.min(Q,N/(N-v)));if(z<0)L=Math.max(L,z/(z-y));else y<0&&(Q=Math.min(Q,z/(z-y)));if(Q<L)return!1;else{A.lerpSelf(s,L);s.lerpSelf(A,1-Q);return!0}}}var e,d,f=[],g,i,h=[],j,m,l=[],n,k=
+[],r,u,B=[],t,K,x=[],G=new THREE.Vector4,C=new THREE.Vector4,p=new THREE.Matrix4,O=new THREE.Matrix4,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(A,s){p.multiply(s.projectionMatrix,s.matrixWorldInverse);p.multiplyVector3(A);return A};this.unprojectVector=function(A,s){p.multiply(s.matrixWorld,THREE.Matrix4.makeInvert(s.projectionMatrix));p.multiplyVector3(A);return A};
+this.projectObjects=function(A,s,L){s=[];var Q,N,v;d=0;N=A.objects;A=0;for(Q=N.length;A<Q;A++){v=N[A];var z;if(!(z=!v.visible))if(z=v instanceof THREE.Mesh){a:{z=void 0;for(var y=v.matrixWorld,D=-v.geometry.boundingSphere.radius*Math.max(v.scale.x,Math.max(v.scale.y,v.scale.z)),q=0;q<6;q++){z=H[q].x*y.n14+H[q].y*y.n24+H[q].z*y.n34+H[q].w;if(z<=D){z=!1;break a}}z=!0}z=!z}if(!z){z=f[d]=f[d]||new THREE.RenderableObject;d++;e=z;G.copy(v.position);p.multiplyVector3(G);e.object=v;e.z=G.z;s.push(e)}}L&&
+s.sort(b);return s};this.projectScene=function(A,s,L){var Q=[],N=s.near,v=s.far,z,y,D,q,o,E,I,w,F,J,R,U,W,X,S,V,T;K=u=n=m=0;s.matrixAutoUpdate&&s.updateMatrix();A.update(undefined,!1,s);p.multiply(s.projectionMatrix,s.matrixWorldInverse);H[0].set(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);H[1].set(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);H[2].set(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);H[3].set(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);H[4].set(p.n41-p.n31,p.n42-p.n32,
+p.n43-p.n33,p.n44-p.n34);H[5].set(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);for(z=0;z<6;z++){F=H[z];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}F=this.projectObjects(A,s,!0);A=0;for(z=F.length;A<z;A++){J=F[A].object;if(J.visible){R=J.matrixWorld;U=J.matrixRotationWorld;W=J.materials;X=J.overdraw;i=0;if(J instanceof THREE.Mesh){S=J.geometry;q=S.vertices;V=S.faces;S=S.faceVertexUvs;y=0;for(D=q.length;y<D;y++){g=a();g.positionWorld.copy(q[y].position);R.multiplyVector3(g.positionWorld);
+g.positionScreen.copy(g.positionWorld);p.multiplyVector4(g.positionScreen);g.positionScreen.x/=g.positionScreen.w;g.positionScreen.y/=g.positionScreen.w;g.visible=g.positionScreen.z>N&&g.positionScreen.z<v}q=0;for(y=V.length;q<y;q++){D=V[q];if(D instanceof THREE.Face3){o=h[D.a];E=h[D.b];I=h[D.c];if(o.visible&&E.visible&&I.visible&&(J.doubleSided||J.flipSided!=(I.positionScreen.x-o.positionScreen.x)*(E.positionScreen.y-o.positionScreen.y)-(I.positionScreen.y-o.positionScreen.y)*(E.positionScreen.x-
+o.positionScreen.x)<0)){w=l[m]=l[m]||new THREE.RenderableFace3;m++;j=w;j.v1.copy(o);j.v2.copy(E);j.v3.copy(I)}else continue}else if(D instanceof THREE.Face4){o=h[D.a];E=h[D.b];I=h[D.c];w=h[D.d];if(o.visible&&E.visible&&I.visible&&w.visible&&(J.doubleSided||J.flipSided!=((w.positionScreen.x-o.positionScreen.x)*(E.positionScreen.y-o.positionScreen.y)-(w.positionScreen.y-o.positionScreen.y)*(E.positionScreen.x-o.positionScreen.x)<0||(E.positionScreen.x-I.positionScreen.x)*(w.positionScreen.y-I.positionScreen.y)-
+(E.positionScreen.y-I.positionScreen.y)*(w.positionScreen.x-I.positionScreen.x)<0))){T=k[n]=k[n]||new THREE.RenderableFace4;n++;j=T;j.v1.copy(o);j.v2.copy(E);j.v3.copy(I);j.v4.copy(w)}else continue}j.normalWorld.copy(D.normal);U.multiplyVector3(j.normalWorld);j.centroidWorld.copy(D.centroid);R.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);p.multiplyVector3(j.centroidScreen);I=D.vertexNormals;o=0;for(E=I.length;o<E;o++){w=j.vertexNormalsWorld[o];w.copy(I[o]);U.multiplyVector3(w)}o=
+0;for(E=S.length;o<E;o++)if(T=S[o][q]){I=0;for(w=T.length;I<w;I++)j.uvs[o][I]=T[I]}j.meshMaterials=W;j.faceMaterials=D.materials;j.overdraw=X;j.z=j.centroidScreen.z;Q.push(j)}}else if(J instanceof THREE.Line){O.multiply(p,R);q=J.geometry.vertices;o=a();o.positionScreen.copy(q[0].position);O.multiplyVector4(o.positionScreen);y=1;for(D=q.length;y<D;y++){o=a();o.positionScreen.copy(q[y].position);O.multiplyVector4(o.positionScreen);E=h[i-2];P.copy(o.positionScreen);M.copy(E.positionScreen);if(c(P,M)){P.multiplyScalar(1/
+P.w);M.multiplyScalar(1/M.w);R=B[u]=B[u]||new THREE.RenderableLine;u++;r=R;r.v1.positionScreen.copy(P);r.v2.positionScreen.copy(M);r.z=Math.max(P.z,M.z);r.materials=J.materials;Q.push(r)}}}else if(J instanceof THREE.Particle){C.set(J.position.x,J.position.y,J.position.z,1);p.multiplyVector4(C);C.z/=C.w;if(C.z>0&&C.z<1){R=x[K]=x[K]||new THREE.RenderableParticle;K++;t=R;t.x=C.x/C.w;t.y=C.y/C.w;t.z=C.z;t.rotation=J.rotation.z;t.scale.x=J.scale.x*Math.abs(t.x-(C.x+s.projectionMatrix.n11)/(C.w+s.projectionMatrix.n14));
+t.scale.y=J.scale.y*Math.abs(t.y-(C.y+s.projectionMatrix.n22)/(C.w+s.projectionMatrix.n24));t.materials=J.materials;Q.push(t)}}}}L&&Q.sort(b);return Q}};
+THREE.SVGRenderer=function(){function a(v,z,y){var D,q,o,E;D=0;for(q=v.lights.length;D<q;D++){o=v.lights[D];if(o instanceof THREE.DirectionalLight){E=z.normalWorld.dot(o.position)*o.intensity;if(E>0){y.r+=o.color.r*E;y.g+=o.color.g*E;y.b+=o.color.b*E}}else if(o instanceof THREE.PointLight){P.sub(o.position,z.centroidWorld);P.normalize();E=z.normalWorld.dot(P)*o.intensity;if(E>0){y.r+=o.color.r*E;y.g+=o.color.g*E;y.b+=o.color.b*E}}}}function b(v,z,y,D,q,o){s=e(L++);s.setAttribute("d","M "+v.positionScreen.x+
+" "+v.positionScreen.y+" L "+z.positionScreen.x+" "+z.positionScreen.y+" L "+y.positionScreen.x+","+y.positionScreen.y+"z");if(q instanceof THREE.MeshBasicMaterial)x.__styleString=q.color.__styleString;else if(q instanceof THREE.MeshLambertMaterial)if(K){G.r=C.r;G.g=C.g;G.b=C.b;a(o,D,G);x.r=q.color.r*G.r;x.g=q.color.g*G.g;x.b=q.color.b*G.b;x.updateStyleString()}else x.__styleString=q.color.__styleString;else if(q instanceof THREE.MeshDepthMaterial){H=1-q.__2near/(q.__farPlusNear-D.z*q.__farMinusNear);
+x.setRGB(H,H,H)}else q instanceof THREE.MeshNormalMaterial&&x.setRGB(d(D.normalWorld.x),d(D.normalWorld.y),d(D.normalWorld.z));q.wireframe?s.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+q.wireframeLinewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframeLinecap+"; stroke-linejoin: "+q.wireframeLinejoin):s.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+q.opacity);i.appendChild(s)}function c(v,z,y,D,q,o,E){s=e(L++);s.setAttribute("d",
+"M "+v.positionScreen.x+" "+v.positionScreen.y+" L "+z.positionScreen.x+" "+z.positionScreen.y+" L "+y.positionScreen.x+","+y.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");if(o instanceof THREE.MeshBasicMaterial)x.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshLambertMaterial)if(K){G.r=C.r;G.g=C.g;G.b=C.b;a(E,q,G);x.r=o.color.r*G.r;x.g=o.color.g*G.g;x.b=o.color.b*G.b;x.updateStyleString()}else x.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshDepthMaterial){H=
+1-o.__2near/(o.__farPlusNear-q.z*o.__farMinusNear);x.setRGB(H,H,H)}else o instanceof THREE.MeshNormalMaterial&&x.setRGB(d(q.normalWorld.x),d(q.normalWorld.y),d(q.normalWorld.z));o.wireframe?s.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):s.setAttribute("style","fill: "+x.__styleString+"; fill-opacity: "+o.opacity);i.appendChild(s)}
+function e(v){if(M[v]==null){M[v]=document.createElementNS("http://www.w3.org/2000/svg","path");N==0&&M[v].setAttribute("shape-rendering","crispEdges")}return M[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,m,l,n,k,r,u,B=new THREE.Rectangle,t=new THREE.Rectangle,K=!1,x=new THREE.Color(16777215),G=new THREE.Color(16777215),C=new THREE.Color(0),p=new THREE.Color(0),O=new THREE.Color(0),
+H,P=new THREE.Vector3,M=[],A=[],s,L,Q,N=1;this.domElement=i;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(v){switch(v){case "high":N=1;break;case "low":N=0}};this.setSize=function(v,z){h=v;j=z;m=h/2;l=j/2;i.setAttribute("viewBox",-m+" "+-l+" "+h+" "+j);i.setAttribute("width",h);i.setAttribute("height",j);B.set(-m,-l,m,l)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(v,z){var y,D,q,o,E,I,w,F;this.autoClear&&
+this.clear();f=g.projectScene(v,z,this.sortElements);Q=L=0;if(K=v.lights.length>0){w=v.lights;C.setRGB(0,0,0);p.setRGB(0,0,0);O.setRGB(0,0,0);y=0;for(D=w.length;y<D;y++){q=w[y];o=q.color;if(q instanceof THREE.AmbientLight){C.r+=o.r;C.g+=o.g;C.b+=o.b}else if(q instanceof THREE.DirectionalLight){p.r+=o.r;p.g+=o.g;p.b+=o.b}else if(q instanceof THREE.PointLight){O.r+=o.r;O.g+=o.g;O.b+=o.b}}}y=0;for(D=f.length;y<D;y++){w=f[y];t.empty();if(w instanceof THREE.RenderableParticle){n=w;n.x*=m;n.y*=-l;q=0;for(o=
+w.materials.length;q<o;)q++}else if(w instanceof THREE.RenderableLine){n=w.v1;k=w.v2;n.positionScreen.x*=m;n.positionScreen.y*=-l;k.positionScreen.x*=m;k.positionScreen.y*=-l;t.addPoint(n.positionScreen.x,n.positionScreen.y);t.addPoint(k.positionScreen.x,k.positionScreen.y);if(B.instersects(t)){q=0;for(o=w.materials.length;q<o;)if((F=w.materials[q++])&&F.opacity!=0){E=n;I=k;var J=Q++;if(A[J]==null){A[J]=document.createElementNS("http://www.w3.org/2000/svg","line");N==0&&A[J].setAttribute("shape-rendering",
+"crispEdges")}s=A[J];s.setAttribute("x1",E.positionScreen.x);s.setAttribute("y1",E.positionScreen.y);s.setAttribute("x2",I.positionScreen.x);s.setAttribute("y2",I.positionScreen.y);if(F instanceof THREE.LineBasicMaterial){x.__styleString=F.color.__styleString;s.setAttribute("style","fill: none; stroke: "+x.__styleString+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin);i.appendChild(s)}}}}else if(w instanceof THREE.RenderableFace3){n=
+w.v1;k=w.v2;r=w.v3;n.positionScreen.x*=m;n.positionScreen.y*=-l;k.positionScreen.x*=m;k.positionScreen.y*=-l;r.positionScreen.x*=m;r.positionScreen.y*=-l;t.addPoint(n.positionScreen.x,n.positionScreen.y);t.addPoint(k.positionScreen.x,k.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);if(B.instersects(t)){q=0;for(o=w.meshMaterials.length;q<o;){F=w.meshMaterials[q++];if(F instanceof THREE.MeshFaceMaterial){E=0;for(I=w.faceMaterials.length;E<I;)(F=w.faceMaterials[E++])&&F.opacity!=
+0&&b(n,k,r,w,F,v)}else F&&F.opacity!=0&&b(n,k,r,w,F,v)}}}else if(w instanceof THREE.RenderableFace4){n=w.v1;k=w.v2;r=w.v3;u=w.v4;n.positionScreen.x*=m;n.positionScreen.y*=-l;k.positionScreen.x*=m;k.positionScreen.y*=-l;r.positionScreen.x*=m;r.positionScreen.y*=-l;u.positionScreen.x*=m;u.positionScreen.y*=-l;t.addPoint(n.positionScreen.x,n.positionScreen.y);t.addPoint(k.positionScreen.x,k.positionScreen.y);t.addPoint(r.positionScreen.x,r.positionScreen.y);t.addPoint(u.positionScreen.x,u.positionScreen.y);
+if(B.instersects(t)){q=0;for(o=w.meshMaterials.length;q<o;){F=w.meshMaterials[q++];if(F instanceof THREE.MeshFaceMaterial){E=0;for(I=w.faceMaterials.length;E<I;)(F=w.faceMaterials[E++])&&F.opacity!=0&&c(n,k,r,u,w,F,v)}else F&&F.opacity!=0&&c(n,k,r,u,w,F,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.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.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.overdraw=!1;this.uvs=[[]];this.z=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};

+ 152 - 152
build/custom/ThreeWebGL.js

@@ -1,85 +1,85 @@
 // ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r36 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,f,i,j,p,n;if(c==0)e=f=i=0;else{j=Math.floor(a*6);p=a*6-j;a=c*(1-b);n=c*(1-b*p);b=c*(1-b*(1-p));switch(j){case 1:e=n;f=c;i=a;break;case 2:e=a;f=c;i=b;break;case 3:e=a;f=n;i=c;break;case 4:e=b;f=a;i=c;break;case 5:e=c;f=a;i=n;break;case 6:case 0:e=c;f=b;i=a}}this.r=e;this.g=f;this.b=i;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var f,e,h,j,p,n;if(c==0)f=e=h=0;else{j=Math.floor(a*6);p=a*6-j;a=c*(1-b);n=c*(1-b*p);b=c*(1-b*(1-p));switch(j){case 1:f=n;e=c;h=a;break;case 2:f=a;e=c;h=b;break;case 3:f=a;e=n;h=c;break;case 4:f=b;e=a;h=c;break;case 5:f=c;e=a;h=n;break;case 6:case 0:f=c;e=b;h=a}}this.r=f;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)}};
 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,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.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/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.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/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.set(c*a.z-e*a.y,e*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,f=this.z;this.set(c*a.z-f*a.y,f*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-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*
+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,f){this.set(a||0,b||0,c||0,f||1)};
+THREE.Vector4.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;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};
 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(O,L,ha,ma){ma=ma.clone().subSelf(L);ha=ha.clone().subSelf(L);var pa=O.clone().subSelf(L);O=ma.dot(ma);L=ma.dot(ha);ma=ma.dot(pa);var R=ha.dot(ha);ha=ha.dot(pa);pa=1/(O*R-L*L);R=(R*ma-L*ha)*pa;O=(O*ha-L*ma)*pa;return R>0&&O>0&&R+O<
-1}var c,e,f,i,j,p,n,s,y,A,D,z=a.geometry,J=z.vertices,K=[];c=0;for(e=z.faces.length;c<e;c++){f=z.faces[c];A=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;i=n.multiplyVector3(J[f.a].position.clone());j=n.multiplyVector3(J[f.b].position.clone());p=n.multiplyVector3(J[f.c].position.clone());n=f instanceof THREE.Face4?n.multiplyVector3(J[f.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(f.normal.clone());y=D.dot(s);if(y<0){s=s.dot((new THREE.Vector3).sub(i,A))/y;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};K.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};K.push(f)}}}return K}};
-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,y,A){p=!1;b=n;c=s;e=y;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,y,A,D,z){if(p){p=!1;b=n<y?n<D?n:D:y<D?y:D;c=s<A?s<z?s:z:A<z?A:z;e=n>y?n>D?n:D:y>D?y:D;f=s>A?s>z?s:z:A>z?A:z}else{b=n<y?n<D?n<b?n:b:D<b?D:b:y<D?y<b?y:b:D<b?D:b;c=s<A?s<z?s<c?s:c:z<c?z:c:A<z?A<c?A:c:z<c?z:c;e=n>y?n>D?n>e?n:e:D>e?D:e:y>D?y>e?y:e:D>e?D:e;f=s>A?s>z?s>f?s:f:z>f?z:f:A>z?A>f?A:f:z>f?z: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.Ray.prototype={intersectScene:function(a){var b,c,f=a.objects,e=[];a=0;for(b=f.length;a<b;a++){c=f[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(h,j){return h.distance-j.distance});return e},intersectObject:function(a){function b(P,L,ja,ma){ma=ma.clone().subSelf(L);ja=ja.clone().subSelf(L);var sa=P.clone().subSelf(L);P=ma.dot(ma);L=ma.dot(ja);ma=ma.dot(sa);var U=ja.dot(ja);ja=ja.dot(sa);sa=1/(P*U-L*L);U=(U*ma-L*ja)*sa;P=(P*ja-L*ma)*sa;return U>0&&P>0&&U+P<
+1}var c,f,e,h,j,p,n,s,x,z,C,y=a.geometry,J=y.vertices,K=[];c=0;for(f=y.faces.length;c<f;c++){e=y.faces[c];z=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;h=n.multiplyVector3(J[e.a].position.clone());j=n.multiplyVector3(J[e.b].position.clone());p=n.multiplyVector3(J[e.c].position.clone());n=e instanceof THREE.Face4?n.multiplyVector3(J[e.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(e.normal.clone());x=C.dot(s);if(x<0){s=s.dot((new THREE.Vector3).sub(h,z))/x;z=z.addSelf(C.multiplyScalar(s));
+if(e instanceof THREE.Face3){if(b(z,h,j,p)){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}else if(e instanceof THREE.Face4&&(b(z,h,j,n)||b(z,j,p,n))){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}}return K}};
+THREE.Rectangle=function(){function a(){h=f-b;j=e-c}var b,c,f,e,h,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return e};this.set=function(n,s,x,z){p=!1;b=n;c=s;f=x;e=z;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;f=n;e=s}else{b=b<n?b:n;c=c<s?c:s;f=f>n?f:n;e=e>s?e:s}a()};
+this.add3Points=function(n,s,x,z,C,y){if(p){p=!1;b=n<x?n<C?n:C:x<C?x:C;c=s<z?s<y?s:y:z<y?z:y;f=n>x?n>C?n:C:x>C?x:C;e=s>z?s>y?s:y:z>y?z:y}else{b=n<x?n<C?n<b?n:b:C<b?C:b:x<C?x<b?x:b:C<b?C:b;c=s<z?s<y?s<c?s:c:y<c?y:c:z<y?z<c?z:c:y<c?y:c;f=n>x?n>C?n>f?n:f:C>f?C:f:x>C?x>f?x:f:C>f?C:f;e=s>z?s>y?s>e?s:e:y>e?y:e:z>y?z>e?z:e:y>e?y:e}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();f=n.getRight();e=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();f=f>n.getRight()?
+f:n.getRight();e=e>n.getBottom()?e:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;f+=n;e+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f<n.getRight()?f:n.getRight();e=e<n.getBottom()?e:n.getBottom();a()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(e,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;e=f=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.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,y,A,D,z,J,K){this.set(a||1,b||0,c||0,e||0,f||0,i||1,j||0,p||0,n||0,s||0,y||1,A||0,D||0,z||0,J||0,K||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,y,A,D,z,J,K){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=y;this.n34=A;this.n41=D;this.n42=z;this.n43=J;this.n44=K;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,y=a.n31,A=a.n32,D=a.n33,z=a.n34,J=a.n41,K=a.n42,O=a.n43,L=a.n44,ha=b.n11,ma=b.n12,pa=b.n13,R=b.n14,B=b.n21,sa=b.n22,
-d=b.n23,Da=b.n24,Aa=b.n31,Q=b.n32,N=b.n33,ta=b.n34;this.n11=c*ha+e*B+f*Aa;this.n12=c*ma+e*sa+f*Q;this.n13=c*pa+e*d+f*N;this.n14=c*R+e*Da+f*ta+i;this.n21=j*ha+p*B+n*Aa;this.n22=j*ma+p*sa+n*Q;this.n23=j*pa+p*d+n*N;this.n24=j*R+p*Da+n*ta+s;this.n31=y*ha+A*B+D*Aa;this.n32=y*ma+A*sa+D*Q;this.n33=y*pa+A*d+D*N;this.n34=y*R+A*Da+D*ta+z;this.n41=J*ha+K*B+O*Aa;this.n42=J*ma+K*sa+O*Q;this.n43=J*pa+K*d+O*N;this.n44=J*R+K*Da+O*ta+L;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;
+THREE.Matrix4=function(a,b,c,f,e,h,j,p,n,s,x,z,C,y,J,K){this.set(a||1,b||0,c||0,f||0,e||0,h||1,j||0,p||0,n||0,s||0,x||1,z||0,C||0,y||0,J||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,f,e,h,j,p,n,s,x,z,C,y,J,K){this.n11=a;this.n12=b;this.n13=c;this.n14=f;this.n21=e;this.n22=h;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=x;this.n34=z;this.n41=C;this.n42=y;this.n43=J;this.n44=K;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 f=THREE.Matrix4.__v1,
+e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}e.cross(h,f).normalize();this.n11=f.x;this.n12=e.x;this.n13=h.x;this.n21=f.y;this.n22=e.y;this.n23=h.y;this.n31=f.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,f=a.z,e=1/(this.n41*b+this.n42*c+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*f+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
+f+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*f+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,f=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*f+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*f+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*f+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*f+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,f=a.z;a.x=b*this.n11+c*this.n12+f*this.n13;a.y=b*this.n21+c*this.n22+f*this.n23;a.z=b*this.n31+c*this.n32+f*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,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44,ja=b.n11,ma=b.n12,sa=b.n13,U=b.n14,A=b.n21,oa=b.n22,
+d=b.n23,Ba=b.n24,Ca=b.n31,Q=b.n32,N=b.n33,pa=b.n34;this.n11=c*ja+f*A+e*Ca;this.n12=c*ma+f*oa+e*Q;this.n13=c*sa+f*d+e*N;this.n14=c*U+f*Ba+e*pa+h;this.n21=j*ja+p*A+n*Ca;this.n22=j*ma+p*oa+n*Q;this.n23=j*sa+p*d+n*N;this.n24=j*U+p*Ba+n*pa+s;this.n31=x*ja+z*A+C*Ca;this.n32=x*ma+z*oa+C*Q;this.n33=x*sa+z*d+C*N;this.n34=x*U+z*Ba+C*pa+y;this.n41=J*ja+K*A+P*Ca;this.n42=J*ma+K*oa+P*Q;this.n43=J*sa+K*d+P*N;this.n44=J*U+K*Ba+P*pa+L;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*=
 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,y=this.n33,A=this.n34,D=this.n41,z=this.n42,J=this.n43,K=this.n44;return e*j*s*D-c*p*s*D-e*i*y*D+b*p*y*D+c*i*A*D-b*j*A*D-e*j*n*z+c*p*n*z+e*f*y*z-a*p*y*z-c*f*A*z+a*j*A*z+e*i*n*J-b*p*n*J-e*f*s*J+a*p*s*J+b*f*A*J-a*i*A*J-c*i*n*K+b*j*n*K+c*f*s*K-a*j*s*K-b*f*y*K+a*i*y*K},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,f=this.n14,e=this.n21,h=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,x=this.n33,z=this.n34,C=this.n41,y=this.n42,J=this.n43,K=this.n44;return f*j*s*C-c*p*s*C-f*h*x*C+b*p*x*C+c*h*z*C-b*j*z*C-f*j*n*y+c*p*n*y+f*e*x*y-a*p*x*y-c*e*z*y+a*j*z*y+f*h*n*J-b*p*n*J-f*e*s*J+a*p*s*J+b*e*z*J-a*h*z*J-c*h*n*K+b*j*n*K+c*e*s*K-a*j*s*K-b*e*x*K+a*h*x*K},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.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;
 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,
 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,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=
-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,y=a.n31,A=a.n32,D=a.n33,z=a.n34,J=a.n41,K=a.n42,O=a.n43,L=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*z*K-s*D*K+s*A*O-p*z*O-n*A*L+p*D*L;b.n12=i*D*K-f*z*K-i*A*O+e*z*O+f*A*L-e*D*L;b.n13=f*s*K-i*n*K+i*p*O-e*s*O-f*p*L+e*n*L;b.n14=i*n*A-f*s*A-i*p*D+e*s*D+f*p*z-e*n*z;b.n21=s*D*J-n*z*J-s*y*O+j*z*O+n*y*L-j*D*L;b.n22=f*z*J-i*D*J+i*y*O-c*z*O-f*y*L+c*D*L;b.n23=i*n*J-f*s*J-i*j*O+c*s*O+f*j*L-c*n*L;
-b.n24=f*s*y-i*n*y+i*j*D-c*s*D-f*j*z+c*n*z;b.n31=p*z*J-s*A*J+s*y*K-j*z*K-p*y*L+j*A*L;b.n32=i*A*J-e*z*J-i*y*K+c*z*K+e*y*L-c*A*L;b.n33=f*s*J-i*p*J+i*j*K-c*s*K-e*j*L+c*p*L;b.n34=i*p*y-e*s*y-i*j*A+c*s*A+e*j*z-c*p*z;b.n41=n*A*J-p*D*J-n*y*K+j*D*K+p*y*O-j*A*O;b.n42=e*D*J-f*A*J+f*y*K-c*D*K-e*y*O+c*A*O;b.n43=f*p*J-e*n*J-f*j*K+c*n*K+e*j*O-c*p*O;b.n44=e*n*y-f*p*y+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,y=-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*y;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;
+0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),f=Math.sin(b),e=
+1-c,h=a.x,j=a.y,p=a.z,n=e*h,s=e*j;this.set(n*h+c,n*j-f*p,n*p+f*j,0,n*j+f*p,s*j+c,s*p-f*h,0,n*p-f*j,s*p+f*h,e*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,f=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=a*c,p=b*c;this.n11=e*h;this.n12=-e*f;this.n13=c;this.n21=p*h+a*f;this.n22=-p*f+a*h;this.n23=-b*e;this.n31=-j*h+b*f;this.n32=j*f+b*h;this.n33=
+a*e;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,f=a.z,e=a.w,h=b+b,j=c+c,p=f+f;a=b*h;var n=b*j;b*=p;var s=c*j;c*=p;f*=p;h*=e;j*=e;e*=p;this.n11=1-(s+f);this.n12=n-e;this.n13=b+j;this.n21=n+e;this.n22=1-(a+f);this.n23=c-h;this.n31=b-j;this.n32=c+h;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,f=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*f;this.n22=a.n22*f;this.n32=a.n32*f;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,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*K-s*C*K+s*z*P-p*y*P-n*z*L+p*C*L;b.n12=h*C*K-e*y*K-h*z*P+f*y*P+e*z*L-f*C*L;b.n13=e*s*K-h*n*K+h*p*P-f*s*P-e*p*L+f*n*L;b.n14=h*n*z-e*s*z-h*p*C+f*s*C+e*p*y-f*n*y;b.n21=s*C*J-n*y*J-s*x*P+j*y*P+n*x*L-j*C*L;b.n22=e*y*J-h*C*J+h*x*P-c*y*P-e*x*L+c*C*L;b.n23=h*n*J-e*s*J-h*j*P+c*s*P+e*j*L-c*n*L;
+b.n24=e*s*x-h*n*x+h*j*C-c*s*C-e*j*y+c*n*y;b.n31=p*y*J-s*z*J+s*x*K-j*y*K-p*x*L+j*z*L;b.n32=h*z*J-f*y*J-h*x*K+c*y*K+f*x*L-c*z*L;b.n33=e*s*J-h*p*J+h*j*K-c*s*K-f*j*L+c*p*L;b.n34=h*p*x-f*s*x-h*j*z+c*s*z+f*j*y-c*p*y;b.n41=n*z*J-p*C*J-n*x*K+j*C*K+p*x*P-j*z*P;b.n42=f*C*J-e*z*J+e*x*K-c*C*K-f*x*P+c*z*P;b.n43=e*p*J-f*n*J-e*j*K+c*n*K+f*j*P-c*p*P;b.n44=f*n*x-e*p*x+e*j*z-c*n*z-f*j*C+c*p*C;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,f=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,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,x=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*f;c[1]=a*e;c[2]=a*h;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*x;c[8]=a*z;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,f,e,h){var j;j=new THREE.Matrix4;j.n11=2*e/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*e/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+e)/(h-e);j.n34=-2*h*e/(h-e);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,f){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,f)};
+THREE.Matrix4.makeOrtho=function(a,b,c,f,e,h){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-f;s=h-e;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+f)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((h+e)/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;
 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=
 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};
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.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!==
 THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.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 b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,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!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,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,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
-b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-f);f=Math.sin(-f);var i=Math.cos(c);c=Math.sin(c);var j=a*b,p=e*f;this.w=j*i-p*c;this.x=j*c+p*i;this.y=e*b*i+a*f*c;this.z=a*f*i-e*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,e=this.z,f=this.w,i=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+f*i+c*p-e*j;this.y=c*a+f*j+e*i-b*p;this.z=e*a+f*p+b*j-c*i;this.w=f*a-b*i-c*j-e*p;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,i=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*f-p*e,y=n*e+p*c-i*f,A=n*f+i*e-j*c;c=-i*c-j*e-p*f;b.x=s*n+c*-i+y*-p-A*-j;b.y=y*n+c*-j+A*-i-s*-p;b.z=A*n+c*-p+s*-j-y*-i;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-e)*i)/j;e=Math.sin(e*i)/j;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,e,f,i){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,e,f,i,j){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
-THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+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,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var f=this.children.length;a<f;a++)this.children[a].update(this.matrixWorld,
+b,c)}};THREE.Quaternion=function(a,b,c,f){this.set(a||0,b||0,c||0,f!==undefined?f:1)};
+THREE.Quaternion.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,f=a.y*b,e=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var j=a*b,p=f*e;this.w=j*h-p*c;this.x=j*c+p*h;this.y=f*b*h+a*e*c;this.z=a*e*h-f*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,f=this.z,e=this.w,h=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+e*h+c*p-f*j;this.y=c*a+e*j+f*h-b*p;this.z=f*a+e*p+b*j-c*h;this.w=e*a-b*h-c*j-f*p;return this},
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,f=a.y,e=a.z,h=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*e-p*f,x=n*f+p*c-h*e,z=n*e+h*f-j*c;c=-h*c-j*f-p*e;b.x=s*n+c*-h+x*-p-z*-j;b.y=x*n+c*-j+z*-h-s*-p;b.z=z*n+c*-p+s*-j-x*-h;return b}};
+THREE.Quaternion.slerp=function(a,b,c,f){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),j=Math.sqrt(1-e*e);if(Math.abs(j)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=a.w*e+b.w*f;c.x=a.x*e+b.x*f;c.y=a.y*e+b.y*f;c.z=a.z*e+b.z*f;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,f,e,h){this.a=a;this.b=b;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,f,e,h,j){this.a=a;this.b=b;this.c=c;this.d=f;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.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
+THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-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(ta,ua,Ba,ia,V,ja,ka){i=ta.vertices[ua].position;j=ta.vertices[Ba].position;p=ta.vertices[ia].position;n=f[V];s=f[ja];y=f[ka];A=j.x-i.x;D=p.x-i.x;z=j.y-i.y;J=p.y-i.y;K=j.z-i.z;O=p.z-i.z;L=s.u-n.u;ha=y.u-n.u;ma=s.v-n.v;pa=y.v-n.v;R=1/(L*
-pa-ha*ma);d.set((pa*A-ma*D)*R,(pa*z-ma*J)*R,(pa*K-ma*O)*R);Da.set((L*D-ha*A)*R,(L*J-ha*z)*R,(L*O-ha*K)*R);B[ua].addSelf(d);B[Ba].addSelf(d);B[ia].addSelf(d);sa[ua].addSelf(Da);sa[Ba].addSelf(Da);sa[ia].addSelf(Da)}var b,c,e,f,i,j,p,n,s,y,A,D,z,J,K,O,L,ha,ma,pa,R,B=[],sa=[],d=new THREE.Vector3,Da=new THREE.Vector3,Aa=new THREE.Vector3,Q=new THREE.Vector3,N=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){B[b]=new THREE.Vector3;sa[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++){N.copy(this.vertices[b].normal);e=B[b];Aa.copy(e);Aa.subSelf(N.multiplyScalar(N.dot(e))).normalize();Q.cross(this.vertices[b].normal,e);e=Q.dot(sa[b]);e=e<0?-1:1;this.vertices[b].tangent.set(Aa.x,Aa.y,Aa.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<
-0)f.hierarchy[i].keys[j].time=0;if(f.hierarchy[i].keys[j].rot!==undefined&&!(f.hierarchy[i].keys[j].rot instanceof THREE.Quaternion)){var p=f.hierarchy[i].keys[j].rot;f.hierarchy[i].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(f.hierarchy[i].keys[0].morphTargets!==undefined){p={};for(j=0;j<f.hierarchy[i].keys.length;j++)for(var n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++){var s=f.hierarchy[i].keys[j].morphTargets[n];p[s]=-1}f.hierarchy[i].usedMorphTargets=p;for(j=0;j<f.hierarchy[i].keys.length;j++){var y=
-{};for(s in p){for(n=0;n<f.hierarchy[i].keys[j].morphTargets.length;n++)if(f.hierarchy[i].keys[j].morphTargets[n]===s){y[s]=f.hierarchy[i].keys[j].morphTargetsInfluences[n];break}n===f.hierarchy[i].keys[j].morphTargets.length&&(y[s]=0)}f.hierarchy[i].keys[j].morphTargetsInfluences=y}}for(j=1;j<f.hierarchy[i].keys.length;j++)if(f.hierarchy[i].keys[j].time===f.hierarchy[i].keys[j-1].time){f.hierarchy[i].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[i].keys.length;j++)f.hierarchy[i].keys[j].index=j}j=parseInt(f.length*
-f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(i=0;i<f.hierarchy.length;i++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};c.get=function(f){if(typeof f==="string")if(b[f])return b[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};c.parse=function(f){var i=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)i.push(f.bones[j]);else e(f,i);return i};var e=function(f,i){i.push(f);for(var j=0;j<f.children.length;j++)e(f.children[j],i)};c.LINEAR=
-0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
-f instanceof THREE.Bone?f.skinMatrix:f.matrix}var i=f.animationCache.prevKey;f=f.animationCache.nextKey;i.pos=this.data.hierarchy[c].keys[0];i.rot=this.data.hierarchy[c].keys[0];i.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,f,e,h,j,p=new THREE.Vector3,n=new THREE.Vector3;f=0;for(e=this.faces.length;f<e;f++){h=this.faces[f];if(a&&h.vertexNormals.length){p.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)p.addSelf(h.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];p.sub(j.position,c.position);n.sub(b.position,c.position);p.crossSelf(n)}p.isZero()||
+p.normalize();h.normal.copy(p)}},computeVertexNormals:function(){var a,b,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[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{f=
+this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)f[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(f[c.a]);
+c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function a(V,ha,ia,W,S,ta,ka){p=V.vertices[ha].position;n=V.vertices[ia].position;s=V.vertices[W].position;x=j[S];z=j[ta];C=j[ka];y=n.x-p.x;J=s.x-p.x;K=n.y-p.y;P=s.y-p.y;L=n.z-p.z;ja=s.z-p.z;ma=z.u-x.u;sa=C.u-x.u;U=z.v-x.v;A=C.v-x.v;oa=1/(ma*A-sa*
+U);Q.set((A*y-U*J)*oa,(A*K-U*P)*oa,(A*L-U*ja)*oa);N.set((ma*J-sa*y)*oa,(ma*P-sa*K)*oa,(ma*ja-sa*L)*oa);Ba[ha].addSelf(Q);Ba[ia].addSelf(Q);Ba[W].addSelf(Q);Ca[ha].addSelf(N);Ca[ia].addSelf(N);Ca[W].addSelf(N)}var b,c,f,e,h,j,p,n,s,x,z,C,y,J,K,P,L,ja,ma,sa,U,A,oa,d,Ba=[],Ca=[],Q=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,ya=new THREE.Vector3,Da=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){Ba[b]=new THREE.Vector3;Ca[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){h=
+this.faces[b];j=this.faceVertexUvs[0][b];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var qa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(f=0;f<h.vertexNormals.length;f++){Da.copy(h.vertexNormals[f]);e=h[qa[f]];d=Ba[e];pa.copy(d);pa.subSelf(Da.multiplyScalar(Da.dot(d))).normalize();ya.cross(h.vertexNormals[f],d);e=ya.dot(Ca[e]);e=e<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(pa.x,
+pa.y,pa.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(e){for(var h=0;h<a.length;h++)a[h].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 h=0;h<e.hierarchy.length;h++){for(var j=0;j<e.hierarchy[h].keys.length;j++){if(e.hierarchy[h].keys[j].time<
+0)e.hierarchy[h].keys[j].time=0;if(e.hierarchy[h].keys[j].rot!==undefined&&!(e.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var p=e.hierarchy[h].keys[j].rot;e.hierarchy[h].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(e.hierarchy[h].keys[0].morphTargets!==undefined){p={};for(j=0;j<e.hierarchy[h].keys.length;j++)for(var n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++){var s=e.hierarchy[h].keys[j].morphTargets[n];p[s]=-1}e.hierarchy[h].usedMorphTargets=p;for(j=0;j<e.hierarchy[h].keys.length;j++){var x=
+{};for(s in p){for(n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++)if(e.hierarchy[h].keys[j].morphTargets[n]===s){x[s]=e.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===e.hierarchy[h].keys[j].morphTargets.length&&(x[s]=0)}e.hierarchy[h].keys[j].morphTargetsInfluences=x}}for(j=1;j<e.hierarchy[h].keys.length;j++)if(e.hierarchy[h].keys[j].time===e.hierarchy[h].keys[j-1].time){e.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<e.hierarchy[h].keys.length;j++)e.hierarchy[h].keys[j].index=j}j=parseInt(e.length*
+e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(h=0;h<e.hierarchy.length;h++)e.JIT.hierarchy.push(Array(j));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var h=[];if(e instanceof THREE.SkinnedMesh)for(var j=0;j<e.bones.length;j++)h.push(e.bones[j]);else f(e,h);return h};var f=function(e,h){h.push(e);for(var j=0;j<e.children.length;j++)f(e.children[j],h)};c.LINEAR=
+0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,f){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,f=this.hierarchy.length,e;for(c=0;c<f;c++){e=this.hierarchy[c];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 h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];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.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.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,y=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 z=0,J=this.hierarchy.length;z<J;z++){a=this.hierarchy[z];n=a.animationCache;if(this.JITCompile&&y[z][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=y[z][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=y[z][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 K=0;K<3;K++){c=b[K];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=D){if(A<D)if(this.loop){j=this.data.hierarchy[z].keys[0];for(p=this.getNextKeyWith(c,z,1);p.time<A;){j=p;p=this.getNextKeyWith(c,z,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,z,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 "+z);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",z,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",z,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&&y[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)y[z][s]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,i,j,p,n,s;f=(a.length-1)*b;i=Math.floor(f);f-=i;c[0]=i==0?i:i-1;c[1]=i;c[2]=i>a.length-2?i:i+1;c[3]=i>a.length-3?i:i+2;i=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=f*f;j=f*c;e[0]=this.interpolate(i[0],p[0],n[0],s[0],f,c,j);e[1]=this.interpolate(i[1],p[1],n[1],s[1],f,c,j);e[2]=this.interpolate(i[2],p[2],n[2],s[2],f,c,j);return e};
-THREE.Animation.prototype.interpolate=function(a,b,c,e,f,i,j){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*j+(-3*(b-c)-2*a-e)*i+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<e.length-1?c:e.length-1;else c%=e.length;for(;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
-THREE.Camera=function(a,b,c,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=e||2E3;this.target=f||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.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,f,e,h,j,p,n,s,x=this.data.JIT.hierarchy,z,C;this.currentTime+=a*this.timeScale;C=this.currentTime;z=this.currentTime%=this.data.length;s=parseInt(Math.min(z*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,J=this.hierarchy.length;y<J;y++){a=this.hierarchy[y];n=a.animationCache;if(this.JITCompile&&x[y][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=x[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 K=0;K<3;K++){c=b[K];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=C){if(z<C)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<z;){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<
+z)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(z-j.time)/(p.time-j.time);e=j[c];h=p[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+y);f=f<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}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]=e;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",y,p.index+1).pos;f=f*0.33+0.33;e=this.interpolateCatmullRom(this.points,f);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,f,0)}}}else if(c===
+"rot")THREE.Quaternion.slerp(e,h,a.quaternion,f);else if(c==="scl"){c=a.scale;c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}}}}if(this.JITCompile&&x[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)x[y][s]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],f=[],e,h,j,p,n,s;e=(a.length-1)*b;h=Math.floor(e);e-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=e*e;j=e*c;f[0]=this.interpolate(h[0],p[0],n[0],s[0],e,c,j);f[1]=this.interpolate(h[1],p[1],n[1],s[1],e,c,j);f[2]=this.interpolate(h[2],p[2],n[2],s[2],e,c,j);return f};
+THREE.Animation.prototype.interpolate=function(a,b,c,f,e,h,j){a=(c-a)*0.5;f=(f-b)*0.5;return(2*(b-c)+a+f)*j+(-3*(b-c)-2*a-f)*h+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[f.length-1]};
+THREE.Camera=function(a,b,c,f,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=f||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,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.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)};
 THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.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)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
 !1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
@@ -109,48 +109,48 @@ undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.unifor
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 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=
 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}};
 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.Texture=function(a,b,c,e,f,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=i!==undefined?i: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,b,c,f,e,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f: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.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.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
 THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var b,c,e,f={};for(b in a){f[b]={};for(c in a[b]){e=a[b][c];f[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var b,c,e,f={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(c in e)f[c]=e[c]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+var Uniforms={clone:function(a){var b,c,f,e={};for(b in a){e[b]={};for(c in a[b]){f=a[b][c];e[b][c]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return e},merge:function(a){var b,c,f,e={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(c in f)e[c]=f[c]}return e}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 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=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,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(f=0;f<e;f++)this.children[f].update(this.skinMatrix,
 b,c)};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;
 b,c)};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,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,i,j,p;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];i=f.pos;j=f.rotq;p=f.scl;e=this.addBone();e.name=f.name;e.position.set(i[0],i[1],i[2]);e.quaternion.set(j[0],j[1],j[2],j[3]);e.useQuaternion=!0;p!==undefined?e.scale.set(p[0],p[1],p[2]):e.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];
-e=this.bones[c];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}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,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,f,e,h,j,p;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];h=e.pos;j=e.rotq;p=e.scl;f=this.addBone();f.name=e.name;f.position.set(h[0],h[1],h[2]);f.quaternion.set(j[0],j[1],j[2],j[3]);f.useQuaternion=!0;p!==undefined?f.scale.set(p[0],p[1],p[2]):f.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){e=this.geometry.bones[c];
+f=this.bones[c];e.parent===-1?this.addChild(f):this.bones[e.parent].addChild(f)}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,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
 b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 b*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,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,i=this.geometry.skinIndices[a].y;
-e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[i].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
+f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[e].multiplyVector3(f));f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(f));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
 THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
 THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
-THREE.Sound=function(a,b,c,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var f;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)f=
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)f="audio/ogg";else b.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);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;
+THREE.Sound=function(a,b,c,f){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
+"audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.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;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
 THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
 THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
-THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible=
-!1;this.LODs[e].object3D.visible=!0}else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(a>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
+!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 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.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.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.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 Q=n[p]=n[p]||new THREE.RenderableVertex;p++;return Q}function b(Q,N){return N.z-Q.z}function c(Q,N){var ta=0,ua=1,Ba=Q.z+Q.w,ia=N.z+N.w,V=-Q.z+Q.w,ja=-N.z+N.w;if(Ba>=0&&ia>=0&&V>=0&&ja>=0)return!0;else if(Ba<0&&ia<0||V<0&&ja<0)return!1;else{if(Ba<0)ta=Math.max(ta,Ba/(Ba-ia));else ia<0&&(ua=Math.min(ua,Ba/(Ba-ia)));if(V<0)ta=Math.max(ta,V/(V-ja));else ja<0&&(ua=Math.min(ua,V/(V-ja)));if(ua<ta)return!1;else{Q.lerpSelf(N,ta);N.lerpSelf(Q,1-ua);return!0}}}var e,
-f,i=[],j,p,n=[],s,y,A=[],D,z=[],J,K,O=[],L,ha,ma=[],pa=new THREE.Vector4,R=new THREE.Vector4,B=new THREE.Matrix4,sa=new THREE.Matrix4,d=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Vector4,Aa=new THREE.Vector4;this.projectVector=function(Q,N){B.multiply(N.projectionMatrix,N.matrixWorldInverse);B.multiplyVector3(Q);return Q};this.unprojectVector=function(Q,N){B.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
-B.multiplyVector3(Q);return Q};this.projectObjects=function(Q,N,ta){N=[];var ua,Ba,ia;f=0;Ba=Q.objects;Q=0;for(ua=Ba.length;Q<ua;Q++){ia=Ba[Q];var V;if(!(V=!ia.visible))if(V=ia instanceof THREE.Mesh){a:{V=void 0;for(var ja=ia.matrixWorld,ka=-ia.geometry.boundingSphere.radius*Math.max(ia.scale.x,Math.max(ia.scale.y,ia.scale.z)),X=0;X<6;X++){V=d[X].x*ja.n14+d[X].y*ja.n24+d[X].z*ja.n34+d[X].w;if(V<=ka){V=!1;break a}}V=!0}V=!V}if(!V){V=i[f]=i[f]||new THREE.RenderableObject;f++;e=V;pa.copy(ia.position);
-B.multiplyVector3(pa);e.object=ia;e.z=pa.z;N.push(e)}}ta&&N.sort(b);return N};this.projectScene=function(Q,N,ta){var ua=[],Ba=N.near,ia=N.far,V,ja,ka,X,S,xa,na,ya,Ka,la,Na,Va,g,m,o,h,k;ha=K=D=y=0;N.matrixAutoUpdate&&N.updateMatrix();Q.update(undefined,!1,N);B.multiply(N.projectionMatrix,N.matrixWorldInverse);d[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);d[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);d[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);d[3].set(B.n41-B.n21,
-B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);d[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);d[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(V=0;V<6;V++){Ka=d[V];Ka.divideScalar(Math.sqrt(Ka.x*Ka.x+Ka.y*Ka.y+Ka.z*Ka.z))}Ka=this.projectObjects(Q,N,!0);Q=0;for(V=Ka.length;Q<V;Q++){la=Ka[Q].object;if(la.visible){Na=la.matrixWorld;Va=la.matrixRotationWorld;g=la.materials;m=la.overdraw;p=0;if(la instanceof THREE.Mesh){o=la.geometry;X=o.vertices;h=o.faces;o=o.faceVertexUvs;ja=0;for(ka=X.length;ja<
-ka;ja++){j=a();j.positionWorld.copy(X[ja].position);Na.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>Ba&&j.positionScreen.z<ia}X=0;for(ja=h.length;X<ja;X++){ka=h[X];if(ka instanceof THREE.Face3){S=n[ka.a];xa=n[ka.b];na=n[ka.c];if(S.visible&&xa.visible&&na.visible&&(la.doubleSided||la.flipSided!=(na.positionScreen.x-S.positionScreen.x)*
-(xa.positionScreen.y-S.positionScreen.y)-(na.positionScreen.y-S.positionScreen.y)*(xa.positionScreen.x-S.positionScreen.x)<0)){ya=A[y]=A[y]||new THREE.RenderableFace3;y++;s=ya;s.v1.copy(S);s.v2.copy(xa);s.v3.copy(na)}else continue}else if(ka instanceof THREE.Face4){S=n[ka.a];xa=n[ka.b];na=n[ka.c];ya=n[ka.d];if(S.visible&&xa.visible&&na.visible&&ya.visible&&(la.doubleSided||la.flipSided!=((ya.positionScreen.x-S.positionScreen.x)*(xa.positionScreen.y-S.positionScreen.y)-(ya.positionScreen.y-S.positionScreen.y)*
-(xa.positionScreen.x-S.positionScreen.x)<0||(xa.positionScreen.x-na.positionScreen.x)*(ya.positionScreen.y-na.positionScreen.y)-(xa.positionScreen.y-na.positionScreen.y)*(ya.positionScreen.x-na.positionScreen.x)<0))){k=z[D]=z[D]||new THREE.RenderableFace4;D++;s=k;s.v1.copy(S);s.v2.copy(xa);s.v3.copy(na);s.v4.copy(ya)}else continue}s.normalWorld.copy(ka.normal);Va.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ka.centroid);Na.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);
-B.multiplyVector3(s.centroidScreen);na=ka.vertexNormals;S=0;for(xa=na.length;S<xa;S++){ya=s.vertexNormalsWorld[S];ya.copy(na[S]);Va.multiplyVector3(ya)}S=0;for(xa=o.length;S<xa;S++)if(k=o[S][X]){na=0;for(ya=k.length;na<ya;na++)s.uvs[S][na]=k[na]}s.meshMaterials=g;s.faceMaterials=ka.materials;s.overdraw=m;s.z=s.centroidScreen.z;ua.push(s)}}else if(la instanceof THREE.Line){sa.multiply(B,Na);X=la.geometry.vertices;S=a();S.positionScreen.copy(X[0].position);sa.multiplyVector4(S.positionScreen);ja=1;
-for(ka=X.length;ja<ka;ja++){S=a();S.positionScreen.copy(X[ja].position);sa.multiplyVector4(S.positionScreen);xa=n[p-2];Da.copy(S.positionScreen);Aa.copy(xa.positionScreen);if(c(Da,Aa)){Da.multiplyScalar(1/Da.w);Aa.multiplyScalar(1/Aa.w);Na=O[K]=O[K]||new THREE.RenderableLine;K++;J=Na;J.v1.positionScreen.copy(Da);J.v2.positionScreen.copy(Aa);J.z=Math.max(Da.z,Aa.z);J.materials=la.materials;ua.push(J)}}}else if(la instanceof THREE.Particle){R.set(la.position.x,la.position.y,la.position.z,1);B.multiplyVector4(R);
-R.z/=R.w;if(R.z>0&&R.z<1){Na=ma[ha]=ma[ha]||new THREE.RenderableParticle;ha++;L=Na;L.x=R.x/R.w;L.y=R.y/R.w;L.z=R.z;L.rotation=la.rotation.z;L.scale.x=la.scale.x*Math.abs(L.x-(R.x+N.projectionMatrix.n11)/(R.w+N.projectionMatrix.n14));L.scale.y=la.scale.y*Math.abs(L.y-(R.y+N.projectionMatrix.n22)/(R.w+N.projectionMatrix.n24));L.materials=la.materials;ua.push(L)}}}}ta&&ua.sort(b);return ua}};
-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.Projector=function(){function a(){var Q=n[p]=n[p]||new THREE.RenderableVertex;p++;return Q}function b(Q,N){return N.z-Q.z}function c(Q,N){var pa=0,ya=1,Da=Q.z+Q.w,qa=N.z+N.w,V=-Q.z+Q.w,ha=-N.z+N.w;if(Da>=0&&qa>=0&&V>=0&&ha>=0)return!0;else if(Da<0&&qa<0||V<0&&ha<0)return!1;else{if(Da<0)pa=Math.max(pa,Da/(Da-qa));else qa<0&&(ya=Math.min(ya,Da/(Da-qa)));if(V<0)pa=Math.max(pa,V/(V-ha));else ha<0&&(ya=Math.min(ya,V/(V-ha)));if(ya<pa)return!1;else{Q.lerpSelf(N,pa);N.lerpSelf(Q,1-ya);return!0}}}var f,
+e,h=[],j,p,n=[],s,x,z=[],C,y=[],J,K,P=[],L,ja,ma=[],sa=new THREE.Vector4,U=new THREE.Vector4,A=new THREE.Matrix4,oa=new THREE.Matrix4,d=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Vector4,Ca=new THREE.Vector4;this.projectVector=function(Q,N){A.multiply(N.projectionMatrix,N.matrixWorldInverse);A.multiplyVector3(Q);return Q};this.unprojectVector=function(Q,N){A.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
+A.multiplyVector3(Q);return Q};this.projectObjects=function(Q,N,pa){N=[];var ya,Da,qa;e=0;Da=Q.objects;Q=0;for(ya=Da.length;Q<ya;Q++){qa=Da[Q];var V;if(!(V=!qa.visible))if(V=qa instanceof THREE.Mesh){a:{V=void 0;for(var ha=qa.matrixWorld,ia=-qa.geometry.boundingSphere.radius*Math.max(qa.scale.x,Math.max(qa.scale.y,qa.scale.z)),W=0;W<6;W++){V=d[W].x*ha.n14+d[W].y*ha.n24+d[W].z*ha.n34+d[W].w;if(V<=ia){V=!1;break a}}V=!0}V=!V}if(!V){V=h[e]=h[e]||new THREE.RenderableObject;e++;f=V;sa.copy(qa.position);
+A.multiplyVector3(sa);f.object=qa;f.z=sa.z;N.push(f)}}pa&&N.sort(b);return N};this.projectScene=function(Q,N,pa){var ya=[],Da=N.near,qa=N.far,V,ha,ia,W,S,ta,ka,za,La,la,Na,Wa,g,m,o,i,k;ja=K=C=x=0;N.matrixAutoUpdate&&N.updateMatrix();Q.update(undefined,!1,N);A.multiply(N.projectionMatrix,N.matrixWorldInverse);d[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);d[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);d[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);d[3].set(A.n41-A.n21,
+A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);d[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);d[5].set(A.n41+A.n31,A.n42+A.n32,A.n43+A.n33,A.n44+A.n34);for(V=0;V<6;V++){La=d[V];La.divideScalar(Math.sqrt(La.x*La.x+La.y*La.y+La.z*La.z))}La=this.projectObjects(Q,N,!0);Q=0;for(V=La.length;Q<V;Q++){la=La[Q].object;if(la.visible){Na=la.matrixWorld;Wa=la.matrixRotationWorld;g=la.materials;m=la.overdraw;p=0;if(la instanceof THREE.Mesh){o=la.geometry;W=o.vertices;i=o.faces;o=o.faceVertexUvs;ha=0;for(ia=W.length;ha<
+ia;ha++){j=a();j.positionWorld.copy(W[ha].position);Na.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);A.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Da&&j.positionScreen.z<qa}W=0;for(ha=i.length;W<ha;W++){ia=i[W];if(ia instanceof THREE.Face3){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];if(S.visible&&ta.visible&&ka.visible&&(la.doubleSided||la.flipSided!=(ka.positionScreen.x-S.positionScreen.x)*
+(ta.positionScreen.y-S.positionScreen.y)-(ka.positionScreen.y-S.positionScreen.y)*(ta.positionScreen.x-S.positionScreen.x)<0)){za=z[x]=z[x]||new THREE.RenderableFace3;x++;s=za;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka)}else continue}else if(ia instanceof THREE.Face4){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];za=n[ia.d];if(S.visible&&ta.visible&&ka.visible&&za.visible&&(la.doubleSided||la.flipSided!=((za.positionScreen.x-S.positionScreen.x)*(ta.positionScreen.y-S.positionScreen.y)-(za.positionScreen.y-S.positionScreen.y)*
+(ta.positionScreen.x-S.positionScreen.x)<0||(ta.positionScreen.x-ka.positionScreen.x)*(za.positionScreen.y-ka.positionScreen.y)-(ta.positionScreen.y-ka.positionScreen.y)*(za.positionScreen.x-ka.positionScreen.x)<0))){k=y[C]=y[C]||new THREE.RenderableFace4;C++;s=k;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka);s.v4.copy(za)}else continue}s.normalWorld.copy(ia.normal);Wa.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ia.centroid);Na.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);
+A.multiplyVector3(s.centroidScreen);ka=ia.vertexNormals;S=0;for(ta=ka.length;S<ta;S++){za=s.vertexNormalsWorld[S];za.copy(ka[S]);Wa.multiplyVector3(za)}S=0;for(ta=o.length;S<ta;S++)if(k=o[S][W]){ka=0;for(za=k.length;ka<za;ka++)s.uvs[S][ka]=k[ka]}s.meshMaterials=g;s.faceMaterials=ia.materials;s.overdraw=m;s.z=s.centroidScreen.z;ya.push(s)}}else if(la instanceof THREE.Line){oa.multiply(A,Na);W=la.geometry.vertices;S=a();S.positionScreen.copy(W[0].position);oa.multiplyVector4(S.positionScreen);ha=1;
+for(ia=W.length;ha<ia;ha++){S=a();S.positionScreen.copy(W[ha].position);oa.multiplyVector4(S.positionScreen);ta=n[p-2];Ba.copy(S.positionScreen);Ca.copy(ta.positionScreen);if(c(Ba,Ca)){Ba.multiplyScalar(1/Ba.w);Ca.multiplyScalar(1/Ca.w);Na=P[K]=P[K]||new THREE.RenderableLine;K++;J=Na;J.v1.positionScreen.copy(Ba);J.v2.positionScreen.copy(Ca);J.z=Math.max(Ba.z,Ca.z);J.materials=la.materials;ya.push(J)}}}else if(la instanceof THREE.Particle){U.set(la.position.x,la.position.y,la.position.z,1);A.multiplyVector4(U);
+U.z/=U.w;if(U.z>0&&U.z<1){Na=ma[ja]=ma[ja]||new THREE.RenderableParticle;ja++;L=Na;L.x=U.x/U.w;L.y=U.y/U.w;L.z=U.z;L.rotation=la.rotation.z;L.scale.x=la.scale.x*Math.abs(L.x-(U.x+N.projectionMatrix.n11)/(U.w+N.projectionMatrix.n14));L.scale.y=la.scale.y*Math.abs(L.y-(U.y+N.projectionMatrix.n22)/(U.w+N.projectionMatrix.n24));L.materials=la.materials;ya.push(L)}}}}pa&&ya.sort(b);return ya}};
+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 f,e=c.length;for(f=0;f<e;f++){a=c[f];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",
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -175,79 +175,79 @@ 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,
 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.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.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,M=g.__colorArray,U=g.__sortArray,H=g.__dirtyVertices,P=g.__dirtyColors;if(o.sortParticles){S.multiplySelf(o.matrixWorld);for(h=0;h<r;h++){k=q[h].position;ya.copy(k);S.multiplyVector3(ya);U[h]=[ya.z,h]}U.sort(function(I,Y){return Y[0]-I[0]});for(h=0;h<r;h++){k=q[U[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[U[h][1]];M[t]=color.r;M[t+1]=
-color.g;M[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(P)for(h=0;h<x;h++){color=E[h];t=h*3;M[t]=color.r;M[t+1]=color.g;M[t+2]=color.b}}if(H||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(P||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,M,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||Q.initMaterial(h,m,o,k);var t=h.program,q=t.uniforms,r=h.uniforms;if(t!=Da){d.useProgram(t);Da=t}d.uniformMatrix4fv(q.projectionMatrix,!1,xa);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,M=0,U=0,H,P,I,Y=Ka,Fa=Y.directional.colors,T=Y.directional.positions,Z=Y.point.colors,w=Y.point.positions,za=0,W=0;o=x=x=0;for(E=m.length;o<E;o++){x=m[o];H=x.color;P=x.position;I=x.intensity;if(x instanceof THREE.AmbientLight){v+=H.r;M+=H.g;U+=H.b}else if(x instanceof THREE.DirectionalLight){x=za*3;Fa[x]=H.r*I;Fa[x+1]=H.g*I;Fa[x+2]=H.b*I;T[x]=P.x;T[x+1]=
-P.y;T[x+2]=P.z;za+=1}else if(x instanceof THREE.PointLight){x=W*3;Z[x]=H.r*I;Z[x+1]=H.g*I;Z[x+2]=H.b*I;w[x]=P.x;w[x+1]=P.y;w[x+2]=P.z;W+=1}}for(o=za*3;o<Fa.length;o++)Fa[o]=0;for(o=W*3;o<Z.length;o++)Z[o]=0;Y.point.length=W;Y.directional.length=za;Y.ambient[0]=v;Y.ambient[1]=M;Y.ambient[2]=U;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=sa.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 Ga in r)if(v=t.uniforms[Ga]){o=r[Ga];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}ha(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}ha(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,na);if(h.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,na);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,M=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(v=0;v<M;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,
+THREE.WebGLRenderer=function(a){function b(g,m,o){var i,k,t,q=g.vertices,r=q.length,D=g.colors,w=D.length,v=g.__vertexArray,M=g.__colorArray,X=g.__sortArray,G=g.__dirtyVertices,R=g.__dirtyColors;if(o.sortParticles){S.multiplySelf(o.matrixWorld);for(i=0;i<r;i++){k=q[i].position;za.copy(k);S.multiplyVector3(za);X[i]=[za.z,i]}X.sort(function(H,Z){return Z[0]-H[0]});for(i=0;i<r;i++){k=q[X[i][1]].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(i=0;i<w;i++){t=i*3;color=D[X[i][1]];M[t]=color.r;M[t+1]=
+color.g;M[t+2]=color.b}}else{if(G)for(i=0;i<r;i++){k=q[i].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(R)for(i=0;i<w;i++){color=D[i];t=i*3;M[t]=color.r;M[t+1]=color.g;M[t+2]=color.b}}if(G||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(R||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,M,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
+function f(g,m,o,i,k){i.program||Q.initMaterial(i,m,o,k);var t=i.program,q=t.uniforms,r=i.uniforms;if(t!=Ba){d.useProgram(t);Ba=t}d.uniformMatrix4fv(q.projectionMatrix,!1,ta);if(o&&(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial||i instanceof THREE.LineBasicMaterial||i 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(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){var D,w,v=0,M=0,X=0,G,R,H,Z=La,Ga=Z.directional.colors,T=Z.directional.positions,$=Z.point.colors,B=Z.point.positions,Aa=0,Y=0;o=w=w=0;for(D=m.length;o<D;o++){w=m[o];G=w.color;R=w.position;H=w.intensity;if(w instanceof THREE.AmbientLight){v+=G.r;M+=G.g;X+=G.b}else if(w instanceof THREE.DirectionalLight){w=Aa*3;Ga[w]=G.r*H;Ga[w+1]=G.g*H;Ga[w+2]=G.b*H;T[w]=R.x;T[w+1]=
+R.y;T[w+2]=R.z;Aa+=1}else if(w instanceof THREE.PointLight){w=Y*3;$[w]=G.r*H;$[w+1]=G.g*H;$[w+2]=G.b*H;B[w]=R.x;B[w+1]=R.y;B[w+2]=R.z;Y+=1}}for(o=Aa*3;o<Ga.length;o++)Ga[o]=0;for(o=Y*3;o<$.length;o++)$[o]=0;Z.point.length=Y;Z.directional.length=Aa;Z.ambient[0]=v;Z.ambient[1]=M;Z.ambient[2]=X;m=La;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(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.map.texture=i.map;r.lightMap.texture=i.lightMap;r.envMap.texture=i.envMap;r.reflectivity.value=i.reflectivity;r.refractionRatio.value=i.refractionRatio;r.combine.value=i.combine;r.useRefract.value=
+i.envMap&&i.envMap.mapping instanceof THREE.CubeRefractionMapping}if(i instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity}else if(i instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.size.value=i.size;r.scale.value=oa.height/2;r.map.texture=i.map}else if(i instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(i.ambient.r,
+i.ambient.g,i.ambient.b);r.specular.value.setRGB(i.specular.r,i.specular.g,i.specular.b);r.shininess.value=i.shininess}else if(i instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=i.opacity}else if(i instanceof THREE.MeshNormalMaterial)r.opacity.value=i.opacity;for(var Ha in r)if(v=t.uniforms[Ha]){o=r[Ha];D=o.type;m=o.value;if(D=="i")d.uniform1i(v,m);else if(D=="f")d.uniform1f(v,m);else if(D=="fv1")d.uniform1fv(v,m);else if(D=="fv")d.uniform3fv(v,m);else if(D==
+"v2")d.uniform2f(v,m.x,m.y);else if(D=="v3")d.uniform3f(v,m.x,m.y,m.z);else if(D=="c")d.uniform3f(v,m.r,m.g,m.b);else if(D=="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(D=0;D<6;++D)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image[D])}else{o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
+o.image.__webGLTextureCube);for(D=0;D<6;++D)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[D]);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);(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshPhongMaterial||
+i.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(i instanceof THREE.MeshShaderMaterial||i.envMap||i.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshShaderMaterial||i.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,ka);if(i.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,ka);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
+function e(g,m,o,i,k,t){if(i.opacity!=0){g=f(g,m,o,i,t).attributes;if(i.morphTargets){m=i.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<i.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 D=-1,w=0;r=t.morphTargetInfluences;var v,M=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<i.numSupportedMorphTargets;){for(v=0;v<M;v++)if(!q[v]&&r[v]>D){w=v;D=r[w]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[w]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=D;q[w]=1;D=-1;o++}}d.uniform1fv(i.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,
 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,
-k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(h.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA,
-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=
+k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(i.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA,
+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(i.wireframe){d.lineWidth(i.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(i.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 h(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,
 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(N!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);N=g.doubleSided}if(ta!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);ta=g.flipSided}}function p(g){if(Ba!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Ba=g}}function n(g){X[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);X[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);X[2].set(g.n41+g.n21,g.n42+g.n22,
-g.n43+g.n23,g.n44+g.n24);X[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);X[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);X[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=X[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=X[h].x*m.n14+X[h].y*m.n24+X[h].z*m.n34+X[h].w;if(g<=o)return!1}return!0}function y(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?y(t,o):y(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?y(E,k):y(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?y(E,k):y(r,k)}}}function z(g,m){return m.z-g.z}function J(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(U){var H=[];o=0;for(h=U.length;o<h;o++)U[o]==undefined?H.push("undefined"):H.push(U[o].id);return H.join("_")}var o,
-h,k,t,q,r,E,x,v={},M=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:M});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:M})}g.geometryGroups[x].faces.push(k);g.geometryGroups[x].vertices+=q}}function O(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(g){if(g!=ua){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)}ua=g}}function ha(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,B(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,B(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,B(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,B(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,R(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,R(m.minFilter))}}function ma(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,B(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,B(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,B(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,B(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,B(g.format),g.width,g.height,0,B(g.format),B(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=ja;g=ka}if(m!=Aa){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(ia,V,o,g);Aa=m}}function pa(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 R(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 B(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
+3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(N!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);N=g.doubleSided}if(pa!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);pa=g.flipSided}}function p(g){if(Da!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Da=g}}function n(g){W[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);W[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);W[2].set(g.n41+g.n21,g.n42+g.n22,
+g.n43+g.n23,g.n44+g.n24);W[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);W[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);W[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=W[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)),i=0;i<6;i++){g=W[i].x*m.n14+W[i].y*m.n24+W[i].z*m.n34+W[i].w;if(g<=o)return!1}return!0}function x(g,
+m){g.list[g.count]=m;g.count+=1}function z(g){var m,o,i=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=i.materials.length;g<m;g++){o=i.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?x(t,o):x(k,o)}}function C(g){var m,o,i,k,t=g.object,q=g.buffer,r=g.opaque,D=g.transparent;D.count=0;g=r.count=0;for(i=t.materials.length;g<i;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?x(D,k):x(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?x(D,k):x(r,k)}}}function y(g,m){return m.z-g.z}function J(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(X){var G=[];o=0;for(i=X.length;o<i;o++)X[o]==undefined?G.push("undefined"):G.push(X[o].id);return G.join("_")}var o,
+i,k,t,q,r,D,w,v={},M=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;D=m(r);v[D]==undefined&&(v[D]={hash:D,counter:0});w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]={faces:[],materials:r,vertices:0,numMorphTargets:M});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[w].vertices+q>65535){v[D].counter+=1;w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]=
+{faces:[],materials:r,vertices:0,numMorphTargets:M})}g.geometryGroups[w].faces.push(k);g.geometryGroups[w].vertices+=q}}function P(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(g){if(g!=ya){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)}ya=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,A(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,A(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,A(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,A(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,U(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,U(m.minFilter))}}function ma(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,A(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,A(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,A(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,A(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,A(g.format),g.width,g.height,0,A(g.format),A(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=ha;g=ia}if(m!=Ca){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(qa,V,o,g);Ca=m}}function sa(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 U(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 A(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.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 sa=document.createElement("canvas"),d,Da=null,Aa=null,Q=this,N=null,ta=null,ua=null,Ba=null,ia=0,V=0,ja=0,ka=0,X=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,xa=new Float32Array(16),na=new Float32Array(16),ya=new THREE.Vector4,Ka={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},la=!0,Na=new THREE.Color(0),Va=0;if(a){if(a.antialias!==undefined)la=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Va=a.clearAlpha}this.maxMorphTargets=8;this.domElement=sa;this.autoClear=!0;this.sortObjects=
-!0;(function(g,m,o){try{if(!(d=sa.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})(la,Na,Va);this.context=d;this.setSize=function(g,m){sa.width=g;sa.height=m;this.setViewport(0,0,sa.width,sa.height)};
-this.setViewport=function(g,m,o,h){ia=g;V=m;ja=o;ka=h;d.viewport(ia,V,ja,ka)};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,
+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 oa=document.createElement("canvas"),d,Ba=null,Ca=null,Q=this,N=null,pa=null,ya=null,Da=null,qa=0,V=0,ha=0,ia=0,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,ta=new Float32Array(16),ka=new Float32Array(16),za=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},la=!0,Na=new THREE.Color(0),Wa=0;if(a){if(a.antialias!==undefined)la=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Wa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=
+!0;(function(g,m,o){try{if(!(d=oa.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(i){console.error(i)}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})(la,Na,Wa);this.context=d;this.setSize=function(g,m){oa.width=g;oa.height=m;this.setViewport(0,0,oa.width,oa.height)};
+this.setViewport=function(g,m,o,i){qa=g;V=m;ha=o;ia=i;d.viewport(qa,V,ha,ia)};this.setScissor=function(g,m,o,i){d.scissor(g,m,o,i)};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,i){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,D,w,v;q=w=v=0;for(r=m.length;q<r;q++){D=m[q];D instanceof THREE.DirectionalLight&&w++;D instanceof THREE.PointLight&&v++}if(v+w<=4)m=w;else{m=Math.ceil(4*w/(v+w));v=4-m}q={directional:m,point:v};r=50;if(i!==undefined&&i instanceof THREE.SkinnedMesh)r=i.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");
 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");
 r=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.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");
 r=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.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");
-d.attachShader(o,pa("fragment",q+v));d.attachShader(o,pa("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
+d.attachShader(o,sa("fragment",q+v));d.attachShader(o,sa("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
 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);
 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);
 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>=
 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,M,U=g.lights,H=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(na);m.projectionMatrix.flattenToArray(xa);S.multiply(m.projectionMatrix,m.matrixWorldInverse);n(S);this.initWebGLObjects(g);
-ma(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);J(v,m);D(k);k.render=!0;if(this.sortObjects){ya.copy(v.position);S.multiplyVector3(ya);k.z=ya.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(z);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);J(v,m);A(k)}}L(THREE.NormalBlending);for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;M=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);f(m,U,H,r,M,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,U,H,r,v);v.render(function(P){i(P,t)})}}}for(h=0;h<E;h++){k=g.__webglObjects[h];if(k.render){v=k.object;M=k.buffer;
-q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);f(m,U,H,r,M,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];L(r.blending);p(r.depthTest);t=e(m,U,H,r,v);v.render(function(P){i(P,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&&K(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,M=void 0,U=E=r=0;v=void 0;M=void 0;var H=void 0;M=void 0;var P=x.geometry;H=P.faces;var I=q.faces;v=0;for(M=I.length;v<M;v++){fi=I[v];face=H[fi];if(face instanceof THREE.Face3){r+=3;E+=1;U+=3}else if(face instanceof THREE.Face4){r+=4;E+=2;U+=4}}v=q;M=x;H=void 0;I=void 0;var Y=void 0,Fa=void 0;Y=void 0;
-var T=[];H=0;for(I=M.materials.length;H<I;H++){Y=M.materials[H];if(Y instanceof THREE.MeshFaceMaterial){Y=0;for(l=v.materials.length;Y<l;Y++)(Fa=v.materials[Y])&&T.push(Fa)}else(Fa=Y)&&T.push(Fa)}M=T;a:{v=void 0;H=void 0;I=M.length;for(v=0;v<I;v++){H=M[v];if(H.map||H.lightMap||H instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{H=void 0;I=void 0;T=M.length;for(H=0;H<T;H++){I=M[H];if(!(I instanceof THREE.MeshBasicMaterial&&!I.envMap||I instanceof THREE.MeshDepthMaterial)){H=I&&I.shading!=
-undefined&&I.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}H=!1}a:{I=void 0;T=void 0;Y=M.length;for(I=0;I<Y;I++){T=M[I];if(T.vertexColors){M=T.vertexColors;break a}}M=!1}q.__vertexArray=new Float32Array(r*3);if(H)q.__normalArray=new Float32Array(r*3);if(P.hasTangents)q.__tangentArray=new Float32Array(r*4);if(M)q.__colorArray=new Float32Array(r*3);if(v){if(P.faceUvs.length>0||P.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(P.faceUvs.length>1||P.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(U*2);if(q.numMorphTargets){x=void 0;P=void 0;q.__morphTargetsArrays=[];x=0;for(P=q.numMorphTargets;x<P;x++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
-H==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=M;q.__normalType=H;q.__webGLFaceCount=E*3;q.__webGLLineCount=U*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}O(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}O(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}O(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}O(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;U=void 0;var Z=void 0,w=void 0;Z=void 0;var za=void 0,W=void 0,Ga=void 0;x=void 0;P=void 0;v=void 0;M=void 0;H=void 0;var C=void 0,F=void 0,G=void 0,$=void 0;W=void 0;Ga=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;za=void 0;Z=void 0;Z=void 0;var Ca=void 0,Wa=void 0,qa=
-void 0,Oa=Fa=Y=T=I=0,Ha=0,aa=0,Ia=0,oa=0,u=0,ra=0,va=q.__vertexArray,Ya=q.__uvArray,Za=q.__uv2Array,Ma=q.__normalArray,ca=q.__tangentArray,wa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,$a=q.__morphTargetsArrays,Pa=q.__faceArray,Ja=q.__lineArray,gb=q.__needsSmoothNormals;P=q.__vertexColorType;x=q.__uvType;v=q.__normalType;var Ea=h.geometry,ab=Ea.__dirtyVertices,bb=Ea.__dirtyElements,Xa=Ea.__dirtyUvs,cb=Ea.__dirtyNormals,db=Ea.__dirtyTangents,
-eb=Ea.__dirtyColors,fb=Ea.__dirtyMorphTargets,La=Ea.vertices,hb=q.faces,kb=Ea.faces,ib=Ea.faceVertexUvs[0],jb=Ea.faceVertexUvs[1],Sa=Ea.skinVerticesA,Ta=Ea.skinVerticesB,Ua=Ea.skinIndices,Ra=Ea.skinWeights,Qa=Ea.morphTargets;E=0;for(U=hb.length;E<U;E++){Z=hb[E];w=kb[Z];ib&&(M=ib[Z]);jb&&(H=jb[Z]);Z=w.vertexNormals;za=w.normal;W=w.vertexColors;Ga=w.color;if(w instanceof THREE.Face3){if(ab){C=La[w.a].position;F=La[w.b].position;G=La[w.c].position;va[T]=C.x;va[T+1]=C.y;va[T+2]=C.z;va[T+3]=F.x;va[T+4]=
-F.y;va[T+5]=F.z;va[T+6]=G.x;va[T+7]=G.y;va[T+8]=G.z;T+=9}if(fb){Ca=0;for(Wa=Qa.length;Ca<Wa;Ca++){C=Qa[Ca].vertices[w.a].position;F=Qa[Ca].vertices[w.b].position;G=Qa[Ca].vertices[w.c].position;qa=$a[Ca];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(Ra.length){C=Ra[w.a];F=Ra[w.b];G=Ra[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=Ua[w.a];F=Ua[w.b];G=Ua[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=Sa[w.a];F=Sa[w.b];G=Sa[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=Ta[w.a];F=Ta[w.b];G=Ta[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&&P){if(W.length==3&&P==THREE.VertexColors){C=W[0];F=W[1];G=W[2]}else G=F=C=Ga;wa[oa]=C.r;wa[oa+1]=C.g;wa[oa+2]=C.b;wa[oa+3]=F.r;wa[oa+4]=F.g;wa[oa+5]=F.b;wa[oa+6]=G.r;wa[oa+7]=G.g;wa[oa+8]=G.b;oa+=9}if(db&&Ea.hasTangents){W=La[w.a].tangent;Ga=La[w.b].tangent;C=La[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]=Ga.x;ca[aa+5]=Ga.y;ca[aa+6]=Ga.z;ca[aa+7]=Ga.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++){za=Z[w];Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}else for(w=0;w<3;w++){Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}if(Xa&&M!==undefined&&x)for(w=0;w<3;w++){Z=M[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&H!==undefined&&x)for(w=0;w<3;w++){Z=H[w];Za[Fa]=Z.u;Za[Fa+1]=Z.v;Fa+=2}if(bb){Pa[Oa]=I;Pa[Oa+1]=I+1;Pa[Oa+2]=I+2;Oa+=3;Ja[Ia]=I;Ja[Ia+1]=I+1;Ja[Ia+2]=I;Ja[Ia+3]=I+2;Ja[Ia+4]=I+1;Ja[Ia+5]=I+2;Ia+=6;I+=3}}else if(w instanceof THREE.Face4){if(ab){C=La[w.a].position;F=La[w.b].position;G=La[w.c].position;
-$=La[w.d].position;va[T]=C.x;va[T+1]=C.y;va[T+2]=C.z;va[T+3]=F.x;va[T+4]=F.y;va[T+5]=F.z;va[T+6]=G.x;va[T+7]=G.y;va[T+8]=G.z;va[T+9]=$.x;va[T+10]=$.y;va[T+11]=$.z;T+=12}if(fb){Ca=0;for(Wa=Qa.length;Ca<Wa;Ca++){C=Qa[Ca].vertices[w.a].position;F=Qa[Ca].vertices[w.b].position;G=Qa[Ca].vertices[w.c].position;$=Qa[Ca].vertices[w.d].position;qa=$a[Ca];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(Ra.length){C=Ra[w.a];F=Ra[w.b];G=Ra[w.c];$=Ra[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=Ua[w.a];F=Ua[w.b];G=Ua[w.c];$=Ua[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=Sa[w.a];
-F=Sa[w.b];G=Sa[w.c];$=Sa[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=Ta[w.a];F=Ta[w.b];G=Ta[w.c];$=Ta[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&&P){if(W.length==4&&P==THREE.VertexColors){C=
-W[0];F=W[1];G=W[2];W=W[3]}else W=G=F=C=Ga;wa[oa]=C.r;wa[oa+1]=C.g;wa[oa+2]=C.b;wa[oa+3]=F.r;wa[oa+4]=F.g;wa[oa+5]=F.b;wa[oa+6]=G.r;wa[oa+7]=G.g;wa[oa+8]=G.b;wa[oa+9]=W.r;wa[oa+10]=W.g;wa[oa+11]=W.b;oa+=12}if(db&&Ea.hasTangents){W=La[w.a].tangent;Ga=La[w.b].tangent;C=La[w.c].tangent;w=La[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]=Ga.x;ca[aa+5]=Ga.y;ca[aa+6]=Ga.z;ca[aa+7]=Ga.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++){za=Z[w];Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}else for(w=0;w<4;w++){Ma[Ha]=za.x;Ma[Ha+1]=za.y;Ma[Ha+2]=za.z;Ha+=3}if(Xa&&M!==undefined&&x)for(w=0;w<4;w++){Z=M[w];Ya[Y]=Z.u;Ya[Y+1]=Z.v;Y+=2}if(Xa&&H!==undefined&&x)for(w=0;w<4;w++){Z=H[w];Za[Fa]=Z.u;Za[Fa+1]=Z.v;Fa+=2}if(bb){Pa[Oa]=I;Pa[Oa+1]=I+1;Pa[Oa+2]=I+2;Pa[Oa+3]=I;Pa[Oa+4]=I+2;Pa[Oa+5]=I+3;Oa+=6;Ja[Ia]=I;Ja[Ia+1]=I+1;Ja[Ia+2]=I;Ja[Ia+3]=I+3;Ja[Ia+4]=I+1;Ja[Ia+5]=I+2;Ja[Ia+
-6]=I+2;Ja[Ia+7]=I+3;Ia+=8;I+=4}}}if(ab){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,va,r)}if(fb){Ca=0;for(Wa=Qa.length;Ca<Wa;Ca++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Ca]);d.bufferData(d.ARRAY_BUFFER,$a[Ca],r)}}if(eb&&oa>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(db&&Ea.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
-q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Xa&&Y>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ya,r)}if(Xa&&Fa>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,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ja,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;P=void 0;q=void 0;v=h.vertices;r=h.colors;M=v.length;E=r.length;H=h.__vertexArray;U=h.__colorArray;I=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<M;x++){P=v[x].position;q=x*3;H[q]=P.x;H[q+1]=P.y;H[q+2]=P.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(I){for(x=0;x<E;x++){color=r[x];q=x*3;U[q]=color.r;U[q+1]=color.g;U[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
-U,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;P=void 0;q=void 0;v=h.vertices;r=h.colors;M=v.length;E=r.length;H=h.__vertexArray;U=h.__colorArray;I=h.__dirtyColors;if(h.__dirtyVertices){for(x=0;x<M;x++){P=v[x].position;q=x*3;H[q]=P.x;H[q+1]=P.y;H[q+2]=P.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}if(I){for(x=0;x<E;x++){color=r[x];q=x*
-3;U[q]=color.r;U[q+1]=color.g;U[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,U,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):
+0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}i.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)i.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,i){var k,t,q,r,D,w,v,M,X=g.lights,G=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(ka);m.projectionMatrix.flattenToArray(ta);S.multiply(m.projectionMatrix,m.matrixWorldInverse);n(S);this.initWebGLObjects(g);
+ma(o);(this.autoClear||i)&&this.clear();D=g.__webglObjects.length;for(i=0;i<D;i++){k=g.__webglObjects[i];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);C(k);k.render=!0;if(this.sortObjects){za.copy(v.position);S.multiplyVector3(za);k.z=za.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);w=g.__webglObjectsImmediate.length;for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){v.matrixAutoUpdate&&
+v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);z(k)}}L(THREE.NormalBlending);for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];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=f(m,X,G,r,v);v.render(function(R){h(R,t)})}}}for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;
+q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);t=f(m,X,G,r,v);v.render(function(R){h(R,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,i=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&&K(k);for(i in k.geometryGroups){t=
+k.geometryGroups[i];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,D=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(D=q.numMorphTargets;r<D;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var w=m,v=void 0,M=void 0,X=D=r=0;v=void 0;M=void 0;var G=void 0;M=void 0;var R=w.geometry;G=R.faces;var H=q.faces;v=0;for(M=H.length;v<M;v++){fi=H[v];face=G[fi];if(face instanceof THREE.Face3){r+=3;D+=1;X+=3}else if(face instanceof THREE.Face4){r+=4;D+=2;X+=4}}v=q;M=w;G=void 0;H=void 0;var Z=void 0,Ga=void 0;Z=void 0;
+var T=[];G=0;for(H=M.materials.length;G<H;G++){Z=M.materials[G];if(Z instanceof THREE.MeshFaceMaterial){Z=0;for(l=v.materials.length;Z<l;Z++)(Ga=v.materials[Z])&&T.push(Ga)}else(Ga=Z)&&T.push(Ga)}M=T;a:{v=void 0;G=void 0;H=M.length;for(v=0;v<H;v++){G=M[v];if(G.map||G.lightMap||G instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{G=void 0;H=void 0;T=M.length;for(G=0;G<T;G++){H=M[G];if(!(H instanceof THREE.MeshBasicMaterial&&!H.envMap||H instanceof THREE.MeshDepthMaterial)){G=H&&H.shading!=
+undefined&&H.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}G=!1}a:{H=void 0;T=void 0;Z=M.length;for(H=0;H<Z;H++){T=M[H];if(T.vertexColors){M=T.vertexColors;break a}}M=!1}q.__vertexArray=new Float32Array(r*3);if(G)q.__normalArray=new Float32Array(r*3);if(R.hasTangents)q.__tangentArray=new Float32Array(r*4);if(M)q.__colorArray=new Float32Array(r*3);if(v){if(R.faceUvs.length>0||R.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(R.faceUvs.length>1||R.faceVertexUvs.length>
+1)q.__uv2Array=new Float32Array(r*2)}if(w.geometry.skinWeights.length&&w.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(D*3);q.__lineArray=new Uint16Array(X*2);if(q.numMorphTargets){w=void 0;R=void 0;q.__morphTargetsArrays=[];w=0;for(R=q.numMorphTargets;w<R;w++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
+G==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=M;q.__normalType=G;q.__webGLFaceCount=D*3;q.__webGLLineCount=X*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}P(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*
+3);i.__colorArray=new Float32Array(t*3);i.__webGLVertexCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=
+m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__sortArray=[];i.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(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;i=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){i=o.__webglObjects[k].object;m==i&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){i=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(i instanceof THREE.Mesh){k=i.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;D=void 0;X=void 0;var $=void 0,B=void 0;$=void 0;var Aa=void 0,Y=void 0,Ha=void 0,O=void 0;w=void 0;R=void 0;v=void 0;M=void 0;G=void 0;var E=void 0,F=void 0,I=void 0,na=void 0;Y=void 0;Ha=void 0;B=void 0;O=void 0;B=void 0;E=void 0;F=void 0;Y=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;B=void 0;O=void 0;Aa=void 0;$=void 0;$=void 0;var Ea=void 0,
+Xa=void 0,ua=void 0,Oa=Ga=Z=T=H=0,Ia=0,aa=0,Ja=0,ra=0,u=0,va=0,wa=q.__vertexArray,Za=q.__uvArray,$a=q.__uv2Array,Ma=q.__normalArray,ca=q.__tangentArray,xa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,ab=q.__morphTargetsArrays,Pa=q.__faceArray,Ka=q.__lineArray,hb=q.__needsSmoothNormals;R=q.__vertexColorType;w=q.__uvType;v=q.__normalType;var Fa=i.geometry,bb=Fa.__dirtyVertices,cb=Fa.__dirtyElements,Ya=Fa.__dirtyUvs,db=Fa.__dirtyNormals,
+eb=Fa.__dirtyTangents,fb=Fa.__dirtyColors,gb=Fa.__dirtyMorphTargets,Sa=Fa.vertices,ib=q.faces,lb=Fa.faces,jb=Fa.faceVertexUvs[0],kb=Fa.faceVertexUvs[1],Ta=Fa.skinVerticesA,Ua=Fa.skinVerticesB,Va=Fa.skinIndices,Ra=Fa.skinWeights,Qa=Fa.morphTargets;D=0;for(X=ib.length;D<X;D++){$=ib[D];B=lb[$];jb&&(M=jb[$]);kb&&(G=kb[$]);$=B.vertexNormals;Aa=B.normal;Y=B.vertexColors;Ha=B.color;O=B.vertexTangents;if(B instanceof THREE.Face3){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;I=Sa[B.c].position;wa[T]=E.x;wa[T+
+1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;T+=9}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z}va+=9}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;
+ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.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]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.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]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;u+=12}if(fb&&R){if(Y.length==3&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2]}else F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;ra+=9}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;aa+=12}if(db&&v)if($.length==
+3&&hb)for(O=0;O<3;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<3;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<3;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<3;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+2;Oa+=3;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+2;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ja+=6;H+=3}}else if(B instanceof THREE.Face4){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;
+I=Sa[B.c].position;na=Sa[B.d].position;wa[T]=E.x;wa[T+1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;wa[T+9]=na.x;wa[T+10]=na.y;wa[T+11]=na.z;T+=12}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;na=Qa[Ea].vertices[B.d].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z;ua[va+9]=na.x;
+ua[va+10]=na.y;ua[va+11]=na.z}va+=12}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];na=Ra[B.d];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;ga[u+12]=na.x;ga[u+13]=na.y;ga[u+14]=na.z;ga[u+15]=na.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];na=Va[B.d];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;fa[u+12]=na.x;fa[u+13]=na.y;
+fa[u+14]=na.z;fa[u+15]=na.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];na=Ta[B.d];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.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]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;da[u+12]=na.x;da[u+13]=na.y;da[u+14]=na.z;da[u+15]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];B=Ua[B.d];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.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]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;ea[u+12]=B.x;ea[u+13]=B.y;ea[u+14]=B.z;ea[u+15]=1;u+=16}if(fb&&
+R){if(Y.length==4&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2];Y=Y[3]}else Y=F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;xa[ra+9]=Y.r;xa[ra+10]=Y.g;xa[ra+11]=Y.b;ra+=12}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];O=O[3];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;ca[aa+12]=O.x;ca[aa+13]=O.y;ca[aa+14]=O.z;
+ca[aa+15]=O.w;aa+=16}if(db&&v)if($.length==4&&hb)for(O=0;O<4;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<4;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<4;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<4;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+2;Pa[Oa+3]=H;Pa[Oa+4]=H+2;Pa[Oa+5]=H+3;Oa+=6;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+3;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ka[Ja+
+6]=H+2;Ka[Ja+7]=H+3;Ja+=8;H+=4}}}if(bb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Ea]);d.bufferData(d.ARRAY_BUFFER,ab[Ea],r)}}if(fb&&ra>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,xa,r)}if(db){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(eb&&Fa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
+q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Ya&&Z>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(Ya&&Ga>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,$a,r)}if(cb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ka,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(i instanceof THREE.Ribbon){k=i.geometry;if(k.__dirtyVertices||
+k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
+X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Line){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*
+3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem){k=i.geometry;(k.__dirtyVertices||k.__dirtyColors||i.sortParticles)&&b(k,d.DYNAMIC_DRAW,i);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.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}};

File diff suppressed because it is too large
+ 0 - 0
examples/obj/leeperrysmith/LeePerrySmith.js


+ 3 - 3
examples/webgl_materials_normalmap.html

@@ -54,7 +54,7 @@
 		</div>
 		</div>
 
 
 		<script type="text/javascript" src="../build/Three.js"></script>
 		<script type="text/javascript" src="../build/Three.js"></script>
-
+		
 		<script type="text/javascript" src="js/Detector.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/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
@@ -188,8 +188,8 @@
 			function createScene( geometry, scale, material1, material2 ) {
 			function createScene( geometry, scale, material1, material2 ) {
 
 
 				geometry.computeTangents();
 				geometry.computeTangents();
-
-				//mesh1 = SceneUtils.addMesh( scene, geometry, scale, -scale * 12, 0, 0, 0,0,0, material1 );
+				
+				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 );
 				mesh2 = SceneUtils.addMesh( scene, geometry, scale,  scale * 12, 0, 0, 0,0,0, material2 );
 
 
 				loader.statusDomElement.style.display = "none";
 				loader.statusDomElement.style.display = "none";

+ 1 - 86
examples/webgl_materials_normalmap2.html

@@ -52,92 +52,8 @@
 			</div>
 			</div>
 		</div>
 		</div>
 
 
-<!--
 		<script type="text/javascript" src="../build/Three.js"></script>
 		<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/Detector.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
@@ -252,7 +168,6 @@
 
 
 				geometry.computeTangents();
 				geometry.computeTangents();
 
 
-				material = new THREE.MeshFaceMaterial();
 				mesh1 = SceneUtils.addMesh( scene, geometry, scale, 0, - 50, 0, 0, 0, 0, material );
 				mesh1 = SceneUtils.addMesh( scene, geometry, scale, 0, - 50, 0, 0, 0, 0, material );
 
 
 				loader.statusDomElement.style.display = "none";
 				loader.statusDomElement.style.display = "none";

+ 2 - 0
src/core/Face3.js

@@ -15,6 +15,8 @@ THREE.Face3 = function ( a, b, c, normal, color, materials ) {
 	this.color = color instanceof THREE.Color ? color : new THREE.Color();
 	this.color = color instanceof THREE.Color ? color : new THREE.Color();
 	this.vertexColors = color instanceof Array ? color : [];
 	this.vertexColors = color instanceof Array ? color : [];
 
 
+	this.vertexTangents = [];
+	
 	this.materials = materials instanceof Array ? materials : [ materials ];
 	this.materials = materials instanceof Array ? materials : [ materials ];
 
 
 	this.centroid = new THREE.Vector3();
 	this.centroid = new THREE.Vector3();

+ 2 - 0
src/core/Face4.js

@@ -16,6 +16,8 @@ THREE.Face4 = function ( a, b, c, d, normal, color, materials ) {
 	this.color = color instanceof THREE.Color ? color : new THREE.Color();
 	this.color = color instanceof THREE.Color ? color : new THREE.Color();
 	this.vertexColors = color instanceof Array ? color : [];
 	this.vertexColors = color instanceof Array ? color : [];
 
 
+	this.vertexTangents = [];
+	
 	this.materials = materials instanceof Array ? materials : [ materials ];
 	this.materials = materials instanceof Array ? materials : [ materials ];
 
 
 	this.centroid = new THREE.Vector3();
 	this.centroid = new THREE.Vector3();

+ 27 - 25
src/core/Geometry.js

@@ -224,7 +224,8 @@ THREE.Geometry.prototype = {
 		// based on http://www.terathon.com/code/tangent.html
 		// based on http://www.terathon.com/code/tangent.html
 		// tangents go to vertices
 		// tangents go to vertices
 
 
-		var f, fl, v, vl, face, uv, vA, vB, vC, uvA, uvB, uvC,
+		var f, fl, v, vl, i, il, vertexIndex,
+			face, uv, vA, vB, vC, uvA, uvB, uvC,
 			x1, x2, y1, y2, z1, z2,
 			x1, x2, y1, y2, z1, z2,
 			s1, s2, t1, t2, r, t, test,
 			s1, s2, t1, t2, r, t, test,
 			tan1 = [], tan2 = [],
 			tan1 = [], tan2 = [],
@@ -282,49 +283,50 @@ THREE.Geometry.prototype = {
 		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
 		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
 
 
 			face = this.faces[ f ];
 			face = this.faces[ f ];
-			uv = this.faceVertexUvs[ f ][ 0 ]; // use UV layer 0 for tangents
+			uv = this.faceVertexUvs[ 0 ][ f ]; // use UV layer 0 for tangents
 
 
 			if ( face instanceof THREE.Face3 ) {
 			if ( face instanceof THREE.Face3 ) {
 
 
 				handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );
 				handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );
 
 
-				this.vertices[ face.a ].normal.copy( face.vertexNormals[ 0 ] );
-				this.vertices[ face.b ].normal.copy( face.vertexNormals[ 1 ] );
-				this.vertices[ face.c ].normal.copy( face.vertexNormals[ 2 ] );
-
-
 			} else if ( face instanceof THREE.Face4 ) {
 			} else if ( face instanceof THREE.Face4 ) {
 
 
 				handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );
 				handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );
 				handleTriangle( this, face.a, face.b, face.d, 0, 1, 3 );
 				handleTriangle( this, face.a, face.b, face.d, 0, 1, 3 );
 
 
-				this.vertices[ face.a ].normal.copy( face.vertexNormals[ 0 ] );
-				this.vertices[ face.b ].normal.copy( face.vertexNormals[ 1 ] );
-				this.vertices[ face.c ].normal.copy( face.vertexNormals[ 2 ] );
-				this.vertices[ face.d ].normal.copy( face.vertexNormals[ 3 ] );
-
 			}
 			}
 
 
 		}
 		}
 
 
-		for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
-
-			n.copy( this.vertices[ v ].normal );
-			t = tan1[ v ];
-
-			// Gram-Schmidt orthogonalize
+		var faceIndex = [ 'a', 'b', 'c', 'd' ];
+		
+		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
+			
+			face = this.faces[ f ];
+			
+			for ( i = 0; i < face.vertexNormals.length; i++ ) {
+				
+				n.copy( face.vertexNormals[ i ] );
+				
+				vertexIndex = face[ faceIndex[ i ] ];
+				
+				t = tan1[ vertexIndex ];
 
 
-			tmp.copy( t );
-			tmp.subSelf( n.multiplyScalar( n.dot( t ) ) ).normalize();
+				// Gram-Schmidt orthogonalize
 
 
-			// Calculate handedness
+				tmp.copy( t );
+				tmp.subSelf( n.multiplyScalar( n.dot( t ) ) ).normalize();
 
 
-			tmp2.cross( this.vertices[ v ].normal, t );
-			test = tmp2.dot( tan2[ v ] );
-			w = (test < 0.0) ? -1.0 : 1.0;
+				// Calculate handedness
 
 
-			this.vertices[ v ].tangent.set( tmp.x, tmp.y, tmp.z, w );
+				tmp2.cross( face.vertexNormals[ i ], t );
+				test = tmp2.dot( tan2[ vertexIndex ] );
+				w = (test < 0.0) ? -1.0 : 1.0;
 
 
+				face.vertexTangents[ i ] = new THREE.Vector4( tmp.x, tmp.y, tmp.z, w );
+				
+			}
+			
 		}
 		}
 
 
 		this.hasTangents = true;
 		this.hasTangents = true;

+ 11 - 8
src/renderers/WebGLRenderer.js

@@ -361,7 +361,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		normalType = bufferGuessNormalType( materials, geometryGroup, object );
 		normalType = bufferGuessNormalType( materials, geometryGroup, object );
 		vertexColorType = bufferGuessVertexColorType( materials, geometryGroup, object );
 		vertexColorType = bufferGuessVertexColorType( materials, geometryGroup, object );
 
 
-		//console.log(uvType, normalType, vertexColorType, object, geometryGroup, materials );
+		//console.log("uvType",uvType, "normalType",normalType, "vertexColorType",vertexColorType, object, geometryGroup, materials );
 
 
 		geometryGroup.__vertexArray = new Float32Array( nvertices * 3 );
 		geometryGroup.__vertexArray = new Float32Array( nvertices * 3 );
 		
 		
@@ -439,6 +439,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		var f, fl, fi, face, 
 		var f, fl, fi, face, 
 			vertexNormals, faceNormal, normal,
 			vertexNormals, faceNormal, normal,
 			vertexColors, faceColor,
 			vertexColors, faceColor,
+			vertexTangents,
 			uvType, vertexColorType, normalType,
 			uvType, vertexColorType, normalType,
 			uv, uv2, v1, v2, v3, v4, t1, t2, t3, t4,
 			uv, uv2, v1, v2, v3, v4, t1, t2, t3, t4,
 			c1, c2, c3, c4,
 			c1, c2, c3, c4,
@@ -535,6 +536,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 			
 			
 			vertexColors = face.vertexColors;
 			vertexColors = face.vertexColors;
 			faceColor = face.color;
 			faceColor = face.color;
+			
+			vertexTangents = face.vertexTangents;
 
 
 			if ( face instanceof THREE.Face3 ) {
 			if ( face instanceof THREE.Face3 ) {
 
 
@@ -711,9 +714,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				if ( dirtyTangents && geometry.hasTangents ) {
 				if ( dirtyTangents && geometry.hasTangents ) {
 
 
-					t1 = vertices[ face.a ].tangent;
-					t2 = vertices[ face.b ].tangent;
-					t3 = vertices[ face.c ].tangent;
+					t1 = vertexTangents[ 0 ];
+					t2 = vertexTangents[ 1 ];
+					t3 = vertexTangents[ 2 ];
 
 
 					tangentArray[ offset_tangent ]     = t1.x;
 					tangentArray[ offset_tangent ]     = t1.x;
 					tangentArray[ offset_tangent + 1 ] = t1.y;
 					tangentArray[ offset_tangent + 1 ] = t1.y;
@@ -1035,10 +1038,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				if ( dirtyTangents && geometry.hasTangents ) {
 				if ( dirtyTangents && geometry.hasTangents ) {
 
 
-					t1 = vertices[ face.a ].tangent;
-					t2 = vertices[ face.b ].tangent;
-					t3 = vertices[ face.c ].tangent;
-					t4 = vertices[ face.d ].tangent;
+					t1 = vertexTangents[ 0 ];
+					t2 = vertexTangents[ 1 ];
+					t3 = vertexTangents[ 2 ];
+					t4 = vertexTangents[ 3 ];
 
 
 					tangentArray[ offset_tangent ]     = t1.x;
 					tangentArray[ offset_tangent ]     = t1.x;
 					tangentArray[ offset_tangent + 1 ] = t1.y;
 					tangentArray[ offset_tangent + 1 ] = t1.y;

+ 6 - 4
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/export_threejs.py

@@ -70,10 +70,12 @@ var model = {
     
     
     'materials': [%(materials)s],
     'materials': [%(materials)s],
 
 
-    'normals': [%(normals)s],
-
     'vertices': [%(vertices)s],
     'vertices': [%(vertices)s],
 
 
+    'morphTargets': [],
+
+    'normals': [%(normals)s],
+
     'colors': [%(colors)s],
     'colors': [%(colors)s],
 
 
     'uvs': [[%(uvs)s]],
     'uvs': [[%(uvs)s]],
@@ -226,7 +228,7 @@ def setBit(value, position, on):
         mask = ~(1 << position)
         mask = ~(1 << position)
         return (value & mask)    
         return (value & mask)    
     
     
-def generate_face(f, i, normals, uvs, colors, mesh, use_normals, use_colors, use_uv_coords):
+def generate_face(f, faceIndex, normals, uvs, colors, mesh, use_normals, use_colors, use_uv_coords):
     isTriangle = ( len(f.vertices) == 3 )
     isTriangle = ( len(f.vertices) == 3 )
     
     
     if isTriangle:
     if isTriangle:
@@ -278,7 +280,7 @@ def generate_face(f, i, normals, uvs, colors, mesh, use_normals, use_colors, use
         faceData.append( f.material_index )
         faceData.append( f.material_index )
 
 
     if hasFaceVertexUvs:
     if hasFaceVertexUvs:
-        uv = get_uv_indices(i, uvs, mesh)
+        uv = get_uv_indices(faceIndex, uvs, mesh)
         for i in range(nVertices):
         for i in range(nVertices):
             index = uv[i]
             index = uv[i]
             faceData.append(index)
             faceData.append(index)

+ 9 - 8
utils/exporters/convert_obj_three.py

@@ -4,7 +4,7 @@
 How to use this converter
 How to use this converter
 -------------------------
 -------------------------
 
 
-python convert_obj_three.py -i infile.obj -o outfile.js [-m morphfiles*.obj] [-a center|top|bottom] [-s smooth|flat] [-t ascii|binary] [-d invert|normal]
+python convert_obj_three.py -i infile.obj -o outfile.js [-m morphfiles*.obj] [-a center|top|bottom|none] [-s smooth|flat] [-t ascii|binary] [-d invert|normal]
 
 
 Notes: 
 Notes: 
 
 
@@ -29,18 +29,19 @@ How to use generated JS file in your HTML document
     <script type="text/javascript">
     <script type="text/javascript">
         ...
         ...
         
         
-        var loader = new THREE.Loader();
-        
         // load ascii model
         // load ascii model
-        loader.loadAscii( "Model_ascii.js", function( geometry ) { createScene( geometry) }, path_to_textures );
+        
+        var jsonLoader = new THREE.JSONLoader();
+        jsonLoader.load( { model: "Model_ascii.js", callback: function( geometry ) { createScene( geometry) } } );
 
 
         // load binary model
         // load binary model
-        loader.loadBinary( "Model_bin.js", function( geometry ) { createScene( geometry) }, path_to_textures );
+        
+        var binLoader = new THREE.BinaryLoader();
+        binLoader.load( { model: "Model_bin.js", callback: function( geometry ) { createScene( geometry) } } );
 
 
         function createScene( geometry ) {
         function createScene( geometry ) {
-            
-            var normalizeUVsFlag = 1; // set to 1 if canvas render has missing materials
-            var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial(), normalizeUVsFlag );
+
+            var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
             
             
         }
         }
         
         

Some files were not shown because too many files changed in this diff