Browse Source

Merged latest zz85's shapes / curves / extruded geometry updates.

The only notable change I did was to rename ExtrudeGeometry's parameter "path" to "extrudePath" (as now there is also "bendPath").
alteredq 14 years ago
parent
commit
e95ca433b2

+ 424 - 413
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r42 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,j;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),j=e*(1-c*h),c=e*(1-c*(1-h)),f){case 1:this.r=j;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=j;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r=
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,g,j;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),g=b*6-f,b=e*(1-c),j=e*(1-c*g),c=e*(1-c*(1-g)),f){case 1:this.r=j;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=j;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r=
 e;this.g=b;this.b=j;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
 THREE.Vector2=function(b,c){this.set(b||0,c||0)};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
@@ -15,74 +15,74 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,e,f){this.x=
 subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
 setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),
-c=c.clone().subSelf(e),h=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(h),g=c.dot(c),c=c.dot(h),h=1/(b*g-e*e),g=(g*f-e*c)*h,b=(b*c-e*f)*h;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,j,g,m,
-n,p,o,t,v,u,y=b.geometry,z=y.vertices,x=[],f=0;for(h=y.faces.length;f<h;f++)if(j=y.faces[f],v=this.origin.clone(),u=this.direction.clone(),p=b.matrixWorld,g=p.multiplyVector3(z[j.a].position.clone()),m=p.multiplyVector3(z[j.b].position.clone()),n=p.multiplyVector3(z[j.c].position.clone()),p=j instanceof THREE.Face4?p.multiplyVector3(z[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=u.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(g,
-v))/t,v=v.addSelf(u.multiplyScalar(o)),j instanceof THREE.Face3)e(v,g,m,n)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},x.push(j));else if(j instanceof THREE.Face4&&(e(v,g,m,p)||e(v,m,n,p)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},x.push(j);return x}else return[]}};
-THREE.Rectangle=function(){function b(){j=f-c;g=h-e}var c,e,f,h,j,g,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return g};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,j,o,t){m=!1;c=g;e=j;f=o;h=t;b()};this.addPoint=function(g,j){m?(m=!1,c=g,e=j,f=g,h=j):(c=c<g?c:g,e=e<j?e:j,f=f>g?f:g,h=h>j?h:j);b()};this.add3Points=
-function(g,j,o,t,v,u){m?(m=!1,c=g<o?g<v?g:v:o<v?o:v,e=j<t?j<u?j:u:t<u?t:u,f=g>o?g>v?g:v:o>v?o:v,h=j>t?j>u?j:u:t>u?t:u):(c=g<o?g<v?g<c?g:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<t?j<u?j<e?j:e:u<e?u:e:t<u?t<e?t:e:u<e?u:e,f=g>o?g>v?g>f?g:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,h=j>t?j>u?j>h?j:h:u>h?u:h:t>u?t>h?t:h:u>h?u:h);b()};this.addRectangle=function(g){m?(m=!1,c=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),e=e<g.getTop()?e:g.getTop(),f=f>g.getRight()?f:g.getRight(),h=h>
-g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){c-=g;e-=g;f+=g;h+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();e=e>g.getTop()?e:g.getTop();f=f<g.getRight()?f:g.getRight();h=h<g.getBottom()?h:g.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;h=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,j,g,m,n,p,o,t,v,u,y,z){this.set(b||1,c||0,e||0,f||0,h||0,j||1,g||0,m||0,n||0,p||0,o||1,t||0,v||0,u||0,y||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,j,g,m,n,p,o,t,v,u,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=j;this.n23=g;this.n24=m;this.n31=n;this.n32=p;this.n33=o;this.n34=t;this.n41=v;this.n42=u;this.n43=y;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
-c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());h.cross(j,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=j.x;this.n21=f.y;this.n22=h.y;this.n23=j.y;this.n31=f.z;this.n32=h.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
-b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,j=b.n14,g=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,y=b.n41,z=b.n42,x=b.n43,w=b.n44,H=c.n11,B=c.n12,
-J=c.n13,C=c.n14,G=c.n21,O=c.n22,F=c.n23,I=c.n24,R=c.n31,ca=c.n32,T=c.n33,D=c.n34,da=c.n41,S=c.n42,P=c.n43,k=c.n44;this.n11=e*H+f*G+h*R+j*da;this.n12=e*B+f*O+h*ca+j*S;this.n13=e*J+f*F+h*T+j*P;this.n14=e*C+f*I+h*D+j*k;this.n21=g*H+m*G+n*R+p*da;this.n22=g*B+m*O+n*ca+p*S;this.n23=g*J+m*F+n*T+p*P;this.n24=g*C+m*I+n*D+p*k;this.n31=o*H+t*G+v*R+u*da;this.n32=o*B+t*O+v*ca+u*S;this.n33=o*J+t*F+v*T+u*P;this.n34=o*C+t*I+v*D+u*k;this.n41=y*H+z*G+x*R+w*da;this.n42=y*B+z*O+x*ca+w*S;this.n43=y*J+z*F+x*T+w*P;this.n44=
-y*C+z*I+x*D+w*k;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
-b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,j=this.n22,g=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,t=this.n34,v=this.n41,u=this.n42,y=this.n43,z=this.n44;return f*g*p*v-e*m*p*v-f*j*o*v+c*m*o*v+e*j*t*v-c*g*t*v-f*g*n*u+e*m*n*u+f*h*o*u-b*m*o*u-e*h*t*u+b*g*t*u+f*j*n*y-c*m*n*y-f*h*p*y+b*m*p*y+c*h*t*y-b*j*t*y-e*j*n*z+c*g*n*z+e*h*p*z-b*g*p*z-c*h*
+c=c.clone().subSelf(e),g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,j,h,m,
+p,n,o,t,v,u,w=b.geometry,z=w.vertices,y=[],f=0;for(g=w.faces.length;f<g;f++)if(j=w.faces[f],v=this.origin.clone(),u=this.direction.clone(),n=b.matrixWorld,h=n.multiplyVector3(z[j.a].position.clone()),m=n.multiplyVector3(z[j.b].position.clone()),p=n.multiplyVector3(z[j.c].position.clone()),n=j instanceof THREE.Face4?n.multiplyVector3(z[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),t=u.dot(o),b.doubleSided||(b.flipSided?t>0:t<0))if(o=o.dot((new THREE.Vector3).sub(h,
+v))/t,v=v.addSelf(u.multiplyScalar(o)),j instanceof THREE.Face3)e(v,h,m,p)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},y.push(j));else if(j instanceof THREE.Face4&&(e(v,h,m,n)||e(v,m,p,n)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},y.push(j);return y}else return[]}};
+THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,t){m=!1;c=h;e=j;f=o;g=t;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
+function(h,j,o,t,v,u){m?(m=!1,c=h<o?h<v?h:v:o<v?o:v,e=j<t?j<u?j:u:t<u?t:u,f=h>o?h>v?h:v:o>v?o:v,g=j>t?j>u?j:u:t>u?t:u):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<t?j<u?j<e?j:e:u<e?u:e:t<u?t<e?t:e:u<e?u:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=j>t?j>u?j>g?j:g:u>g?u:g:t>u?t>g?t:g:u>g?u:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
+h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,j,h,m,p,n,o,t,v,u,w,z){this.set(b||1,c||0,e||0,f||0,g||0,j||1,h||0,m||0,p||0,n||0,o||1,t||0,v||0,u||0,w||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,g,j,h,m,p,n,o,t,v,u,w,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=m;this.n31=p;this.n32=n;this.n33=o;this.n34=t;this.n41=v;this.n42=u;this.n43=w;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+c,e){var f=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;
+b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,p=b.n23,n=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,z=b.n42,y=b.n43,x=b.n44,H=c.n11,B=c.n12,
+F=c.n13,J=c.n14,D=c.n21,L=c.n22,G=c.n23,I=c.n24,R=c.n31,da=c.n32,T=c.n33,C=c.n34,ea=c.n41,S=c.n42,P=c.n43,k=c.n44;this.n11=e*H+f*D+g*R+j*ea;this.n12=e*B+f*L+g*da+j*S;this.n13=e*F+f*G+g*T+j*P;this.n14=e*J+f*I+g*C+j*k;this.n21=h*H+m*D+p*R+n*ea;this.n22=h*B+m*L+p*da+n*S;this.n23=h*F+m*G+p*T+n*P;this.n24=h*J+m*I+p*C+n*k;this.n31=o*H+t*D+v*R+u*ea;this.n32=o*B+t*L+v*da+u*S;this.n33=o*F+t*G+v*T+u*P;this.n34=o*J+t*I+v*C+u*k;this.n41=w*H+z*D+y*R+x*ea;this.n42=w*B+z*L+y*da+x*S;this.n43=w*F+z*G+y*T+x*P;this.n44=
+w*J+z*I+y*C+x*k;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
+b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,m=this.n24,p=this.n31,n=this.n32,o=this.n33,t=this.n34,v=this.n41,u=this.n42,w=this.n43,z=this.n44;return f*h*n*v-e*m*n*v-f*j*o*v+c*m*o*v+e*j*t*v-c*h*t*v-f*h*p*u+e*m*p*u+f*g*o*u-b*m*o*u-e*g*t*u+b*h*t*u+f*j*p*w-c*m*p*w-f*g*n*w+b*m*n*w+c*g*t*w-b*j*t*w-e*j*p*z+c*h*p*z+e*g*n*z-b*h*n*z-c*g*
 o*z+b*j*o*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
 this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
 this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
 this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
-0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,j=b.x,g=b.y,m=b.z,n=h*j,p=h*g;this.set(n*j+e,n*g-f*m,n*m+f*g,0,n*g+f*m,p*g+e,p*m-f*j,0,n*m-f*g,p*m+f*j,h*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,j=Math.cos(e),e=Math.sin(e),g=Math.cos(f),f=Math.sin(f),m=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var n=
-g*m,p=g*h,o=f*m,t=f*h;this.n11=n+t*e;this.n12=o*e-p;this.n13=j*f;this.n21=j*h;this.n22=j*m;this.n23=-e;this.n31=p*e-o;this.n32=t+n*e;this.n33=j*g;break;case "ZXY":n=g*m;p=g*h;o=f*m;t=f*h;this.n11=n-t*e;this.n12=-j*h;this.n13=o+p*e;this.n21=p+o*e;this.n22=j*m;this.n23=t-n*e;this.n31=-j*f;this.n32=e;this.n33=j*g;break;case "ZYX":n=j*m;p=j*h;o=e*m;t=e*h;this.n11=g*m;this.n12=o*f-p;this.n13=n*f+t;this.n21=g*h;this.n22=t*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*g;this.n33=j*g;break;case "YZX":n=j*g;p=
-j*f;o=e*g;t=e*f;this.n11=g*m;this.n12=t-n*h;this.n13=o*h+p;this.n21=h;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*h+o;this.n33=n-t*h;break;case "XZY":n=j*g;p=j*f;o=e*g;t=e*f;this.n11=g*m;this.n12=-h;this.n13=f*m;this.n21=n*h+t;this.n22=j*m;this.n23=p*h-o;this.n31=o*h-p;this.n32=e*m;this.n33=t*h+n;break;default:n=j*m,p=j*h,o=e*m,t=e*h,this.n11=g*m,this.n12=-g*h,this.n13=f,this.n21=p+o*f,this.n22=n-t*f,this.n23=-e*g,this.n31=t-n*f,this.n32=o+p*f,this.n33=j*g}return this},setRotationFromQuaternion:function(b){var c=
-b.x,e=b.y,f=b.z,h=b.w,j=c+c,g=e+e,m=f+f,b=c*j,n=c*g;c*=m;var p=e*g;e*=m;f*=m;j*=h;g*=h;h*=m;this.n11=1-(p+f);this.n12=n-h;this.n13=c+g;this.n21=n+h;this.n22=1-(b+f);this.n23=e-j;this.n31=c-g;this.n32=e+j;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
-extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,j=b.n14,g=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,y=b.n41,z=b.n42,x=b.n43,w=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*u*z-p*v*z+p*t*x-m*u*x-n*t*w+m*v*w;c.n12=j*v*z-h*u*z-j*t*x+f*u*x+h*t*w-f*v*w;c.n13=h*p*z-j*n*z+j*m*x-f*p*x-h*m*w+f*n*w;c.n14=j*n*t-h*p*t-j*m*v+f*p*v+h*m*u-f*n*u;c.n21=p*v*y-n*u*y-p*o*x+g*u*x+n*o*w-g*v*w;c.n22=h*u*y-j*v*y+j*o*x-e*u*x-h*o*w+e*v*w;c.n23=j*n*y-h*p*y-j*g*x+e*p*x+h*g*w-e*n*w;c.n24=
-h*p*o-j*n*o+j*g*v-e*p*v-h*g*u+e*n*u;c.n31=m*u*y-p*t*y+p*o*z-g*u*z-m*o*w+g*t*w;c.n32=j*t*y-f*u*y-j*o*z+e*u*z+f*o*w-e*t*w;c.n33=h*p*y-j*m*y+j*g*z-e*p*z-f*g*w+e*m*w;c.n34=j*m*o-f*p*o-j*g*t+e*p*t+f*g*u-e*m*u;c.n41=n*t*y-m*v*y-n*o*z+g*v*z+m*o*x-g*t*x;c.n42=f*v*y-h*t*y+h*o*z-e*v*z-f*o*x+e*t*x;c.n43=h*m*y-f*n*y-h*g*z+e*n*z+f*g*x-e*m*x;c.n44=f*n*o-h*m*o+h*g*t-e*n*t-f*g*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*j;e[3]=b*g;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*t;return c};
-THREE.Matrix4.makeFrustum=function(b,c,e,f,h,j){var g;g=new THREE.Matrix4;g.n11=2*h/(c-b);g.n12=0;g.n13=(c+b)/(c-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(j+h)/(j-h);g.n34=-2*j*h/(j-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
-THREE.Matrix4.makeOrtho=function(b,c,e,f,h,j){var g,m,n,p;g=new THREE.Matrix4;m=c-b;n=e-f;p=j-h;g.n11=2/m;g.n12=0;g.n13=0;g.n14=-((c+b)/m);g.n21=0;g.n22=2/n;g.n23=0;g.n24=-((e+f)/n);g.n31=0;g.n32=0;g.n33=-2/p;g.n34=-((j+h)/p);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;
+0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,h=b.y,m=b.z,p=g*j,n=g*h;this.set(p*j+e,p*h-f*m,p*m+f*h,0,p*h+f*m,n*h+e,n*m-f*j,0,p*m-f*h,n*m+f*j,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var p=
+h*m,n=h*g,o=f*m,t=f*g;this.n11=p+t*e;this.n12=o*e-n;this.n13=j*f;this.n21=j*g;this.n22=j*m;this.n23=-e;this.n31=n*e-o;this.n32=t+p*e;this.n33=j*h;break;case "ZXY":p=h*m;n=h*g;o=f*m;t=f*g;this.n11=p-t*e;this.n12=-j*g;this.n13=o+n*e;this.n21=n+o*e;this.n22=j*m;this.n23=t-p*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":p=j*m;n=j*g;o=e*m;t=e*g;this.n11=h*m;this.n12=o*f-n;this.n13=p*f+t;this.n21=h*g;this.n22=t*f+p;this.n23=n*f-o;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":p=j*h;n=
+j*f;o=e*h;t=e*f;this.n11=h*m;this.n12=t-p*g;this.n13=o*g+n;this.n21=g;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=n*g+o;this.n33=p-t*g;break;case "XZY":p=j*h;n=j*f;o=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=p*g+t;this.n22=j*m;this.n23=n*g-o;this.n31=o*g-n;this.n32=e*m;this.n33=t*g+p;break;default:p=j*m,n=j*g,o=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=n+o*f,this.n22=p-t*f,this.n23=-e*h,this.n31=t-p*f,this.n32=o+n*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=
+b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,m=f+f,b=c*j,p=c*h;c*=m;var n=e*h;e*=m;f*=m;j*=g;h*=g;g*=m;this.n11=1-(n+f);this.n12=p-g;this.n13=c+h;this.n21=p+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
+extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,p=b.n23,n=b.n24,o=b.n31,t=b.n32,v=b.n33,u=b.n34,w=b.n41,z=b.n42,y=b.n43,x=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*u*z-n*v*z+n*t*y-m*u*y-p*t*x+m*v*x;c.n12=j*v*z-g*u*z-j*t*y+f*u*y+g*t*x-f*v*x;c.n13=g*n*z-j*p*z+j*m*y-f*n*y-g*m*x+f*p*x;c.n14=j*p*t-g*n*t-j*m*v+f*n*v+g*m*u-f*p*u;c.n21=n*v*w-p*u*w-n*o*y+h*u*y+p*o*x-h*v*x;c.n22=g*u*w-j*v*w+j*o*y-e*u*y-g*o*x+e*v*x;c.n23=j*p*w-g*n*w-j*h*y+e*n*y+g*h*x-e*p*x;c.n24=
+g*n*o-j*p*o+j*h*v-e*n*v-g*h*u+e*p*u;c.n31=m*u*w-n*t*w+n*o*z-h*u*z-m*o*x+h*t*x;c.n32=j*t*w-f*u*w-j*o*z+e*u*z+f*o*x-e*t*x;c.n33=g*n*w-j*m*w+j*h*z-e*n*z-f*h*x+e*m*x;c.n34=j*m*o-f*n*o-j*h*t+e*n*t+f*h*u-e*m*u;c.n41=p*t*w-m*v*w-p*o*z+h*v*z+m*o*y-h*t*y;c.n42=f*v*w-g*t*w+g*o*z-e*v*z-f*o*y+e*t*y;c.n43=g*m*w-f*p*w-g*h*z+e*p*z+f*h*y-e*m*y;c.n44=f*p*o-g*m*o+g*h*t-e*p*t-f*h*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*m;e[5]=b*p;e[6]=b*n;e[7]=b*o;e[8]=b*t;return c};
+THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(j+g)/(j-g);h.n34=-2*j*g/(j-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
+THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var h,m,p,n;h=new THREE.Matrix4;m=c-b;p=e-f;n=j-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/p;h.n23=0;h.n24=-((e+f)/p);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((j+g)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
 this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
--1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);
+-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
 this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);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(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
 this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),j=Math.cos(e),e=Math.sin(e),g=b*c,m=f*h;this.w=g*j-m*e;this.x=g*e+m*j;this.y=f*c*j+b*h*e;this.z=b*h*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),j=Math.cos(e),e=Math.sin(e),h=b*c,m=f*g;this.w=h*j-m*e;this.x=h*e+m*j;this.y=f*c*j+b*g*e;this.z=b*g*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
-b,this.w*=b);return this},multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,h=this.w,j=b.x,g=b.y,m=b.z,b=b.w;this.x=c*b+h*j+e*m-f*g;this.y=e*b+h*g+f*j-c*m;this.z=f*b+h*m+c*g-e*j;this.w=h*b-c*j-e*g-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,j=this.x,g=this.y,m=this.z,
-n=this.w,p=n*e+g*h-m*f,o=n*f+m*e-j*h,t=n*h+j*f-g*e,e=-j*e-g*f-m*h;c.x=p*n+e*-j+o*-m-t*-g;c.y=o*n+e*-g+t*-j-p*-m;c.z=t*n+e*-m+p*-g-o*-j;return c}};
-THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*j)/g;f=Math.sin(f*j)/g;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
-THREE.Face3=function(b,c,e,f,h,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=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.Face4=function(b,c,e,f,h,j,g){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
+b,this.w*=b);return this},multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*j+e*m-f*h;this.y=e*b+g*h+f*j-c*m;this.z=f*b+g*m+c*h-e*j;this.w=g*b-c*j-e*h-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,m=this.z,
+p=this.w,n=p*e+h*g-m*f,o=p*f+m*e-j*g,t=p*g+j*f-h*e,e=-j*e-h*f-m*g;c.x=n*p+e*-j+o*-m-t*-h;c.y=o*p+e*-h+t*-j-n*-m;c.z=t*p+e*-m+n*-h-o*-j;return c}};
+THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
+THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,h,j,g,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],g=this.vertices[j.c],m.sub(g.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,m=new THREE.Vector3,p=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){m.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)m.addSelf(j.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],m.sub(h.position,e.position),p.sub(c.position,e.position),m.crossSelf(p);m.isZero()||
 m.normalize();j.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,j,h,F){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=g[j];t=g[h];v=g[F];u=n.x-m.x;y=p.x-m.x;z=n.y-m.y;x=p.y-m.y;w=n.z-m.z;H=p.z-m.z;B=t.u-o.u;J=v.u-o.u;C=t.v-o.v;G=v.v-o.v;O=1/(B*G-J*C);ca.set((G*u-C*y)*
-O,(G*z-C*x)*O,(G*w-C*H)*O);T.set((B*y-J*u)*O,(B*x-J*z)*O,(B*H-J*w)*O);I[e].addSelf(ca);I[c].addSelf(ca);I[f].addSelf(ca);R[e].addSelf(T);R[c].addSelf(T);R[f].addSelf(T)}var c,e,f,h,j,g,m,n,p,o,t,v,u,y,z,x,w,H,B,J,C,G,O,F,I=[],R=[],ca=new THREE.Vector3,T=new THREE.Vector3,D=new THREE.Vector3,da=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)I[c]=new THREE.Vector3,R[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],g=this.faceVertexUvs[0][c],j instanceof
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var P=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)S.copy(j.vertexNormals[f]),h=j[P[f]],F=I[h],D.copy(F),D.subSelf(S.multiplyScalar(S.dot(F))).normalize(),da.cross(j.vertexNormals[f],F),h=da.dot(R[h]),h=h<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(D.x,D.y,D.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,g,j,G){m=b.vertices[e].position;p=b.vertices[c].position;n=b.vertices[f].position;o=h[g];t=h[j];v=h[G];u=p.x-m.x;w=n.x-m.x;z=p.y-m.y;y=n.y-m.y;x=p.z-m.z;H=n.z-m.z;B=t.u-o.u;F=v.u-o.u;J=t.v-o.v;D=v.v-o.v;L=1/(B*D-F*J);da.set((D*u-J*w)*
+L,(D*z-J*y)*L,(D*x-J*H)*L);T.set((B*w-F*u)*L,(B*y-F*z)*L,(B*H-F*x)*L);I[e].addSelf(da);I[c].addSelf(da);I[f].addSelf(da);R[e].addSelf(T);R[c].addSelf(T);R[f].addSelf(T)}var c,e,f,g,j,h,m,p,n,o,t,v,u,w,z,y,x,H,B,F,J,D,L,G,I=[],R=[],da=new THREE.Vector3,T=new THREE.Vector3,C=new THREE.Vector3,ea=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)I[c]=new THREE.Vector3,R[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var P=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)S.copy(j.vertexNormals[f]),g=j[P[f]],G=I[g],C.copy(G),C.subSelf(S.multiplyScalar(S.dot(G))).normalize(),ea.cross(j.vertexNormals[f],G),g=ea.dot(R[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(C.x,C.y,C.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
-void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,j,g,m={};e=0;for(f=this.faces.length;e<f;e++)g=this.faces[e],g instanceof THREE.Face3?(h=b(g.a,g.b),c(m,h,e),h=b(g.b,g.c),c(m,h,e),h=b(g.a,g.c),c(m,h,e)):g instanceof THREE.Face4&&(h=b(g.b,g.d),c(m,h,e),h=b(g.a,g.b),c(m,h,e),h=b(g.a,g.d),c(m,h,e),h=b(g.b,g.c),c(m,h,e),h=b(g.c,g.d),c(m,h,e));e=0;for(f=this.edges.length;e<f;e++){g=this.edges[e];h=g.vertexIndices[0];j=g.vertexIndices[1];
-g.faceIndices=m[b(h,j)].array;for(h=0;h<g.faceIndices.length;h++)j=g.faceIndices[h],g.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,e,c,f,g,j,h){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*h+(-3*(e-c)-2*b-f)*j+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},h,j,g,m,n,p,o,t,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;j=Math.floor(h);g=h-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;p=this.points[e[0]];o=this.points[e[1]];
-t=this.points[e[2]];v=this.points[e[3]];m=g*g;n=g*m;f.x=c(p.x,o.x,t.x,v.x,g,m,n);f.y=c(p.y,o.y,t.y,v.y,g,m,n);f.z=c(p.z,o.z,t.z,v.z,g,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,j=new THREE.Vector3,h=[],m=0;h[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),j.copy(position),
-m+=j.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(h[e]=m,f=e);h[h.length]=m;return{chunks:h,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,j,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];j=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<j-1;c++)f=g+c*(1/j)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
-m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
+void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,j,h,m={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.a,h.c),c(m,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(m,g,e),g=b(h.a,h.b),c(m,g,e),g=b(h.a,h.d),c(m,g,e),g=b(h.b,h.c),c(m,g,e),g=b(h.c,h.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];j=h.vertexIndices[1];
+h.faceIndices=m[b(g,j)].array;for(g=0;g<h.faceIndices.length;g++)j=h.faceIndices[g],h.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
+THREE.Spline=function(b){function c(b,e,c,f,h,g,j){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*j+(-3*(e-c)-2*b-f)*g+b*h+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,j,h,m,p,n,o,t,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;j=Math.floor(g);h=g-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;n=this.points[e[0]];o=this.points[e[1]];
+t=this.points[e[2]];v=this.points[e[3]];m=h*h;p=h*m;f.x=c(n.x,o.x,t.x,v.x,h,m,p);f.y=c(n.y,o.y,t.y,v.y,h,m,p);f.z=c(n.z,o.z,t.z,v.z,h,m,p);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,h=new THREE.Vector3,g=new THREE.Vector3,j=[],m=0;j[0]=0;b||(b=100);c=this.points.length*b;h.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),g.copy(position),
+m+=g.distanceTo(h),h.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(j[e]=m,f=e);j[j.length]=m;return{chunks:j,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,h,g,j,m=[],p=new THREE.Vector3,n=this.getLength();m.push(p.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=n.chunks[e]-n.chunks[e-1];j=Math.ceil(b*c/n.total);h=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<j-1;c++)f=h+c*(1/j)*(g-h),position=this.getPoint(f),m.push(p.copy(position).clone());
+m.push(p.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
-THREE.Camera.prototype.setViewOffset=function(b,c,e,f,h,j){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=h;this.height=j;this.updateProjectionMatrix()};
+THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,j){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=j;this.updateProjectionMatrix()};
 THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
 !1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
 THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
 THREE.LensFlare=function(b,c,e,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=void 0;b!==void 0&&this.add(b,c,e,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
 THREE.LensFlare.prototype.add=function(b,c,e,f){c===void 0&&(c=-1);e===void 0&&(e=0);if(f===void 0)f=THREE.BillboardBlending;e=Math.min(e,Math.max(0,e));this.lensFlares.push({texture:b,size:c,distance:e,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
-THREE.LensFlare.prototype.updateLensFlares=function(){var b,c=this.lensFlares.length,e,f=-this.positionScreen.x*2,h=-this.positionScreen.y*2;for(b=0;b<c;b++)e=this.lensFlares[b],e.x=this.positionScreen.x+f*e.distance,e.y=this.positionScreen.y+h*e.distance,e.wantedRotation=e.x*Math.PI*0.25,e.rotation+=(e.wantedRotation-e.rotation)*0.25};
+THREE.LensFlare.prototype.updateLensFlares=function(){var b,c=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(b=0;b<c;b++)e=this.lensFlares[b],e.x=this.positionScreen.x+f*e.distance,e.y=this.positionScreen.y+g*e.distance,e.wantedRotation=e.x*Math.PI*0.25,e.rotation+=(e.wantedRotation-e.rotation)*0.25};
 THREE.Material=function(b){this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:
 0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};
@@ -105,34 +105,34 @@ void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wiref
 THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
 THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
-THREE.Texture=function(b,c,e,f,h,j){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=j!==void 0?j:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
+THREE.Texture=function(b,c,e,f,g,j){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=j!==void 0?j:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;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.DataTexture=function(b,c,e,f,h,j,g,m,n){THREE.Texture.call(this,null,h,j,g,m,n);this.image={data:b,width:c,height:e};this.format=f!==void 0?f:THREE.RGBAFormat};
+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.DataTexture=function(b,c,e,f,g,j,h,m,p){THREE.Texture.call(this,null,g,j,h,m,p);this.image={data:b,width:c,height:e};this.format=f!==void 0?f:THREE.RGBAFormat};
 THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;THREE.DataTexture.prototype={clone:function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
 e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;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(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<h;f++)this.children[f].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
 c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
-THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,h,j,g,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],j=h.pos,g=h.rotq,m=h.scl,f=this.addBone(),f.name=h.name,f.position.set(j[0],j[1],j[2]),f.quaternion.set(g[0],g[1],g[2],g[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)h=this.geometry.bones[e],
-f=this.bones[e],h.parent===-1?this.addChild(f):this.bones[h.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(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,h=this.children.length;for(f=0;f<h;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,j,h,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],j=g.pos,h=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(j[0],j[1],j[2]),f.quaternion.set(h[0],h[1],h[2],h[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
+f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.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(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
-THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,j=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
-e.y,e.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[j].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,j=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
+e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[j].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;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(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
 THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
 this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
 THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,h,j,g,m,n,p,o,t,v,u,y=new THREE.Geometry;y.vertices=this.geometry.vertices;f=y.faces=this.geometry.faces;var z=y.egdes=this.geometry.edges,x=y.edgeFaces=[];h=0;var w=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],w.push(h),h+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
-e.normal;b=0;for(c=z.length;b<c;b++)m=z[b],e=m.faces[0],f=m.faces[1],h=m.faceIndices[0],j=m.faceIndices[1],g=m.vertexIndices[0],m=m.vertexIndices[1],e.a===g?(n="a",o=w[h]+0):e.b===g?(n="b",o=w[h]+1):e.c===g?(n="c",o=w[h]+2):e.d===g&&(n="d",o=w[h]+3),e.a===m?(n+="a",t=w[h]+0):e.b===m?(n+="b",t=w[h]+1):e.c===m?(n+="c",t=w[h]+2):e.d===m&&(n+="d",t=w[h]+3),f.a===g?(p="a",v=w[j]+0):f.b===g?(p="b",v=w[j]+1):f.c===g?(p="c",v=w[j]+2):f.d===g&&(p="d",v=w[j]+3),f.a===m?(p+="a",u=w[j]+0):f.b===m?(p+="b",u=w[j]+
-1):f.c===m?(p+="c",u=w[j]+2):f.d===m&&(p+="d",u=w[j]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>t&&(e=o,o=t,t=e):o<t&&(e=o,o=t,t=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(o,t,v,u),e.normal.set(1,0,0),x.push(e);this.geometry=y}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
-THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,h=b.faces,b=b.vertices,j=h.length,g,m,n,p,o,t=["a","b","c","d"];for(n=0;n<j;n++){m=c.length;g=h[n];g instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(g.normal);e.push(m);
-for(m=0;m<p;m++)o=b[g[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(j=0;j<h.length-1;j++){b=e[j];for(g=j+1;g<h.length;g++)m=e[g],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,h,j,g,m,n,p,o,t,v,u,y,z,x=0,w=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(y=0;y<f;y++){j=c[w[y]];m=b[j];for(z=0;z<h;z++)if(g=e[w[z]],n=b[g],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(x++,x===1&&(p=m,o=n,t=j,v=g,u=w[y]),x===2))return u+=w[y],u==="ad"||u==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[t,v,
-g,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[t,j,g,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,j,h,m,p,n,o,t,v,u,w=new THREE.Geometry;w.vertices=this.geometry.vertices;f=w.faces=this.geometry.faces;var z=w.egdes=this.geometry.edges,y=w.edgeFaces=[];g=0;var x=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],x.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
+e.normal;b=0;for(c=z.length;b<c;b++)m=z[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],j=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(p="a",o=x[g]+0):e.b===h?(p="b",o=x[g]+1):e.c===h?(p="c",o=x[g]+2):e.d===h&&(p="d",o=x[g]+3),e.a===m?(p+="a",t=x[g]+0):e.b===m?(p+="b",t=x[g]+1):e.c===m?(p+="c",t=x[g]+2):e.d===m&&(p+="d",t=x[g]+3),f.a===h?(n="a",v=x[j]+0):f.b===h?(n="b",v=x[j]+1):f.c===h?(n="c",v=x[j]+2):f.d===h&&(n="d",v=x[j]+3),f.a===m?(n+="a",u=x[j]+0):f.b===m?(n+="b",u=x[j]+
+1):f.c===m?(n+="c",u=x[j]+2):f.d===m&&(n+="d",u=x[j]+3),p==="ac"||p==="ad"||p==="ca"||p==="da"?o>t&&(e=o,o=t,t=e):o<t&&(e=o,o=t,t=e),n==="ac"||n==="ad"||n==="ca"||n==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(o,t,v,u),e.normal.set(1,0,0),y.push(e);this.geometry=w}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,j=g.length,h,m,p,n,o,t=["a","b","c","d"];for(p=0;p<j;p++){m=c.length;h=g[p];h instanceof THREE.Face4?(n=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(n=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(h.normal);e.push(m);
+for(m=0;m<n;m++)o=b[h[t[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(j=0;j<g.length-1;j++){b=e[j];for(h=j+1;h<g.length;h++)m=e[h],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,j,h,m,p,n,o,t,v,u,w,z,y=0,x=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(w=0;w<f;w++){j=c[x[w]];m=b[j];for(z=0;z<g;z++)if(h=e[x[z]],p=b[h],Math.abs(m.position.x-p.position.x)<1.0E-4&&Math.abs(m.position.y-p.position.y)<1.0E-4&&Math.abs(m.position.z-p.position.z)<1.0E-4&&(y++,y===1&&(n=m,o=p,t=j,v=h,u=x[w]),y===2))return u+=x[w],u==="ad"||u==="ac"?{faces:[c,e],vertices:[n,o,p,m],indices:[t,v,
+h,j],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[n,m,p,o],indices:[t,j,h,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
 THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
 this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
 THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
@@ -141,57 +141,57 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,j=e.z+e.w,k=-b.z+b.w,h=-e.z+e.w;return g>=0&&j>=0&&k>=0&&h>=0?!0:g<0&&j<0||k<0&&h<0?!1:(g<0?c=Math.max(c,g/(g-j)):j<0&&(f=Math.min(f,g/(g-j))),k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,j=[],g,m,n=[],p,o,t=[],v,u=[],y,z,x=[],w,H,B=[],J=new THREE.Vector4,C=new THREE.Vector4,
-G=new THREE.Matrix4,O=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){G.multiply(e.projectionMatrix,e.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,e){G.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,g){var e=[],m,n,p;h=0;n=
-b.objects;b=0;for(m=n.length;b<m;b++){p=n[b];var k;if(!(k=!p.visible))if(k=p instanceof THREE.Mesh){a:{k=void 0;for(var t=p.matrixWorld,u=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),o=0;o<6;o++)if(k=F[o].x*t.n14+F[o].y*t.n24+F[o].z*t.n34+F[o].w,k<=u){k=!1;break a}k=!0}k=!k}if(!k)k=j[h]=j[h]||new THREE.RenderableObject,h++,f=k,J.copy(p.position),G.multiplyVector3(J),f.object=p,f.z=J.z,e.push(f)}g&&e.sort(c);return e};this.projectScene=function(f,j,h){var J=[],
-S=j.near,P=j.far,k,K,X,$,Y,ga,ja,ea,M,W,aa,ma,ka,sa,la,U,fa;H=z=v=o=0;j.matrixAutoUpdate&&j.update(void 0,!0);f.update(void 0,!1,j);G.multiply(j.projectionMatrix,j.matrixWorldInverse);F[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);F[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);F[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);F[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);F[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-G.n34);F[5].set(G.n41+G.n31,G.n42+
-G.n32,G.n43+G.n33,G.n44+G.n34);for(k=0;k<6;k++)M=F[k],M.divideScalar(Math.sqrt(M.x*M.x+M.y*M.y+M.z*M.z));M=this.projectObjects(f,j,!0);f=0;for(k=M.length;f<k;f++)if(W=M[f].object,W.visible)if(aa=W.matrixWorld,ma=W.matrixRotationWorld,ka=W.materials,sa=W.overdraw,m=0,W instanceof THREE.Mesh){la=W.geometry;$=la.vertices;U=la.faces;la=la.faceVertexUvs;K=0;for(X=$.length;K<X;K++)g=b(),g.positionWorld.copy($[K].position),aa.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),G.multiplyVector4(g.positionScreen),
-g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>S&&g.positionScreen.z<P;$=0;for(K=U.length;$<K;$++){X=U[$];if(X instanceof THREE.Face3)if(Y=n[X.a],ga=n[X.b],ja=n[X.c],Y.visible&&ga.visible&&ja.visible&&(W.doubleSided||W.flipSided!=(ja.positionScreen.x-Y.positionScreen.x)*(ga.positionScreen.y-Y.positionScreen.y)-(ja.positionScreen.y-Y.positionScreen.y)*(ga.positionScreen.x-Y.positionScreen.x)<0))ea=t[o]=t[o]||new THREE.RenderableFace3,o++,
-p=ea,p.v1.copy(Y),p.v2.copy(ga),p.v3.copy(ja);else continue;else if(X instanceof THREE.Face4)if(Y=n[X.a],ga=n[X.b],ja=n[X.c],ea=n[X.d],Y.visible&&ga.visible&&ja.visible&&ea.visible&&(W.doubleSided||W.flipSided!=((ea.positionScreen.x-Y.positionScreen.x)*(ga.positionScreen.y-Y.positionScreen.y)-(ea.positionScreen.y-Y.positionScreen.y)*(ga.positionScreen.x-Y.positionScreen.x)<0||(ga.positionScreen.x-ja.positionScreen.x)*(ea.positionScreen.y-ja.positionScreen.y)-(ga.positionScreen.y-ja.positionScreen.y)*
-(ea.positionScreen.x-ja.positionScreen.x)<0)))fa=u[v]=u[v]||new THREE.RenderableFace4,v++,p=fa,p.v1.copy(Y),p.v2.copy(ga),p.v3.copy(ja),p.v4.copy(ea);else continue;p.normalWorld.copy(X.normal);ma.multiplyVector3(p.normalWorld);p.centroidWorld.copy(X.centroid);aa.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);G.multiplyVector3(p.centroidScreen);ja=X.vertexNormals;Y=0;for(ga=ja.length;Y<ga;Y++)ea=p.vertexNormalsWorld[Y],ea.copy(ja[Y]),ma.multiplyVector3(ea);Y=0;for(ga=la.length;Y<
-ga;Y++)if(fa=la[Y][$]){ja=0;for(ea=fa.length;ja<ea;ja++)p.uvs[Y][ja]=fa[ja]}p.meshMaterials=ka;p.faceMaterials=X.materials;p.overdraw=sa;p.z=p.centroidScreen.z;J.push(p)}}else if(W instanceof THREE.Line){O.multiply(G,aa);$=W.geometry.vertices;Y=b();Y.positionScreen.copy($[0].position);O.multiplyVector4(Y.positionScreen);K=1;for(X=$.length;K<X;K++)if(Y=b(),Y.positionScreen.copy($[K].position),O.multiplyVector4(Y.positionScreen),ga=n[m-2],I.copy(Y.positionScreen),R.copy(ga.positionScreen),e(I,R))I.multiplyScalar(1/
-I.w),R.multiplyScalar(1/R.w),aa=x[z]=x[z]||new THREE.RenderableLine,z++,y=aa,y.v1.positionScreen.copy(I),y.v2.positionScreen.copy(R),y.z=Math.max(I.z,R.z),y.materials=W.materials,J.push(y)}else if(W instanceof THREE.Particle&&(C.set(W.matrixWorld.n14,W.matrixWorld.n24,W.matrixWorld.n34,1),G.multiplyVector4(C),C.z/=C.w,C.z>0&&C.z<1))aa=B[H]=B[H]||new THREE.RenderableParticle,H++,w=aa,w.x=C.x/C.w,w.y=C.y/C.w,w.z=C.z,w.rotation=W.rotation.z,w.scale.x=W.scale.x*Math.abs(w.x-(C.x+j.projectionMatrix.n11)/
-(C.w+j.projectionMatrix.n14)),w.scale.y=W.scale.y*Math.abs(w.y-(C.y+j.projectionMatrix.n22)/(C.w+j.projectionMatrix.n24)),w.materials=W.materials,J.push(w);h&&J.sort(c);return J}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;j=f/2};this.render=function(e,f){var n,p,o,t,v,u,y,z;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(v=b[n],v instanceof THREE.RenderableParticle){y=v.x*h+h;z=v.y*j+j;o=0;for(t=v.material.length;o<t;o++)if(u=v.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=y+"px",u.style.top=z+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(x!=b)u.globalAlpha=x=b}function e(b){if(w!=b){switch(b){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}w=b}}function f(b){if(H!=b)u.strokeStyle=H=b}function h(b){if(B!=b)u.fillStyle=B=b}var j=this,g=null,m=new THREE.Projector,b=b||{},n=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-p,o,t,v,u=n.getContext("2d"),y=new THREE.Color(0),z=0,x=1,w=0,H=null,B=null,J=null,C=null,G=null,O,F,I,R,ca=new THREE.RenderableVertex,T=new THREE.RenderableVertex,D,da,S,P,k,K,X,$,Y,ga,ja,ea,M=new THREE.Color(0),W=new THREE.Color(0),aa=new THREE.Color(0),ma=new THREE.Color(0),ka=new THREE.Color(0),sa=[],la,U,fa,ia,qa,va,za,La,ya,Oa,V=new THREE.Rectangle,ta=new THREE.Rectangle,na=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ra=new THREE.Color,wa=new THREE.Color,Ba=new THREE.Color,pa=new THREE.Vector3,
-xa,Da,Z,Q,Ea,N,b=16;xa=document.createElement("canvas");xa.width=xa.height=2;Da=xa.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Z=Da.getImageData(0,0,2,2);Q=Z.data;Ea=document.createElement("canvas");Ea.width=Ea.height=b;N=Ea.getContext("2d");N.translate(-b/2,-b/2);N.scale(b,b);b--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){p=b;o=e;t=p/2;v=o/2;n.width=p;n.height=o;V.set(-t,-v,t,v);ta.set(-t,
--v,t,v);x=1;w=0;G=C=J=B=H=null};this.setClearColor=function(b,e){y=b;z=e;ta.set(-t,-v,t,v)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;ta.set(-t,-v,t,v)};this.clear=function(){u.setTransform(1,0,0,-1,t,v);ta.isEmpty()||(ta.inflate(1),ta.minSelf(V),z==0?u.clearRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight()):(e(THREE.NormalBlending),c(1),setContextFillStyle("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+z+")"),u.fillRect(ta.getX(),ta.getY(),ta.getWidth(),
-ta.getHeight())),ta.empty())};this.render=function(b,n){function p(b){var e,c,f,g=b.lights;ra.setRGB(0,0,0);wa.setRGB(0,0,0);Ba.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(ra.r+=f.r,ra.g+=f.g,ra.b+=f.b):c instanceof THREE.DirectionalLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.PointLight&&(Ba.r+=f.r,Ba.g+=f.g,Ba.b+=f.b)}function o(b,e,c,f){var g,k,j,h,m=b.lights,b=0;for(g=m.length;b<g;b++)k=m[b],j=k.color,k instanceof THREE.DirectionalLight?
-(h=c.dot(k.position),h<=0||(h*=k.intensity,f.r+=j.r*h,f.g+=j.g*h,f.b+=j.b*h)):k instanceof THREE.PointLight&&(h=c.dot(pa.sub(k.position,e).normalize()),h<=0||(h*=k.distance==0?1:1-Math.min(e.distanceTo(k.position)/k.distance,1),h!=0&&(h*=k.intensity,f.r+=j.r*h,f.g+=j.g*h,f.b+=j.b*h)))}function Sa(b,g,k){c(k.opacity);e(k.blending);var j,m,n,p,Aa,o;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)p=k.map.image,Aa=p.width>>1,o=p.height>>1,k=g.scale.x*t,n=g.scale.y*v,j=k*Aa,m=n*o,na.set(b.x-j,b.y-
-m,b.x+j,b.y+m),V.instersects(na)&&(u.save(),u.translate(b.x,b.y),u.rotate(-g.rotation),u.scale(k,-n),u.translate(-Aa,-o),u.drawImage(p,0,0),u.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=g.scale.x*t,m=g.scale.y*v,na.set(b.x-j,b.y-m,b.x+j,b.y+m),V.instersects(na)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-g.rotation),u.scale(j,m),k.program(u),u.restore()))}function Ya(b,g,k,j){c(j.opacity);e(j.blending);u.beginPath();u.moveTo(b.positionScreen.x,
-b.positionScreen.y);u.lineTo(g.positionScreen.x,g.positionScreen.y);u.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(J!=b)u.lineWidth=J=b;b=j.linecap;if(C!=b)u.lineCap=C=b;b=j.linejoin;if(G!=b)u.lineJoin=G=b;f(j.color.getContextStyle());u.stroke();na.inflate(j.linewidth*2)}}function w(b,f,g,h,m,p,t,u,v){j.data.vertices+=3;j.data.faces++;c(u.opacity);e(u.blending);D=b.positionScreen.x;da=b.positionScreen.y;S=f.positionScreen.x;P=f.positionScreen.y;k=g.positionScreen.x;K=g.positionScreen.y;
-z(D,da,S,P,k,K);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ia=t.uvs[0],H(D,da,S,P,k,K,ia[h].u,ia[h].v,ia[m].u,ia[m].v,ia[p].u,ia[p].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=n.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),qa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,va=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),za=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
-La=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),ya=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Oa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,H(D,da,S,P,k,K,qa,va,za,La,ya,Oa,u.envMap)}else u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(ia=t.uvs[0],H(D,da,S,P,k,K,ia[h].u,ia[h].v,ia[m].u,ia[m].v,ia[p].u,ia[p].v,
-u.map)),e(THREE.SubtractiveBlending)),ua?!u.wireframe&&u.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(W.r=aa.r=ma.r=ra.r,W.g=aa.g=ma.g=ra.g,W.b=aa.b=ma.b=ra.b,o(v,t.v1.positionWorld,t.vertexNormalsWorld[0],W),o(v,t.v2.positionWorld,t.vertexNormalsWorld[1],aa),o(v,t.v3.positionWorld,t.vertexNormalsWorld[2],ma),ka.r=(aa.r+ma.r)*0.5,ka.g=(aa.g+ma.g)*0.5,ka.b=(aa.b+ma.b)*0.5,fa=Ta(W,aa,ma,ka),Pa(D,da,S,P,k,K,0,0,1,0,0,1,fa)):(ha.r=ra.r,ha.g=ra.g,ha.b=ra.b,o(v,t.centroidWorld,t.normalWorld,
-ha),M.r=Math.max(0,Math.min(u.color.r*ha.r,1)),M.g=Math.max(0,Math.min(u.color.g*ha.g,1)),M.b=Math.max(0,Math.min(u.color.b*ha.b,1)),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(M)):u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshDepthMaterial)la=n.near,U=n.far,W.r=W.g=W.b=1-Ma(b.positionScreen.z,la,U),aa.r=aa.g=aa.b=1-Ma(f.positionScreen.z,la,U),ma.r=ma.g=ma.b=1-Ma(g.positionScreen.z,
-la,U),ka.r=(aa.r+ma.r)*0.5,ka.g=(aa.g+ma.g)*0.5,ka.b=(aa.b+ma.b)*0.5,fa=Ta(W,aa,ma,ka),Pa(D,da,S,P,k,K,0,0,1,0,0,1,fa);else if(u instanceof THREE.MeshNormalMaterial)M.r=Qa(t.normalWorld.x),M.g=Qa(t.normalWorld.y),M.b=Qa(t.normalWorld.z),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(M)}function y(b,f,g,h,m,p,t,u,v){j.data.vertices+=4;j.data.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)w(b,f,h,0,1,3,t,u,v),w(m,g,p,1,2,3,t,u,v);else if(D=b.positionScreen.x,
-da=b.positionScreen.y,S=f.positionScreen.x,P=f.positionScreen.y,k=g.positionScreen.x,K=g.positionScreen.y,X=h.positionScreen.x,$=h.positionScreen.y,Y=m.positionScreen.x,ga=m.positionScreen.y,ja=p.positionScreen.x,ea=p.positionScreen.y,u instanceof THREE.MeshBasicMaterial)x(D,da,S,P,k,K,X,$),u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshLambertMaterial)ua?!u.wireframe&&u.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
-4?(W.r=aa.r=ma.r=ka.r=ra.r,W.g=aa.g=ma.g=ka.g=ra.g,W.b=aa.b=ma.b=ka.b=ra.b,o(v,t.v1.positionWorld,t.vertexNormalsWorld[0],W),o(v,t.v2.positionWorld,t.vertexNormalsWorld[1],aa),o(v,t.v4.positionWorld,t.vertexNormalsWorld[3],ma),o(v,t.v3.positionWorld,t.vertexNormalsWorld[2],ka),fa=Ta(W,aa,ma,ka),z(D,da,S,P,X,$),Pa(D,da,S,P,X,$,0,0,1,0,0,1,fa),z(Y,ga,k,K,ja,ea),Pa(Y,ga,k,K,ja,ea,1,0,1,1,0,1,fa)):(ha.r=ra.r,ha.g=ra.g,ha.b=ra.b,o(v,t.centroidWorld,t.normalWorld,ha),M.r=Math.max(0,Math.min(u.color.r*ha.r,
-1)),M.g=Math.max(0,Math.min(u.color.g*ha.g,1)),M.b=Math.max(0,Math.min(u.color.b*ha.b,1)),x(D,da,S,P,k,K,X,$),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(M)):(x(D,da,S,P,k,K,X,$),u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color));else if(u instanceof THREE.MeshNormalMaterial)M.r=Qa(t.normalWorld.x),M.g=Qa(t.normalWorld.y),M.b=Qa(t.normalWorld.z),x(D,da,S,P,k,K,X,$),u.wireframe?B(M,u.wireframeLinewidth,u.wireframeLinecap,
-u.wireframeLinejoin):Ha(M);else if(u instanceof THREE.MeshDepthMaterial)la=n.near,U=n.far,W.r=W.g=W.b=1-Ma(b.positionScreen.z,la,U),aa.r=aa.g=aa.b=1-Ma(f.positionScreen.z,la,U),ma.r=ma.g=ma.b=1-Ma(h.positionScreen.z,la,U),ka.r=ka.g=ka.b=1-Ma(g.positionScreen.z,la,U),fa=Ta(W,aa,ma,ka),z(D,da,S,P,X,$),Pa(D,da,S,P,X,$,0,0,1,0,0,1,fa),z(Y,ga,k,K,ja,ea),Pa(Y,ga,k,K,ja,ea,1,0,1,1,0,1,fa)}function z(b,e,c,f,g,k){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(g,k);u.lineTo(b,e);u.closePath()}function x(b,
-e,c,f,g,k,j,h){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(g,k);u.lineTo(j,h);u.lineTo(b,e);u.closePath()}function B(b,e,c,g){if(J!=e)u.lineWidth=J=e;if(C!=c)u.lineCap=C=c;if(G!=g)u.lineJoin=G=g;f(b.getContextStyle());u.stroke();na.inflate(e*2)}function Ha(b){h(b.getContextStyle());u.fill()}function H(b,e,c,f,g,k,j,m,n,p,t,Aa,o){if(o.image.width!=0){if(o.needsUpdate==!0||sa[o.id]==void 0){var v=o.wrapS==THREE.RepeatWrapping,Sa=o.wrapT==THREE.RepeatWrapping;sa[o.id]=u.createPattern(o.image,
-v&&Sa?"repeat":v&&!Sa?"repeat-x":!v&&Sa?"repeat-y":"no-repeat");o.needsUpdate=!1}h(sa[o.id]);v=(o.image.width-1)*o.repeat.x;o=(o.image.height-1)*o.repeat.y;j*=v;m*=o;n*=v;p*=o;t*=v;Aa*=o;c-=b;f-=e;g-=b;k-=e;n-=j;p-=m;t-=j;Aa-=m;v=1/(n*Aa-t*p);o=(Aa*c-p*g)*v;p=(Aa*f-p*k)*v;c=(n*g-t*c)*v;f=(n*k-t*f)*v;b=b-o*j-c*m;e=e-p*j-f*m;u.save();u.transform(o,p,c,f,b,e);u.fill();u.restore()}}function Pa(b,e,c,f,g,k,j,h,m,n,p,t,Aa){var o,v;o=Aa.width-1;v=Aa.height-1;j*=o;h*=v;m*=o;n*=v;p*=o;t*=v;c-=b;f-=e;g-=b;
-k-=e;m-=j;n-=h;p-=j;t-=h;v=1/(m*t-p*n);o=(t*c-n*g)*v;n=(t*f-n*k)*v;c=(m*g-p*c)*v;f=(m*k-p*f)*v;b=b-o*j-c*h;e=e-n*j-f*h;u.save();u.transform(o,n,c,f,b,e);u.clip();u.drawImage(Aa,0,0);u.restore()}function Ta(b,e,c,f){var g=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),h=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Q[0]=g<0?0:g>255?255:g;Q[1]=k<0?0:k>255?255:k;Q[2]=b<0?0:b>255?255:b;Q[4]=j<0?0:j>255?255:j;Q[5]=h<0?0:h>255?255:h;
-Q[6]=e<0?0:e>255?255:e;Q[8]=m<0?0:m>255?255:m;Q[9]=n<0?0:n>255?255:n;Q[10]=c<0?0:c>255?255:c;Q[12]=p<0?0:p>255?255:p;Q[13]=u<0?0:u>255?255:u;Q[14]=f<0?0:f>255?255:f;Da.putImageData(Z,0,0);N.drawImage(xa,0,0);return Ea}function Ma(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ia(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ua,Xa,oa,Ca,Ja,Ra,Va,E;this.autoClear?this.clear():u.setTransform(1,
-0,0,-1,t,v);j.data.vertices=0;j.data.faces=0;g=m.projectScene(b,n,this.sortElements);(ua=b.lights.length>0)&&p(b);Ua=0;for(Xa=g.length;Ua<Xa;Ua++){oa=g[Ua];na.empty();if(oa instanceof THREE.RenderableParticle){O=oa;O.x*=t;O.y*=v;Ca=0;for(Ja=oa.materials.length;Ca<Ja;)E=oa.materials[Ca++],E.opacity!=0&&Sa(O,oa,E,b)}else if(oa instanceof THREE.RenderableLine){if(O=oa.v1,F=oa.v2,O.positionScreen.x*=t,O.positionScreen.y*=v,F.positionScreen.x*=t,F.positionScreen.y*=v,na.addPoint(O.positionScreen.x,O.positionScreen.y),
-na.addPoint(F.positionScreen.x,F.positionScreen.y),V.instersects(na)){Ca=0;for(Ja=oa.materials.length;Ca<Ja;)E=oa.materials[Ca++],E.opacity!=0&&Ya(O,F,oa,E,b)}}else if(oa instanceof THREE.RenderableFace3){if(O=oa.v1,F=oa.v2,I=oa.v3,O.positionScreen.x*=t,O.positionScreen.y*=v,F.positionScreen.x*=t,F.positionScreen.y*=v,I.positionScreen.x*=t,I.positionScreen.y*=v,oa.overdraw&&(Ia(O.positionScreen,F.positionScreen),Ia(F.positionScreen,I.positionScreen),Ia(I.positionScreen,O.positionScreen)),na.add3Points(O.positionScreen.x,
-O.positionScreen.y,F.positionScreen.x,F.positionScreen.y,I.positionScreen.x,I.positionScreen.y),V.instersects(na)){Ca=0;for(Ja=oa.meshMaterials.length;Ca<Ja;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Va=oa.faceMaterials.length;Ra<Va;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&w(O,F,I,0,1,2,oa,E,b)}else E.opacity!=0&&w(O,F,I,0,1,2,oa,E,b)}}else if(oa instanceof THREE.RenderableFace4&&(O=oa.v1,F=oa.v2,I=oa.v3,R=oa.v4,O.positionScreen.x*=t,O.positionScreen.y*=v,F.positionScreen.x*=
-t,F.positionScreen.y*=v,I.positionScreen.x*=t,I.positionScreen.y*=v,R.positionScreen.x*=t,R.positionScreen.y*=v,ca.positionScreen.copy(F.positionScreen),T.positionScreen.copy(R.positionScreen),oa.overdraw&&(Ia(O.positionScreen,F.positionScreen),Ia(F.positionScreen,R.positionScreen),Ia(R.positionScreen,O.positionScreen),Ia(I.positionScreen,ca.positionScreen),Ia(I.positionScreen,T.positionScreen)),na.addPoint(O.positionScreen.x,O.positionScreen.y),na.addPoint(F.positionScreen.x,F.positionScreen.y),
-na.addPoint(I.positionScreen.x,I.positionScreen.y),na.addPoint(R.positionScreen.x,R.positionScreen.y),V.instersects(na))){Ca=0;for(Ja=oa.meshMaterials.length;Ca<Ja;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Va=oa.faceMaterials.length;Ra<Va;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&y(O,F,I,R,ca,T,oa,E,b)}else E.opacity!=0&&y(O,F,I,R,ca,T,oa,E,b)}ta.addRectangle(na)}u.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,g,j,h;f=0;for(g=b.lights.length;f<g;f++)j=b.lights[f],j instanceof THREE.DirectionalLight?(h=e.normalWorld.dot(j.position)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h)):j instanceof THREE.PointLight&&(R.sub(j.position,e.centroidWorld),R.normalize(),h=e.normalWorld.dot(R)*j.intensity,h>0&&(c.r+=j.color.r*h,c.g+=j.color.g*h,c.b+=j.color.b*h))}function c(e,c,g,m,p,u){j.data.vertices+=3;j.data.faces++;D=f(da++);D.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?J.copy(p.color):p instanceof THREE.MeshLambertMaterial?B?(C.r=G.r,C.g=G.g,C.b=G.b,b(u,m,C),J.r=Math.max(0,Math.min(p.color.r*C.r,1)),J.g=Math.max(0,Math.min(p.color.g*C.g,1)),J.b=Math.max(0,Math.min(p.color.b*C.b,1))):J.copy(p.color):p instanceof THREE.MeshDepthMaterial?(I=1-p.__2near/(p.__farPlusNear-m.z*p.__farMinusNear),
-J.setRGB(I,I,I)):p instanceof THREE.MeshNormalMaterial&&J.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));p.wireframe?D.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):D.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+p.opacity);n.appendChild(D)}function e(e,c,g,m,p,u,t){j.data.vertices+=4;j.data.faces++;
-D=f(da++);D.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+g.positionScreen.x+","+g.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?J.copy(u.color):u instanceof THREE.MeshLambertMaterial?B?(C.r=G.r,C.g=G.g,C.b=G.b,b(t,p,C),J.r=Math.max(0,Math.min(u.color.r*C.r,1)),J.g=Math.max(0,Math.min(u.color.g*C.g,1)),J.b=Math.max(0,Math.min(u.color.b*C.b,1))):J.copy(u.color):u instanceof
-THREE.MeshDepthMaterial?(I=1-u.__2near/(u.__farPlusNear-p.z*u.__farMinusNear),J.setRGB(I,I,I)):u instanceof THREE.MeshNormalMaterial&&J.setRGB(h(p.normalWorld.x),h(p.normalWorld.y),h(p.normalWorld.z));u.wireframe?D.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):D.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+
-u.opacity);n.appendChild(D)}function f(b){ca[b]==null&&(ca[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&ca[b].setAttribute("shape-rendering","crispEdges"));return ca[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,g=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,o,t,v,u,y,z,x,w=new THREE.Rectangle,H=new THREE.Rectangle,B=!1,J=new THREE.Color(16777215),C=new THREE.Color(16777215),G=new THREE.Color(0),O=new THREE.Color(0),
-F=new THREE.Color(0),I,R=new THREE.Vector3,ca=[],T=[],D,da,S,P=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":P=1;break;case "low":P=0}};this.setSize=function(b,e){p=b;o=e;t=p/2;v=o/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+o);n.setAttribute("width",p);n.setAttribute("height",o);w.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=
-function(b,f){var h,p,o,J,C,I,M,W;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;g=m.projectScene(b,f,this.sortElements);S=da=0;if(B=b.lights.length>0){M=b.lights;G.setRGB(0,0,0);O.setRGB(0,0,0);F.setRGB(0,0,0);h=0;for(p=M.length;h<p;h++)o=M[h],J=o.color,o instanceof THREE.AmbientLight?(G.r+=J.r,G.g+=J.g,G.b+=J.b):o instanceof THREE.DirectionalLight?(O.r+=J.r,O.g+=J.g,O.b+=J.b):o instanceof THREE.PointLight&&(F.r+=J.r,F.g+=J.g,F.b+=J.b)}h=0;for(p=g.length;h<p;h++)if(M=g[h],H.empty(),
-M instanceof THREE.RenderableParticle){u=M;u.x*=t;u.y*=-v;o=0;for(J=M.materials.length;o<J;)o++}else if(M instanceof THREE.RenderableLine){if(u=M.v1,y=M.v2,u.positionScreen.x*=t,u.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(y.positionScreen.x,y.positionScreen.y),w.instersects(H)){o=0;for(J=M.materials.length;o<J;)if((W=M.materials[o++])&&W.opacity!=0){C=u;I=y;var R=S++;T[R]==null&&(T[R]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),P==0&&T[R].setAttribute("shape-rendering","crispEdges"));D=T[R];D.setAttribute("x1",C.positionScreen.x);D.setAttribute("y1",C.positionScreen.y);D.setAttribute("x2",I.positionScreen.x);D.setAttribute("y2",I.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(D.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin),n.appendChild(D))}}}else if(M instanceof
-THREE.RenderableFace3){if(u=M.v1,y=M.v2,z=M.v3,u.positionScreen.x*=t,u.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.positionScreen.x*=t,z.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(y.positionScreen.x,y.positionScreen.y),H.addPoint(z.positionScreen.x,z.positionScreen.y),w.instersects(H)){o=0;for(J=M.meshMaterials.length;o<J;)if(W=M.meshMaterials[o++],W instanceof THREE.MeshFaceMaterial){C=0;for(I=M.faceMaterials.length;C<I;)(W=M.faceMaterials[C++])&&
-W.opacity!=0&&c(u,y,z,M,W,b)}else W&&W.opacity!=0&&c(u,y,z,M,W,b)}}else if(M instanceof THREE.RenderableFace4&&(u=M.v1,y=M.v2,z=M.v3,x=M.v4,u.positionScreen.x*=t,u.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.positionScreen.x*=t,z.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(y.positionScreen.x,y.positionScreen.y),H.addPoint(z.positionScreen.x,z.positionScreen.y),H.addPoint(x.positionScreen.x,x.positionScreen.y),
-w.instersects(H))){o=0;for(J=M.meshMaterials.length;o<J;)if(W=M.meshMaterials[o++],W instanceof THREE.MeshFaceMaterial){C=0;for(I=M.faceMaterials.length;C<I;)(W=M.faceMaterials[C++])&&W.opacity!=0&&e(u,y,z,x,M,W,b)}else W&&W.opacity!=0&&e(u,y,z,x,M,W,b)}}};
+THREE.Projector=function(){function b(){var b=p[m]=p[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,j=-e.z+e.w;return h>=0&&g>=0&&k>=0&&j>=0?!0:h<0&&g<0||k<0&&j<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),k<0?c=Math.max(c,k/(k-j)):j<0&&(f=Math.min(f,k/(k-j))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,j=[],h,m,p=[],n,o,t=[],v,u=[],w,z,y=[],x,H,B=[],F=new THREE.Vector4,J=new THREE.Vector4,
+D=new THREE.Matrix4,L=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){D.multiply(e.projectionMatrix,e.matrixWorldInverse);D.multiplyVector3(b);return b};this.unprojectVector=function(b,e){D.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));D.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,p,n;g=0;p=
+b.objects;b=0;for(m=p.length;b<m;b++){n=p[b];var k;if(!(k=!n.visible))if(k=n instanceof THREE.Mesh){a:{k=void 0;for(var t=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),o=0;o<6;o++)if(k=G[o].x*t.n14+G[o].y*t.n24+G[o].z*t.n34+G[o].w,k<=u){k=!1;break a}k=!0}k=!k}if(!k)k=j[g]=j[g]||new THREE.RenderableObject,g++,f=k,F.copy(n.position),D.multiplyVector3(F),f.object=n,f.z=F.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var F=[],
+S=g.near,P=g.far,k,M,Y,aa,Z,ha,ka,fa,U,X,ca,ma,la,sa,K,V,ga;H=z=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);D.multiply(g.projectionMatrix,g.matrixWorldInverse);G[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);G[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);G[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);G[3].set(D.n41-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);G[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);G[5].set(D.n41+D.n31,D.n42+
+D.n32,D.n43+D.n33,D.n44+D.n34);for(k=0;k<6;k++)U=G[k],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,g,!0);f=0;for(k=U.length;f<k;f++)if(X=U[f].object,X.visible)if(ca=X.matrixWorld,ma=X.matrixRotationWorld,la=X.materials,sa=X.overdraw,m=0,X instanceof THREE.Mesh){K=X.geometry;aa=K.vertices;V=K.faces;K=K.faceVertexUvs;M=0;for(Y=aa.length;M<Y;M++)h=b(),h.positionWorld.copy(aa[M].position),ca.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),
+h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>S&&h.positionScreen.z<P;aa=0;for(M=V.length;aa<M;aa++){Y=V[aa];if(Y instanceof THREE.Face3)if(Z=p[Y.a],ha=p[Y.b],ka=p[Y.c],Z.visible&&ha.visible&&ka.visible&&(X.doubleSided||X.flipSided!=(ka.positionScreen.x-Z.positionScreen.x)*(ha.positionScreen.y-Z.positionScreen.y)-(ka.positionScreen.y-Z.positionScreen.y)*(ha.positionScreen.x-Z.positionScreen.x)<0))fa=t[o]=t[o]||new THREE.RenderableFace3,
+o++,n=fa,n.v1.copy(Z),n.v2.copy(ha),n.v3.copy(ka);else continue;else if(Y instanceof THREE.Face4)if(Z=p[Y.a],ha=p[Y.b],ka=p[Y.c],fa=p[Y.d],Z.visible&&ha.visible&&ka.visible&&fa.visible&&(X.doubleSided||X.flipSided!=((fa.positionScreen.x-Z.positionScreen.x)*(ha.positionScreen.y-Z.positionScreen.y)-(fa.positionScreen.y-Z.positionScreen.y)*(ha.positionScreen.x-Z.positionScreen.x)<0||(ha.positionScreen.x-ka.positionScreen.x)*(fa.positionScreen.y-ka.positionScreen.y)-(ha.positionScreen.y-ka.positionScreen.y)*
+(fa.positionScreen.x-ka.positionScreen.x)<0)))ga=u[v]=u[v]||new THREE.RenderableFace4,v++,n=ga,n.v1.copy(Z),n.v2.copy(ha),n.v3.copy(ka),n.v4.copy(fa);else continue;n.normalWorld.copy(Y.normal);ma.multiplyVector3(n.normalWorld);n.centroidWorld.copy(Y.centroid);ca.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);D.multiplyVector3(n.centroidScreen);ka=Y.vertexNormals;Z=0;for(ha=ka.length;Z<ha;Z++)fa=n.vertexNormalsWorld[Z],fa.copy(ka[Z]),ma.multiplyVector3(fa);Z=0;for(ha=K.length;Z<
+ha;Z++)if(ga=K[Z][aa]){ka=0;for(fa=ga.length;ka<fa;ka++)n.uvs[Z][ka]=ga[ka]}n.meshMaterials=la;n.faceMaterials=Y.materials;n.overdraw=sa;n.z=n.centroidScreen.z;F.push(n)}}else if(X instanceof THREE.Line){L.multiply(D,ca);aa=X.geometry.vertices;Z=b();Z.positionScreen.copy(aa[0].position);L.multiplyVector4(Z.positionScreen);M=1;for(Y=aa.length;M<Y;M++)if(Z=b(),Z.positionScreen.copy(aa[M].position),L.multiplyVector4(Z.positionScreen),ha=p[m-2],I.copy(Z.positionScreen),R.copy(ha.positionScreen),e(I,R))I.multiplyScalar(1/
+I.w),R.multiplyScalar(1/R.w),ca=y[z]=y[z]||new THREE.RenderableLine,z++,w=ca,w.v1.positionScreen.copy(I),w.v2.positionScreen.copy(R),w.z=Math.max(I.z,R.z),w.materials=X.materials,F.push(w)}else if(X instanceof THREE.Particle&&(J.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),D.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))ca=B[H]=B[H]||new THREE.RenderableParticle,H++,x=ca,x.x=J.x/J.w,x.y=J.y/J.w,x.z=J.z,x.rotation=X.rotation.z,x.scale.x=X.scale.x*Math.abs(x.x-(J.x+g.projectionMatrix.n11)/
+(J.w+g.projectionMatrix.n14)),x.scale.y=X.scale.y*Math.abs(x.y-(J.y+g.projectionMatrix.n22)/(J.w+g.projectionMatrix.n24)),x.materials=X.materials,F.push(x);j&&F.sort(c);return F}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var p,n,o,t,v,u,w,z;b=c.projectScene(e,f);p=0;for(n=b.length;p<n;p++)if(v=b[p],v instanceof THREE.RenderableParticle){w=v.x*g+g;z=v.y*j+j;o=0;for(t=v.material.length;o<t;o++)if(u=v.material[o],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=w+"px",u.style.top=z+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)u.globalAlpha=y=b}function e(b){if(x!=b){switch(b){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}x=b}}function f(b){if(H!=b)u.strokeStyle=H=b}function g(b){if(B!=b)u.fillStyle=B=b}var j=this,h=null,m=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+n,o,t,v,u=p.getContext("2d"),w=new THREE.Color(0),z=0,y=1,x=0,H=null,B=null,F=null,J=null,D=null,L,G,I,R,da=new THREE.RenderableVertex,T=new THREE.RenderableVertex,C,ea,S,P,k,M,Y,aa,Z,ha,ka,fa,U=new THREE.Color(0),X=new THREE.Color(0),ca=new THREE.Color(0),ma=new THREE.Color(0),la=new THREE.Color(0),sa=[],K,V,ga,ja,qa,va,za,La,ya,Oa,W=new THREE.Rectangle,ta=new THREE.Rectangle,na=new THREE.Rectangle,ua=!1,ia=new THREE.Color,ra=new THREE.Color,wa=new THREE.Color,Ba=new THREE.Color,pa=new THREE.Vector3,
+xa,Da,$,Q,Ea,O,b=16;xa=document.createElement("canvas");xa.width=xa.height=2;Da=xa.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);$=Da.getImageData(0,0,2,2);Q=$.data;Ea=document.createElement("canvas");Ea.width=Ea.height=b;O=Ea.getContext("2d");O.translate(-b/2,-b/2);O.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){n=b;o=e;t=n/2;v=o/2;p.width=n;p.height=o;W.set(-t,-v,t,v);ta.set(-t,
+-v,t,v);y=1;x=0;D=J=F=B=H=null};this.setClearColor=function(b,e){w=b;z=e;ta.set(-t,-v,t,v)};this.setClearColorHex=function(b,e){w.setHex(b);z=e;ta.set(-t,-v,t,v)};this.clear=function(){u.setTransform(1,0,0,-1,t,v);ta.isEmpty()||(ta.inflate(1),ta.minSelf(W),z==0?u.clearRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight()):(e(THREE.NormalBlending),c(1),setContextFillStyle("rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*255)+","+z+")"),u.fillRect(ta.getX(),ta.getY(),ta.getWidth(),
+ta.getHeight())),ta.empty())};this.render=function(b,p){function n(b){var e,c,f,h=b.lights;ra.setRGB(0,0,0);wa.setRGB(0,0,0);Ba.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(ra.r+=f.r,ra.g+=f.g,ra.b+=f.b):c instanceof THREE.DirectionalLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.PointLight&&(Ba.r+=f.r,Ba.g+=f.g,Ba.b+=f.b)}function o(b,e,c,f){var h,g,k,j,m=b.lights,b=0;for(h=m.length;b<h;b++)g=m[b],k=g.color,g instanceof THREE.DirectionalLight?
+(j=c.dot(g.position),j<=0||(j*=g.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)):g instanceof THREE.PointLight&&(j=c.dot(pa.sub(g.position,e).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),j!=0&&(j*=g.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)))}function Sa(b,h,k){c(k.opacity);e(k.blending);var j,m,p,n,Aa,o;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)n=k.map.image,Aa=n.width>>1,o=n.height>>1,k=h.scale.x*t,p=h.scale.y*v,j=k*Aa,m=p*o,na.set(b.x-j,b.y-
+m,b.x+j,b.y+m),W.instersects(na)&&(u.save(),u.translate(b.x,b.y),u.rotate(-h.rotation),u.scale(k,-p),u.translate(-Aa,-o),u.drawImage(n,0,0),u.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*t,m=h.scale.y*v,na.set(b.x-j,b.y-m,b.x+j,b.y+m),W.instersects(na)&&(f(k.color.getContextStyle()),g(k.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-h.rotation),u.scale(j,m),k.program(u),u.restore()))}function Ya(b,h,k,g){c(g.opacity);e(g.blending);u.beginPath();u.moveTo(b.positionScreen.x,
+b.positionScreen.y);u.lineTo(h.positionScreen.x,h.positionScreen.y);u.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)u.lineWidth=F=b;b=g.linecap;if(J!=b)u.lineCap=J=b;b=g.linejoin;if(D!=b)u.lineJoin=D=b;f(g.color.getContextStyle());u.stroke();na.inflate(g.linewidth*2)}}function w(b,f,h,g,m,n,t,u,v){j.data.vertices+=3;j.data.faces++;c(u.opacity);e(u.blending);C=b.positionScreen.x;ea=b.positionScreen.y;S=f.positionScreen.x;P=f.positionScreen.y;k=h.positionScreen.x;M=h.positionScreen.y;
+z(C,ea,S,P,k,M);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(ja=t.uvs[0],H(C,ea,S,P,k,M,ja[g].u,ja[g].v,ja[m].u,ja[m].v,ja[n].u,ja[n].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),qa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,va=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),za=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
+La=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),ya=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Oa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,H(C,ea,S,P,k,M,qa,va,za,La,ya,Oa,u.envMap)}else u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(ja=t.uvs[0],H(C,ea,S,P,k,M,ja[g].u,ja[g].v,ja[m].u,ja[m].v,ja[n].u,ja[n].v,
+u.map)),e(THREE.SubtractiveBlending)),ua?!u.wireframe&&u.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(X.r=ca.r=ma.r=ra.r,X.g=ca.g=ma.g=ra.g,X.b=ca.b=ma.b=ra.b,o(v,t.v1.positionWorld,t.vertexNormalsWorld[0],X),o(v,t.v2.positionWorld,t.vertexNormalsWorld[1],ca),o(v,t.v3.positionWorld,t.vertexNormalsWorld[2],ma),la.r=(ca.r+ma.r)*0.5,la.g=(ca.g+ma.g)*0.5,la.b=(ca.b+ma.b)*0.5,ga=Ta(X,ca,ma,la),Pa(C,ea,S,P,k,M,0,0,1,0,0,1,ga)):(ia.r=ra.r,ia.g=ra.g,ia.b=ra.b,o(v,t.centroidWorld,t.normalWorld,
+ia),U.r=Math.max(0,Math.min(u.color.r*ia.r,1)),U.g=Math.max(0,Math.min(u.color.g*ia.g,1)),U.b=Math.max(0,Math.min(u.color.b*ia.b,1)),u.wireframe?B(U,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(U)):u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshDepthMaterial)K=p.near,V=p.far,X.r=X.g=X.b=1-Ma(b.positionScreen.z,K,V),ca.r=ca.g=ca.b=1-Ma(f.positionScreen.z,K,V),ma.r=ma.g=ma.b=1-Ma(h.positionScreen.z,K,V),
+la.r=(ca.r+ma.r)*0.5,la.g=(ca.g+ma.g)*0.5,la.b=(ca.b+ma.b)*0.5,ga=Ta(X,ca,ma,la),Pa(C,ea,S,P,k,M,0,0,1,0,0,1,ga);else if(u instanceof THREE.MeshNormalMaterial)U.r=Qa(t.normalWorld.x),U.g=Qa(t.normalWorld.y),U.b=Qa(t.normalWorld.z),u.wireframe?B(U,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(U)}function x(b,f,h,g,m,n,t,u,v){j.data.vertices+=4;j.data.faces++;c(u.opacity);e(u.blending);if(u.map||u.envMap)w(b,f,g,0,1,3,t,u,v),w(m,h,n,1,2,3,t,u,v);else if(C=b.positionScreen.x,ea=b.positionScreen.y,
+S=f.positionScreen.x,P=f.positionScreen.y,k=h.positionScreen.x,M=h.positionScreen.y,Y=g.positionScreen.x,aa=g.positionScreen.y,Z=m.positionScreen.x,ha=m.positionScreen.y,ka=n.positionScreen.x,fa=n.positionScreen.y,u instanceof THREE.MeshBasicMaterial)y(C,ea,S,P,k,M,Y,aa),u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color);else if(u instanceof THREE.MeshLambertMaterial)ua?!u.wireframe&&u.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(X.r=ca.r=
+ma.r=la.r=ra.r,X.g=ca.g=ma.g=la.g=ra.g,X.b=ca.b=ma.b=la.b=ra.b,o(v,t.v1.positionWorld,t.vertexNormalsWorld[0],X),o(v,t.v2.positionWorld,t.vertexNormalsWorld[1],ca),o(v,t.v4.positionWorld,t.vertexNormalsWorld[3],ma),o(v,t.v3.positionWorld,t.vertexNormalsWorld[2],la),ga=Ta(X,ca,ma,la),z(C,ea,S,P,Y,aa),Pa(C,ea,S,P,Y,aa,0,0,1,0,0,1,ga),z(Z,ha,k,M,ka,fa),Pa(Z,ha,k,M,ka,fa,1,0,1,1,0,1,ga)):(ia.r=ra.r,ia.g=ra.g,ia.b=ra.b,o(v,t.centroidWorld,t.normalWorld,ia),U.r=Math.max(0,Math.min(u.color.r*ia.r,1)),U.g=
+Math.max(0,Math.min(u.color.g*ia.g,1)),U.b=Math.max(0,Math.min(u.color.b*ia.b,1)),y(C,ea,S,P,k,M,Y,aa),u.wireframe?B(U,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(U)):(y(C,ea,S,P,k,M,Y,aa),u.wireframe?B(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ha(u.color));else if(u instanceof THREE.MeshNormalMaterial)U.r=Qa(t.normalWorld.x),U.g=Qa(t.normalWorld.y),U.b=Qa(t.normalWorld.z),y(C,ea,S,P,k,M,Y,aa),u.wireframe?B(U,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):
+Ha(U);else if(u instanceof THREE.MeshDepthMaterial)K=p.near,V=p.far,X.r=X.g=X.b=1-Ma(b.positionScreen.z,K,V),ca.r=ca.g=ca.b=1-Ma(f.positionScreen.z,K,V),ma.r=ma.g=ma.b=1-Ma(g.positionScreen.z,K,V),la.r=la.g=la.b=1-Ma(h.positionScreen.z,K,V),ga=Ta(X,ca,ma,la),z(C,ea,S,P,Y,aa),Pa(C,ea,S,P,Y,aa,0,0,1,0,0,1,ga),z(Z,ha,k,M,ka,fa),Pa(Z,ha,k,M,ka,fa,1,0,1,1,0,1,ga)}function z(b,e,c,f,h,g){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(h,g);u.lineTo(b,e);u.closePath()}function y(b,e,c,f,h,g,k,j){u.beginPath();
+u.moveTo(b,e);u.lineTo(c,f);u.lineTo(h,g);u.lineTo(k,j);u.lineTo(b,e);u.closePath()}function B(b,e,c,h){if(F!=e)u.lineWidth=F=e;if(J!=c)u.lineCap=J=c;if(D!=h)u.lineJoin=D=h;f(b.getContextStyle());u.stroke();na.inflate(e*2)}function Ha(b){g(b.getContextStyle());u.fill()}function H(b,e,c,f,h,k,j,m,p,n,t,Aa,o){if(o.image.width!=0){if(o.needsUpdate==!0||sa[o.id]==void 0){var v=o.wrapS==THREE.RepeatWrapping,Sa=o.wrapT==THREE.RepeatWrapping;sa[o.id]=u.createPattern(o.image,v&&Sa?"repeat":v&&!Sa?"repeat-x":
+!v&&Sa?"repeat-y":"no-repeat");o.needsUpdate=!1}g(sa[o.id]);v=(o.image.width-1)*o.repeat.x;o=(o.image.height-1)*o.repeat.y;j*=v;m*=o;p*=v;n*=o;t*=v;Aa*=o;c-=b;f-=e;h-=b;k-=e;p-=j;n-=m;t-=j;Aa-=m;v=1/(p*Aa-t*n);o=(Aa*c-n*h)*v;n=(Aa*f-n*k)*v;c=(p*h-t*c)*v;f=(p*k-t*f)*v;b=b-o*j-c*m;e=e-n*j-f*m;u.save();u.transform(o,n,c,f,b,e);u.fill();u.restore()}}function Pa(b,e,c,f,h,g,k,j,m,p,n,t,Aa){var o,v;o=Aa.width-1;v=Aa.height-1;k*=o;j*=v;m*=o;p*=v;n*=o;t*=v;c-=b;f-=e;h-=b;g-=e;m-=k;p-=j;n-=k;t-=j;v=1/(m*t-
+n*p);o=(t*c-p*h)*v;p=(t*f-p*g)*v;c=(m*h-n*c)*v;f=(m*g-n*f)*v;b=b-o*k-c*j;e=e-p*k-f*j;u.save();u.transform(o,p,c,f,b,e);u.clip();u.drawImage(Aa,0,0);u.restore()}function Ta(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),j=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Q[0]=h<0?0:h>255?255:h;Q[1]=g<0?0:g>255?255:g;Q[2]=b<0?0:b>255?255:b;Q[4]=k<0?0:k>255?255:k;Q[5]=j<0?0:j>255?255:j;Q[6]=e<0?0:e>255?255:e;Q[8]=m<0?0:
+m>255?255:m;Q[9]=p<0?0:p>255?255:p;Q[10]=c<0?0:c>255?255:c;Q[12]=n<0?0:n>255?255:n;Q[13]=u<0?0:u>255?255:u;Q[14]=f<0?0:f>255?255:f;Da.putImageData($,0,0);O.drawImage(xa,0,0);return Ea}function Ma(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ia(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),c*=h,f*=h,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ua,Xa,oa,Ca,Ja,Ra,Va,E;this.autoClear?this.clear():u.setTransform(1,0,0,-1,t,v);j.data.vertices=0;j.data.faces=
+0;h=m.projectScene(b,p,this.sortElements);(ua=b.lights.length>0)&&n(b);Ua=0;for(Xa=h.length;Ua<Xa;Ua++){oa=h[Ua];na.empty();if(oa instanceof THREE.RenderableParticle){L=oa;L.x*=t;L.y*=v;Ca=0;for(Ja=oa.materials.length;Ca<Ja;)E=oa.materials[Ca++],E.opacity!=0&&Sa(L,oa,E,b)}else if(oa instanceof THREE.RenderableLine){if(L=oa.v1,G=oa.v2,L.positionScreen.x*=t,L.positionScreen.y*=v,G.positionScreen.x*=t,G.positionScreen.y*=v,na.addPoint(L.positionScreen.x,L.positionScreen.y),na.addPoint(G.positionScreen.x,
+G.positionScreen.y),W.instersects(na)){Ca=0;for(Ja=oa.materials.length;Ca<Ja;)E=oa.materials[Ca++],E.opacity!=0&&Ya(L,G,oa,E,b)}}else if(oa instanceof THREE.RenderableFace3){if(L=oa.v1,G=oa.v2,I=oa.v3,L.positionScreen.x*=t,L.positionScreen.y*=v,G.positionScreen.x*=t,G.positionScreen.y*=v,I.positionScreen.x*=t,I.positionScreen.y*=v,oa.overdraw&&(Ia(L.positionScreen,G.positionScreen),Ia(G.positionScreen,I.positionScreen),Ia(I.positionScreen,L.positionScreen)),na.add3Points(L.positionScreen.x,L.positionScreen.y,
+G.positionScreen.x,G.positionScreen.y,I.positionScreen.x,I.positionScreen.y),W.instersects(na)){Ca=0;for(Ja=oa.meshMaterials.length;Ca<Ja;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Va=oa.faceMaterials.length;Ra<Va;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&w(L,G,I,0,1,2,oa,E,b)}else E.opacity!=0&&w(L,G,I,0,1,2,oa,E,b)}}else if(oa instanceof THREE.RenderableFace4&&(L=oa.v1,G=oa.v2,I=oa.v3,R=oa.v4,L.positionScreen.x*=t,L.positionScreen.y*=v,G.positionScreen.x*=t,G.positionScreen.y*=
+v,I.positionScreen.x*=t,I.positionScreen.y*=v,R.positionScreen.x*=t,R.positionScreen.y*=v,da.positionScreen.copy(G.positionScreen),T.positionScreen.copy(R.positionScreen),oa.overdraw&&(Ia(L.positionScreen,G.positionScreen),Ia(G.positionScreen,R.positionScreen),Ia(R.positionScreen,L.positionScreen),Ia(I.positionScreen,da.positionScreen),Ia(I.positionScreen,T.positionScreen)),na.addPoint(L.positionScreen.x,L.positionScreen.y),na.addPoint(G.positionScreen.x,G.positionScreen.y),na.addPoint(I.positionScreen.x,
+I.positionScreen.y),na.addPoint(R.positionScreen.x,R.positionScreen.y),W.instersects(na))){Ca=0;for(Ja=oa.meshMaterials.length;Ca<Ja;)if(E=oa.meshMaterials[Ca++],E instanceof THREE.MeshFaceMaterial){Ra=0;for(Va=oa.faceMaterials.length;Ra<Va;)(E=oa.faceMaterials[Ra++])&&E.opacity!=0&&x(L,G,I,R,da,T,oa,E,b)}else E.opacity!=0&&x(L,G,I,R,da,T,oa,E,b)}ta.addRectangle(na)}u.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=e.normalWorld.dot(g.position)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j)):g instanceof THREE.PointLight&&(R.sub(g.position,e.centroidWorld),R.normalize(),j=e.normalWorld.dot(R)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j))}function c(e,c,h,m,n,u){j.data.vertices+=3;j.data.faces++;C=f(ea++);C.setAttribute("d",
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.copy(n.color):n instanceof THREE.MeshLambertMaterial?B?(J.r=D.r,J.g=D.g,J.b=D.b,b(u,m,J),F.r=Math.max(0,Math.min(n.color.r*J.r,1)),F.g=Math.max(0,Math.min(n.color.g*J.g,1)),F.b=Math.max(0,Math.min(n.color.b*J.b,1))):F.copy(n.color):n instanceof THREE.MeshDepthMaterial?(I=1-n.__2near/(n.__farPlusNear-m.z*n.__farMinusNear),
+F.setRGB(I,I,I)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?C.setAttribute("style","fill: none; stroke: "+F.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):C.setAttribute("style","fill: "+F.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(C)}function e(e,c,h,m,n,u,t){j.data.vertices+=4;j.data.faces++;
+C=f(ea++);C.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?F.copy(u.color):u instanceof THREE.MeshLambertMaterial?B?(J.r=D.r,J.g=D.g,J.b=D.b,b(t,n,J),F.r=Math.max(0,Math.min(u.color.r*J.r,1)),F.g=Math.max(0,Math.min(u.color.g*J.g,1)),F.b=Math.max(0,Math.min(u.color.b*J.b,1))):F.copy(u.color):u instanceof
+THREE.MeshDepthMaterial?(I=1-u.__2near/(u.__farPlusNear-n.z*u.__farMinusNear),F.setRGB(I,I,I)):u instanceof THREE.MeshNormalMaterial&&F.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));u.wireframe?C.setAttribute("style","fill: none; stroke: "+F.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):C.setAttribute("style","fill: "+F.getContextStyle()+"; fill-opacity: "+
+u.opacity);p.appendChild(C)}function f(b){da[b]==null&&(da[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&da[b].setAttribute("shape-rendering","crispEdges"));return da[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,m=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,o,t,v,u,w,z,y,x=new THREE.Rectangle,H=new THREE.Rectangle,B=!1,F=new THREE.Color(16777215),J=new THREE.Color(16777215),D=new THREE.Color(0),L=new THREE.Color(0),
+G=new THREE.Color(0),I,R=new THREE.Vector3,da=[],T=[],C,ea,S,P=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":P=1;break;case "low":P=0}};this.setSize=function(b,e){n=b;o=e;t=n/2;v=o/2;p.setAttribute("viewBox",-t+" "+-v+" "+n+" "+o);p.setAttribute("width",n);p.setAttribute("height",o);x.set(-t,-v,t,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=
+function(b,f){var g,n,o,F,J,I,U,X;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=m.projectScene(b,f,this.sortElements);S=ea=0;if(B=b.lights.length>0){U=b.lights;D.setRGB(0,0,0);L.setRGB(0,0,0);G.setRGB(0,0,0);g=0;for(n=U.length;g<n;g++)o=U[g],F=o.color,o instanceof THREE.AmbientLight?(D.r+=F.r,D.g+=F.g,D.b+=F.b):o instanceof THREE.DirectionalLight?(L.r+=F.r,L.g+=F.g,L.b+=F.b):o instanceof THREE.PointLight&&(G.r+=F.r,G.g+=F.g,G.b+=F.b)}g=0;for(n=h.length;g<n;g++)if(U=h[g],H.empty(),
+U instanceof THREE.RenderableParticle){u=U;u.x*=t;u.y*=-v;o=0;for(F=U.materials.length;o<F;)o++}else if(U instanceof THREE.RenderableLine){if(u=U.v1,w=U.v2,u.positionScreen.x*=t,u.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(w.positionScreen.x,w.positionScreen.y),x.instersects(H)){o=0;for(F=U.materials.length;o<F;)if((X=U.materials[o++])&&X.opacity!=0){J=u;I=w;var R=S++;T[R]==null&&(T[R]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),P==0&&T[R].setAttribute("shape-rendering","crispEdges"));C=T[R];C.setAttribute("x1",J.positionScreen.x);C.setAttribute("y1",J.positionScreen.y);C.setAttribute("x2",I.positionScreen.x);C.setAttribute("y2",I.positionScreen.y);X instanceof THREE.LineBasicMaterial&&(C.setAttribute("style","fill: none; stroke: "+X.color.getContextStyle()+"; stroke-width: "+X.linewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.linecap+"; stroke-linejoin: "+X.linejoin),p.appendChild(C))}}}else if(U instanceof
+THREE.RenderableFace3){if(u=U.v1,w=U.v2,z=U.v3,u.positionScreen.x*=t,u.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,z.positionScreen.x*=t,z.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(w.positionScreen.x,w.positionScreen.y),H.addPoint(z.positionScreen.x,z.positionScreen.y),x.instersects(H)){o=0;for(F=U.meshMaterials.length;o<F;)if(X=U.meshMaterials[o++],X instanceof THREE.MeshFaceMaterial){J=0;for(I=U.faceMaterials.length;J<I;)(X=U.faceMaterials[J++])&&
+X.opacity!=0&&c(u,w,z,U,X,b)}else X&&X.opacity!=0&&c(u,w,z,U,X,b)}}else if(U instanceof THREE.RenderableFace4&&(u=U.v1,w=U.v2,z=U.v3,y=U.v4,u.positionScreen.x*=t,u.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,z.positionScreen.x*=t,z.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,H.addPoint(u.positionScreen.x,u.positionScreen.y),H.addPoint(w.positionScreen.x,w.positionScreen.y),H.addPoint(z.positionScreen.x,z.positionScreen.y),H.addPoint(y.positionScreen.x,y.positionScreen.y),
+x.instersects(H))){o=0;for(F=U.meshMaterials.length;o<F;)if(X=U.meshMaterials[o++],X instanceof THREE.MeshFaceMaterial){J=0;for(I=U.faceMaterials.length;J<I;)(X=U.faceMaterials[J++])&&X.opacity!=0&&e(u,w,z,y,U,X,b)}else X&&X.opacity!=0&&e(u,w,z,y,U,X,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -203,7 +203,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"};
-THREE.UniformsUtils={merge:function(b){var c,e,f,h={};for(c=0;c<b.length;c++)for(e in f=this.clone(b[c]),f)h[e]=f[e];return h},clone:function(b){var c,e,f,h={};for(c in b)for(e in h[c]={},b[c])f=b[c][e],h[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return h}};
+THREE.UniformsUtils={merge:function(b){var c,e,f,g={};for(c=0;c<b.length;c++)for(e in f=this.clone(b[c]),f)g[e]=f[e];return g},clone:function(b){var c,e,f,g={};for(c in b)for(e in g[c]={},b[c])f=b[c][e],g[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return g}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",
 value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
 value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:3,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -227,148 +227,148 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_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;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
 "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,g,j,h=b.vertices,m=h.length,p=b.colors,n=p.length,u=b.__vertexArray,t=b.__colorArray,o=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,y=b.__webglCustomAttributes,z,x;if(y)for(z in y)y[z].offset=0;if(c.sortParticles){ia.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=h[f].position,za.copy(g),ia.multiplyVector3(za),o[f]=[za.z,f];o.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=h[o[f][1]].position,j=f*3,u[j]=g.x,u[j+1]=g.y,u[j+2]=g.z;
-for(f=0;f<n;f++)j=f*3,color=p[o[f][1]],t[j]=color.r,t[j+1]=color.g,t[j+2]=color.b;if(y)for(z in y){f=y[z];p=f.value.length;for(j=0;j<p;j++){index=o[j][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[index];f.size===2?(f.array[n]=x.x,f.array[n+1]=x.y):f.size===3?f.type==="c"?(f.array[n]=x.r,f.array[n+1]=x.g,f.array[n+2]=x.b):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z):(f.array[n]=
-x.x,f.array[n+1]=x.y,f.array[n+2]=x.z,f.array[n+3]=x.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)g=h[f].position,j=f*3,u[j]=g.x,u[j+1]=g.y,u[j+2]=g.z;if(w)for(f=0;f<n;f++)color=p[f],j=f*3,t[j]=color.r,t[j+1]=color.g,t[j+2]=color.b;if(y)for(z in y)if(f=y[z],f.__original.needsUpdate){p=f.value.length;for(j=0;j<p;j++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[j]}else{if(f.boundTo===void 0||f.boundTo==="vertices")x=f.value[j];f.size===2?(f.array[n]=
-x.x,f.array[n+1]=x.y):f.size===3?f.type==="c"?(f.array[n]=x.r,f.array[n+1]=x.g,f.array[n+2]=x.b):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z):(f.array[n]=x.x,f.array[n+1]=x.y,f.array[n+2]=x.z,f.array[n+3]=x.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,u,e);if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(y)for(z in y)if(f=y[z],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
-f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||P.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var j=0,h=P.maxMorphTargets;j<h;j++)g.__webglMorphTargetInfluences[j]=0}var j=f.program,h=j.uniforms,m=f.uniforms;j!=X&&(k.useProgram(j),X=j);k.uniformMatrix4fv(h.projectionMatrix,!1,qa);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,p,u,t=0,o=0,v=0,y,w,x,z=La,B=z.directional.colors,H=z.directional.positions,F=z.point.colors,J=z.point.positions,C=z.point.distances,
-la=0,E=0,c=p=x=0;for(n=e.length;c<n;c++)if(p=e[c],u=p.color,y=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)t+=u.r,o+=u.g,v+=u.b;else if(p instanceof THREE.DirectionalLight)x=la*3,B[x]=u.r*w,B[x+1]=u.g*w,B[x+2]=u.b*w,H[x]=y.x,H[x+1]=y.y,H[x+2]=y.z,la+=1;else if(p instanceof THREE.SpotLight)x=la*3,B[x]=u.r*w,B[x+1]=u.g*w,B[x+2]=u.b*w,u=1/y.length(),H[x]=y.x*u,H[x+1]=y.y*u,H[x+2]=y.z*u,la+=1;else if(p instanceof THREE.PointLight)p=E*3,F[p]=u.r*w,F[p+1]=u.g*w,F[p+2]=u.b*w,J[p]=
-y.x,J[p+1]=y.y,J[p+2]=y.z,C[E]=x,E+=1;for(c=la*3;c<B.length;c++)B[c]=0;for(c=E*3;c<F.length;c++)F[c]=0;z.point.length=E;z.directional.length=la;z.ambient[0]=t;z.ambient[1]=o;z.ambient[2]=v;c=La;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,h,g,j=b.vertices,m=j.length,p=b.colors,n=p.length,u=b.__vertexArray,t=b.__colorArray,o=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,x=b.__webglCustomAttributes,z,y;if(x)for(z in x)x[z].offset=0;if(c.sortParticles){ja.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)h=j[f].position,za.copy(h),ja.multiplyVector3(za),o[f]=[za.z,f];o.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)h=j[o[f][1]].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;
+for(f=0;f<n;f++)g=f*3,color=p[o[f][1]],t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(z in x){f=x[z];p=f.value.length;for(g=0;g<p;g++){index=o[g][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[n]=y.x,f.array[n+1]=y.y):f.size===3?f.type==="c"?(f.array[n]=y.r,f.array[n+1]=y.g,f.array[n+2]=y.b):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z):(f.array[n]=
+y.x,f.array[n+1]=y.y,f.array[n+2]=y.z,f.array[n+3]=y.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)h=j[f].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;if(w)for(f=0;f<n;f++)color=p[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(z in x)if(f=x[z],f.__original.needsUpdate){p=f.value.length;for(g=0;g<p;g++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[g];f.size===2?(f.array[n]=
+y.x,f.array[n+1]=y.y):f.size===3?f.type==="c"?(f.array[n]=y.r,f.array[n+1]=y.g,f.array[n+2]=y.b):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z):(f.array[n]=y.x,f.array[n+1]=y.y,f.array[n+2]=y.z,f.array[n+3]=y.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,u,e);if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(x)for(z in x)if(f=x[z],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
+f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||P.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var h=0,j=P.maxMorphTargets;h<j;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,j=h.uniforms,m=f.uniforms;h!=Y&&(k.useProgram(h),Y=h);k.uniformMatrix4fv(j.projectionMatrix,!1,qa);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
+f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,p,u,t=0,o=0,v=0,w,x,y,z=La,B=z.directional.colors,F=z.directional.positions,H=z.point.colors,G=z.point.positions,J=z.point.distances,
+K=0,E=0,c=p=y=0;for(n=e.length;c<n;c++)if(p=e[c],u=p.color,w=p.position,x=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)t+=u.r,o+=u.g,v+=u.b;else if(p instanceof THREE.DirectionalLight)y=K*3,B[y]=u.r*x,B[y+1]=u.g*x,B[y+2]=u.b*x,F[y]=w.x,F[y+1]=w.y,F[y+2]=w.z,K+=1;else if(p instanceof THREE.SpotLight)y=K*3,B[y]=u.r*x,B[y+1]=u.g*x,B[y+2]=u.b*x,u=1/w.length(),F[y]=w.x*u,F[y+1]=w.y*u,F[y+2]=w.z*u,K+=1;else if(p instanceof THREE.PointLight)p=E*3,H[p]=u.r*x,H[p+1]=u.g*x,H[p+2]=u.b*x,G[p]=w.x,
+G[p+1]=w.y,G[p+2]=w.z,J[E]=y,E+=1;for(c=K*3;c<B.length;c++)B[c]=0;for(c=E*3;c<H.length;c++)H[c]=0;z.point.length=E;z.directional.length=K;z.ambient[0]=t;z.ambient[1]=o;z.ambient[2]=v;c=La;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=
 c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof
 THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=ya.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ra.length;c++)m.shadowMatrix.value[c]=ra[c],m.shadowMap.texture[c]=P.shadowMap[c];m.shadowDarkness.value=P.shadowMapDarkness;m.shadowBias.value=P.shadowMapBias}for(var A in m)if(t=j.uniforms[A])if(n=m[A],o=n.type,c=n.value,o=="i")k.uniform1i(t,c);else if(o=="f")k.uniform1f(t,c);else if(o=="fv1")k.uniform1fv(t,c);else if(o=="fv")k.uniform3fv(t,c);else if(o==
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(g.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ra.length;c++)m.shadowMatrix.value[c]=ra[c],m.shadowMap.texture[c]=P.shadowMap[c];m.shadowDarkness.value=P.shadowMapDarkness;m.shadowBias.value=P.shadowMapBias}for(var A in m)if(t=h.uniforms[A])if(n=m[A],o=n.type,c=n.value,o=="i")k.uniform1i(t,c);else if(o=="f")k.uniform1f(t,c);else if(o=="fv1")k.uniform1fv(t,c);else if(o=="fv")k.uniform3fv(t,c);else if(o==
 "v2")k.uniform2f(t,c.x,c.y);else if(o=="v3")k.uniform3f(t,c.x,c.y,c.z);else if(o=="v4")k.uniform4f(t,c.x,c.y,c.z,c.w);else if(o=="m4"){if(!n._array)n._array=new Float32Array(16);c.flattenToArray(n._array);k.uniformMatrix4fv(t,!1,n._array)}else if(o=="m4v"){if(!n._array)n._array=new Float32Array(16*c.length);o=0;for(v=c.length;o<v;o++)c[o].flattenToArrayOffset(n._array,o*16);k.uniformMatrix4fv(t,!1,n._array)}else if(o=="c")k.uniform3f(t,c.r,c.g,c.b);else if(o=="t"){if(k.uniform1i(t,c),t=n.texture)if(t.image instanceof
 Array&&t.image.length==6){if(n=t,n.image.length==6){if(n.needsUpdate){if(n.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,k.RGBA,k.UNSIGNED_BYTE,n.image[t])}else{n.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(t=0;t<6;++t)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,n.image[t]);n.__webglInit=!0}R(k.TEXTURE_CUBE_MAP,
-n,n.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else ca(t,c)}else if(o=="tv"){if(!n._array){n._array=[];o=0;for(v=n.texture.length;o<v;o++)n._array[o]=c+o}k.uniform1iv(t,n._array);o=0;for(v=n.texture.length;o<v;o++)(t=n.texture[o])&&ca(t,n._array[o])}k.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(h.normalMatrix,!1,g._normalMatrixArray);(f instanceof
-THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&h.cameraPosition!==null&&k.uniform3f(h.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,
-!1,va);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(h.directionalLightDirection,b),k.uniformMatrix4fv(h.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(h.viewMatrix,!1,va);f.skinning&&(k.uniformMatrix4fv(h.cameraInverseMatrix,!1,va),k.uniformMatrix4fv(h.boneGlobalMatrices,!1,g.boneMatrices));return j}function f(b,c,f,g,j,h){if(g.opacity!=0){var m,b=e(b,c,f,g,h).attributes;
-if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(h.morphTargetBase){c=g.program.attributes;h.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[h.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length)for(var f=
-0,n=h.morphTargetForcedOrder,p=h.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[n[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[f]=p[n[f]],f++;else{var n=[],u=-1,t=0,p=h.morphTargetInfluences,o,v=p.length,f=0;for(h.morphTargetBase!==-1&&(n[h.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(o=0;o<v;o++)!n[o]&&p[o]>u&&(t=o,u=p[t]);k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[t]);
-k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[f]=u;n[t]=1;u=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(j.__webglCustomAttributes)for(m in j.__webglCustomAttributes)b[m]>=0&&(c=j.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglColorBuffer),
-k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(j.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,j.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(j.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,
-j.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,
-4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));h instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglLineBuffer),k.drawElements(k.LINES,j.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)),P.data.vertices+=j.__webglFaceCount,P.data.faces+=j.__webglFaceCount/
-3,P.data.drawCalls++):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(h,0,j.__webglLineCount),P.data.drawCalls++):h instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,j.__webglParticleCount),P.data.drawCalls++):h instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,j.__webglVertexCount),P.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
-k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,j,g,h,m,n,p,u,t,o,v=b.count*3;for(o=0;o<v;o+=9)c=b.normalArray,f=c[o],j=c[o+1],g=c[o+2],h=c[o+3],n=c[o+4],u=c[o+5],m=c[o+6],p=c[o+7],t=c[o+8],f=(f+h+m)/
-3,j=(j+n+p)/3,g=(g+u+t)/3,c[o]=f,c[o+1]=j,c[o+2]=g,c[o+3]=f,c[o+4]=j,c[o+5]=g,c[o+6]=f,c[o+7]=j,c[o+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function j(b){if(ga!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ga=b.doubleSided;if(ja!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ja=b.flipSided}
-function g(b){M!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),M=b)}function m(b,e,c){W!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),W=b);if(b&&(aa!=e||ma!=c))k.polygonOffset(e,c),aa=e,ma=c}function n(b){fa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);fa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);fa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);fa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);fa[4].set(b.n41-b.n31,b.n42-
-b.n32,b.n43-b.n33,b.n44-b.n34);fa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=fa[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=fa[f].x*e.n14+fa[f].y*e.n24+fa[f].z*e.n34+fa[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function t(b){var e,c,f=b.object,j=b.opaque,g=b.transparent;g.count=0;b=
-j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?o(g,c):o(j,c)}function v(b){var e,c,f,j,g=b.object,h=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=h.materials.length;e<c;e++)(j=h.materials[e])&&(j.transparent?o(m,j):o(k,j))}else(j=e)&&(j.transparent?o(m,j):o(k,j))}function u(b,e){return e.z-b.z}function y(b,c){var m,u,o,t=0,v,y,w,x,z=b.lights;ha||(ha=new THREE.Camera(P.shadowCameraFov,
-c.aspect,P.shadowCameraNear,P.shadowCameraFar));m=0;for(u=z.length;m<u;m++)if(o=z[m],o instanceof THREE.SpotLight&&o.castShadow){P.shadowMap[t]||(P.shadowMap[t]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ra[t]||(ra[t]=new THREE.Matrix4);v=P.shadowMap[t];y=ra[t];ha.position.copy(o.position);ha.target.position.copy(o.target.position);ha.update(void 0,!0);b.update(void 0,!1,ha);y.set(0.5,0,0,0.5,
-0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ha.projectionMatrix);y.multiplySelf(ha.matrixWorldInverse);ha.matrixWorldInverse.flattenToArray(va);ha.projectionMatrix.flattenToArray(qa);ia.multiply(ha.projectionMatrix,ha.matrixWorldInverse);n(ia);P.initWebGLObjects(b);T(v);k.clearColor(1,1,1,1);P.clear();k.clearColor(na.r,na.g,na.b,ua);y=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<y;v++)w=b.__webglObjects[v],x=w.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||
-p(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),H(x,ha,!1),w.render=!0):w.render=!1:w.render=!1;g(!0);I(THREE.NormalBlending);for(v=0;v<y;v++)if(w=b.__webglObjects[v],w.render)x=w.object,buffer=w.buffer,j(x),w=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?pa:Ba,f(ha,z,null,w,buffer,x);for(v=0;v<o;v++)w=b.__webglObjectsImmediate[v],x=w.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),H(x,ha,!1),j(x),program=
-e(ha,z,null,Ba,x),x.render(function(b){h(b,program,Ba.shading)}));t++}}function z(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,j=b.lights,g=[],h,m,n,p,u,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&
-f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(u=0;u<o;u++)f=b.__webglShadowVolumes[u].object,h=b.__webglShadowVolumes[u].buffer,m=f.materials[0],m.program||P.initMaterial(m,j,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,X!==m&&(k.useProgram(m),X=m,k.uniformMatrix4fv(n.projectionMatrix,!1,qa),k.uniformMatrix4fv(n.viewMatrix,!1,va),k.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),
-k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(p.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.vertexAttribPointer(p.normal,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,
-0,255);k.stencilOp(k.KEEP,k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);M=ea=-1;X=Z.program;k.useProgram(Z.program);k.uniformMatrix4fv(Z.projectionLocation,!1,qa);k.uniform1f(Z.darknessLocation,Z.darkness);k.bindBuffer(k.ARRAY_BUFFER,Z.vertexBuffer);k.vertexAttribPointer(Z.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(Z.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,
-0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function x(b,e){var c,f,j;c=N.attributes;var g=N.uniforms,h=U/la,m,n=[],p=la*0.5,o=U*0.5,t=!0;k.useProgram(N.program);X=N.program;M=ea=-1;Wa||(k.enableVertexAttribArray(N.attributes.position),k.enableVertexAttribArray(N.attributes.uv),Wa=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,N.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,
-16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,N.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,qa);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.material===void 0&&j.map&&j.map.image&&
-j.map.image.width&&(j.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(j.position.x-p)/p,(o-j.position.y)/o,Math.max(0,Math.min(1,j.position.z)))):(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,j.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,j._modelViewMatrixArray)),m=j.map.image.width/(j.scaleByViewport?U:1),n[0]=m*h*j.scale.x,n[1]=m*j.scale.y,k.uniform2f(g.uvScale,j.uvScale.x,j.uvScale.y),k.uniform2f(g.uvOffset,
-j.uvOffset.x,j.uvOffset.y),k.uniform2f(g.alignment,j.alignment.x,j.alignment.y),k.uniform1f(g.opacity,j.opacity),k.uniform1f(g.rotation,j.rotation),k.uniform2fv(g.scale,n),j.mergeWith3D&&!t?(k.enable(k.DEPTH_TEST),t=!0):!j.mergeWith3D&&t&&(k.disable(k.DEPTH_TEST),t=!1),I(j.blending),ca(j.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function w(b,e){var c,f,j=b.__webglLensFlares.length,g,h,m,n=new THREE.Vector3,p=U/la,u=la*0.5,
-o=U*0.5,t=16/U,v=[t*p,t],y=[1,1,0],w=[1,1],x=Q.uniforms;c=Q.attributes;k.useProgram(Q.program);X=Q.program;M=ea=-1;Ea||(k.enableVertexAttribArray(Q.attributes.vertex),k.enableVertexAttribArray(Q.attributes.uv),Ea=!0);k.uniform1i(x.occlusionMap,0);k.uniform1i(x.map,1);k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);
-k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<j;f++)if(c=b.__webglLensFlares[f].object,n.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(n),e.projectionMatrix.multiplyVector3(n),y[0]=n.x,y[1]=n.y,y[2]=n.z,w[0]=y[0]*u+u,w[1]=y[1]*o+o,Q.hasVertexTexture||w[0]>0&&w[0]<la&&w[1]>0&&w[1]<U){k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,
-0);k.uniform2fv(x.scale,v);k.uniform3fv(x.screenPosition,y);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=y[0];c.positionScreen.y=y[1];c.positionScreen.z=y[2];c.customUpdateCallback?c.customUpdateCallback(c):
-c.updateLensFlares();k.uniform1i(x.renderType,2);k.enable(k.BLEND);g=0;for(h=c.lensFlares.length;g<h;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)y[0]=m.x,y[1]=m.y,y[2]=m.z,t=m.size*m.scale/U,v[0]=t*p,v[1]=t,k.uniform3fv(x.screenPosition,y),k.uniform2fv(x.scale,v),k.uniform1f(x.rotation,m.rotation),k.uniform1f(x.opacity,m.opacity),I(m.blending),ca(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Y)}function H(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
-b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function B(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function J(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function C(b){var e,f,j,g;if(b instanceof THREE.Mesh){f=b.geometry;
-for(e in f.geometryGroups)if(j=f.geometryGroups[e],g=B(j),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=j;var h=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,p=void 0,u=void 0,o=void 0,t=u=void 0,v=void 0,y=void 0,w=void 0,x=void 0,z=void 0,H=void 0,F=void 0,la=void 0,C=void 0,G=void 0,I=void 0,U=void 0,E=o=w=o=y=v=void 0,A=void 0,D=A=E=v=void 0,K=void 0,O=D=A=E=u=u=t=w=o=D=A=E=K=D=A=E=K=D=A=E=void 0,M=
-0,fa=0,W=0,Q=0,R=0,Y=0,N=0,T=0,ia=0,L=0,P=0,D=E=0,D=void 0,S=g.__vertexArray,ca=g.__uvArray,da=g.__uv2Array,ja=g.__normalArray,V=g.__tangentArray,$=g.__colorArray,X=g.__skinVertexAArray,ea=g.__skinVertexBArray,aa=g.__skinIndexArray,Z=g.__skinWeightArray,ma=g.__morphTargetsArrays,ga=g.__webglCustomAttributes,A=void 0,qa=g.__faceArray,ka=g.__lineArray,na=g.__needsSmoothNormals,z=g.__vertexColorType,x=g.__uvType,H=g.__normalType,ha=h.geometry,sa=ha.__dirtyVertices,pa=ha.__dirtyElements,va=ha.__dirtyUvs,
-ra=ha.__dirtyNormals,za=ha.__dirtyTangents,ta=ha.__dirtyColors,ya=ha.__dirtyMorphTargets,ua=ha.vertices,Ba=g.faces,La=ha.faces,Da=ha.faceVertexUvs[0],Ea=ha.faceVertexUvs[1],wa=ha.skinVerticesA,xa=ha.skinVerticesB,Na=ha.skinIndices,Ga=ha.skinWeights,Ka=h instanceof THREE.ShadowVolume?ha.edgeFaces:void 0,Fa=ha.morphTargets;if(ga)for(O in ga)ga[O].offset=0,ga[O].offsetSrc=0;n=0;for(p=Ba.length;n<p;n++)if(u=Ba[n],o=La[u],Da&&(F=Da[u]),Ea&&(la=Ea[u]),u=o.vertexNormals,t=o.normal,v=o.vertexColors,y=o.color,
-w=o.vertexTangents,o instanceof THREE.Face3){if(sa)C=ua[o.a].position,G=ua[o.b].position,I=ua[o.c].position,S[fa]=C.x,S[fa+1]=C.y,S[fa+2]=C.z,S[fa+3]=G.x,S[fa+4]=G.y,S[fa+5]=G.z,S[fa+6]=I.x,S[fa+7]=I.y,S[fa+8]=I.z,fa+=9;if(ga)for(O in ga)if(A=ga[O],A.__original.needsUpdate)E=A.offset,D=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c]):A.boundTo==="faces"?(D=A.value[D],A.array[E]=D,A.array[E+1]=D,A.array[E+
-2]=D,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[D],A.array[E+1]=A.value[D+1],A.array[E+2]=A.value[D+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(C=A.value[o.a],G=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(I=G=C=D=A.value[D],A.offsetSrc++):A.boundTo==="faceVertices"&&(C=A.value[D],G=A.value[D+1],I=A.value[D+2],A.offsetSrc+=3),A.size===2?(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=G.x,A.array[E+3]=G.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.offset+=
-6):A.size===3?(A.type==="c"?(A.array[E]=C.r,A.array[E+1]=C.g,A.array[E+2]=C.b,A.array[E+3]=G.r,A.array[E+4]=G.g,A.array[E+5]=G.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=G.x,A.array[E+4]=G.y,A.array[E+5]=G.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z),A.offset+=9):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=C.w,A.array[E+4]=G.x,A.array[E+5]=G.y,A.array[E+6]=G.z,A.array[E+7]=G.w,A.array[E+8]=I.x,A.array[E+
-9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.offset+=12));if(ya){E=0;for(A=Fa.length;E<A;E++)C=Fa[E].vertices[o.a].position,G=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,D=ma[E],D[P]=C.x,D[P+1]=C.y,D[P+2]=C.z,D[P+3]=G.x,D[P+4]=G.y,D[P+5]=G.z,D[P+6]=I.x,D[P+7]=I.y,D[P+8]=I.z;P+=9}if(Ga.length)E=Ga[o.a],A=Ga[o.b],D=Ga[o.c],Z[L]=E.x,Z[L+1]=E.y,Z[L+2]=E.z,Z[L+3]=E.w,Z[L+4]=A.x,Z[L+5]=A.y,Z[L+6]=A.z,Z[L+7]=A.w,Z[L+8]=D.x,Z[L+9]=D.y,Z[L+10]=D.z,Z[L+11]=D.w,E=Na[o.a],A=Na[o.b],D=Na[o.c],
-aa[L]=E.x,aa[L+1]=E.y,aa[L+2]=E.z,aa[L+3]=E.w,aa[L+4]=A.x,aa[L+5]=A.y,aa[L+6]=A.z,aa[L+7]=A.w,aa[L+8]=D.x,aa[L+9]=D.y,aa[L+10]=D.z,aa[L+11]=D.w,E=wa[o.a],A=wa[o.b],D=wa[o.c],X[L]=E.x,X[L+1]=E.y,X[L+2]=E.z,X[L+3]=1,X[L+4]=A.x,X[L+5]=A.y,X[L+6]=A.z,X[L+7]=1,X[L+8]=D.x,X[L+9]=D.y,X[L+10]=D.z,X[L+11]=1,E=xa[o.a],A=xa[o.b],D=xa[o.c],ea[L]=E.x,ea[L+1]=E.y,ea[L+2]=E.z,ea[L+3]=1,ea[L+4]=A.x,ea[L+5]=A.y,ea[L+6]=A.z,ea[L+7]=1,ea[L+8]=D.x,ea[L+9]=D.y,ea[L+10]=D.z,ea[L+11]=1,L+=12;if(ta&&z)v.length==3&&z==THREE.VertexColors?
-(o=v[0],E=v[1],A=v[2]):A=E=o=y,$[ia]=o.r,$[ia+1]=o.g,$[ia+2]=o.b,$[ia+3]=E.r,$[ia+4]=E.g,$[ia+5]=E.b,$[ia+6]=A.r,$[ia+7]=A.g,$[ia+8]=A.b,ia+=9;if(za&&ha.hasTangents)v=w[0],y=w[1],o=w[2],V[N]=v.x,V[N+1]=v.y,V[N+2]=v.z,V[N+3]=v.w,V[N+4]=y.x,V[N+5]=y.y,V[N+6]=y.z,V[N+7]=y.w,V[N+8]=o.x,V[N+9]=o.y,V[N+10]=o.z,V[N+11]=o.w,N+=12;if(ra&&H)if(u.length==3&&na)for(w=0;w<3;w++)t=u[w],ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;else for(w=0;w<3;w++)ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;if(va&&F!==void 0&&x)for(w=
-0;w<3;w++)u=F[w],ca[W]=u.u,ca[W+1]=u.v,W+=2;if(va&&la!==void 0&&x)for(w=0;w<3;w++)u=la[w],da[Q]=u.u,da[Q+1]=u.v,Q+=2;pa&&(qa[R]=M,qa[R+1]=M+1,qa[R+2]=M+2,R+=3,ka[T]=M,ka[T+1]=M+1,ka[T+2]=M,ka[T+3]=M+2,ka[T+4]=M+1,ka[T+5]=M+2,T+=6,M+=3)}else if(o instanceof THREE.Face4){if(sa)C=ua[o.a].position,G=ua[o.b].position,I=ua[o.c].position,U=ua[o.d].position,S[fa]=C.x,S[fa+1]=C.y,S[fa+2]=C.z,S[fa+3]=G.x,S[fa+4]=G.y,S[fa+5]=G.z,S[fa+6]=I.x,S[fa+7]=I.y,S[fa+8]=I.z,S[fa+9]=U.x,S[fa+10]=U.y,S[fa+11]=U.z,fa+=12;
-if(ga)for(O in ga)if(A=ga[O],A.__original.needsUpdate)E=A.offset,D=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c],A.array[E+3]=A.value[o.d]):A.boundTo==="faces"?(D=A.value[D],A.array[E]=D,A.array[E+1]=D,A.array[E+2]=D,A.array[E+3]=D,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[D],A.array[E+1]=A.value[D+1],A.array[E+2]=A.value[D+2],A.array[E+3]=A.value[D+3],A.offsetSrc+=4),A.offset+=4):
-(A.boundTo===void 0||A.boundTo==="vertices"?(C=A.value[o.a],G=A.value[o.b],I=A.value[o.c],U=A.value[o.d]):A.boundTo==="faces"?(U=I=G=C=D=A.value[D],A.offsetSrc++):A.boundTo==="faceVertices"&&(C=A.value[D],G=A.value[D+1],I=A.value[D+2],U=A.value[D+3],A.offsetSrc+=4),A.size===2?(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=G.x,A.array[E+3]=G.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.array[E+6]=U.x,A.array[E+7]=U.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[E]=C.r,A.array[E+1]=C.g,A.array[E+2]=C.b,A.array[E+
-3]=G.r,A.array[E+4]=G.g,A.array[E+5]=G.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b,A.array[E+9]=U.r,A.array[E+10]=U.g,A.array[E+11]=U.b):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=G.x,A.array[E+4]=G.y,A.array[E+5]=G.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z,A.array[E+9]=U.x,A.array[E+10]=U.y,A.array[E+11]=U.z),A.offset+=12):(A.array[E]=C.x,A.array[E+1]=C.y,A.array[E+2]=C.z,A.array[E+3]=C.w,A.array[E+4]=G.x,A.array[E+5]=G.y,A.array[E+6]=G.z,A.array[E+7]=G.w,
-A.array[E+8]=I.x,A.array[E+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.array[E+12]=U.x,A.array[E+13]=U.y,A.array[E+14]=U.z,A.array[E+15]=U.w,A.offset+=16));if(ya){E=0;for(A=Fa.length;E<A;E++)C=Fa[E].vertices[o.a].position,G=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,U=Fa[E].vertices[o.d].position,D=ma[E],D[P]=C.x,D[P+1]=C.y,D[P+2]=C.z,D[P+3]=G.x,D[P+4]=G.y,D[P+5]=G.z,D[P+6]=I.x,D[P+7]=I.y,D[P+8]=I.z,D[P+9]=U.x,D[P+10]=U.y,D[P+11]=U.z;P+=12}if(Ga.length)E=Ga[o.a],A=Ga[o.b],D=Ga[o.c],
-K=Ga[o.d],Z[L]=E.x,Z[L+1]=E.y,Z[L+2]=E.z,Z[L+3]=E.w,Z[L+4]=A.x,Z[L+5]=A.y,Z[L+6]=A.z,Z[L+7]=A.w,Z[L+8]=D.x,Z[L+9]=D.y,Z[L+10]=D.z,Z[L+11]=D.w,Z[L+12]=K.x,Z[L+13]=K.y,Z[L+14]=K.z,Z[L+15]=K.w,E=Na[o.a],A=Na[o.b],D=Na[o.c],K=Na[o.d],aa[L]=E.x,aa[L+1]=E.y,aa[L+2]=E.z,aa[L+3]=E.w,aa[L+4]=A.x,aa[L+5]=A.y,aa[L+6]=A.z,aa[L+7]=A.w,aa[L+8]=D.x,aa[L+9]=D.y,aa[L+10]=D.z,aa[L+11]=D.w,aa[L+12]=K.x,aa[L+13]=K.y,aa[L+14]=K.z,aa[L+15]=K.w,E=wa[o.a],A=wa[o.b],D=wa[o.c],K=wa[o.d],X[L]=E.x,X[L+1]=E.y,X[L+2]=E.z,X[L+
-3]=1,X[L+4]=A.x,X[L+5]=A.y,X[L+6]=A.z,X[L+7]=1,X[L+8]=D.x,X[L+9]=D.y,X[L+10]=D.z,X[L+11]=1,X[L+12]=K.x,X[L+13]=K.y,X[L+14]=K.z,X[L+15]=1,E=xa[o.a],A=xa[o.b],D=xa[o.c],o=xa[o.d],ea[L]=E.x,ea[L+1]=E.y,ea[L+2]=E.z,ea[L+3]=1,ea[L+4]=A.x,ea[L+5]=A.y,ea[L+6]=A.z,ea[L+7]=1,ea[L+8]=D.x,ea[L+9]=D.y,ea[L+10]=D.z,ea[L+11]=1,ea[L+12]=o.x,ea[L+13]=o.y,ea[L+14]=o.z,ea[L+15]=1,L+=16;if(ta&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],E=v[1],A=v[2],v=v[3]):v=A=E=o=y,$[ia]=o.r,$[ia+1]=o.g,$[ia+2]=o.b,$[ia+3]=E.r,
-$[ia+4]=E.g,$[ia+5]=E.b,$[ia+6]=A.r,$[ia+7]=A.g,$[ia+8]=A.b,$[ia+9]=v.r,$[ia+10]=v.g,$[ia+11]=v.b,ia+=12;if(za&&ha.hasTangents)v=w[0],y=w[1],o=w[2],w=w[3],V[N]=v.x,V[N+1]=v.y,V[N+2]=v.z,V[N+3]=v.w,V[N+4]=y.x,V[N+5]=y.y,V[N+6]=y.z,V[N+7]=y.w,V[N+8]=o.x,V[N+9]=o.y,V[N+10]=o.z,V[N+11]=o.w,V[N+12]=w.x,V[N+13]=w.y,V[N+14]=w.z,V[N+15]=w.w,N+=16;if(ra&&H)if(u.length==4&&na)for(w=0;w<4;w++)t=u[w],ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;else for(w=0;w<4;w++)ja[Y]=t.x,ja[Y+1]=t.y,ja[Y+2]=t.z,Y+=3;if(va&&F!==
-void 0&&x)for(w=0;w<4;w++)u=F[w],ca[W]=u.u,ca[W+1]=u.v,W+=2;if(va&&la!==void 0&&x)for(w=0;w<4;w++)u=la[w],da[Q]=u.u,da[Q+1]=u.v,Q+=2;pa&&(qa[R]=M,qa[R+1]=M+1,qa[R+2]=M+3,qa[R+3]=M+1,qa[R+4]=M+2,qa[R+5]=M+3,R+=6,ka[T]=M,ka[T+1]=M+1,ka[T+2]=M,ka[T+3]=M+3,ka[T+4]=M+1,ka[T+5]=M+2,ka[T+6]=M+2,ka[T+7]=M+3,T+=8,M+=4)}if(Ka){n=0;for(p=Ka.length;n<p;n++)qa[R]=Ka[n].a,qa[R+1]=Ka[n].b,qa[R+2]=Ka[n].c,qa[R+3]=Ka[n].a,qa[R+4]=Ka[n].c,qa[R+5]=Ka[n].d,R+=6}sa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),
-k.bufferData(k.ARRAY_BUFFER,S,m));if(ga)for(O in ga)A=ga[O],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(ya){E=0;for(A=Fa.length;E<A;E++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[E]),k.bufferData(k.ARRAY_BUFFER,ma[E],m)}ta&&ia>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));ra&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,ja,m));za&&ha.hasTangents&&
-(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,V,m));va&&W>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m));va&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,da,m));pa&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,qa,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ka,m));L>0&&(k.bindBuffer(k.ARRAY_BUFFER,
-g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,X,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Z,m));h.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,
-delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;J(j)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;h=g.length;H=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(n=
-0;n<z;n++)p=x[n].position,j=n*3,H[j]=p.x,H[j+1]=p.y,H[j+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(F){for(n=0;n<h;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;h=g.length;
-H=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<z;n++)p=x[n].position,j=n*3,H[j]=p.x,H[j+1]=p.y,H[j+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(F){for(n=0;n<h;n++)color=g[n],j=n*3,m[j]=color.r,m[j+1]=color.g,m[j+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=B(f),(f.__dirtyVertices||
-f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,J(f)}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function O(b){function e(b){var g=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?g.push("undefined"):g.push(b[c].id);return g.join("_")}var c,f,g,j,h,k,m,n,o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(j=b.faces.length;g<j;g++)h=b.faces[g],k=h.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,
-counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+h>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=h}function F(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],
-count:0}})}function I(b){if(b!=ea){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ea=b}}function R(b,e,c){(c.width&
-c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,da(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,da(e.minFilter)))}function ca(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
-k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);R(k.TEXTURE_2D,b,b.image);k.bindTexture(k.TEXTURE_2D,null);b.needsUpdate=!1}k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function T(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
+n,n.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);n.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}}else da(t,c)}else if(o=="tv"){if(!n._array){n._array=[];o=0;for(v=n.texture.length;o<v;o++)n._array[o]=c+o}k.uniform1iv(t,n._array);o=0;for(v=n.texture.length;o<v;o++)(t=n.texture[o])&&da(t,n._array[o])}k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof
+THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,
+!1,va);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,va);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,va),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;
+if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(j.morphTargetBase){c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=
+0,n=j.morphTargetForcedOrder,p=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<n.length;)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=p[n[f]],f++;else{var n=[],u=-1,t=0,p=j.morphTargetInfluences,o,v=p.length,f=0;for(j.morphTargetBase!==-1&&(n[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(o=0;o<v;o++)!n[o]&&p[o]>u&&(t=o,u=p[t]);k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[t]);
+k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=u;n[t]=1;u=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),
+k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,
+h.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,
+4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.drawElements(k.LINES,h.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0)),P.data.vertices+=h.__webglFaceCount,P.data.faces+=h.__webglFaceCount/
+3,P.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),P.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),P.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),P.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
+k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,n,p,u,t,o,v=b.count*3;for(o=0;o<v;o+=9)c=b.normalArray,f=c[o],h=c[o+1],g=c[o+2],j=c[o+3],n=c[o+4],u=c[o+5],m=c[o+6],p=c[o+7],t=c[o+8],f=(f+j+m)/
+3,h=(h+n+p)/3,g=(g+u+t)/3,c[o]=f,c[o+1]=h,c[o+2]=g,c[o+3]=f,c[o+4]=h,c[o+5]=g,c[o+6]=f,c[o+7]=h,c[o+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function j(b){if(ha!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),ha=b.doubleSided;if(ka!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ka=b.flipSided}
+function h(b){U!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),U=b)}function m(b,c,e){X!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),X=b);if(b&&(ca!=c||ma!=e))k.polygonOffset(c,e),ca=c,ma=e}function p(b){ga[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ga[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ga[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ga[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ga[4].set(b.n41-b.n31,b.n42-
+b.n32,b.n43-b.n33,b.n44-b.n34);ga[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ga[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function n(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ga[f].x*c.n14+ga[f].y*c.n24+ga[f].z*c.n34+ga[f].w,b<=e)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function t(b){var c,e,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=
+h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?o(g,e):o(h,e)}function v(b){var c,e,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<e;c++)(h=j.materials[c])&&(h.transparent?o(m,h):o(k,h))}else(h=c)&&(h.transparent?o(m,h):o(k,h))}function u(b,c){return c.z-b.z}function w(b,c){var m,u,o,t=0,v,w,x,y,z=b.lights;ia||(ia=new THREE.Camera(P.shadowCameraFov,
+c.aspect,P.shadowCameraNear,P.shadowCameraFar));m=0;for(u=z.length;m<u;m++)if(o=z[m],o instanceof THREE.SpotLight&&o.castShadow){P.shadowMap[t]||(P.shadowMap[t]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ra[t]||(ra[t]=new THREE.Matrix4);v=P.shadowMap[t];w=ra[t];ia.position.copy(o.position);ia.target.position.copy(o.target.position);ia.update(void 0,!0);b.update(void 0,!1,ia);w.set(0.5,0,0,0.5,
+0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf(ia.projectionMatrix);w.multiplySelf(ia.matrixWorldInverse);ia.matrixWorldInverse.flattenToArray(va);ia.projectionMatrix.flattenToArray(qa);ja.multiply(ia.projectionMatrix,ia.matrixWorldInverse);p(ja);P.initWebGLObjects(b);T(v);k.clearColor(1,1,1,1);P.clear();k.clearColor(na.r,na.g,na.b,ua);w=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<w;v++)x=b.__webglObjects[v],y=x.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||
+n(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),H(y,ia,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);I(THREE.NormalBlending);for(v=0;v<w;v++)if(x=b.__webglObjects[v],x.render)y=x.object,buffer=x.buffer,j(y),x=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?pa:Ba,f(ia,z,null,x,buffer,y);for(v=0;v<o;v++)x=b.__webglObjectsImmediate[v],y=x.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),H(y,ia,!1),j(y),program=
+e(ia,z,null,Ba,y),y.render(function(b){g(b,program,Ba.shading)}));t++}}function z(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var c,e=b.lights.length,f,h=b.lights,g=[],j,m,n,p,u,o=b.__webglShadowVolumes.length;for(c=0;c<e;c++)if(f=b.lights[c],f instanceof THREE.DirectionalLight&&
+f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(u=0;u<o;u++)f=b.__webglShadowVolumes[u].object,j=b.__webglShadowVolumes[u].buffer,m=f.materials[0],m.program||P.initMaterial(m,h,void 0,f),m=m.program,n=m.uniforms,p=m.attributes,Y!==m&&(k.useProgram(m),Y=m,k.uniformMatrix4fv(n.projectionMatrix,!1,qa),k.uniformMatrix4fv(n.viewMatrix,!1,va),k.uniform3fv(n.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(n.objectMatrix,!1,f._objectMatrixArray),
+k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(p.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(p.normal,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,
+0,255);k.stencilOp(k.KEEP,k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);U=fa=-1;Y=$.program;k.useProgram($.program);k.uniformMatrix4fv($.projectionLocation,!1,qa);k.uniform1f($.darknessLocation,$.darkness);k.bindBuffer(k.ARRAY_BUFFER,$.vertexBuffer);k.vertexAttribPointer($.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray($.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,$.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,
+0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(Z)}function y(b,c){var e,f,h;e=O.attributes;var g=O.uniforms,j=V/K,m,n=[],p=K*0.5,o=V*0.5,t=!0;k.useProgram(O.program);Y=O.program;U=fa=-1;Wa||(k.enableVertexAttribArray(O.attributes.position),k.enableVertexAttribArray(O.attributes.uv),Wa=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.vertexAttribPointer(e.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(e.uv,2,k.FLOAT,!1,16,
+8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,qa);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(u);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.material===void 0&&h.map&&h.map.image&&
+h.map.image.width&&(h.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-p)/p,(o-h.position.y)/o,Math.max(0,Math.min(1,h.position.z)))):(k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?V:1),n[0]=m*j*h.scale.x,n[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,
+h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,n),h.mergeWith3D&&!t?(k.enable(k.DEPTH_TEST),t=!0):!h.mergeWith3D&&t&&(k.disable(k.DEPTH_TEST),t=!1),I(h.blending),da(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Z)}function x(b,c){var e,f,h=b.__webglLensFlares.length,g,j,m,n=new THREE.Vector3,p=V/K,u=K*0.5,o=
+V*0.5,t=16/V,v=[t*p,t],y=[1,1,0],w=[1,1],x=Q.uniforms;e=Q.attributes;k.useProgram(Q.program);Y=Q.program;U=fa=-1;Ea||(k.enableVertexAttribArray(Q.attributes.vertex),k.enableVertexAttribArray(Q.attributes.uv),Ea=!0);k.uniform1i(x.occlusionMap,0);k.uniform1i(x.map,1);k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);k.vertexAttribPointer(e.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(e.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);
+k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(e=b.__webglLensFlares[f].object,n.set(e.matrixWorld.n14,e.matrixWorld.n24,e.matrixWorld.n34),c.matrixWorldInverse.multiplyVector3(n),c.projectionMatrix.multiplyVector3(n),y[0]=n.x,y[1]=n.y,y[2]=n.z,w[0]=y[0]*u+u,w[1]=y[1]*o+o,Q.hasVertexTexture||w[0]>0&&w[0]<K&&w[1]>0&&w[1]<V){k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,0);
+k.uniform2fv(x.scale,v);k.uniform3fv(x.screenPosition,y);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,w[0]-8,w[1]-8,16,16,0);k.uniform1i(x.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);e.positionScreen.x=y[0];e.positionScreen.y=y[1];e.positionScreen.z=y[2];e.customUpdateCallback?e.customUpdateCallback(e):
+e.updateLensFlares();k.uniform1i(x.renderType,2);k.enable(k.BLEND);g=0;for(j=e.lensFlares.length;g<j;g++)if(m=e.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)y[0]=m.x,y[1]=m.y,y[2]=m.z,t=m.size*m.scale/V,v[0]=t*p,v[1]=t,k.uniform3fv(x.screenPosition,y),k.uniform2fv(x.scale,v),k.uniform1f(x.rotation,m.rotation),k.uniform1f(x.opacity,m.opacity),I(m.blending),da(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(Z)}function H(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
+b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function B(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function J(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;
+for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=B(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var n=void 0,p=void 0,u=void 0,o=void 0,t=u=void 0,v=void 0,y=void 0,w=void 0,x=void 0,z=void 0,H=void 0,G=void 0,J=void 0,K=void 0,D=void 0,I=void 0,V=void 0,E=o=w=o=y=v=void 0,A=void 0,C=A=E=v=void 0,M=void 0,U=C=A=E=u=u=t=w=o=C=A=E=M=C=A=E=M=C=A=E=void 0,L=
+0,ga=0,X=0,Q=0,R=0,Z=0,O=0,T=0,ja=0,N=0,P=0,C=E=0,C=void 0,S=g.__vertexArray,da=g.__uvArray,ea=g.__uv2Array,ka=g.__normalArray,W=g.__tangentArray,aa=g.__colorArray,Y=g.__skinVertexAArray,fa=g.__skinVertexBArray,ca=g.__skinIndexArray,$=g.__skinWeightArray,ma=g.__morphTargetsArrays,ha=g.__webglCustomAttributes,A=void 0,qa=g.__faceArray,la=g.__lineArray,na=g.__needsSmoothNormals,z=g.__vertexColorType,x=g.__uvType,H=g.__normalType,ia=j.geometry,sa=ia.__dirtyVertices,pa=ia.__dirtyElements,va=ia.__dirtyUvs,
+ra=ia.__dirtyNormals,za=ia.__dirtyTangents,ta=ia.__dirtyColors,ya=ia.__dirtyMorphTargets,ua=ia.vertices,Ba=g.faces,La=ia.faces,Da=ia.faceVertexUvs[0],Ea=ia.faceVertexUvs[1],wa=ia.skinVerticesA,xa=ia.skinVerticesB,Na=ia.skinIndices,Ga=ia.skinWeights,Ka=j instanceof THREE.ShadowVolume?ia.edgeFaces:void 0,Fa=ia.morphTargets;if(ha)for(U in ha)ha[U].offset=0,ha[U].offsetSrc=0;n=0;for(p=Ba.length;n<p;n++)if(u=Ba[n],o=La[u],Da&&(G=Da[u]),Ea&&(J=Ea[u]),u=o.vertexNormals,t=o.normal,v=o.vertexColors,y=o.color,
+w=o.vertexTangents,o instanceof THREE.Face3){if(sa)K=ua[o.a].position,D=ua[o.b].position,I=ua[o.c].position,S[ga]=K.x,S[ga+1]=K.y,S[ga+2]=K.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,ga+=9;if(ha)for(U in ha)if(A=ha[U],A.__original.needsUpdate)E=A.offset,C=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c]):A.boundTo==="faces"?(C=A.value[C],A.array[E]=C,A.array[E+1]=C,A.array[E+
+2]=C,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[C],A.array[E+1]=A.value[C+1],A.array[E+2]=A.value[C+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(K=A.value[o.a],D=A.value[o.b],I=A.value[o.c]):A.boundTo==="faces"?(I=D=K=C=A.value[C],A.offsetSrc++):A.boundTo==="faceVertices"&&(K=A.value[C],D=A.value[C+1],I=A.value[C+2],A.offsetSrc+=3),A.size===2?(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=D.x,A.array[E+3]=D.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.offset+=
+6):A.size===3?(A.type==="c"?(A.array[E]=K.r,A.array[E+1]=K.g,A.array[E+2]=K.b,A.array[E+3]=D.r,A.array[E+4]=D.g,A.array[E+5]=D.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=D.x,A.array[E+4]=D.y,A.array[E+5]=D.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z),A.offset+=9):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=K.w,A.array[E+4]=D.x,A.array[E+5]=D.y,A.array[E+6]=D.z,A.array[E+7]=D.w,A.array[E+8]=I.x,A.array[E+
+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.offset+=12));if(ya){E=0;for(A=Fa.length;E<A;E++)K=Fa[E].vertices[o.a].position,D=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,C=ma[E],C[P]=K.x,C[P+1]=K.y,C[P+2]=K.z,C[P+3]=D.x,C[P+4]=D.y,C[P+5]=D.z,C[P+6]=I.x,C[P+7]=I.y,C[P+8]=I.z;P+=9}if(Ga.length)E=Ga[o.a],A=Ga[o.b],C=Ga[o.c],$[N]=E.x,$[N+1]=E.y,$[N+2]=E.z,$[N+3]=E.w,$[N+4]=A.x,$[N+5]=A.y,$[N+6]=A.z,$[N+7]=A.w,$[N+8]=C.x,$[N+9]=C.y,$[N+10]=C.z,$[N+11]=C.w,E=Na[o.a],A=Na[o.b],C=Na[o.c],
+ca[N]=E.x,ca[N+1]=E.y,ca[N+2]=E.z,ca[N+3]=E.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=C.x,ca[N+9]=C.y,ca[N+10]=C.z,ca[N+11]=C.w,E=wa[o.a],A=wa[o.b],C=wa[o.c],Y[N]=E.x,Y[N+1]=E.y,Y[N+2]=E.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=C.x,Y[N+9]=C.y,Y[N+10]=C.z,Y[N+11]=1,E=xa[o.a],A=xa[o.b],C=xa[o.c],fa[N]=E.x,fa[N+1]=E.y,fa[N+2]=E.z,fa[N+3]=1,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=1,fa[N+8]=C.x,fa[N+9]=C.y,fa[N+10]=C.z,fa[N+11]=1,N+=12;if(ta&&z)v.length==3&&z==THREE.VertexColors?
+(o=v[0],E=v[1],A=v[2]):A=E=o=y,aa[ja]=o.r,aa[ja+1]=o.g,aa[ja+2]=o.b,aa[ja+3]=E.r,aa[ja+4]=E.g,aa[ja+5]=E.b,aa[ja+6]=A.r,aa[ja+7]=A.g,aa[ja+8]=A.b,ja+=9;if(za&&ia.hasTangents)v=w[0],y=w[1],o=w[2],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,O+=12;if(ra&&H)if(u.length==3&&na)for(w=0;w<3;w++)t=u[w],ka[Z]=t.x,ka[Z+1]=t.y,ka[Z+2]=t.z,Z+=3;else for(w=0;w<3;w++)ka[Z]=t.x,ka[Z+1]=t.y,ka[Z+2]=t.z,Z+=3;if(va&&G!==void 0&&
+x)for(w=0;w<3;w++)u=G[w],da[X]=u.u,da[X+1]=u.v,X+=2;if(va&&J!==void 0&&x)for(w=0;w<3;w++)u=J[w],ea[Q]=u.u,ea[Q+1]=u.v,Q+=2;pa&&(qa[R]=L,qa[R+1]=L+1,qa[R+2]=L+2,R+=3,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+2,la[T+4]=L+1,la[T+5]=L+2,T+=6,L+=3)}else if(o instanceof THREE.Face4){if(sa)K=ua[o.a].position,D=ua[o.b].position,I=ua[o.c].position,V=ua[o.d].position,S[ga]=K.x,S[ga+1]=K.y,S[ga+2]=K.z,S[ga+3]=D.x,S[ga+4]=D.y,S[ga+5]=D.z,S[ga+6]=I.x,S[ga+7]=I.y,S[ga+8]=I.z,S[ga+9]=V.x,S[ga+10]=V.y,S[ga+11]=V.z,
+ga+=12;if(ha)for(U in ha)if(A=ha[U],A.__original.needsUpdate)E=A.offset,C=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[E]=A.value[o.a],A.array[E+1]=A.value[o.b],A.array[E+2]=A.value[o.c],A.array[E+3]=A.value[o.d]):A.boundTo==="faces"?(C=A.value[C],A.array[E]=C,A.array[E+1]=C,A.array[E+2]=C,A.array[E+3]=C,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[E]=A.value[C],A.array[E+1]=A.value[C+1],A.array[E+2]=A.value[C+2],A.array[E+3]=A.value[C+3],A.offsetSrc+=4),A.offset+=
+4):(A.boundTo===void 0||A.boundTo==="vertices"?(K=A.value[o.a],D=A.value[o.b],I=A.value[o.c],V=A.value[o.d]):A.boundTo==="faces"?(V=I=D=K=C=A.value[C],A.offsetSrc++):A.boundTo==="faceVertices"&&(K=A.value[C],D=A.value[C+1],I=A.value[C+2],V=A.value[C+3],A.offsetSrc+=4),A.size===2?(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=D.x,A.array[E+3]=D.y,A.array[E+4]=I.x,A.array[E+5]=I.y,A.array[E+6]=V.x,A.array[E+7]=V.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[E]=K.r,A.array[E+1]=K.g,A.array[E+2]=K.b,
+A.array[E+3]=D.r,A.array[E+4]=D.g,A.array[E+5]=D.b,A.array[E+6]=I.r,A.array[E+7]=I.g,A.array[E+8]=I.b,A.array[E+9]=V.r,A.array[E+10]=V.g,A.array[E+11]=V.b):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=D.x,A.array[E+4]=D.y,A.array[E+5]=D.z,A.array[E+6]=I.x,A.array[E+7]=I.y,A.array[E+8]=I.z,A.array[E+9]=V.x,A.array[E+10]=V.y,A.array[E+11]=V.z),A.offset+=12):(A.array[E]=K.x,A.array[E+1]=K.y,A.array[E+2]=K.z,A.array[E+3]=K.w,A.array[E+4]=D.x,A.array[E+5]=D.y,A.array[E+6]=D.z,A.array[E+
+7]=D.w,A.array[E+8]=I.x,A.array[E+9]=I.y,A.array[E+10]=I.z,A.array[E+11]=I.w,A.array[E+12]=V.x,A.array[E+13]=V.y,A.array[E+14]=V.z,A.array[E+15]=V.w,A.offset+=16));if(ya){E=0;for(A=Fa.length;E<A;E++)K=Fa[E].vertices[o.a].position,D=Fa[E].vertices[o.b].position,I=Fa[E].vertices[o.c].position,V=Fa[E].vertices[o.d].position,C=ma[E],C[P]=K.x,C[P+1]=K.y,C[P+2]=K.z,C[P+3]=D.x,C[P+4]=D.y,C[P+5]=D.z,C[P+6]=I.x,C[P+7]=I.y,C[P+8]=I.z,C[P+9]=V.x,C[P+10]=V.y,C[P+11]=V.z;P+=12}if(Ga.length)E=Ga[o.a],A=Ga[o.b],
+C=Ga[o.c],M=Ga[o.d],$[N]=E.x,$[N+1]=E.y,$[N+2]=E.z,$[N+3]=E.w,$[N+4]=A.x,$[N+5]=A.y,$[N+6]=A.z,$[N+7]=A.w,$[N+8]=C.x,$[N+9]=C.y,$[N+10]=C.z,$[N+11]=C.w,$[N+12]=M.x,$[N+13]=M.y,$[N+14]=M.z,$[N+15]=M.w,E=Na[o.a],A=Na[o.b],C=Na[o.c],M=Na[o.d],ca[N]=E.x,ca[N+1]=E.y,ca[N+2]=E.z,ca[N+3]=E.w,ca[N+4]=A.x,ca[N+5]=A.y,ca[N+6]=A.z,ca[N+7]=A.w,ca[N+8]=C.x,ca[N+9]=C.y,ca[N+10]=C.z,ca[N+11]=C.w,ca[N+12]=M.x,ca[N+13]=M.y,ca[N+14]=M.z,ca[N+15]=M.w,E=wa[o.a],A=wa[o.b],C=wa[o.c],M=wa[o.d],Y[N]=E.x,Y[N+1]=E.y,Y[N+2]=
+E.z,Y[N+3]=1,Y[N+4]=A.x,Y[N+5]=A.y,Y[N+6]=A.z,Y[N+7]=1,Y[N+8]=C.x,Y[N+9]=C.y,Y[N+10]=C.z,Y[N+11]=1,Y[N+12]=M.x,Y[N+13]=M.y,Y[N+14]=M.z,Y[N+15]=1,E=xa[o.a],A=xa[o.b],C=xa[o.c],o=xa[o.d],fa[N]=E.x,fa[N+1]=E.y,fa[N+2]=E.z,fa[N+3]=1,fa[N+4]=A.x,fa[N+5]=A.y,fa[N+6]=A.z,fa[N+7]=1,fa[N+8]=C.x,fa[N+9]=C.y,fa[N+10]=C.z,fa[N+11]=1,fa[N+12]=o.x,fa[N+13]=o.y,fa[N+14]=o.z,fa[N+15]=1,N+=16;if(ta&&z)v.length==4&&z==THREE.VertexColors?(o=v[0],E=v[1],A=v[2],v=v[3]):v=A=E=o=y,aa[ja]=o.r,aa[ja+1]=o.g,aa[ja+2]=o.b,aa[ja+
+3]=E.r,aa[ja+4]=E.g,aa[ja+5]=E.b,aa[ja+6]=A.r,aa[ja+7]=A.g,aa[ja+8]=A.b,aa[ja+9]=v.r,aa[ja+10]=v.g,aa[ja+11]=v.b,ja+=12;if(za&&ia.hasTangents)v=w[0],y=w[1],o=w[2],w=w[3],W[O]=v.x,W[O+1]=v.y,W[O+2]=v.z,W[O+3]=v.w,W[O+4]=y.x,W[O+5]=y.y,W[O+6]=y.z,W[O+7]=y.w,W[O+8]=o.x,W[O+9]=o.y,W[O+10]=o.z,W[O+11]=o.w,W[O+12]=w.x,W[O+13]=w.y,W[O+14]=w.z,W[O+15]=w.w,O+=16;if(ra&&H)if(u.length==4&&na)for(w=0;w<4;w++)t=u[w],ka[Z]=t.x,ka[Z+1]=t.y,ka[Z+2]=t.z,Z+=3;else for(w=0;w<4;w++)ka[Z]=t.x,ka[Z+1]=t.y,ka[Z+2]=t.z,
+Z+=3;if(va&&G!==void 0&&x)for(w=0;w<4;w++)u=G[w],da[X]=u.u,da[X+1]=u.v,X+=2;if(va&&J!==void 0&&x)for(w=0;w<4;w++)u=J[w],ea[Q]=u.u,ea[Q+1]=u.v,Q+=2;pa&&(qa[R]=L,qa[R+1]=L+1,qa[R+2]=L+3,qa[R+3]=L+1,qa[R+4]=L+2,qa[R+5]=L+3,R+=6,la[T]=L,la[T+1]=L+1,la[T+2]=L,la[T+3]=L+3,la[T+4]=L+1,la[T+5]=L+2,la[T+6]=L+2,la[T+7]=L+3,T+=8,L+=4)}if(Ka){n=0;for(p=Ka.length;n<p;n++)qa[R]=Ka[n].a,qa[R+1]=Ka[n].b,qa[R+2]=Ka[n].c,qa[R+3]=Ka[n].a,qa[R+4]=Ka[n].c,qa[R+5]=Ka[n].d,R+=6}sa&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),
+k.bufferData(k.ARRAY_BUFFER,S,m));if(ha)for(U in ha)A=ha[U],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(ya){E=0;for(A=Fa.length;E<A;E++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[E]),k.bufferData(k.ARRAY_BUFFER,ma[E],m)}ta&&ja>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m));ra&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,ka,m));za&&ia.hasTangents&&
+(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));va&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,da,m));va&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ea,m));pa&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,qa,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,la,m));N>0&&(k.bindBuffer(k.ARRAY_BUFFER,
+g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,Y,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,
+delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;F(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;j=g.length;H=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=
+0;n<z;n++)p=x[n].position,h=n*3,H[h]=p.x,H[h+1]=p.y,H[h+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(G){for(n=0;n<j;n++)color=g[n],h=n*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;x=b.vertices;g=b.colors;z=x.length;j=g.length;
+H=b.__vertexArray;m=b.__colorArray;G=b.__dirtyColors;if(b.__dirtyVertices){for(n=0;n<z;n++)p=x[n].position,h=n*3,H[h]=p.x,H[h+1]=p.y,H[h+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,H,e)}if(G){for(n=0;n<j;n++)color=g[n],h=n*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=B(f),(f.__dirtyVertices||
+f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,F(f)}function D(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,n,o={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,m=e(k),o[m]==void 0&&(o[m]={hash:m,
+counter:0}),n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(o[m].counter+=1,n=o[m].hash+"_"+o[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(h),b.geometryGroups[n].vertices+=j}function G(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
+count:0}})}function I(b){if(b!=fa){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}fa=b}}function R(b,c,e){(e.width&
+e.width-1)==0&&(e.height&e.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(c.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(c.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(c.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(c.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,ea(c.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,ea(c.minFilter)))}function da(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
+k.createTexture(),b.__webglInit=!0;k.bindTexture(k.TEXTURE_2D,b.__webglTexture);b.image.data?k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),k.UNSIGNED_BYTE,b.image.data):k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image);R(k.TEXTURE_2D,b,b.image);k.bindTexture(k.TEXTURE_2D,null);b.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function T(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
 !0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),
 b.width,b.height,0,S(b.format),S(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,
-k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=la,b=U);e!=$&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ka,sa,c,b),$=e)}function D(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):
-b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function da(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
+k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var c,e;b?(c=b.__webglFramebuffer,e=b.width,b=b.height):(c=null,e=K,b=V);c!=aa&&(k.bindFramebuffer(k.FRAMEBUFFER,c),k.viewport(la,sa,e,b),aa=c)}function C(b,c){var e;b=="fragment"?e=k.createShader(k.FRAGMENT_SHADER):
+b=="vertex"&&(e=k.createShader(k.VERTEX_SHADER));k.shaderSource(e,c);k.compileShader(e);if(!k.getShaderParameter(e,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(e)),console.error(c),null;return e}function ea(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
 case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;
-case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var P=this,k,K=[],X=null,$=null,Y=!0,ga=null,ja=null,ea=null,M=null,W=null,aa=null,ma=null,ka=0,sa=0,la=0,U=0,fa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ia=new THREE.Matrix4,qa=new Float32Array(16),va=new Float32Array(16),za=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ya=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Oa=b.stencil!==void 0?b.stencil:!0,V=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ta=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):
-new THREE.Color(0),ua=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ya;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ha,ra=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
-vertexShader:b.vertexShader,uniforms:wa}),pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Ba._shadowPass=!0;pa._shadowPass=!0;try{if(!(k=ya.getContext("experimental-webgl",{antialias:ta,stencil:Oa,preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(xa){console.error(xa)}k.clearColor(0,
-0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(na.r,na.g,na.b,ua);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Oa){var Z={};Z.vertices=new Float32Array(12);Z.faces=new Uint16Array(6);Z.darkness=0.5;Z.vertices[0]=-20;Z.vertices[1]=-20;Z.vertices[2]=-1;Z.vertices[3]=20;Z.vertices[4]=-20;
-Z.vertices[5]=-1;Z.vertices[6]=20;Z.vertices[7]=20;Z.vertices[8]=-1;Z.vertices[9]=-20;Z.vertices[10]=20;Z.vertices[11]=-1;Z.faces[0]=0;Z.faces[1]=1;Z.faces[2]=2;Z.faces[3]=0;Z.faces[4]=2;Z.faces[5]=3;Z.vertexBuffer=k.createBuffer();Z.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Z.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,Z.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Z.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Z.faces,k.STATIC_DRAW);Z.program=k.createProgram();
-k.attachShader(Z.program,D("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Z.program,D("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Z.program);Z.vertexLocation=k.getAttribLocation(Z.program,"position");Z.projectionLocation=k.getUniformLocation(Z.program,"projectionMatrix");Z.darknessLocation=k.getUniformLocation(Z.program,"darkness")}var Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);V=0;Q.vertices[V++]=-1;Q.vertices[V++]=-1;Q.vertices[V++]=
-0;Q.vertices[V++]=0;Q.vertices[V++]=1;Q.vertices[V++]=-1;Q.vertices[V++]=1;Q.vertices[V++]=0;Q.vertices[V++]=1;Q.vertices[V++]=1;Q.vertices[V++]=1;Q.vertices[V++]=1;Q.vertices[V++]=-1;Q.vertices[V++]=1;Q.vertices[V++]=0;Q.vertices[V++]=1;V=0;Q.faces[V++]=0;Q.faces[V++]=1;Q.faces[V++]=2;Q.faces[V++]=0;Q.faces[V++]=2;Q.faces[V++]=3;Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();Q.tempTexture=k.createTexture();Q.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);
+case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var P=this,k,M=[],Y=null,aa=null,Z=!0,ha=null,ka=null,fa=null,U=null,X=null,ca=null,ma=null,la=0,sa=0,K=0,V=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,qa=new Float32Array(16),va=new Float32Array(16),za=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ya=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Oa=b.stencil!==void 0?b.stencil:!0,W=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ta=b.antialias!==void 0?b.antialias:!1,na=b.clearColor!==void 0?new THREE.Color(b.clearColor):
+new THREE.Color(0),ua=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ya;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var ia,ra=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
+vertexShader:b.vertexShader,uniforms:wa}),pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Ba._shadowPass=!0;pa._shadowPass=!0;try{if(!(k=ya.getContext("experimental-webgl",{antialias:ta,stencil:Oa,preserveDrawingBuffer:W})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(xa){console.error(xa)}k.clearColor(0,
+0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(na.r,na.g,na.b,ua);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Oa){var $={};$.vertices=new Float32Array(12);$.faces=new Uint16Array(6);$.darkness=0.5;$.vertices[0]=-20;$.vertices[1]=-20;$.vertices[2]=-1;$.vertices[3]=20;$.vertices[4]=-20;
+$.vertices[5]=-1;$.vertices[6]=20;$.vertices[7]=20;$.vertices[8]=-1;$.vertices[9]=-20;$.vertices[10]=20;$.vertices[11]=-1;$.faces[0]=0;$.faces[1]=1;$.faces[2]=2;$.faces[3]=0;$.faces[4]=2;$.faces[5]=3;$.vertexBuffer=k.createBuffer();$.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,$.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,$.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,$.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,$.faces,k.STATIC_DRAW);$.program=k.createProgram();
+k.attachShader($.program,C("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader($.program,C("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram($.program);$.vertexLocation=k.getAttribLocation($.program,"position");$.projectionLocation=k.getUniformLocation($.program,"projectionMatrix");$.darknessLocation=k.getUniformLocation($.program,"darkness")}var Q={};Q.vertices=new Float32Array(16);Q.faces=new Uint16Array(6);W=0;Q.vertices[W++]=-1;Q.vertices[W++]=-1;Q.vertices[W++]=
+0;Q.vertices[W++]=0;Q.vertices[W++]=1;Q.vertices[W++]=-1;Q.vertices[W++]=1;Q.vertices[W++]=0;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=1;Q.vertices[W++]=-1;Q.vertices[W++]=1;Q.vertices[W++]=0;Q.vertices[W++]=1;W=0;Q.faces[W++]=0;Q.faces[W++]=1;Q.faces[W++]=2;Q.faces[W++]=0;Q.faces[W++]=2;Q.faces[W++]=3;Q.vertexBuffer=k.createBuffer();Q.elementBuffer=k.createBuffer();Q.tempTexture=k.createTexture();Q.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,Q.vertexBuffer);
 k.bufferData(k.ARRAY_BUFFER,Q.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Q.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,Q.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,
 k.NEAREST);k.bindTexture(k.TEXTURE_2D,Q.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(Q.hasVertexTexture=!1,Q.program=k.createProgram(),k.attachShader(Q.program,
-D("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(Q.program,D("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=k.createProgram(),k.attachShader(Q.program,D("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(Q.program,D("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.vertex=k.getAttribLocation(Q.program,"position");Q.attributes.uv=
-k.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=k.getUniformLocation(Q.program,"renderType");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=k.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=k.getUniformLocation(Q.program,"scale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");var Ea=!1,N={};N.vertices=
-new Float32Array(16);N.faces=new Uint16Array(6);V=0;N.vertices[V++]=-1;N.vertices[V++]=-1;N.vertices[V++]=0;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=-1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=1;N.vertices[V++]=0;N.vertices[V++]=-1;N.vertices[V++]=1;N.vertices[V++]=0;V=N.vertices[V++]=0;N.faces[V++]=0;N.faces[V++]=1;N.faces[V++]=2;N.faces[V++]=0;N.faces[V++]=2;N.faces[V++]=3;N.vertexBuffer=k.createBuffer();N.elementBuffer=k.createBuffer();
-k.bindBuffer(k.ARRAY_BUFFER,N.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,N.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,N.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,N.faces,k.STATIC_DRAW);N.program=k.createProgram();k.attachShader(N.program,D("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(N.program,D("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=k.getAttribLocation(N.program,"position");
-N.attributes.uv=k.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=k.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=k.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=k.getUniformLocation(N.program,"rotation");N.uniforms.scale=k.getUniformLocation(N.program,"scale");N.uniforms.alignment=k.getUniformLocation(N.program,"alignment");N.uniforms.map=k.getUniformLocation(N.program,"map");N.uniforms.opacity=k.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=
-k.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=k.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=k.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=k.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=k.getUniformLocation(N.program,"projectionMatrix");var Wa=!1;this.setSize=function(b,e){ya.width=b;ya.height=e;this.setViewport(0,0,ya.width,ya.height)};this.setViewport=function(b,e,
-c,f){ka=b;sa=e;la=c;U=f;k.viewport(ka,sa,la,U)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){Y=b;k.depthMask(b)};this.setClearColorHex=function(b,e){na.setHex(b);ua=e;k.clearColor(na.r,na.g,na.b,ua)};this.setClearColor=function(b,e){na.copy(b);ua=e;k.clearColor(na.r,na.g,na.b,ua)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};
-this.setStencilShadowDarkness=function(b){Z.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var g,j,h;b instanceof THREE.MeshDepthMaterial?h="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?h="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?h="normal":b instanceof THREE.MeshBasicMaterial?h="basic":b instanceof THREE.MeshLambertMaterial?h="lambert":b instanceof THREE.MeshPhongMaterial?h="phong":b instanceof THREE.LineBasicMaterial?h="basic":b instanceof
-THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var m=THREE.ShaderLib[h];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,p;n=p=m=0;for(o=e.length;n<o;n++)j=e[n],j instanceof THREE.SpotLight&&p++,j instanceof THREE.DirectionalLight&&p++,j instanceof THREE.PointLight&&m++;m+p<=4?n=p:(n=Math.ceil(4*p/(m+p)),m=4-n);j={directional:n,point:m};m=p=0;for(n=e.length;m<n;m++)o=e[m],o instanceof THREE.SpotLight&&o.castShadow&&p++;
-var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var t;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
-shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},v,f=[];h?f.push(h):(f.push(n),f.push(o));for(v in c)f.push(v),f.push(c[v]);h=f.join();v=0;for(f=K.length;v<f;v++)if(K[v].code==h){t=K[v].program;break a}v=k.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?
-"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,D("fragment",j+n));k.attachShader(v,D("vertex",f+o));k.linkProgram(v);k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms=
-{};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)f.push(w);w=f;f=0;for(m=w.length;f<m;f++)n=w[f],v.uniforms[n]=k.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)f.push("morphTarget"+w);for(t in e)f.push(t);t=f;w=0;for(e=t.length;w<e;w++)c=
-t[w],v.attributes[c]=k.getAttribLocation(v,c);K.push({program:v,code:h});t=v}b.program=t;t=b.program.attributes;t.position>=0&&k.enableVertexAttribArray(t.position);t.color>=0&&k.enableVertexAttribArray(t.color);t.normal>=0&&k.enableVertexAttribArray(t.normal);t.tangent>=0&&k.enableVertexAttribArray(t.tangent);b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(k.enableVertexAttribArray(t.skinVertexA),k.enableVertexAttribArray(t.skinVertexB),k.enableVertexAttribArray(t.skinIndex),
-k.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(g in b.attributes)t[g]!==void 0&&t[g]>=0&&k.enableVertexAttribArray(t[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,t[w]>=0&&(k.enableVertexAttribArray(t[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,o,B){var C,D,G,F,J,la,U,M,K=b.lights,fa=b.fog;this.shadowMapEnabled&&y(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
-!1,c);c.matrixWorldInverse.flattenToArray(va);c.projectionMatrix.flattenToArray(qa);ia.multiply(c.projectionMatrix,c.matrixWorldInverse);n(ia);this.initWebGLObjects(b);T(o);(this.autoClear||B)&&this.clear();J=b.__webglObjects.length;for(B=0;B<J;B++)if(C=b.__webglObjects[B],U=C.object,U.visible)if(!(U instanceof THREE.Mesh)||p(U)){if(U.matrixWorld.flattenToArray(U._objectMatrixArray),H(U,c,!0),v(C),C.render=!0,this.sortObjects)C.object.renderDepth?C.z=C.object.renderDepth:(za.copy(U.position),ia.multiplyVector3(za),
-C.z=za.z)}else C.render=!1;else C.render=!1;this.sortObjects&&b.__webglObjects.sort(u);la=b.__webglObjectsImmediate.length;for(B=0;B<la;B++)C=b.__webglObjectsImmediate[B],U=C.object,U.visible&&(U.matrixAutoUpdate&&U.matrixWorld.flattenToArray(U._objectMatrixArray),H(U,c,!0),t(C));if(b.overrideMaterial){g(b.overrideMaterial.depthTest);I(b.overrideMaterial.blending);for(B=0;B<J;B++)if(C=b.__webglObjects[B],C.render)U=C.object,M=C.buffer,j(U),f(c,K,fa,b.overrideMaterial,M,U);for(B=0;B<la;B++)C=b.__webglObjectsImmediate[B],
-U=C.object,U.visible&&(j(U),D=e(c,K,fa,b.overrideMaterial,U),U.render(function(c){h(c,D,b.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(B=J-1;B>=0;B--)if(C=b.__webglObjects[B],C.render){U=C.object;M=C.buffer;G=C.opaque;j(U);for(C=0;C<G.count;C++)F=G.list[C],g(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,K,fa,F,M,U)}for(B=0;B<la;B++)if(C=b.__webglObjectsImmediate[B],U=C.object,U.visible){G=C.opaque;j(U);for(C=0;C<G.count;C++)F=G.list[C],g(F.depthTest),
-m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=e(c,K,fa,F,U),U.render(function(b){h(b,D,F.shading)})}for(B=0;B<J;B++)if(C=b.__webglObjects[B],C.render){U=C.object;M=C.buffer;G=C.transparent;j(U);for(C=0;C<G.count;C++)F=G.list[C],I(F.blending),g(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,K,fa,F,M,U)}for(B=0;B<la;B++)if(C=b.__webglObjectsImmediate[B],U=C.object,U.visible){G=C.transparent;j(U);for(C=0;C<G.count;C++)F=G.list[C],I(F.blending),g(F.depthTest),
-m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),D=e(c,K,fa,F,U),U.render(function(b){h(b,D,F.shading)})}}b.__webglSprites.length&&x(b,c);Oa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&w(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],
-b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var c=b.__objectsAdded[0],e=b,f=void 0,g=void 0,j=void 0;if(c._modelViewMatrix==void 0)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)for(f in g=c.geometry,g.geometryGroups==void 0&&
-O(g),g.geometryGroups){j=g.geometryGroups[f];if(!j.__webglVertexBuffer){var h=j;h.__webglVertexBuffer=k.createBuffer();h.__webglNormalBuffer=k.createBuffer();h.__webglTangentBuffer=k.createBuffer();h.__webglColorBuffer=k.createBuffer();h.__webglUVBuffer=k.createBuffer();h.__webglUV2Buffer=k.createBuffer();h.__webglSkinVertexABuffer=k.createBuffer();h.__webglSkinVertexBBuffer=k.createBuffer();h.__webglSkinIndicesBuffer=k.createBuffer();h.__webglSkinWeightsBuffer=k.createBuffer();h.__webglFaceBuffer=
-k.createBuffer();h.__webglLineBuffer=k.createBuffer();if(h.numMorphTargets){var m=void 0,n=void 0;h.__webglMorphTargetsBuffers=[];m=0;for(n=h.numMorphTargets;m<n;m++)h.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var h=j,m=c,o=void 0,t=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,y=w=n=0,x=p=t=void 0,z=x=t=o=void 0,p=void 0,u=m.geometry,v=u.faces,x=h.faces,o=0,t=x.length;o<t;o++)p=x[o],p=v[p],p instanceof THREE.Face3?(n+=3,w+=1,y+=3):p instanceof THREE.Face4&&(n+=4,w+=2,y+=4);for(var o=h,
-t=m,B=x=v=void 0,H=void 0,B=void 0,p=[],v=0,x=t.materials.length;v<x;v++)if(B=t.materials[v],B instanceof THREE.MeshFaceMaterial){B=0;for(l=o.materials.length;B<l;B++)(H=o.materials[B])&&p.push(H)}else(H=B)&&p.push(H);o=p;h.__materials=o;a:{v=t=void 0;x=o.length;for(t=0;t<x;t++)if(v=o[t],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{x=v=void 0;p=o.length;for(v=0;v<p;v++)if(x=o[v],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=
-x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{p=v=void 0;B=o.length;for(v=0;v<B;v++)if(p=o[v],p.vertexColors){p=p.vertexColors;break a}p=!1}h.__vertexArray=new Float32Array(n*3);if(x)h.__normalArray=new Float32Array(n*3);if(u.hasTangents)h.__tangentArray=new Float32Array(n*4);if(p)h.__colorArray=new Float32Array(n*3);if(t){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)h.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
-1)h.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)h.__skinVertexAArray=new Float32Array(n*4),h.__skinVertexBArray=new Float32Array(n*4),h.__skinIndexArray=new Float32Array(n*4),h.__skinWeightArray=new Float32Array(n*4);h.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));h.__lineArray=new Uint16Array(y*2);if(h.numMorphTargets){h.__morphTargetsArrays=[];u=0;for(v=h.numMorphTargets;u<v;u++)h.__morphTargetsArrays.push(new Float32Array(n*
-3))}h.__needsSmoothNormals=x==THREE.SmoothShading;h.__uvType=t;h.__vertexColorType=p;h.__normalType=x;h.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);h.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(t=o[u],t.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in t.attributes){p=t.attributes[a];x={};for(z in p)x[z]=p[z];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,w=1,x.type==="v2"?w=2:x.type==="v3"?w=3:x.type===
-"v4"?w=4:x.type==="c"&&(w=3),x.size=w,x.array=new Float32Array(n*w),x.buffer=k.createBuffer(),x.buffer.belongsToAttribute=a,p.needsUpdate=!0,x.__original=p;h.__webglCustomAttributes[a]=x}}h.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}c instanceof THREE.ShadowVolume?F(e.__webglShadowVolumes,j,c):F(e.__webglObjects,j,c)}else if(c instanceof THREE.LensFlare)F(e.__webglLensFlares,void 0,
-c);else if(c instanceof THREE.Ribbon){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglVertexCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,c)}else if(c instanceof THREE.Line){g=c.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,
-j=f.vertices.length,f.__vertexArray=new Float32Array(j*3),f.__colorArray=new Float32Array(j*3),f.__webglLineCount=j,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,c)}else if(c instanceof THREE.ParticleSystem){g=c.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;j=c;h=f.vertices.length;f.__vertexArray=new Float32Array(h*3);f.__colorArray=new Float32Array(h*3);f.__sortArray=[];f.__webglParticleCount=h;f.__materials=
-j.materials;z=n=m=void 0;m=0;for(n=j.materials.length;m<n;m++)if(z=j.materials[m],z.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
-4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(h*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}F(e.__webglObjects,g,c)}else THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
-c instanceof THREE.Sprite&&e.__webglSprites.push(c);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];c=b;if(e instanceof THREE.ShadowVolume)G(c.__webglShadowVolumes,e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(c.__webglObjects,e);else if(e instanceof THREE.Sprite){c=c.__webglSprites;g=void 0;for(g=c.length-1;g>=0;g--)c[g]==e&&c.splice(g,1)}else e instanceof THREE.LensFlare?G(c.__webglLensFlares,
-e):e instanceof THREE.MarchingCubes&&G(c.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}c=0;for(e=b.__webglObjects.length;c<e;c++)C(b.__webglObjects[c].object,b);c=0;for(e=b.__webglShadowVolumes.length;c<e;c++)C(b.__webglShadowVolumes[c].object,b);c=0;for(e=b.__webglLensFlares.length;c<e;c++)C(b.__webglLensFlares[c].object,b)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),
+C("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(Q.program,C("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(Q.hasVertexTexture=!0,Q.program=k.createProgram(),k.attachShader(Q.program,C("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(Q.program,C("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(Q.program);Q.attributes={};Q.uniforms={};Q.attributes.vertex=k.getAttribLocation(Q.program,"position");Q.attributes.uv=
+k.getAttribLocation(Q.program,"UV");Q.uniforms.renderType=k.getUniformLocation(Q.program,"renderType");Q.uniforms.map=k.getUniformLocation(Q.program,"map");Q.uniforms.occlusionMap=k.getUniformLocation(Q.program,"occlusionMap");Q.uniforms.opacity=k.getUniformLocation(Q.program,"opacity");Q.uniforms.scale=k.getUniformLocation(Q.program,"scale");Q.uniforms.rotation=k.getUniformLocation(Q.program,"rotation");Q.uniforms.screenPosition=k.getUniformLocation(Q.program,"screenPosition");var Ea=!1,O={};O.vertices=
+new Float32Array(16);O.faces=new Uint16Array(6);W=0;O.vertices[W++]=-1;O.vertices[W++]=-1;O.vertices[W++]=0;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=-1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=1;O.vertices[W++]=0;O.vertices[W++]=-1;O.vertices[W++]=1;O.vertices[W++]=0;W=O.vertices[W++]=0;O.faces[W++]=0;O.faces[W++]=1;O.faces[W++]=2;O.faces[W++]=0;O.faces[W++]=2;O.faces[W++]=3;O.vertexBuffer=k.createBuffer();O.elementBuffer=k.createBuffer();
+k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,O.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,O.faces,k.STATIC_DRAW);O.program=k.createProgram();k.attachShader(O.program,C("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(O.program,C("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.position=k.getAttribLocation(O.program,"position");
+O.attributes.uv=k.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=k.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=k.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=k.getUniformLocation(O.program,"rotation");O.uniforms.scale=k.getUniformLocation(O.program,"scale");O.uniforms.alignment=k.getUniformLocation(O.program,"alignment");O.uniforms.map=k.getUniformLocation(O.program,"map");O.uniforms.opacity=k.getUniformLocation(O.program,"opacity");O.uniforms.useScreenCoordinates=
+k.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=k.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=k.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=k.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=k.getUniformLocation(O.program,"projectionMatrix");var Wa=!1;this.setSize=function(b,c){ya.width=b;ya.height=c;this.setViewport(0,0,ya.width,ya.height)};this.setViewport=function(b,c,
+e,f){la=b;sa=c;K=e;V=f;k.viewport(la,sa,K,V)};this.setScissor=function(b,c,e,f){k.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){Z=b;k.depthMask(b)};this.setClearColorHex=function(b,c){na.setHex(b);ua=c;k.clearColor(na.r,na.g,na.b,ua)};this.setClearColor=function(b,c){na.copy(b);ua=c;k.clearColor(na.r,na.g,na.b,ua)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};
+this.setStencilShadowDarkness=function(b){$.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,c,e,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof
+THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,o,p;n=p=m=0;for(o=c.length;n<o;n++)g=c[n],g instanceof THREE.SpotLight&&p++,g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&m++;m+p<=4?n=p:(n=Math.ceil(4*p/(m+p)),m=4-n);g={directional:n,point:m};m=p=0;for(n=c.length;m<n;m++)o=c[m],o instanceof THREE.SpotLight&&o.castShadow&&p++;
+var u=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)u=f.bones.length;var t;a:{n=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:u,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
+shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(n),f.push(o));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=M.length;v<f;v++)if(M[v].code==j){t=M[v].program;break a}v=k.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?
+"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
+"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,C("fragment",g+n));k.attachShader(v,C("vertex",f+o));k.linkProgram(v);k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms=
+{};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)f.push(w);w=f;f=0;for(m=w.length;f<m;f++)n=w[f],v.uniforms[n]=k.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<e.maxMorphTargets;w++)f.push("morphTarget"+w);for(t in c)f.push(t);t=f;w=0;for(c=t.length;w<c;w++)e=
+t[w],v.attributes[e]=k.getAttribLocation(v,e);M.push({program:v,code:j});t=v}b.program=t;t=b.program.attributes;t.position>=0&&k.enableVertexAttribArray(t.position);t.color>=0&&k.enableVertexAttribArray(t.color);t.normal>=0&&k.enableVertexAttribArray(t.normal);t.tangent>=0&&k.enableVertexAttribArray(t.tangent);b.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0&&(k.enableVertexAttribArray(t.skinVertexA),k.enableVertexAttribArray(t.skinVertexB),k.enableVertexAttribArray(t.skinIndex),
+k.enableVertexAttribArray(t.skinWeight));if(b.attributes)for(h in b.attributes)t[h]!==void 0&&t[h]>=0&&k.enableVertexAttribArray(t[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)w="morphTarget"+h,t[w]>=0&&(k.enableVertexAttribArray(t[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,o,B){var K,C,F,D,G,J,V,L,M=b.lights,ga=b.fog;this.shadowMapEnabled&&w(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
+!1,c);c.matrixWorldInverse.flattenToArray(va);c.projectionMatrix.flattenToArray(qa);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);p(ja);this.initWebGLObjects(b);T(o);(this.autoClear||B)&&this.clear();G=b.__webglObjects.length;for(B=0;B<G;B++)if(K=b.__webglObjects[B],V=K.object,V.visible)if(!(V instanceof THREE.Mesh)||n(V)){if(V.matrixWorld.flattenToArray(V._objectMatrixArray),H(V,c,!0),v(K),K.render=!0,this.sortObjects)K.object.renderDepth?K.z=K.object.renderDepth:(za.copy(V.position),ja.multiplyVector3(za),
+K.z=za.z)}else K.render=!1;else K.render=!1;this.sortObjects&&b.__webglObjects.sort(u);J=b.__webglObjectsImmediate.length;for(B=0;B<J;B++)K=b.__webglObjectsImmediate[B],V=K.object,V.visible&&(V.matrixAutoUpdate&&V.matrixWorld.flattenToArray(V._objectMatrixArray),H(V,c,!0),t(K));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);I(b.overrideMaterial.blending);for(B=0;B<G;B++)if(K=b.__webglObjects[B],K.render)V=K.object,L=K.buffer,j(V),f(c,M,ga,b.overrideMaterial,L,V);for(B=0;B<J;B++)K=b.__webglObjectsImmediate[B],
+V=K.object,V.visible&&(j(V),C=e(c,M,ga,b.overrideMaterial,V),V.render(function(e){g(e,C,b.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(B=G-1;B>=0;B--)if(K=b.__webglObjects[B],K.render){V=K.object;L=K.buffer;F=K.opaque;j(V);for(K=0;K<F.count;K++)D=F.list[K],h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,M,ga,D,L,V)}for(B=0;B<J;B++)if(K=b.__webglObjectsImmediate[B],V=K.object,V.visible){F=K.opaque;j(V);for(K=0;K<F.count;K++)D=F.list[K],h(D.depthTest),
+m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),C=e(c,M,ga,D,V),V.render(function(b){g(b,C,D.shading)})}for(B=0;B<G;B++)if(K=b.__webglObjects[B],K.render){V=K.object;L=K.buffer;F=K.transparent;j(V);for(K=0;K<F.count;K++)D=F.list[K],I(D.blending),h(D.depthTest),m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,M,ga,D,L,V)}for(B=0;B<J;B++)if(K=b.__webglObjectsImmediate[B],V=K.object,V.visible){F=K.transparent;j(V);for(K=0;K<F.count;K++)D=F.list[K],I(D.blending),h(D.depthTest),
+m(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),C=e(c,M,ga,D,V),V.render(function(b){g(b,C,D.shading)})}}b.__webglSprites.length&&y(b,c);Oa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&x(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],
+b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],c=b,f=void 0,h=void 0,g=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups==void 0&&
+L(h),h.geometryGroups){g=h.geometryGroups[f];if(!g.__webglVertexBuffer){var j=g;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=
+k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,n=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(n=j.numMorphTargets;m<n;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=g,m=e,o=void 0,t=void 0,p=void 0,u=p=void 0,v=void 0,w=void 0,y=w=n=0,x=p=t=void 0,z=x=t=o=void 0,p=void 0,u=m.geometry,v=u.faces,x=j.faces,o=0,t=x.length;o<t;o++)p=x[o],p=v[p],p instanceof THREE.Face3?(n+=3,w+=1,y+=3):p instanceof THREE.Face4&&(n+=4,w+=2,y+=4);for(var o=j,
+t=m,K=x=v=void 0,B=void 0,K=void 0,p=[],v=0,x=t.materials.length;v<x;v++)if(K=t.materials[v],K instanceof THREE.MeshFaceMaterial){K=0;for(l=o.materials.length;K<l;K++)(B=o.materials[K])&&p.push(B)}else(B=K)&&p.push(B);o=p;j.__materials=o;a:{v=t=void 0;x=o.length;for(t=0;t<x;t++)if(v=o[t],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{x=v=void 0;p=o.length;for(v=0;v<p;v++)if(x=o[v],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=
+x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{p=v=void 0;K=o.length;for(v=0;v<K;v++)if(p=o[v],p.vertexColors){p=p.vertexColors;break a}p=!1}j.__vertexArray=new Float32Array(n*3);if(x)j.__normalArray=new Float32Array(n*3);if(u.hasTangents)j.__tangentArray=new Float32Array(n*4);if(p)j.__colorArray=new Float32Array(n*3);if(t){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
+1)j.__uv2Array=new Float32Array(n*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(y*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(v=j.numMorphTargets;u<v;u++)j.__morphTargetsArrays.push(new Float32Array(n*
+3))}j.__needsSmoothNormals=x==THREE.SmoothShading;j.__uvType=t;j.__vertexColorType=p;j.__normalType=x;j.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=y*2;u=0;for(v=o.length;u<v;u++)if(t=o[u],t.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in t.attributes){p=t.attributes[a];x={};for(z in p)x[z]=p[z];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,w=1,x.type==="v2"?w=2:x.type==="v3"?w=3:x.type===
+"v4"?w=4:x.type==="c"&&(w=3),x.size=w,x.array=new Float32Array(n*w),x.buffer=k.createBuffer(),x.buffer.belongsToAttribute=a,p.needsUpdate=!0,x.__original=p;j.__webglCustomAttributes[a]=x}}j.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}e instanceof THREE.ShadowVolume?G(c.__webglShadowVolumes,g,e):G(c.__webglObjects,g,e)}else if(e instanceof THREE.LensFlare)G(c.__webglLensFlares,void 0,
+e);else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=h,g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglVertexCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(c.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=h,
+g=f.vertices.length,f.__vertexArray=new Float32Array(g*3),f.__colorArray=new Float32Array(g*3),f.__webglLineCount=g,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(c.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){f=h;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=h;g=e;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=
+g.materials;z=n=m=void 0;m=0;for(n=g.materials.length;m<n;m++)if(z=g.materials[m],z.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
+4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}G(c.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):
+e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof THREE.ShadowVolume)D(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)D(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==c&&e.splice(h,1)}else c instanceof THREE.LensFlare?D(e.__webglLensFlares,
+c):c instanceof THREE.MarchingCubes&&D(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)J(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)J(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)J(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),
 k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
-THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,j=Math.max(Math.max(e,f),h),g=Math.min(Math.min(e,f),h);if(g==j)g=e=0;else{var m=j-g,g=m/j,e=e==j?(f-h)/m:f==j?2+(h-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=g;c.v=j;return c},
+THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,j=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==j)h=e=0;else{var m=j-h,h=m/j,e=e==j?(f-g)/m:f==j?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=j;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,j=b.vertices,g=h.vertices,m=b.faces,n=h.faces,p=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=g.length;o<t;o++){var v=new THREE.Vertex(g[o].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}o=0;for(t=n.length;o<t;o++){var g=n[o],u,y,z=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?u=new THREE.Face3(g.a+f,g.b+f,g.c+
-f):g instanceof THREE.Face4&&(u=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));u.normal.copy(g.normal);e=0;for(j=z.length;e<j;e++)y=z[e],u.vertexNormals.push(y.clone());u.color.copy(g.color);e=0;for(j=v.length;e<j;e++)y=v[e],u.vertexColors.push(y.clone());u.materials=g.materials.slice();u.centroid.copy(g.centroid);m.push(u)}o=0;for(t=h.length;o<t;o++){f=h[o];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,
-j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var g=new THREE.Vertex(f[b].position.clone());c.vertices.push(g)}b=0;for(e=h.length;b<e;b++){var m=h[b],n,p,o=m.vertexNormals,t=m.vertexColors;m instanceof THREE.Face3?n=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(n=new THREE.Face4(m.a,m.b,m.c,m.d));n.normal.copy(m.normal);f=0;for(g=o.length;f<g;f++)p=o[f],n.vertexNormals.push(p.clone());n.color.copy(m.color);f=0;for(g=t.length;f<g;f++)p=t[f],n.vertexColors.push(p.clone());n.materials=m.materials.slice();
-n.centroid.copy(m.centroid);c.faces.push(n)}b=0;for(e=j.length;b<e;b++){h=j[b];n=[];f=0;for(g=h.length;f<g;f++)n.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(b,c,e){var f,h,j,g=new THREE.Vector3,m=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();f+h>1&&(f=1-f,h=1-h);j=1-f-h;g.copy(b);g.multiplyScalar(f);m.copy(c);m.multiplyScalar(h);g.addSelf(m);m.copy(e);m.multiplyScalar(j);g.addSelf(m);return g},randomPointInFace:function(b,
-c,e){var f,h,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,g;e?b._area1&&b._area2?(e=b._area1,g=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),g=THREE.GeometryUtils.triangleArea(h,j,c),b._area1=e,b._area2=g):(e=THREE.GeometryUtils.triangleArea(f,
-h,c),g=THREE.GeometryUtils.triangleArea(h,j,c));return THREE.GeometryUtils.random()*(e+g)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function c(e,f){if(f<e)return e;var g=e+Math.floor((f-e)/2);return p[g]>b?c(e,g-1):p[g]<b?c(g+1,f):g}return c(0,p.length-1)}var f,h,j=b.faces,g=b.vertices,m=j.length,n=0,p=[],o,t,v,u;for(h=0;h<m;h++){f=j[h];if(f instanceof THREE.Face3)o=g[f.a].position,t=g[f.b].position,
-v=g[f.c].position,f._area=THREE.GeometryUtils.triangleArea(o,t,v);else if(f instanceof THREE.Face4)o=g[f.a].position,t=g[f.b].position,v=g[f.c].position,u=g[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(o,t,u),f._area2=THREE.GeometryUtils.triangleArea(t,v,u),f._area=f._area1+f._area2;n+=f._area;p[h]=n}f=[];g={};for(h=0;h<c;h++)m=THREE.GeometryUtils.random()*n,m=e(m),f[h]=THREE.GeometryUtils.randomPointInFace(j[m],b,!0),g[m]?g[m]+=1:g[m]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;
-h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
-THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],j=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)j.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return j}};
-THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,j=b.vertices,h=g.vertices,m=b.faces,p=g.faces,n=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,t=h.length;o<t;o++){var v=new THREE.Vertex(h[o].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}o=0;for(t=p.length;o<t;o++){var h=p[o],u,w,z=h.vertexNormals,v=h.vertexColors;h instanceof THREE.Face3?u=new THREE.Face3(h.a+f,h.b+f,h.c+
+f):h instanceof THREE.Face4&&(u=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));u.normal.copy(h.normal);e=0;for(j=z.length;e<j;e++)w=z[e],u.vertexNormals.push(w.clone());u.color.copy(h.color);e=0;for(j=v.length;e<j;e++)w=v[e],u.vertexColors.push(w.clone());u.materials=h.materials.slice();u.centroid.copy(h.centroid);m.push(u)}o=0;for(t=g.length;o<t;o++){f=g[o];m=[];e=0;for(j=f.length;e<j;e++)m.push(new THREE.UV(f[e].u,f[e].v));n.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,g=b.faces,
+j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var h=new THREE.Vertex(f[b].position.clone());c.vertices.push(h)}b=0;for(e=g.length;b<e;b++){var m=g[b],p,n,o=m.vertexNormals,t=m.vertexColors;m instanceof THREE.Face3?p=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(p=new THREE.Face4(m.a,m.b,m.c,m.d));p.normal.copy(m.normal);f=0;for(h=o.length;f<h;f++)n=o[f],p.vertexNormals.push(n.clone());p.color.copy(m.color);f=0;for(h=t.length;f<h;f++)n=t[f],p.vertexColors.push(n.clone());p.materials=m.materials.slice();
+p.centroid.copy(m.centroid);c.faces.push(p)}b=0;for(e=j.length;b<e;b++){g=j[b];p=[];f=0;for(h=g.length;f<h;f++)p.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,g,j,h=new THREE.Vector3,m=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();f+g>1&&(f=1-f,g=1-g);j=1-f-g;h.copy(b);h.multiplyScalar(f);m.copy(c);m.multiplyScalar(g);h.addSelf(m);m.copy(e);m.multiplyScalar(j);h.addSelf(m);return h},randomPointInFace:function(b,
+c,e){var f,g,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,g=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,g,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;g=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,h;e?b._area1&&b._area2?(e=b._area1,h=b._area2):(e=THREE.GeometryUtils.triangleArea(f,g,c),h=THREE.GeometryUtils.triangleArea(g,j,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f,
+g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)<e?THREE.GeometryUtils.randomPointInTriangle(f,g,c):THREE.GeometryUtils.randomPointInTriangle(g,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var h=c+Math.floor((f-c)/2);return n[h]>b?e(c,h-1):n[h]<b?e(h+1,f):h}return e(0,n.length-1)}var f,g,j=b.faces,h=b.vertices,m=j.length,p=0,n=[],o,t,v,u;for(g=0;g<m;g++){f=j[g];if(f instanceof THREE.Face3)o=h[f.a].position,t=h[f.b].position,
+v=h[f.c].position,f._area=THREE.GeometryUtils.triangleArea(o,t,v);else if(f instanceof THREE.Face4)o=h[f.a].position,t=h[f.b].position,v=h[f.c].position,u=h[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(o,t,u),f._area2=THREE.GeometryUtils.triangleArea(t,v,u),f._area=f._area1+f._area2;p+=f._area;n[g]=p}f=[];h={};for(g=0;g<c;g++)m=THREE.GeometryUtils.random()*p,m=e(m),f[g]=THREE.GeometryUtils.randomPointInFace(j[m],b,!0),h[m]?h[m]+=1:h[m]=1;return f},triangleArea:function(b,c,e){var f,g=THREE.GeometryUtils.__v1;
+g.sub(b,c);f=g.length();g.sub(b,e);b=g.length();g.sub(c,e);e=g.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
+THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)j.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return j}};
+THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
 value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
@@ -378,23 +378,23 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,h,j=2*Math.ceil(b*3)+1;j>25&&(j=25);h=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-h)*(c-h))/(2*b*b)),f+=e[c];for(c=0;c<j;++c)e[c]/=f;return e}};
-THREE.AnimationHandler=function(){var b=[],c={},e={update:function(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
-0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var p=b.hierarchy[e].keys[f].morphTargets[n];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
-{};for(p in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===p){o[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(o[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
-b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var c=[];if(b instanceof THREE.SkinnedMesh)for(var e=0;e<b.bones.length;e++)c.push(b.bones[e]);else f(b,c);return c}},f=function(b,c){c.push(b);for(var e=0;e<b.children.length;e++)f(b.children[e],c)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,j=2*Math.ceil(b*3)+1;j>25&&(j=25);g=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<j;++c)e[c]/=f;return e}};
+THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++){var n=b.hierarchy[e].keys[f].morphTargets[p];m[n]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
+{};for(n in m){for(p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++)if(b.hierarchy[e].keys[f].morphTargets[p]===n){o[n]=b.hierarchy[e].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[e].keys[f].morphTargets.length&&(o[n]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
+b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
 2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,h;for(e=0;e<f;e++){h=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)h.useQuaternion=!0;h.matrixAutoUpdate=!0;if(h.animationCache===void 0)h.animationCache={},h.animationCache.prevKey={pos:0,rot:0,scl:0},h.animationCache.nextKey={pos:0,rot:0,scl:0},h.animationCache.originalMatrix=h instanceof
-THREE.Bone?h.skinMatrix:h.matrix;var j=h.animationCache.prevKey;h=h.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];h.pos=this.getNextKeyWith("pos",e,1);h.rot=this.getNextKeyWith("rot",e,1);h.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
+THREE.Bone?g.skinMatrix:g.matrix;var j=g.animationCache.prevKey;g=g.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,j,g,m,n,p,o=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,y=this.hierarchy.length;u<y;u++)if(b=this.hierarchy[u],n=b.animationCache,this.JITCompile&&o[u][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=o[u][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){e=c[z];g=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){g=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)g=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do g=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
-t)}n.prevKey[e]=g;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-g.time)/(m.time-g.time);h=g[e];j=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(j[0]-h[0])*f,e.y=h[1]+(j[1]-h[1])*f,e.z=h[2]+(j[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",u,g.index-1).pos,this.points[1]=h,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
-"rot")THREE.Quaternion.slerp(h,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(j[0]-h[0])*f,e.y=h[1]+(j[1]-h[1])*f,e.z=h[2]+(j[2]-h[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)o[u][p]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,j,g,m,n,p;h=(b.length-1)*c;j=Math.floor(h);h-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=h*h;g=h*e;f[0]=this.interpolate(j[0],m[0],n[0],p[0],h,e,g);f[1]=this.interpolate(j[1],m[1],n[1],p[1],h,e,g);f[2]=this.interpolate(j[2],m[2],n[2],p[2],h,e,g);return f};
-THREE.Animation.prototype.interpolate=function(b,c,e,f,h,j,g){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*g+(-3*(c-e)-2*b-f)*j+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,j,h,m,p,n,o=this.data.JIT.hierarchy,t,v;this.currentTime+=b*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;n=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,w=this.hierarchy.length;u<w;u++)if(b=this.hierarchy[u],p=b.animationCache,this.JITCompile&&o[u][n]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[u][n],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=o[u][n],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var z=0;z<3;z++){e=c[z];h=p.prevKey[e];m=p.nextKey[e];if(m.time<=v){if(t<v)if(this.loop){h=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<t;)h=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do h=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
+t)}p.prevKey[e]=h;p.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-h.time)/(m.time-h.time);g=h[e];j=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",u,h.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
+"rot")THREE.Quaternion.slerp(g,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&o[0][n]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)o[u][n]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,j,h,m,p,n;g=(b.length-1)*c;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];p=b[e[2]];n=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(j[0],m[0],p[0],n[0],g,e,h);f[1]=this.interpolate(j[1],m[1],p[1],n[1],g,e,h);f[2]=this.interpolate(j[2],m[2],p[2],n[2],g,e,h);return f};
+THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*j+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
 THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
 b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
@@ -402,182 +402,193 @@ void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this
 b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
 !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=
 function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);
-this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;var b=this.target.position,h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=
-1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*
+this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;var b=this.target.position,g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=
+1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
 THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
-THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},j,h=c.getControlPointsArray(),m=c.getLength(),n=h.length,H=0;j=n-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[j]={time:f,pos:h[j],rot:[0,0,0,1],scl:[1,1,1]};for(j=1;j<n-1;j++)H=f*m.chunks[j]/m.total,c.keys[j]={time:H,pos:h[j]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
-f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),j=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,j);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
-16,8);j=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,j),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
+THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},g,j=e.getControlPointsArray(),m=e.getLength(),p=j.length,H=0;g=p-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[g]={time:f,pos:j[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<p-1;g++)H=f*m.chunks[g]/m.total,e.keys[g]={time:H,pos:j[g]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
+f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
+16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
 void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,j=Math.PI/180;this.update=function(b,c,e){var f,g;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)*j;this.theta=this.lon*j;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var m=g[1]-g[0];this.phi=
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/m)*m+g[0];f=this.horizontalAngleMap.srcRange;g=this.horizontalAngleMap.dstRange;m=g[1]-g[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(g[1]-g[0])/(f[1]-f[0])+g[0]-g[0])/m)*m+g[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,c,e)};this.onMouseMove=function(b){this.mouseX=
-b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),g=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,g);b.position.set(0,10,0);this.animation=
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,j=Math.PI/180;this.update=function(b,e,c){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var m=h[1]-h[0];this.phi=
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;m=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/m)*m+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
+b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),p=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(p,h);b.position.set(0,10,0);this.animation=
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
 THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
 b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
 this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
-case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),h=c.size[0]/2,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-h)/h;this.moveState.pitchDown=(b.clientY-
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
 c.offset[1]-j)/j;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
 this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,j=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,t=0,v=0,u=0,y=0,z=window.innerWidth/2,x=window.innerHeight/2;this.update=
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
-else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);j.set(0,1,0);h.cross(j,g).normalize();j.cross(g,h).normalize();this.matrix.n11=h.x;this.matrix.n12=j.x;this.matrix.n13=g.x;this.matrix.n21=h.y;this.matrix.n22=j.y;this.matrix.n23=g.y;this.matrix.n31=h.z;this.matrix.n32=j.z;this.matrix.n33=g.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,p=!1,n=1,o=0,t=0,v=0,u=0,w=0,z=window.innerWidth/2,y=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*t);this.translateY(b*v);p&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);j.set(0,1,0);g.cross(j,h).normalize();j.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=j.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=j.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=j.z;this.matrix.n33=h.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
-this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){h.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);h.multiplyScalar(b);this.forward.subSelf(h);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){u=(b.clientX-z)/window.innerWidth;y=(b.clientY-x)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:t=-1;break;
-case 40:case 83:o=-1;break;case 39:case 68:t=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:t=0;break;case 40:case 83:o=0;break;case 39:case 68:t=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(b){u=(b.clientX-z)/window.innerWidth;w=(b.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:t=-1;break;
+case 40:case 83:o=-1;break;case 39:case 68:t=1;break;case 81:p=!0;n=1;break;case 69:p=!0;n=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:t=0;break;case 40:case 83:o=0;break;case 39:case 68:t=0;break;case 81:p=!1;break;case 69:p=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,j=new THREE.Vector3,g=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f};
-this.rotateCamera=function(){var b=Math.acos(j.dot(g)/j.length()/g.length());if(b){var c=(new THREE.Vector3).cross(j,g).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(g);this.staticMoving?j=g:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=o:p.addSelf(b.sub(o,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
-h.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,h.setLength(this.minDistance))};this.update=function(b,c,e){h=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,h);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(b){e&&(j=g=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),p=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?g=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
-b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?j=g=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
+this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f};
+this.rotateCamera=function(){var b=Math.acos(j.dot(h)/j.length()/h.length());if(b){var c=(new THREE.Vector3).cross(j,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?j=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(p.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=p:m.y+=(p.y-m.y)*this.dynamicDampingFactor)};
+this.panCamera=function(){var b=o.clone().subSelf(n);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?n=o:n.addSelf(b.sub(o,n).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
+g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,c,e){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+c(this,function(b){e&&(j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=p=this.getMouseOnScreen(b.clientX,b.clientY),n=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
+b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=p=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(n=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
 this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};
-THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheLengths&&this.cacheLengths.length==b)return this.cacheLengths;var c=[],e,f=this.getPoint(0),h,j=0;for(h=1;h<=b;h++)e=this.getPoint(h/b),j+=e.distanceTo(f),c.push(j),f=e;return this.cacheLengths=c};
-THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,j;for(j=c?c:b*e[h-1];f<h;){if(e[f]>j)break;f++}return f/h};THREE.LineCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)};
-THREE.QuadraticBezierCurve=function(b,c,e,f,h,j){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=h;this.y2=j};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.x0,this.x1,this.x2);b=THREE.Shape.Utils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)};
-THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,h,j,g,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=h;this.y2=j;this.x3=g;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
-THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.Shape.Utils.b3(b,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,b)};THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
-THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,h;h=(f.length-1)*b;b=Math.floor(h);h-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,h);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,h);return c};THREE.ArcCurve=function(b,c,e,f,h,j){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=h;this.aClockwise=j};
+THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};
+THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),g,j=0;c.push(0);for(g=1;g<=b;g++)e=this.getPoint(g/b),j+=e.distanceTo(f),c.push(j),f=e;return this.cacheArcLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,j;j=c?c:b*e[g-1];time=Date.now();for(var h=0,m=g-1,p;h<=m;)if(f=Math.floor(h+(m-h)/2),p=e[f]-j,p<0)h=f+1;else if(p>0)m=f-1;else{m=f;break}f=m;if(e[f]==j)return f/(g-1);h=e[f];return e=(f+(j-h)/(e[f+1]-h))/(g-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)};
+THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve;
+THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b};
+THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
+THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,b)};THREE.QuadraticBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,b);c.normalize();return c};
+THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var g=Array.prototype.slice.call(arguments),b=new THREE.Vector2(g[0],g[1]),c=new THREE.Vector2(g[2],g[3]),e=new THREE.Vector2(g[4],g[5]),f=new THREE.Vector2(g[6],g[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,b)};THREE.CubicBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,b);c.normalize();return c};
+THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
+THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,j){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=j};
 THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentSpline:function(){},interpolate:function(b,c,e,f,h){var b=(e-b)*0.5,f=(f-c)*0.5,j=h*h;return(2*c-2*e+b+f)*h*j+(-3*c+3*e-2*b-f)*j+b*h+c}};THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constructor=b;b.prototype.getPoint=c;return b};
-THREE.LineCurve3=THREE.Curve.create(function(b,c){this.v1=b;this.v2=c},function(b){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(b);c.addSelf(this.v1);return c});THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)});
-THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};
-THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],b,c);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:e,curve:f})};
-THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args,j=new THREE.QuadraticBezierCurve(j[j.length-2],j[j.length-1],b,c,e,f);this.curves.push(j);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:h,curve:j})};
-THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,j){var g=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args,m=new THREE.CubicBezierCurve(m[m.length-2],m[m.length-1],b,c,e,f,h,j);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g,curve:m})};
-THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b),e=new THREE.SplineCurve(e);this.curves.push(e);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:e})};
-THREE.Path.prototype.arc=function(b,c,e,f,h,j){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,j));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(b,c){b||(b=40);for(var e=[],f=0;f<b;f++)e.push(this.getPoint(f/b));c&&e.push(e[0]);return e};
-THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,j,g,m,n,p,o,t,v,u,y,z;f=0;for(h=this.actions.length;f<h;f++)switch(j=this.actions[f],g=j.action,j=j.args,g){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];n=j[3];t=j[0];v=j[1];e.length>0?(g=e[e.length-1],u=g.x,y=g.y):(g=this.actions[f-1].args,u=g[g.length-2],y=g[g.length-1]);for(g=1;g<=b;g++)z=g/b,j=THREE.Shape.Utils.b2(z,u,t,m),z=THREE.Shape.Utils.b2(z,y,v,
-n),e.push(new THREE.Vector2(j,z));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];n=j[5];t=j[0];v=j[1];p=j[2];o=j[3];e.length>0?(g=e[e.length-1],u=g.x,y=g.y):(g=this.actions[f-1].args,u=g[g.length-2],y=g[g.length-1]);for(g=1;g<=b;g++)z=g/b,j=THREE.Shape.Utils.b3(z,u,t,p,m),z=THREE.Shape.Utils.b3(z,y,v,o,n),e.push(new THREE.Vector2(j,z));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[f-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];z=b*j[0].length;g=g.concat(j[0]);j=new THREE.SplineCurve(g);
-for(g=1;g<=z;g++)e.push(j.getPointAt(g/z));break;case THREE.PathActions.ARC:g=this.actions[f-1].args;m=j[0];n=j[1];p=j[2];t=j[3];z=j[4];v=!!j[5];o=g[g.length-2];u=g[g.length-1];g.length==0&&(o=u=0);y=z-t;var x=b*2;for(g=1;g<=x;g++)z=g/x,v||(z=1-z),z=t+z*y,j=o+m+p*Math.cos(z),z=u+n+p*Math.sin(z),e.push(new THREE.Vector2(j,z))}c&&e.push(e[0]);return e};
-THREE.Path.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,h;c=e=Number.NEGATIVE_INFINITY;f=h=Number.POSITIVE_INFINITY;var j,g,m,n;n=new THREE.Vector2;g=0;for(m=b.length;g<m;g++){j=b[g];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)h=j.y;n.addSelf(j.x,j.y)}return{minX:f,minY:h,maxX:c,maxY:e,centroid:n.divideScalar(m)}};
-THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};THREE.Path.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
-THREE.Path.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.Path.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};
-THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getBoundingBox(),e=this.getPoints(),f,h,j,g,m,n;f=0;for(h=e.length;f<h;f++)j=e[f],g=j.x,m=j.y,n=g/c.maxX,g=b.getPoint(n),m=b.getNormalVector(n).multiplyScalar(m),j.x=g.x+m.x,j.y=g.y+m.y;return e};
-THREE.Path.prototype.nltransform=function(b,c,e,f,h,j){var g=this.getPoints(),m,n,p,o,t;m=0;for(n=g.length;m<n;m++)p=g[m],o=p.x,t=p.y,p.x=b*o+c*t+e,p.y=f*t+h*o+j;return g};
-THREE.Path.prototype.debug=function(b){var c=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,h,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],h=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";f=
-this.getPoints();b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
-THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],j=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&j.actions.length!=0&&(h.push(j),j=new THREE.Path),j[e].apply(j,f);j.actions.length!=0&&h.push(j);if(h.length==0)return[];var g,j=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(g&&j.push(g),g=new THREE.Shape,g.actions=f.actions,g.curves=
-f.curves):g.holes.push(f);j.push(g)}else{g=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(g.actions=f.actions,g.curves=f.curves,j.push(g),g=new THREE.Shape):g.holes.push(f)}return j};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
-THREE.Shape.prototype.getPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getPoints(b);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getSpacedPoints(b);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getPoints(b),holes:this.getPointsHoles(b)}};THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,j,g,m,n,p,o,t,v,u,y=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);j=Number.POSITIVE_INFINITY;for(h=0;h<p.length;h++){v=p[h];u=[];for(t=0;t<e.length;t++)o=e[t],o=v.distanceToSquared(o),u.push(o),o<j&&(j=o,g=h,m=t)}h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;var z=[p[g],e[m],e[h]];t=THREE.FontUtils.Triangulate.area(z);var x=[p[g],p[j],e[m]];v=THREE.FontUtils.Triangulate.area(x);u=m;o=g;m+=1;g+=-1;m<0&&(m+=e.length);m%=
-e.length;g<0&&(g+=p.length);g%=p.length;h=m-1>=0?m-1:e.length-1;j=g-1>=0?g-1:p.length-1;z=[p[g],e[m],e[h]];z=THREE.FontUtils.Triangulate.area(z);x=[p[g],p[j],e[m]];x=THREE.FontUtils.Triangulate.area(x);t+v>z+x&&(m=u,g=o,m<0&&(m+=e.length),m%=e.length,g<0&&(g+=p.length),g%=p.length,h=m-1>=0?m-1:e.length-1,j=g-1>=0?g-1:p.length-1);t=e.slice(0,m);v=e.slice(m);u=p.slice(g);o=p.slice(0,g);j=[p[g],p[j],e[m]];y.push([p[g],e[m],e[h]]);y.push(j);e=t.concat(u).concat(o).concat(v)}return{shape:e,isolatedPts:y,
-allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,g,m,n,p={};j=0;for(g=f.length;j<g;j++)n=f[j].x+":"+f[j].y,p[n]!==void 0&&console.log("Duplicate point",n),p[n]=j;j=0;for(g=e.length;j<g;j++){m=e[j];for(f=0;f<3;f++)n=m[f].x+":"+m[f].y,n=p[n],n!==void 0&&(m[f]=n)}j=0;for(g=h.length;j<g;j++){m=h[j];for(f=0;f<3;f++)n=m[f].x+":"+m[f].y,n=p[n],n!==void 0&&(m[f]=n)}return e.concat(h)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<
-0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,h){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,h)}};
-THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",h=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=h;THREE.FontUtils.style=j};
+THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,g){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*g},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,j=g*g;return(2*c-2*e+b+f)*g*j+(-3*c+3*e-2*b-f)*j+b*g+c}};
+THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constructor=b;b.prototype.getPoint=c;return b};THREE.LineCurve3=THREE.Curve.create(function(b,c){this.v1=b;this.v2=c},function(b){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(b);c.addSelf(this.v1);return c});
+THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)});THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(b){this.curves.push(b)};
+THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};THREE.CurvePath.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.getCurveLengths(),b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]};
+THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);return this.cacheLengths=b};
+THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var j,h,m,p;p=new THREE.Vector2;h=0;for(m=b.length;h<m;h++){j=b[h];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)g=j.y;p.addSelf(j.x,j.y)}return{minX:f,minY:g,maxX:c,maxY:e,centroid:p.divideScalar(m)}};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
+THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.CurvePath.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
+THREE.CurvePath.prototype.getTransformedPoints=function(b,c){var e=this.getPoints(b),f,g;if(!c)c=this.bends;f=0;for(g=c.length;f<g;f++)e=this.getWrapPoints(e,c[f]);return e};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(b,c){var e=this.getSpacedPoints(b),f,g;if(!c)c=this.bends;f=0;for(g=c.length;f<g;f++)e=this.getWrapPoints(e,c[f]);return e};
+THREE.CurvePath.prototype.getWrapPoints=function(b,c){var e=this.getBoundingBox(),f,g,j,h,m,p;f=0;for(g=b.length;f<g;f++)j=b[f],h=j.x,m=j.y,p=h/e.maxX,p=c.getUtoTmapping(p,h),h=c.getPoint(p),m=c.getNormalVector(p).multiplyScalar(m),j.x=h.x+m.x,j.y=h.y+m.y;return b};THREE.Path=function(b){THREE.CurvePath.call(this);this.actions=[];b&&this.fromPoints(b)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
+THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
+THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(b,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:e})};
+THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var g=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(j[j.length-2],j[j.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
+THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(m[m.length-2],m[m.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f),new THREE.Vector2(g,j)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h})};
+THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b);this.curves.push(new THREE.SplineCurve(e));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};THREE.Path.prototype.arc=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,j));this.actions.push({action:THREE.PathActions.ARC,args:h})};
+THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,g,j,h,m,p,n,o,t,v,u,w,z;f=0;for(g=this.actions.length;f<g;f++)switch(j=this.actions[f],h=j.action,j=j.args,h){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=j[2];p=j[3];t=j[0];v=j[1];e.length>0?(h=e[e.length-1],u=h.x,w=h.y):(h=this.actions[f-1].args,u=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)z=h/b,j=THREE.Shape.Utils.b2(z,u,t,m),z=THREE.Shape.Utils.b2(z,w,v,
+p),e.push(new THREE.Vector2(j,z));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];p=j[5];t=j[0];v=j[1];n=j[2];o=j[3];e.length>0?(h=e[e.length-1],u=h.x,w=h.y):(h=this.actions[f-1].args,u=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)z=h/b,j=THREE.Shape.Utils.b3(z,u,t,n,m),z=THREE.Shape.Utils.b3(z,w,v,o,p),e.push(new THREE.Vector2(j,z));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];z=b*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h);
+for(h=1;h<=z;h++)e.push(j.getPointAt(h/z));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;m=j[0];p=j[1];n=j[2];t=j[3];z=j[4];v=!!j[5];o=h[h.length-2];u=h[h.length-1];h.length==0&&(o=u=0);w=z-t;var y=b*2;for(h=1;h<=y;h++)z=h/y,v||(z=1-z),z=t+z*w,j=o+m+n*Math.cos(z),z=u+p+n*Math.sin(z),e.push(new THREE.Vector2(j,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
+THREE.Path.prototype.nltransform=function(b,c,e,f,g,j){var h=this.getPoints(),m,p,n,o,t;m=0;for(p=h.length;m<p;m++)n=h[m],o=n.x,t=n.y,n.x=b*o+c*t+e,n.y=f*t+g*o+j;return h};
+THREE.Path.prototype.debug=function(b){var c=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=
+this.getPoints();b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
+THREE.Path.prototype.toShapes=function(){var b,c,e,f,g=[],j=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&j.actions.length!=0&&(g.push(j),j=new THREE.Path),j[e].apply(j,f);j.actions.length!=0&&g.push(j);if(g.length==0)return[];var h,j=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h&&j.push(h),h=new THREE.Shape,h.actions=f.actions,h.curves=
+f.curves):h.holes.push(f);j.push(h)}else{h=new THREE.Shape;b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h.actions=f.actions,h.curves=f.curves,j.push(h),h=new THREE.Shape):h.holes.push(f)}return j};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
+THREE.Shape.prototype.getPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedPoints(b,this.bends);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedSpacedPoints(b,this.bends);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};
+THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,j,h,m,p,n,o,t,v,u,w=[];for(p=0;p<c.length;p++){n=c[p];f=f.concat(n);j=Number.POSITIVE_INFINITY;for(g=0;g<n.length;g++){v=n[g];u=[];for(t=0;t<e.length;t++)o=e[t],o=v.distanceToSquared(o),u.push(o),o<j&&(j=o,h=g,m=t)}g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:n.length-1;var z=[n[h],e[m],e[g]];t=THREE.FontUtils.Triangulate.area(z);var y=[n[h],n[j],e[m]];v=THREE.FontUtils.Triangulate.area(y);u=m;o=h;m+=1;h+=-1;m<0&&(m+=e.length);m%=
+e.length;h<0&&(h+=n.length);h%=n.length;g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:n.length-1;z=[n[h],e[m],e[g]];z=THREE.FontUtils.Triangulate.area(z);y=[n[h],n[j],e[m]];y=THREE.FontUtils.Triangulate.area(y);t+v>z+y&&(m=u,h=o,m<0&&(m+=e.length),m%=e.length,h<0&&(h+=n.length),h%=n.length,g=m-1>=0?m-1:e.length-1,j=h-1>=0?h-1:n.length-1);t=e.slice(0,m);v=e.slice(m);u=n.slice(h);o=n.slice(0,h);j=[n[h],n[j],e[m]];w.push([n[h],e[m],e[g]]);w.push(j);e=t.concat(u).concat(o).concat(v)}return{shape:e,isolatedPts:w,
+allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,m,p,n={};j=0;for(h=f.length;j<h;j++)p=f[j].x+":"+f[j].y,n[p]!==void 0&&console.log("Duplicate point",p),n[p]=j;j=0;for(h=e.length;j<h;j++){m=e[j];for(f=0;f<3;f++)p=m[f].x+":"+m[f].y,p=n[p],p!==void 0&&(m[f]=p)}j=0;for(h=g.length;j<h;j++){m=g[j];for(f=0;f<3;f++)p=m[f].x+":"+m[f].y,p=n[p],p!==void 0&&(m[f]=p)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<
+0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)}};
+THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=j};
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
-THREE.CubeGeometry=function(b,c,e,f,h,j,g,m,n){function p(b,c,e,g,m,n,p,u){var t,v,y=f||1,z=h||1,T=m/2,D=n/2,da=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",y=j||1;var S=y+1,P=z+1;m/=y;var k=n/z;for(v=0;v<P;v++)for(n=0;n<S;n++){var K=new THREE.Vector3;K[b]=(n*m-T)*e;K[c]=(v*k-D)*g;K[t]=p;o.vertices.push(new THREE.Vertex(K))}for(v=0;v<z;v++)for(n=0;n<y;n++)o.faces.push(new THREE.Face4(n+S*
-v+da,n+S*(v+1)+da,n+1+S*(v+1)+da,n+1+S*v+da,null,null,u)),o.faceVertexUvs[0].push([new THREE.UV(n/y,v/z),new THREE.UV(n/y,(v+1)/z),new THREE.UV((n+1)/y,(v+1)/z),new THREE.UV((n+1)/y,v/z)])}THREE.Geometry.call(this);var o=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var z in n)this.sides[z]!=void 0&&(this.sides[z]=
-n[z]);this.sides.px&&p("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var g=o.vertices[e],j=!1,h=0,m=b.length;h<m;h++){var n=b[h];if(g.position.x==n.position.x&&
-g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=h;j=!0;break}}if(!j)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)g=o.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,c,e,f,h,j){function g(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)g(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)g(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){g(0,0,-o-(j||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){g(0,0,o+
-(h||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],h=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/p,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;for(e=0;e<f;e++)h=b[e],this.addShape(h,c)}};
+THREE.CubeGeometry=function(b,c,e,f,g,j,h,m,p){function n(b,c,e,h,m,n,p,u){var t,v,w=f||1,z=g||1,T=m/2,C=n/2,ea=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",z=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",w=j||1;var S=w+1,P=z+1;m/=w;var k=n/z;for(v=0;v<P;v++)for(n=0;n<S;n++){var M=new THREE.Vector3;M[b]=(n*m-T)*e;M[c]=(v*k-C)*h;M[t]=p;o.vertices.push(new THREE.Vertex(M))}for(v=0;v<z;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+S*
+v+ea,n+S*(v+1)+ea,n+1+S*(v+1)+ea,n+1+S*v+ea,null,null,u)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/z),new THREE.UV(n/w,(v+1)/z),new THREE.UV((n+1)/w,(v+1)/z),new THREE.UV((n+1)/w,v/z)])}THREE.Geometry.call(this);var o=this,t=b/2,v=c/2,u=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
+p[z]);this.sides.px&&n("z","y",1*m,-1,e,c,-t,this.materials[0]);this.sides.nx&&n("z","y",-1*m,-1,e,c,t,this.materials[1]);this.sides.py&&n("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&n("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&n("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&n("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var h=o.vertices[e],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
+h.position.y==n.position.y&&h.position.z==n.position.z){c[e]=j;g=!0;break}}if(!g)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)h=o.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,p,n=Math.PI*2,o=f/2;for(p=0;p<b;p++)h(Math.sin(n*p/b)*c,Math.cos(n*p/b)*c,-o);for(p=0;p<b;p++)h(Math.sin(n*p/b)*e,Math.cos(n*p/b)*e,o);for(p=0;p<b;p++)m.faces.push(new THREE.Face4(p,p+b,b+(p+1)%b,(p+1)%b));if(e>0){h(0,0,-o-(j||0));for(p=b;p<b+b/2;p++)m.faces.push(new THREE.Face4(2*b,(2*p-2*b)%b,(2*p-2*b+1)%b,(2*p-2*b+2)%b))}if(c>0){h(0,0,o+
+(g||0));for(p=b+b/2;p<2*b;p++)m.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b))}p=0;for(b=this.faces.length;p<b;p++){var c=[],e=this.faces[p],g=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],t=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/n,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/n,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/n,0.5+o.position.z/
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/n,0.5+t.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};
 THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,j=THREE.ExtrudeGeometry.__v3,h=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);g.set(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();j.set(-f.y,f.x);h.set(g.y,-g.x);k.copy(b).addSelf(j);m.copy(b).addSelf(h);if(k.equals(m))return h.clone();
-k.copy(c).addSelf(j);m.copy(e).addSelf(h);j=f.dot(h);h=m.subSelf(k).dot(h);j==0&&(console.log("Either infinite or no solutions!"),h==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));h/=j;if(h<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(h).addSelf(k).subSelf(b).clone()}function h(b){for(F=b.length;--F>=0;){$=F;Y=F-1;Y<0&&(Y=b.length-
-1);for(var c=0,c=0;c<u+o*2;c++){var e=da*c,f=da*(c+1),g=ga+$+e,e=ga+Y+e,j=ga+Y+f,f=ga+$+f;g+=C;e+=C;j+=C;f+=C;J.faces.push(new THREE.Face4(g,e,j,f))}}}function j(b,c,e){J.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function g(b,c,e){b+=C;c+=C;e+=C;J.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:n-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,v=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.path!==void 0?c.path:null,z,x=!1;if(y)z=y.getPoints(v),u=z.length,x=!0,t=!1;t||(p=n=o=0);var w,H,B,J=this,C=this.vertices.length,v=b.extractAllPoints(v),y=v.shape,v=v.holes,G=!THREE.Shape.Utils.isClockWise(y);if(G){y=y.reverse();H=0;for(B=v.length;H<B;H++)w=v[H],THREE.Shape.Utils.isClockWise(w)&&(v[H]=w.reverse());G=!1}var G=THREE.Shape.Utils.triangulateShape(y,v),O=y;H=0;for(B=v.length;H<B;H++)w=v[H],y=y.concat(w);
-var F,I,R,ca,T,D,da=y.length,S=G.length,P=[];F=0;I=O.length;$=I-1;for(Y=F+1;F<I;F++,$++,Y++)$==I&&($=0),Y==I&&(Y=0),P[F]=f(O[F],O[$],O[Y]);var k=[],K,X=P.concat();H=0;for(B=v.length;H<B;H++){w=v[H];K=[];F=0;I=w.length;$=I-1;for(Y=F+1;F<I;F++,$++,Y++)$==I&&($=0),Y==I&&(Y=0),K[F]=f(w[F],w[$],w[Y]);k.push(K);X=X.concat(K)}for(R=0;R<o;R++){ca=R/o;T=n*(1-ca);ca=p*Math.sin(ca*Math.PI/2);F=0;for(I=O.length;F<I;F++)D=e(O[F],P[F],ca),j(D.x,D.y,-T);H=0;for(B=v.length;H<B;H++){w=v[H];K=k[H];F=0;for(I=w.length;F<
-I;F++)D=e(w[F],K[F],ca),j(D.x,D.y,-T)}}ca=p;for(F=0;F<da;F++)D=t?e(y[F],X[F],ca):y[F],x?j(D.x,D.y+z[0].y,z[0].x):j(D.x,D.y,0);for(R=1;R<=u;R++)for(F=0;F<da;F++)D=t?e(y[F],X[F],ca):y[F],x?j(D.x,D.y+z[R-1].y,z[R-1].x):j(D.x,D.y,m/u*R);for(R=o-1;R>=0;R--){ca=R/o;T=n*(1-ca);ca=p*Math.sin(ca*Math.PI/2);F=0;for(I=O.length;F<I;F++)D=e(O[F],P[F],ca),j(D.x,D.y,m+T);H=0;for(B=v.length;H<B;H++){w=v[H];K=k[H];F=0;for(I=w.length;F<I;F++)D=e(w[F],K[F],ca),x?j(D.x,D.y+z[u-1].y,z[u-1].x+T):j(D.x,D.y,m+T)}}if(t){n=
-da*0;for(F=0;F<S;F++)m=G[F],g(m[2]+n,m[1]+n,m[0]+n);n=da*(u+o*2);for(F=0;F<S;F++)m=G[F],g(m[0]+n,m[1]+n,m[2]+n)}else{for(F=0;F<S;F++)m=G[F],g(m[2],m[1],m[0]);for(F=0;F<S;F++)m=G[F],g(m[0]+da*u,m[1]+da*u,m[2]+da*u)}var $,Y,ga=0;h(O);ga+=O.length;H=0;for(B=v.length;H<B;H++)w=v[H],h(w),ga+=w.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;
-THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,g=h.vertices[e].position;return c((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var h=this,j=new THREE.Geometry,g;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){g=new THREE.Geometry;for(var m in j.faces){var n=f(j.faces[m].a,j.faces[m].b),p=f(j.faces[m].b,j.faces[m].c),o=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,n,o,g);e(j.faces[m].b,p,n,g);
-e(j.faces[m].c,o,p,g);e(n,p,o,g)}j.faces=g.faces}h.faces=j.faces;delete j;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],h=[],j=[],g=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=g.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),h[m]=this.vertices.length-1):h=j;n==0&&(j=f);
-for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(h[m],h[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,j=b/2,g=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(h=0;h<n;h++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(h*p-g),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*h,c+m*(h+1),c+1+m*(h+1),c+1+m*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,g=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();g.set(-f.y,f.x);j.set(h.y,-h.x);k.copy(b).addSelf(g);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
+k.copy(c).addSelf(g);m.copy(e).addSelf(j);g=f.dot(j);j=m.subSelf(k).dot(j);g==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=g;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(G=b.length;--G>=0;){aa=G;Z=G-1;Z<0&&(Z=b.length-
+1);for(var c=0,c=0;c<u+o*2;c++){var e=ea*c,f=ea*(c+1),h=ha+aa+e,e=ha+Z+e,g=ha+Z+f,f=ha+aa+f;h+=L;e+=L;g+=L;f+=L;D.faces.push(new THREE.Face4(h,e,g,f))}}}function j(b,c,e){D.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=L;c+=L;e+=L;D.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,n=c.bevelSize!==void 0?c.bevelSize:p-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,v=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,w=c.bendPath,z=c.extrudePath,y,x=!1,H=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1;if(z)y=z.getPoints(v),u=y.length,x=!0,t=!1;t||(n=p=o=0);var B,F,J,D=this,L=this.vertices.length;w&&b.addWrapPath(w);v=H?b.extractAllSpacedPoints(v):b.extractAllPoints(v);w=v.shape;v=v.holes;if(z=!THREE.Shape.Utils.isClockWise(w)){w=w.reverse();F=0;for(J=v.length;F<J;F++)B=v[F],THREE.Shape.Utils.isClockWise(B)&&(v[F]=B.reverse());z=!1}z=
+THREE.Shape.Utils.triangulateShape(w,v);H=w;F=0;for(J=v.length;F<J;F++)B=v[F],w=w.concat(B);var G,I,R,da,T,C,ea=w.length,S=z.length,P=[];G=0;I=H.length;aa=I-1;for(Z=G+1;G<I;G++,aa++,Z++)aa==I&&(aa=0),Z==I&&(Z=0),P[G]=f(H[G],H[aa],H[Z]);var k=[],M,Y=P.concat();F=0;for(J=v.length;F<J;F++){B=v[F];M=[];G=0;I=B.length;aa=I-1;for(Z=G+1;G<I;G++,aa++,Z++)aa==I&&(aa=0),Z==I&&(Z=0),M[G]=f(B[G],B[aa],B[Z]);k.push(M);Y=Y.concat(M)}for(R=0;R<o;R++){da=R/o;T=p*(1-da);da=n*Math.sin(da*Math.PI/2);G=0;for(I=H.length;G<
+I;G++)C=e(H[G],P[G],da),j(C.x,C.y,-T);F=0;for(J=v.length;F<J;F++){B=v[F];M=k[F];G=0;for(I=B.length;G<I;G++)C=e(B[G],M[G],da),j(C.x,C.y,-T)}}da=n;for(G=0;G<ea;G++)C=t?e(w[G],Y[G],da):w[G],x?j(C.x,C.y+y[0].y,y[0].x):j(C.x,C.y,0);for(R=1;R<=u;R++)for(G=0;G<ea;G++)C=t?e(w[G],Y[G],da):w[G],x?j(C.x,C.y+y[R-1].y,y[R-1].x):j(C.x,C.y,m/u*R);for(R=o-1;R>=0;R--){da=R/o;T=p*(1-da);da=n*Math.sin(da*Math.PI/2);G=0;for(I=H.length;G<I;G++)C=e(H[G],P[G],da),j(C.x,C.y,m+T);F=0;for(J=v.length;F<J;F++){B=v[F];M=k[F];
+G=0;for(I=B.length;G<I;G++)C=e(B[G],M[G],da),x?j(C.x,C.y+y[u-1].y,y[u-1].x+T):j(C.x,C.y,m+T)}}if(t){p=ea*0;for(G=0;G<S;G++)m=z[G],h(m[2]+p,m[1]+p,m[0]+p);p=ea*(u+o*2);for(G=0;G<S;G++)m=z[G],h(m[0]+p,m[1]+p,m[2]+p)}else{for(G=0;G<S;G++)m=z[G],h(m[2],m[1],m[0]);for(G=0;G<S;G++)m=z[G],h(m[0]+ea*u,m[1]+ea*u,m[2]+ea*u)}var aa,Z,ha=0;g(H);ha+=H.length;F=0;for(J=v.length;F<J;F++)B=v[F],g(B),ha+=B.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
+THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,j=new THREE.Geometry,h;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in j.faces){var p=f(j.faces[m].a,j.faces[m].b),n=f(j.faces[m].b,j.faces[m].c),o=f(j.faces[m].c,j.faces[m].a);e(j.faces[m].a,p,o,h);e(j.faces[m].b,n,p,h);
+e(j.faces[m].c,o,n,h);e(p,n,o,h)}j.faces=h.faces}g.faces=j.faces;delete j;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],j=[],h=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=c){for(m=0;m<e.length;m++)p<this.angle?(e[m]=h.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=j;p==0&&(j=f);
+for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,m/b.length),new THREE.UV(1-p/this.angle,(m+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(p-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,h=c/2,e=e||1,f=f||1,m=e+1,p=f+1;b/=e;var n=c/f;for(g=0;g<p;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*n-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,j=Math.max(3,c||8),g=Math.max(2,e||6),c=[],e=0;e<g+1;e++){f=e/g;var m=b*Math.cos(f*h),n=b*Math.sin(f*h),p=[],o=0;for(f=0;f<j;f++){var t=2*f/j,v=n*Math.sin(t*h),t=n*Math.cos(t*h);(e==0||e==g)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);p.push(o)}c.push(p)}for(var u,y,z,h=c.length,e=0;e<h;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){p=f==j-1;g=c[e][p?0:f+1];m=c[e][p?j-1:f];n=c[e-1][p?
-j-1:f];p=c[e-1][p?0:f+1];v=e/(h-1);u=(e-1)/(h-1);y=(f+1)/j;var t=f/j,o=new THREE.UV(1-y,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),x=new THREE.UV(1-y,u);e<c.length-1&&(u=this.vertices[g].position.clone(),y=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),u.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(g,m,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,v,t]));e>1&&(u=
-this.vertices[g].position.clone(),y=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),u.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(g,n,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,t,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
-THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,j=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var m=b*Math.cos(f*g),p=b*Math.sin(f*g),n=[],o=0;for(f=0;f<j;f++){var t=2*f/j,v=p*Math.sin(t*g),t=p*Math.cos(t*g);(e==0||e==h)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,v)))-1);n.push(o)}c.push(n)}for(var u,w,z,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){n=f==j-1;h=c[e][n?0:f+1];m=c[e][n?j-1:f];p=c[e-1][n?
+j-1:f];n=c[e-1][n?0:f+1];v=e/(g-1);u=(e-1)/(g-1);w=(f+1)/j;var t=f/j,o=new THREE.UV(1-w,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,u),y=new THREE.UV(1-w,u);e<c.length-1&&(u=this.vertices[h].position.clone(),w=this.vertices[m].position.clone(),z=this.vertices[p].position.clone(),u.normalize(),w.normalize(),z.normalize(),this.faces.push(new THREE.Face3(h,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,v,t]));e>1&&(u=
+this.vertices[h].position.clone(),w=this.vertices[p].position.clone(),z=this.vertices[n].position.clone(),u.normalize(),w.normalize(),z.normalize(),this.faces.push(new THREE.Face3(h,p,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([o,t,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
+THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
-this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),j=h.length,g=[],b=0;b<j;b++){var m=new THREE.Path,m=this.extractGlyphPoints(h[b],c,e,f,m);f+=m.offset;g.push(m.path)}return{paths:g,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var j=[],g,m,n,p,o,t,v,u,y,z,x=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,
-p));h.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;j.push(new THREE.Vector2(m,p));h.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(v,u,m,p);if(g=j[j.length-1]){o=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var w=g/divisions,H=THREE.Shape.Utils.b2(w,o,v,m),w=THREE.Shape.Utils.b2(w,t,u,p);j.push(new THREE.Vector2(H,w))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(m,p,
-v,u,y,z),g=j[j.length-1]){o=g.x;t=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)w=g/divisions,H=THREE.Shape.Utils.b3(w,o,v,y,m),w=THREE.Shape.Utils.b3(w,t,u,z,p),j.push(new THREE.Vector2(H,w))}}}return{offset:x.ha*e,points:j,path:h}}}};
-(function(b){var c=function(b){for(var c=b.length,h=0,j=c-1,g=0;g<c;j=g++)h+=b[j].x*b[g].y-b[g].x*b[j].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var j=[],g=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<h;p++)g[p]=p;else for(p=0;p<h;p++)g[p]=h-1-p;var t=2*h;for(p=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}n=p;h<=n&&(n=0);p=n+1;h<=p&&(p=0);o=p+1;h<=o&&(o=0);var v;a:{v=b;var u=n,y=p,z=o,x=h,w=g,H=void 0,B=void 0,J=void 0,
-C=void 0,G=void 0,O=void 0,F=void 0,I=void 0,R=void 0,B=v[w[u]].x,J=v[w[u]].y,C=v[w[y]].x,G=v[w[y]].y,O=v[w[z]].x,F=v[w[z]].y;if(1.0E-10>(C-B)*(F-J)-(G-J)*(O-B))v=!1;else{for(H=0;H<x;H++)if(!(H==u||H==y||H==z)){var I=v[w[H]].x,R=v[w[H]].y,ca=void 0,T=void 0,D=void 0,da=void 0,S=void 0,P=void 0,k=void 0,K=void 0,X=void 0,$=void 0,Y=void 0,ga=void 0,ca=D=S=void 0,ca=O-C,T=F-G,D=B-O,da=J-F,S=C-B,P=G-J,k=I-B,K=R-J,X=I-C,$=R-G,Y=I-O,ga=R-F,ca=ca*$-T*X,S=S*K-P*k,D=D*ga-da*Y;if(ca>=0&&D>=0&&S>=0){v=!1;break a}}v=
-!0}}if(v){j.push([b[g[n]],b[g[p]],b[g[o]]]);m.push([g[n],g[p],g[o]]);n=p;for(o=p+1;o<h;n++,o++)g[n]=g[o];h--;t=2*h}}if(f)return m;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,h=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(f),(this.radius+this.tube*Math.cos(h))*Math.sin(f),this.tube*Math.sin(h))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
-1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,h=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,g=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,h,j,g));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[g][0],b[g][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
+this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b<j;b++){var m=new THREE.Path,m=this.extractGlyphPoints(g[b],c,e,f,m);f+=m.offset;h.push(m.path)}return{paths:h,offset:f/2}},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,m,p,n,o,t,v,u,w,z,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));p=c.length;for(b=0;b<p;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;n=c[b++]*e;j.push(new THREE.Vector2(m,
+n));g.moveTo(m,n);break;case "l":m=c[b++]*e+f;n=c[b++]*e;j.push(new THREE.Vector2(m,n));g.lineTo(m,n);break;case "q":m=c[b++]*e+f;n=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;g.quadraticCurveTo(v,u,m,n);if(h=j[j.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var x=h/divisions,H=THREE.Shape.Utils.b2(x,o,v,m),x=THREE.Shape.Utils.b2(x,t,u,n);j.push(new THREE.Vector2(H,x))}}break;case "b":if(m=c[b++]*e+f,n=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,w=c[b++]*e+f,z=c[b++]*-e,g.bezierCurveTo(m,n,
+v,u,w,z),h=j[j.length-1]){o=h.x;t=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)x=h/divisions,H=THREE.Shape.Utils.b3(x,o,v,w,m),x=THREE.Shape.Utils.b3(x,t,u,z,n),j.push(new THREE.Vector2(H,x))}}}return{offset:y.ha*e,points:j,path:g}}}};
+(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],m=[],p,n,o;if(c(b)>0)for(n=0;n<g;n++)h[n]=n;else for(n=0;n<g;n++)h[n]=g-1-n;var t=2*g;for(n=g-1;g>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}p=n;g<=p&&(p=0);n=p+1;g<=n&&(n=0);o=n+1;g<=o&&(o=0);var v;a:{v=b;var u=p,w=n,z=o,y=g,x=h,H=void 0,B=void 0,F=void 0,
+J=void 0,D=void 0,L=void 0,G=void 0,I=void 0,R=void 0,B=v[x[u]].x,F=v[x[u]].y,J=v[x[w]].x,D=v[x[w]].y,L=v[x[z]].x,G=v[x[z]].y;if(1.0E-10>(J-B)*(G-F)-(D-F)*(L-B))v=!1;else{for(H=0;H<y;H++)if(!(H==u||H==w||H==z)){var I=v[x[H]].x,R=v[x[H]].y,da=void 0,T=void 0,C=void 0,ea=void 0,S=void 0,P=void 0,k=void 0,M=void 0,Y=void 0,aa=void 0,Z=void 0,ha=void 0,da=C=S=void 0,da=L-J,T=G-D,C=B-L,ea=F-G,S=J-B,P=D-F,k=I-B,M=R-F,Y=I-J,aa=R-D,Z=I-L,ha=R-G,da=da*aa-T*Y,S=S*M-P*k,C=C*ha-ea*Z;if(da>=0&&C>=0&&S>=0){v=!1;
+break a}}v=!0}}if(v){j.push([b[h[p]],b[h[n]],b[h[o]]]);m.push([h[p],h[n],h[o]]);p=n;for(o=n+1;o<g;p++,o++)h[p]=h[o];g--;t=2*g}}if(f)return m;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
+1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(b,c,e,f,h,j,g){function m(b,c,e,f,g,j){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,j*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=j||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,g=c/this.segmentsT*2*Math.PI,h=m(n,g,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,g,this.q,this.p,this.radius,this.heightScale);e.x=n.x-h.x;e.y=n.y-h.y;e.z=n.z-h.z;f.x=n.x+h.x;f.y=n.y+h.y;f.z=n.z+h.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();n=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);h.x+=n*f.x+g*j.x;h.y+=n*f.y+g*j.y;h.z+=n*f.z+g*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
-h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],g=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,j));this.faceVertexUvs[0].push([g,n,p,o])}this.computeCentroids();
+THREE.TorusKnotGeometry=function(b,c,e,f,g,j,h){function m(b,c,e,f,h,g){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,g*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
+this.segmentsT;++c){var p=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(p,h,this.q,this.p,this.radius,this.heightScale),p=m(p+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=p.x-g.x;e.y=p.y-g.y;e.z=p.z-g.z;f.x=p.x+g.x;f.y=p.y+g.y;f.z=p.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();p=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=p*f.x+h*j.x;g.y+=p*f.y+h*j.y;g.z+=p*f.z+h*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
+g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([h,p,n,o])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
 this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function h(b,e,g,j,h,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=g;if(j){b[e].repeat.set(j[0],j[1]);if(j[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(j[1]!=
-1)b[e].wrapT=THREE.RepeatWrapping}h&&b[e].offset.set(h[0],h[1]);if(m){j={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(j[m[0]]!==void 0)b[e].wrapS=j[m[0]];if(j[m[1]]!==void 0)b[e].wrapT=j[m[1]]}f(b[e],c+"/"+g)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var g,m,n;m="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
-if(b.blending)if(b.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")g.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)g.transparent=b.transparent;if(b.depthTest!==void 0)g.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(b.vertexColors)g.vertexColors=THREE.VertexColors;if(b.colorDiffuse)g.color=j(b.colorDiffuse);
-else if(b.DbgColor)g.color=b.DbgColor;if(b.colorSpecular)g.specular=j(b.colorSpecular);if(b.colorAmbient)g.ambient=j(b.colorAmbient);if(b.transparency)g.opacity=b.transparency;if(b.specularCoef)g.shininess=b.specularCoef;b.mapDiffuse&&c&&h(g,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(g,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(g,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
-b.mapSpecular&&c&&h(g,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),t=g.color;m=g.specular;n=g.ambient;var v=g.shininess;o.tNormal.texture=g.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(g.map)o.tDiffuse.texture=g.map,o.enableDiffuse.value=!0;if(g.specularMap)o.tSpecular.texture=g.specularMap,o.enableSpecular.value=!0;if(g.lightMap)o.tAO.texture=
-g.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(t);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=v;if(g.opacity)o.uOpacity.value=g.opacity;g=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else g=new THREE[m](g);return g},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
-THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,n,p,o,t,v,u,y,z,x,w,H,B,J=b.faces;t=b.vertices;var C=b.normals,G=b.colors,O=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&O++;for(e=0;e<O;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];p=0;for(o=t.length;p<o;)v=new THREE.Vertex,v.position.x=t[p++]*c,v.position.y=
-t[p++]*c,v.position.z=t[p++]*c,f.vertices.push(v);p=0;for(o=J.length;p<o;){c=J[p++];t=c&1;n=c&2;e=c&4;h=c&8;u=c&16;v=c&32;z=c&64;c&=128;t?(x=new THREE.Face4,x.a=J[p++],x.b=J[p++],x.c=J[p++],x.d=J[p++],t=4):(x=new THREE.Face3,x.a=J[p++],x.b=J[p++],x.c=J[p++],t=3);if(n)n=J[p++],x.materials=f.materials[n];n=f.faces.length;if(e)for(e=0;e<O;e++)w=b.uvs[e],y=J[p++],B=w[y*2],y=w[y*2+1],f.faceUvs[e][n]=new THREE.UV(B,y);if(h)for(e=0;e<O;e++){w=b.uvs[e];H=[];for(h=0;h<t;h++)y=J[p++],B=w[y*2],y=w[y*2+1],H[h]=
-new THREE.UV(B,y);f.faceVertexUvs[e][n]=H}if(u)u=J[p++]*3,h=new THREE.Vector3,h.x=C[u++],h.y=C[u++],h.z=C[u],x.normal=h;if(v)for(e=0;e<t;e++)u=J[p++]*3,h=new THREE.Vector3,h.x=C[u++],h.y=C[u++],h.z=C[u],x.vertexNormals.push(h);if(z)v=J[p++],v=new THREE.Color(G[v]),x.color=v;if(c)for(e=0;e<t;e++)v=J[p++],v=new THREE.Color(G[v]),x.vertexColors.push(v);f.faces.push(x)}}})(h);(function(){var c,e,h,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
-n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,n,p,o,t,v,u,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;n=0;for(p=y.length;n<p;n+=3)o=y[n]*c,t=y[n+1]*
-c,v=y[n+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,t,v)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(o[c],o[c+1],o[c+2]),p.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
-f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),h=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,h,j){var g=new XMLHttpRequest,m=f+"/"+b,n=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,e,h,c):alert("Couldn't load ["+m+"] ["+g.status+"]"):g.readyState==3?j&&(n==0&&(n=g.getResponseHeader("Content-Length")),j({total:n,loaded:g.responseText.length})):g.readyState==2&&(n=g.getResponseHeader("Content-Length"))};g.open("GET",m,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(b,c,e,f){var h=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function h(b,c){var e=o(b,c),f=o(b,c+1),g=o(b,c+2);return(o(b,c+3)<<24)+(g<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
-c){return b.charCodeAt(c)&255}function t(c){var e,f,g;e=h(b,c);f=h(b,c+G);g=h(b,c+O);c=n(b,c+F);THREE.BinaryLoader.prototype.f3(w,e,f,g,c)}function v(c){var e,f,g,j,k,o;e=h(b,c);f=h(b,c+G);g=h(b,c+O);j=n(b,c+F);k=h(b,c+I);o=h(b,c+R);c=h(b,c+ca);THREE.BinaryLoader.prototype.f3n(w,J,e,f,g,j,k,o,c)}function u(c){var e,f,g,j;e=h(b,c);f=h(b,c+T);g=h(b,c+D);j=h(b,c+da);c=n(b,c+S);THREE.BinaryLoader.prototype.f4(w,e,f,g,j,c)}function y(c){var e,f,g,j,o,p,t,u;e=h(b,c);f=h(b,c+T);g=h(b,c+D);j=h(b,c+da);o=
-n(b,c+S);p=h(b,c+P);t=h(b,c+k);u=h(b,c+K);c=h(b,c+X);THREE.BinaryLoader.prototype.f4n(w,J,e,f,g,j,o,p,t,u,c)}function z(c){var e,f;e=h(b,c);f=h(b,c+$);c=h(b,c+Y);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],C[e*2],C[e*2+1],C[f*2],C[f*2+1],C[c*2],C[c*2+1])}function x(c){var e,f,g;e=h(b,c);f=h(b,c+ga);g=h(b,c+ja);c=h(b,c+ea);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],C[e*2],C[e*2+1],C[f*2],C[f*2+1],C[g*2],C[g*2+1],C[c*2],C[c*2+1])}var w=this,H=0,B,J=[],C=[],G,O,F,I,R,ca,T,D,da,S,P,k,
-K,X,$,Y,ga,ja,ea,M,W,aa,ma,ka,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);B={signature:b.substr(H,8),header_bytes:o(b,H+8),vertex_coordinate_bytes:o(b,H+9),normal_coordinate_bytes:o(b,H+10),uv_coordinate_bytes:o(b,H+11),vertex_index_bytes:o(b,H+12),normal_index_bytes:o(b,H+13),uv_index_bytes:o(b,H+14),material_index_bytes:o(b,H+15),nvertices:h(b,H+16),nnormals:h(b,H+16+4),nuvs:h(b,H+16+8),ntri_flat:h(b,H+16+12),ntri_smooth:h(b,H+16+16),ntri_flat_uv:h(b,H+16+20),ntri_smooth_uv:h(b,
-H+16+24),nquad_flat:h(b,H+16+28),nquad_smooth:h(b,H+16+32),nquad_flat_uv:h(b,H+16+36),nquad_smooth_uv:h(b,H+16+40)};H+=B.header_bytes;G=B.vertex_index_bytes;O=B.vertex_index_bytes*2;F=B.vertex_index_bytes*3;I=B.vertex_index_bytes*3+B.material_index_bytes;R=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;ca=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;T=B.vertex_index_bytes;D=B.vertex_index_bytes*2;da=B.vertex_index_bytes*3;S=B.vertex_index_bytes*4;P=B.vertex_index_bytes*
-4+B.material_index_bytes;k=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;K=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;X=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;$=B.uv_index_bytes;Y=B.uv_index_bytes*2;ga=B.uv_index_bytes;ja=B.uv_index_bytes*2;ea=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;sa=B.vertex_index_bytes*4+B.material_index_bytes;M=B.ntri_flat*c;W=B.ntri_smooth*(c+B.normal_index_bytes*3);aa=B.ntri_flat_uv*
-(c+B.uv_index_bytes*3);ma=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);ka=B.nquad_flat*sa;c=B.nquad_smooth*(sa+B.normal_index_bytes*4);sa=B.nquad_flat_uv*(sa+B.uv_index_bytes*4);H+=function(c){for(var f,h,j,k=B.vertex_coordinate_bytes*3,m=c+B.nvertices*k;c<m;c+=k)f=e(b,c),h=e(b,c+B.vertex_coordinate_bytes),j=e(b,c+B.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(w,f,h,j);return B.nvertices*k}(H);H+=function(c){for(var e,f,g,h=B.normal_coordinate_bytes*3,j=c+B.nnormals*
-h;c<j;c+=h)e=p(b,c),f=p(b,c+B.normal_coordinate_bytes),g=p(b,c+B.normal_coordinate_bytes*2),J.push(e/127,f/127,g/127);return B.nnormals*h}(H);H+=function(c){for(var f,h,j=B.uv_coordinate_bytes*2,k=c+B.nuvs*j;c<k;c+=j)f=e(b,c),h=e(b,c+B.uv_coordinate_bytes),C.push(f,h);return B.nuvs*j}(H);M=H+M;W=M+W;aa=W+aa;ma=aa+ma;ka=ma+ka;c=ka+c;sa=c+sa;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=e+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),z(c+e);return g-b})(W);(function(b){var c,
-e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(aa);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=e+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(c=b;c<g;c+=f)y(c),x(c+e);return g-b})(sa);
-(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(H);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(M);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(ma);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=b+B.nquad_smooth*
-e;for(c=b;c<f;c+=e)y(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,h){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[h]))},f4:function(b,c,e,f,h,j){b.faces.push(new THREE.Face4(c,e,f,h,null,null,b.materials[j]))},f3n:function(b,c,e,
-f,h,j,g,m,n){var j=b.materials[j],p=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(c[g*3],c[g*3+1],c[g*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(t,v,n)],null,j))},f4n:function(b,c,e,f,h,j,g,m,n,p,o){var g=b.materials[g],t=c[n*3],v=c[n*3+1],n=c[n*3+2],u=c[p*3],y=c[p*3+1],p=c[p*3+2],z=c[o*3],x=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,h,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,v,n),new THREE.Vector3(u,
-y,p),new THREE.Vector3(z,x,o)],null,g))},uv3:function(b,c,e,f,h,j,g){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,h));m.push(new THREE.UV(j,g));b.push(m)},uv4:function(b,c,e,f,h,j,g,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,h));p.push(new THREE.UV(j,g));p.push(new THREE.UV(m,n));b.push(p)},constructor:THREE.BinaryLoader};
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,j,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
+1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,p;m="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
+if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=j(b.colorDiffuse);
+else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpecular);if(b.colorAmbient)h.ambient=j(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
+b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var n=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(n.uniforms),t=h.color;m=h.specular;p=h.ambient;var v=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
+h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(t);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(p);o.uShininess.value=v;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[m](h);return h},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
+THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,p,n,o,t,v,u,w,z,y,x,H,B,F=b.faces;t=b.vertices;var J=b.normals,D=b.colors,L=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&L++;for(e=0;e<L;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];n=0;for(o=t.length;n<o;)v=new THREE.Vertex,v.position.x=t[n++]*c,v.position.y=
+t[n++]*c,v.position.z=t[n++]*c,f.vertices.push(v);n=0;for(o=F.length;n<o;){c=F[n++];t=c&1;p=c&2;e=c&4;g=c&8;u=c&16;v=c&32;z=c&64;c&=128;t?(y=new THREE.Face4,y.a=F[n++],y.b=F[n++],y.c=F[n++],y.d=F[n++],t=4):(y=new THREE.Face3,y.a=F[n++],y.b=F[n++],y.c=F[n++],t=3);if(p)p=F[n++],y.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<L;e++)x=b.uvs[e],w=F[n++],B=x[w*2],w=x[w*2+1],f.faceUvs[e][p]=new THREE.UV(B,w);if(g)for(e=0;e<L;e++){x=b.uvs[e];H=[];for(g=0;g<t;g++)w=F[n++],B=x[w*2],w=x[w*2+1],H[g]=
+new THREE.UV(B,w);f.faceVertexUvs[e][p]=H}if(u)u=F[n++]*3,g=new THREE.Vector3,g.x=J[u++],g.y=J[u++],g.z=J[u],y.normal=g;if(v)for(e=0;e<t;e++)u=F[n++]*3,g=new THREE.Vector3,g.x=J[u++],g.y=J[u++],g.z=J[u],y.vertexNormals.push(g);if(z)v=F[n++],v=new THREE.Color(D[v]),y.color=v;if(c)for(e=0;e<t;e++)v=F[n++],v=new THREE.Color(D[v]),y.vertexColors.push(v);f.faces.push(y)}}})(g);(function(){var c,e,g,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
+p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,p,n,o,t,v,u,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;p=0;for(n=w.length;p<n;p+=3)o=w[p]*c,t=w[p+1]*
+c,v=w[p+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(o,t,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];n=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(p=o.length;c<p;c+=3)t=new THREE.Color(16755200),t.setRGB(o[c],o[c+1],o[c+2]),n.push(t)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
+f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,m=f+"/"+b,p=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+h.status+"]"):h.readyState==3?j&&(p==0&&(p=h.getResponseHeader("Content-Length")),j({total:p,loaded:h.responseText.length})):h.readyState==2&&(p=h.getResponseHeader("Content-Length"))};h.open("GET",m,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
+h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function p(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function n(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
+c){return b.charCodeAt(c)&255}function t(c){var e,f,h;e=g(b,c);f=g(b,c+D);h=g(b,c+L);c=p(b,c+G);THREE.BinaryLoader.prototype.f3(x,e,f,h,c)}function v(c){var e,f,h,j,k,n;e=g(b,c);f=g(b,c+D);h=g(b,c+L);j=p(b,c+G);k=g(b,c+I);n=g(b,c+R);c=g(b,c+da);THREE.BinaryLoader.prototype.f3n(x,F,e,f,h,j,k,n,c)}function u(c){var e,f,h,j;e=g(b,c);f=g(b,c+T);h=g(b,c+C);j=g(b,c+ea);c=p(b,c+S);THREE.BinaryLoader.prototype.f4(x,e,f,h,j,c)}function w(c){var e,f,h,j,n,o,t,u;e=g(b,c);f=g(b,c+T);h=g(b,c+C);j=g(b,c+ea);n=
+p(b,c+S);o=g(b,c+P);t=g(b,c+k);u=g(b,c+M);c=g(b,c+Y);THREE.BinaryLoader.prototype.f4n(x,F,e,f,h,j,n,o,t,u,c)}function z(c){var e,f;e=g(b,c);f=g(b,c+aa);c=g(b,c+Z);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[c*2],J[c*2+1])}function y(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+ka);c=g(b,c+fa);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],J[e*2],J[e*2+1],J[f*2],J[f*2+1],J[h*2],J[h*2+1],J[c*2],J[c*2+1])}var x=this,H=0,B,F=[],J=[],D,L,G,I,R,da,T,C,ea,S,P,
+k,M,Y,aa,Z,ha,ka,fa,U,X,ca,ma,la,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,f,c);B={signature:b.substr(H,8),header_bytes:o(b,H+8),vertex_coordinate_bytes:o(b,H+9),normal_coordinate_bytes:o(b,H+10),uv_coordinate_bytes:o(b,H+11),vertex_index_bytes:o(b,H+12),normal_index_bytes:o(b,H+13),uv_index_bytes:o(b,H+14),material_index_bytes:o(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b,
+H+16+24),nquad_flat:g(b,H+16+28),nquad_smooth:g(b,H+16+32),nquad_flat_uv:g(b,H+16+36),nquad_smooth_uv:g(b,H+16+40)};H+=B.header_bytes;D=B.vertex_index_bytes;L=B.vertex_index_bytes*2;G=B.vertex_index_bytes*3;I=B.vertex_index_bytes*3+B.material_index_bytes;R=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;da=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;T=B.vertex_index_bytes;C=B.vertex_index_bytes*2;ea=B.vertex_index_bytes*3;S=B.vertex_index_bytes*4;P=B.vertex_index_bytes*
+4+B.material_index_bytes;k=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;M=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;Y=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;aa=B.uv_index_bytes;Z=B.uv_index_bytes*2;ha=B.uv_index_bytes;ka=B.uv_index_bytes*2;fa=B.uv_index_bytes*3;c=B.vertex_index_bytes*3+B.material_index_bytes;sa=B.vertex_index_bytes*4+B.material_index_bytes;U=B.ntri_flat*c;X=B.ntri_smooth*(c+B.normal_index_bytes*3);ca=B.ntri_flat_uv*
+(c+B.uv_index_bytes*3);ma=B.ntri_smooth_uv*(c+B.normal_index_bytes*3+B.uv_index_bytes*3);la=B.nquad_flat*sa;c=B.nquad_smooth*(sa+B.normal_index_bytes*4);sa=B.nquad_flat_uv*(sa+B.uv_index_bytes*4);H+=function(c){for(var f,g,j,k=B.vertex_coordinate_bytes*3,m=c+B.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+B.vertex_coordinate_bytes),j=e(b,c+B.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,f,g,j);return B.nvertices*k}(H);H+=function(c){for(var e,f,g,h=B.normal_coordinate_bytes*3,j=c+B.nnormals*
+h;c<j;c+=h)e=n(b,c),f=n(b,c+B.normal_coordinate_bytes),g=n(b,c+B.normal_coordinate_bytes*2),F.push(e/127,f/127,g/127);return B.nnormals*h}(H);H+=function(c){for(var f,g,j=B.uv_coordinate_bytes*2,k=c+B.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+B.uv_coordinate_bytes),J.push(f,g);return B.nuvs*j}(H);U=H+U;X=U+X;ca=X+ca;ma=ca+ma;la=ma+la;c=la+c;sa=c+sa;(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=e+B.uv_index_bytes*3,g=b+B.ntri_flat_uv*f;for(c=b;c<g;c+=f)t(c),z(c+e);return g-b})(X);(function(b){var c,
+e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=e+B.uv_index_bytes*3,g=b+B.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(ca);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=e+B.uv_index_bytes*4,g=b+B.nquad_flat_uv*f;for(c=b;c<g;c+=f)u(c),y(c+e);return g-b})(c);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=e+B.uv_index_bytes*4,g=b+B.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),y(c+e);return g-b})(sa);
+(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes,f=b+B.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(H);(function(b){var c,e=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,f=b+B.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(U);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes,f=b+B.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(ma);(function(b){var c,e=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,f=b+B.nquad_smooth*
+e;for(c=b;c<f;c+=e)w(c);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},f3n:function(b,c,e,
+f,g,j,h,m,p){var j=b.materials[j],n=c[m*3],o=c[m*3+1],m=c[m*3+2],t=c[p*3],v=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,o,m),new THREE.Vector3(t,v,p)],null,j))},f4n:function(b,c,e,f,g,j,h,m,p,n,o){var h=b.materials[h],t=c[p*3],v=c[p*3+1],p=c[p*3+2],u=c[n*3],w=c[n*3+1],n=c[n*3+2],z=c[o*3],y=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(u,
+w,n),new THREE.Vector3(z,y,o)],null,h))},uv3:function(b,c,e,f,g,j,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,h));b.push(m)},uv4:function(b,c,e,f,g,j,h,m,p){var n=[];n.push(new THREE.UV(c,e));n.push(new THREE.UV(f,g));n.push(new THREE.UV(j,h));n.push(new THREE.UV(m,p));b.push(n)},constructor:THREE.BinaryLoader};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function m(){for(u in T.objects)if(!K.objects[u])if(H=T.objects[u],H.geometry!==void 0){if(G=K.geometries[H.geometry]){var b=!1;R=[];for($=0;$<H.materials.length;$++)R[$]=K.materials[H.materials[$]],b=R[$]instanceof THREE.MeshShaderMaterial;b&&G.computeTangents();B=H.position;r=H.rotation;
-q=H.quaternion;s=H.scale;q=0;R.length==0&&(R[0]=new THREE.MeshFaceMaterial);R.length>1&&(R=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,R);object.name=u;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;K.scene.addObject(object);K.objects[u]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),K.scene.collisions.colliders.push(b));
-if(H.castsShadow)b=new THREE.ShadowVolume(G),K.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},K.triggers[object.name]=b)}}else B=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,K.scene.addObject(object),K.objects[u]=object,K.empties[u]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},K.triggers[object.name]=b)}function n(b){return function(c){K.geometries[b]=c;m();da-=1;e.onLoadComplete();o()}}function p(b){return function(c){K.geometries[b]=c}}function o(){e.callbackProgress({totalModels:P,totalTextures:k,loadedModels:P-da,loadedTextures:k-S},K);e.onLoadProgress();da==0&&S==0&&c(K)}
-var t,v,u,y,z,x,w,H,B,J,C,G,O,F,I,R,ca,T,D,da,S,P,k,K;T=b.data;I=new THREE.BinaryLoader;D=new THREE.JSONLoader;S=da=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in T.objects)if(H=T.objects[u],H.meshCollider){b=!0;break}if(b)K.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;J=T.transform.rotation;var X=T.transform.scale;b&&K.scene.position.set(b[0],b[1],b[2]);J&&K.scene.rotation.set(J[0],
-J[1],J[2]);X&&K.scene.scale.set(X[0],X[1],X[2]);(b||J||X)&&K.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(z in T.cameras){J=T.cameras[z];if(J.type=="perspective")O=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")O=new THREE.Camera,O.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);B=J.position;J=J.target;O.position.set(B[0],B[1],B[2]);O.target.position.set(J[0],J[1],J[2]);K.cameras[z]=O}for(y in T.lights)z=T.lights[y],
-O=z.color!==void 0?z.color:16777215,J=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(B=z.direction,ca=new THREE.DirectionalLight(O,J),ca.position.set(B[0],B[1],B[2]),ca.position.normalize()):z.type=="point"?(B=z.position,d=z.distance,ca=new THREE.PointLight(O,J,d),ca.position.set(B[0],B[1],B[2])):z.type=="ambient"&&(ca=new THREE.AmbientLight(O)),K.scene.addLight(ca),K.lights[y]=ca;for(x in T.fogs)y=T.fogs[x],y.type=="linear"?F=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(F=new THREE.FogExp2(0,
-y.density)),J=y.color,F.color.setRGB(J[0],J[1],J[2]),K.fogs[x]=F;if(K.cameras&&T.defaults.camera)K.currentCamera=K.cameras[T.defaults.camera];if(K.fogs&&T.defaults.fog)K.scene.fog=K.fogs[T.defaults.fog];J=T.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(J[0],J[1],J[2]);K.bgColorAlpha=T.defaults.bgalpha;for(t in T.geometries)if(x=T.geometries[t],x.type=="bin_mesh"||x.type=="ascii_mesh")da+=1,e.onLoadStart();P=da;for(t in T.geometries)x=T.geometries[t],x.type=="cube"?(G=new THREE.CubeGeometry(x.width,
-x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,null,x.flipped,x.sides),K.geometries[t]=G):x.type=="plane"?(G=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),K.geometries[t]=G):x.type=="sphere"?(G=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),K.geometries[t]=G):x.type=="cylinder"?(G=new THREE.CylinderGeometry(x.numSegs,x.topRad,x.botRad,x.height,x.topOffset,x.botOffset),K.geometries[t]=G):x.type=="torus"?(G=new THREE.TorusGeometry(x.radius,
-x.tube,x.segmentsR,x.segmentsT),K.geometries[t]=G):x.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(x.subdivisions),K.geometries[t]=G):x.type=="bin_mesh"?I.load({model:f(x.url,T.urlBaseType),callback:n(t)}):x.type=="ascii_mesh"?D.load({model:f(x.url,T.urlBaseType),callback:n(t)}):x.type=="embedded_mesh"&&(x=T.embeds[x.id])&&D.createModel(x,p(t),"");for(w in T.textures)if(t=T.textures[w],t.url instanceof Array){S+=t.url.length;for(I=0;I<t.url.length;I++)e.onLoadStart()}else S+=1,e.onLoadStart();
-k=S;for(w in T.textures){t=T.textures[w];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){I=[];for(var $=0;$<t.url.length;$++)I[$]=f(t.url[$],T.urlBaseType);I=THREE.ImageUtils.loadTextureCube(I,t.mapping,b)}else{I=THREE.ImageUtils.loadTexture(f(t.url,T.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)I.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)I.magFilter=THREE[t.magFilter];if(t.repeat){I.repeat.set(t.repeat[0],t.repeat[1]);
-if(t.repeat[0]!=1)I.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)I.wrapT=THREE.RepeatWrapping}t.offset&&I.offset.set(t.offset[0],t.offset[1]);if(t.wrap){D={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(D[t.wrap[0]]!==void 0)I.wrapS=D[t.wrap[0]];if(D[t.wrap[1]]!==void 0)I.wrapT=D[t.wrap[1]]}}K.textures[w]=I}for(v in T.materials){w=T.materials[v];for(C in w.parameters)if(C=="envMap"||C=="map"||C=="lightMap")w.parameters[C]=K.textures[w.parameters[C]];else if(C=="shading")w.parameters[C]=
-w.parameters[C]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(C=="blending")w.parameters[C]=THREE[w.parameters[C]]?THREE[w.parameters[C]]:THREE.NormalBlending;else if(C=="combine")w.parameters[C]=w.parameters[C]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(C=="vertexColors")if(w.parameters[C]=="face")w.parameters[C]=THREE.FaceColors;else if(w.parameters[C])w.parameters[C]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=
-!0;if(w.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);I=w.parameters.color;D=w.parameters.specular;x=w.parameters.ambient;F=w.parameters.shininess;b.tNormal.texture=K.textures[w.parameters.normalMap];if(w.parameters.normalMapFactor)b.uNormalScale.value=w.parameters.normalMapFactor;if(w.parameters.map)b.tDiffuse.texture=w.parameters.map,b.enableDiffuse.value=!0;if(w.parameters.lightMap)b.tAO.texture=w.parameters.lightMap,b.enableAO.value=!0;if(w.parameters.specularMap)b.tSpecular.texture=
-K.textures[w.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(I);b.uSpecularColor.value.setHex(D);b.uAmbientColor.value.setHex(x);b.uShininess.value=F;if(w.parameters.opacity)b.uOpacity.value=w.parameters.opacity;w=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else w=new THREE[w.type](w.parameters);K.materials[v]=w}m();e.callbackSync(K)}},constructor:THREE.SceneLoader};
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(u in T.objects)if(!M.objects[u])if(H=T.objects[u],H.geometry!==void 0){if(D=M.geometries[H.geometry]){var b=!1;R=[];for(aa=0;aa<H.materials.length;aa++)R[aa]=M.materials[H.materials[aa]],b=R[aa]instanceof THREE.MeshShaderMaterial;b&&D.computeTangents();B=H.position;r=
+H.rotation;q=H.quaternion;s=H.scale;q=0;R.length==0&&(R[0]=new THREE.MeshFaceMaterial);R.length>1&&(R=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(D,R);object.name=u;object.position.set(B[0],B[1],B[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;M.scene.addObject(object);M.objects[u]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),M.scene.collisions.colliders.push(b));
+if(H.castsShadow)b=new THREE.ShadowVolume(D),M.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},M.triggers[object.name]=b)}}else B=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(B[0],B[1],B[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,M.scene.addObject(object),M.objects[u]=object,M.empties[u]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},M.triggers[object.name]=b)}function p(b){return function(c){M.geometries[b]=c;m();ea-=1;e.onLoadComplete();o()}}function n(b){return function(c){M.geometries[b]=c}}function o(){e.callbackProgress({totalModels:P,totalTextures:k,loadedModels:P-ea,loadedTextures:k-S},M);e.onLoadProgress();ea==0&&S==0&&c(M)}
+var t,v,u,w,z,y,x,H,B,F,J,D,L,G,I,R,da,T,C,ea,S,P,k,M;T=b.data;I=new THREE.BinaryLoader;C=new THREE.JSONLoader;S=ea=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in T.objects)if(H=T.objects[u],H.meshCollider){b=!0;break}if(b)M.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;F=T.transform.rotation;var Y=T.transform.scale;b&&M.scene.position.set(b[0],b[1],b[2]);F&&M.scene.rotation.set(F[0],
+F[1],F[2]);Y&&M.scene.scale.set(Y[0],Y[1],Y[2]);(b||F||Y)&&M.scene.updateMatrix()}b=function(){S-=1;o();e.onLoadComplete()};for(z in T.cameras){F=T.cameras[z];if(F.type=="perspective")L=new THREE.Camera(F.fov,F.aspect,F.near,F.far);else if(F.type=="ortho")L=new THREE.Camera,L.projectionMatrix=THREE.Matrix4.makeOrtho(F.left,F.right,F.top,F.bottom,F.near,F.far);B=F.position;F=F.target;L.position.set(B[0],B[1],B[2]);L.target.position.set(F[0],F[1],F[2]);M.cameras[z]=L}for(w in T.lights)z=T.lights[w],
+L=z.color!==void 0?z.color:16777215,F=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(B=z.direction,da=new THREE.DirectionalLight(L,F),da.position.set(B[0],B[1],B[2]),da.position.normalize()):z.type=="point"?(B=z.position,d=z.distance,da=new THREE.PointLight(L,F,d),da.position.set(B[0],B[1],B[2])):z.type=="ambient"&&(da=new THREE.AmbientLight(L)),M.scene.addLight(da),M.lights[w]=da;for(y in T.fogs)w=T.fogs[y],w.type=="linear"?G=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(G=new THREE.FogExp2(0,
+w.density)),F=w.color,G.color.setRGB(F[0],F[1],F[2]),M.fogs[y]=G;if(M.cameras&&T.defaults.camera)M.currentCamera=M.cameras[T.defaults.camera];if(M.fogs&&T.defaults.fog)M.scene.fog=M.fogs[T.defaults.fog];F=T.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(F[0],F[1],F[2]);M.bgColorAlpha=T.defaults.bgalpha;for(t in T.geometries)if(y=T.geometries[t],y.type=="bin_mesh"||y.type=="ascii_mesh")ea+=1,e.onLoadStart();P=ea;for(t in T.geometries)y=T.geometries[t],y.type=="cube"?(D=new THREE.CubeGeometry(y.width,
+y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),M.geometries[t]=D):y.type=="plane"?(D=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),M.geometries[t]=D):y.type=="sphere"?(D=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),M.geometries[t]=D):y.type=="cylinder"?(D=new THREE.CylinderGeometry(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset),M.geometries[t]=D):y.type=="torus"?(D=new THREE.TorusGeometry(y.radius,
+y.tube,y.segmentsR,y.segmentsT),M.geometries[t]=D):y.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(y.subdivisions),M.geometries[t]=D):y.type=="bin_mesh"?I.load({model:f(y.url,T.urlBaseType),callback:p(t)}):y.type=="ascii_mesh"?C.load({model:f(y.url,T.urlBaseType),callback:p(t)}):y.type=="embedded_mesh"&&(y=T.embeds[y.id])&&C.createModel(y,n(t),"");for(x in T.textures)if(t=T.textures[x],t.url instanceof Array){S+=t.url.length;for(I=0;I<t.url.length;I++)e.onLoadStart()}else S+=1,e.onLoadStart();
+k=S;for(x in T.textures){t=T.textures[x];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){I=[];for(var aa=0;aa<t.url.length;aa++)I[aa]=f(t.url[aa],T.urlBaseType);I=THREE.ImageUtils.loadTextureCube(I,t.mapping,b)}else{I=THREE.ImageUtils.loadTexture(f(t.url,T.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)I.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)I.magFilter=THREE[t.magFilter];if(t.repeat){I.repeat.set(t.repeat[0],t.repeat[1]);
+if(t.repeat[0]!=1)I.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)I.wrapT=THREE.RepeatWrapping}t.offset&&I.offset.set(t.offset[0],t.offset[1]);if(t.wrap){C={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(C[t.wrap[0]]!==void 0)I.wrapS=C[t.wrap[0]];if(C[t.wrap[1]]!==void 0)I.wrapT=C[t.wrap[1]]}}M.textures[x]=I}for(v in T.materials){x=T.materials[v];for(J in x.parameters)if(J=="envMap"||J=="map"||J=="lightMap")x.parameters[J]=M.textures[x.parameters[J]];else if(J=="shading")x.parameters[J]=
+x.parameters[J]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(J=="blending")x.parameters[J]=THREE[x.parameters[J]]?THREE[x.parameters[J]]:THREE.NormalBlending;else if(J=="combine")x.parameters[J]=x.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(J=="vertexColors")if(x.parameters[J]=="face")x.parameters[J]=THREE.FaceColors;else if(x.parameters[J])x.parameters[J]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=
+!0;if(x.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);I=x.parameters.color;C=x.parameters.specular;y=x.parameters.ambient;G=x.parameters.shininess;b.tNormal.texture=M.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)b.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map)b.tDiffuse.texture=x.parameters.map,b.enableDiffuse.value=!0;if(x.parameters.lightMap)b.tAO.texture=x.parameters.lightMap,b.enableAO.value=!0;if(x.parameters.specularMap)b.tSpecular.texture=
+M.textures[x.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(I);b.uSpecularColor.value.setHex(C);b.uAmbientColor.value.setHex(y);b.uShininess.value=G;if(x.parameters.opacity)b.uOpacity.value=x.parameters.opacity;x=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else x=new THREE[x.type](x.parameters);M.materials[v]=x}m();e.callbackSync(M)}},constructor:THREE.SceneLoader};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,j,g,m,n,p,o,t){g=(g-o)/(t-o);o=this.normal_cache;c[j]=m+g*this.delta;c[j+1]=n;c[j+2]=p;h[j]=this.lerp(o[b],o[b+3],g);h[j+1]=this.lerp(o[b+1],o[b+4],g);h[j+2]=this.lerp(o[b+2],o[b+5],g)};this.VIntY=function(b,c,h,j,g,m,n,p,o,t){g=(g-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=n+g*this.delta;c[j+
-2]=p;c=b+this.yd*3;h[j]=this.lerp(o[b],o[c],g);h[j+1]=this.lerp(o[b+1],o[c+1],g);h[j+2]=this.lerp(o[b+2],o[c+2],g)};this.VIntZ=function(b,c,h,j,g,m,n,p,o,t){g=(g-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=n;c[j+2]=p+g*this.delta;c=b+this.zd*3;h[j]=this.lerp(o[b],o[c],g);h[j+1]=this.lerp(o[b+1],o[c+1],g);h[j+2]=this.lerp(o[b+2],o[c+2],g)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,j,g,m){var n=j+1,p=j+this.yd,o=j+this.zd,t=n+this.yd,v=n+this.zd,u=j+this.yd+this.zd,y=n+this.yd+this.zd,z=0,x=this.field[j],w=this.field[n],H=this.field[p],B=this.field[t],J=this.field[o],C=this.field[v],G=this.field[u],O=this.field[y];x<g&&(z|=1);w<g&&(z|=2);H<g&&(z|=8);B<g&&(z|=4);J<g&&(z|=16);C<g&&(z|=32);G<g&&(z|=128);O<g&&(z|=64);var F=THREE.edgeTable[z];if(F==0)return 0;var I=this.delta,
-R=b+I,ca=c+I,I=h+I;F&1&&(this.compNorm(j),this.compNorm(n),this.VIntX(j*3,this.vlist,this.nlist,0,g,b,c,h,x,w));F&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,g,R,c,h,w,B));F&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,g,b,ca,h,H,B));F&8&&(this.compNorm(j),this.compNorm(p),this.VIntY(j*3,this.vlist,this.nlist,9,g,b,c,h,x,H));F&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,g,b,c,I,J,C));F&32&&(this.compNorm(v),
-this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,g,R,c,I,C,O));F&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,g,b,ca,I,G,O));F&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,g,b,c,I,J,G));F&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,g,b,c,h,x,J));F&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,g,R,c,h,w,C));F&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
-3,this.vlist,this.nlist,30,g,R,ca,h,B,O));F&2048&&(this.compNorm(p),this.compNorm(u),this.VIntZ(p*3,this.vlist,this.nlist,33,g,b,ca,h,H,G));z<<=4;for(g=j=0;THREE.triTable[z+g]!=-1;)b=z+g,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],m),g+=3,j++;return j};this.posnormtriv=function(b,c,h,j,g,m){var n=this.count*3;this.positionArray[n]=b[h];this.positionArray[n+1]=b[h+1];this.positionArray[n+2]=b[h+2];this.positionArray[n+3]=b[j];this.positionArray[n+
-4]=b[j+1];this.positionArray[n+5]=b[j+2];this.positionArray[n+6]=b[g];this.positionArray[n+7]=b[g+1];this.positionArray[n+8]=b[g+2];this.normalArray[n]=c[h];this.normalArray[n+1]=c[h+1];this.normalArray[n+2]=c[h+2];this.normalArray[n+3]=c[j];this.normalArray[n+4]=c[j+1];this.normalArray[n+5]=c[j+2];this.normalArray[n+6]=c[g];this.normalArray[n+7]=c[g+1];this.normalArray[n+8]=c[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,j,g){var m=this.size*Math.sqrt(j/g),n=h*this.size,p=c*this.size,o=b*this.size,t=Math.floor(n-m);t<1&&(t=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
-1);for(var y,z,x,w,H,B;t<n;t++){o=this.size2*t;z=t/this.size-h;H=z*z;for(z=v;z<p;z++){x=o+this.size*z;y=z/this.size-c;B=y*y;for(y=u;y<m;y++)w=y/this.size-b,w=j/(1.0E-6+w*w+B+H)-g,w>0&&(this.field[x+y]+=w)}}};this.addPlaneX=function(b,c){var h,j,g,m,n,p=this.size,o=this.yd,t=this.zd,v=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(h=0;h<u;h++)if(j=h/p,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<p;j++){n=h+j*o;for(g=0;g<p;g++)v[t*g+n]+=m}};this.addPlaneY=function(b,c){var h,j,g,m,n,p,o=this.size,t=this.yd,v=
-this.zd,u=this.field,y=o*Math.sqrt(b/c);y>o&&(y=o);for(j=0;j<y;j++)if(h=j/o,h*=h,m=b/(1.0E-4+h)-c,m>0){n=j*t;for(h=0;h<o;h++){p=n+h;for(g=0;g<o;g++)u[v*g+p]+=m}}};this.addPlaneZ=function(b,c){var h,j,g,m,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(g=0;g<dist;g++)if(h=g/size,h*=h,m=b/(1.0E-4+h)-c,m>0){n=zd*g;for(j=0;j<size;j++){p=n+j*yd;for(h=0;h<size;h++)field[p+h]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,j,g,m,n,p,o,t,v=this.size-2;for(g=1;g<v;g++){t=this.size2*g;p=(g-this.halfsize)/this.halfsize;for(j=1;j<v;j++){o=t+this.size*j;n=(j-this.halfsize)/this.halfsize;for(h=1;h<v;h++)m=(h-this.halfsize)/this.halfsize,c=o+h,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(j){var g,m,n,p,o,t,v,u;for(g=0;g<j.count;g++)v=g*3,o=v+1,u=v+2,m=j.positionArray[v],
-n=j.positionArray[o],p=j.positionArray[u],t=new THREE.Vector3(m,n,p),m=j.normalArray[v],n=j.normalArray[o],p=j.normalArray[u],v=new THREE.Vector3(m,n,p),v.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),h.push(v);nfaces=j.count/3;for(g=0;g<nfaces;g++)v=(b+g)*3,o=v+1,u=v+2,t=h[v],m=h[o],n=h[u],v=new THREE.Face3(v,o,u,[t,m,n]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,m,p,n,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[j]=m+h*this.delta;c[j+1]=p;c[j+2]=n;g[j]=this.lerp(o[b],o[b+3],h);g[j+1]=this.lerp(o[b+1],o[b+4],h);g[j+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,j,h,m,p,n,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=p+h*this.delta;c[j+
+2]=n;c=b+this.yd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,j,h,m,p,n,o,t){h=(h-o)/(t-o);o=this.normal_cache;c[j]=m;c[j+1]=p;c[j+2]=n+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,m){var p=j+1,n=j+this.yd,o=j+this.zd,t=p+this.yd,v=p+this.zd,u=j+this.yd+this.zd,w=p+this.yd+this.zd,z=0,y=this.field[j],x=this.field[p],H=this.field[n],B=this.field[t],F=this.field[o],J=this.field[v],D=this.field[u],L=this.field[w];y<h&&(z|=1);x<h&&(z|=2);H<h&&(z|=8);B<h&&(z|=4);F<h&&(z|=16);J<h&&(z|=32);D<h&&(z|=128);L<h&&(z|=64);var G=THREE.edgeTable[z];if(G==0)return 0;var I=this.delta,
+R=b+I,da=c+I,I=g+I;G&1&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,y,x));G&2&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,3,h,R,c,g,x,B));G&4&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,6,h,b,da,g,H,B));G&8&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,y,H));G&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,I,F,J));G&32&&(this.compNorm(v),
+this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,h,R,c,I,J,L));G&64&&(this.compNorm(u),this.compNorm(w),this.VIntX(u*3,this.vlist,this.nlist,18,h,b,da,I,D,L));G&128&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,I,F,D));G&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,y,F));G&512&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,27,h,R,c,g,x,J));G&1024&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*
+3,this.vlist,this.nlist,30,h,R,da,g,B,L));G&2048&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,da,g,H,D));z<<=4;for(h=j=0;THREE.triTable[z+h]!=-1;)b=z+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,m){var p=this.count*3;this.positionArray[p]=b[g];this.positionArray[p+1]=b[g+1];this.positionArray[p+2]=b[g+2];this.positionArray[p+3]=b[j];this.positionArray[p+
+4]=b[j+1];this.positionArray[p+5]=b[j+2];this.positionArray[p+6]=b[h];this.positionArray[p+7]=b[h+1];this.positionArray[p+8]=b[h+2];this.normalArray[p]=c[g];this.normalArray[p+1]=c[g+1];this.normalArray[p+2]=c[g+2];this.normalArray[p+3]=c[j];this.normalArray[p+4]=c[j+1];this.normalArray[p+5]=c[j+2];this.normalArray[p+6]=c[h];this.normalArray[p+7]=c[h+1];this.normalArray[p+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var m=this.size*Math.sqrt(j/h),p=g*this.size,n=c*this.size,o=b*this.size,t=Math.floor(p-m);t<1&&(t=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(n-m);v<1&&(v=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var u=Math.floor(o-m);u<1&&(u=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
+1);for(var w,z,y,x,H,B;t<p;t++){o=this.size2*t;z=t/this.size-g;H=z*z;for(z=v;z<n;z++){y=o+this.size*z;w=z/this.size-c;B=w*w;for(w=u;w<m;w++)x=w/this.size-b,x=j/(1.0E-6+x*x+B+H)-h,x>0&&(this.field[y+w]+=x)}}};this.addPlaneX=function(b,c){var g,j,h,m,p,n=this.size,o=this.yd,t=this.zd,v=this.field,u=n*Math.sqrt(b/c);u>n&&(u=n);for(g=0;g<u;g++)if(j=g/n,j*=j,m=b/(1.0E-4+j)-c,m>0)for(j=0;j<n;j++){p=g+j*o;for(h=0;h<n;h++)v[t*h+p]+=m}};this.addPlaneY=function(b,c){var g,j,h,m,p,n,o=this.size,t=this.yd,v=
+this.zd,u=this.field,w=o*Math.sqrt(b/c);w>o&&(w=o);for(j=0;j<w;j++)if(g=j/o,g*=g,m=b/(1.0E-4+g)-c,m>0){p=j*t;for(g=0;g<o;g++){n=p+g;for(h=0;h<o;h++)u[v*h+n]+=m}}};this.addPlaneZ=function(b,c){var g,j,h,m,p,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,m=b/(1.0E-4+g)-c,m>0){p=zd*h;for(j=0;j<size;j++){n=p+j*yd;for(g=0;g<size;g++)field[n+g]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,m,p,n,o,t,v=this.size-2;for(h=1;h<v;h++){t=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(j=1;j<v;j++){o=t+this.size*j;p=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,p,n,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,m,p,n,o,t,v,u;for(h=0;h<j.count;h++)v=h*3,o=v+1,u=v+2,m=j.positionArray[v],
+p=j.positionArray[o],n=j.positionArray[u],t=new THREE.Vector3(m,p,n),m=j.normalArray[v],p=j.normalArray[o],n=j.normalArray[u],v=new THREE.Vector3(m,p,n),v.normalize(),o=new THREE.Vertex(t),c.vertices.push(o),g.push(v);nfaces=j.count/3;for(h=0;h<nfaces;h++)v=(b+h)*3,o=v+1,u=v+2,t=g[v],m=g[o],p=g[u],v=new THREE.Face3(v,o,u,[t,m,p]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -602,27 +613,27 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
-THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,b.length/20,b.length/5),new THREE.MeshBasicMaterial({color:c}))}function e(b,c){var e=new THREE.Geometry;e.vertices=[new THREE.Vertex,new THREE.Vertex(b)];return new THREE.Line(e,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var f=Math.PI/2,h,b=b||THREE.Trident.defaultParams;if(b!==THREE.Trident.defaultParams)for(h in THREE.Trident.defaultParams)b.hasOwnProperty(h)||(b[h]=THREE.Trident.defaultParams[h]);
-this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)h=c(b.xAxisColor),h.rotation.y=-f,h.position.x=b.length,this.addChild(h),h=c(b.yAxisColor),h.rotation.x=f,h.position.y=b.length,this.addChild(h),h=c(b.zAxisColor),h.rotation.y=Math.PI,h.position.z=b.length,this.addChild(h)};
+THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,b.length/20,b.length/5),new THREE.MeshBasicMaterial({color:c}))}function e(b,c){var e=new THREE.Geometry;e.vertices=[new THREE.Vertex,new THREE.Vertex(b)];return new THREE.Line(e,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var f=Math.PI/2,g,b=b||THREE.Trident.defaultParams;if(b!==THREE.Trident.defaultParams)for(g in THREE.Trident.defaultParams)b.hasOwnProperty(g)||(b[g]=THREE.Trident.defaultParams[g]);
+this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
 THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
 THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,j=0;c=0;for(e=this.colliders.length;c<e;c++)if(h=this.colliders[c],f=this.rayCast(b,h),f<Number.MAX_VALUE)h.distance=f,f>j?this.hits.push(h):this.hits.unshift(h),j=f;return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,j=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>j?this.hits.push(g):this.hits.unshift(g),j=f;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
 THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,j=0;j<c.numFaces;j++){var g=c.mesh.geometry.faces[j],m=c.mesh.geometry.vertices[g.a].position,n=c.mesh.geometry.vertices[g.b].position,p=c.mesh.geometry.vertices[g.c].position,o=g instanceof THREE.Face4?c.mesh.geometry.vertices[g.d].position:null;g instanceof THREE.Face3?(g=this.rayTriangle(e,m,n,p,f,this.collisionNormal,c.mesh),g<f&&(f=g,h=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-g instanceof THREE.Face4&&(g=this.rayTriangle(e,m,n,o,f,this.collisionNormal,c.mesh),g<f&&(f=g,h=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),g=this.rayTriangle(e,n,p,o,f,this.collisionNormal,c.mesh),g<f&&(f=g,h=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:h}};
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,h,j,g){var m=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;j.set(0,0,0);m.sub(e,c);n.sub(f,e);j.cross(m,n);m=j.dot(b.direction);if(!(m<0))if(g.doubleSided||g.flipSided)j.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;g=j.dot(c)-j.dot(b.origin);if(!(g<=0))return Number.MAX_VALUE;if(!(g>=m*h))return Number.MAX_VALUE;g/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(g);m.addSelf(b.origin);Math.abs(j.x)>
-Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=m.y-c.y,j=e.y-c.y,h=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,h=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=m.x-c.x,j=e.x-c.x,h=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,h=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return g};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,j=0;j<c.numFaces;j++){var h=c.mesh.geometry.faces[j],m=c.mesh.geometry.vertices[h.a].position,p=c.mesh.geometry.vertices[h.b].position,n=c.mesh.geometry.vertices[h.c].position,o=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,m,p,n,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+h instanceof THREE.Face4&&(h=this.rayTriangle(e,m,p,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,p,n,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,j,h){var m=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;j.set(0,0,0);m.sub(e,c);p.sub(f,e);j.cross(m,p);m=j.dot(b.direction);if(!(m<0))if(h.doubleSided||h.flipSided)j.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;h=j.dot(c)-j.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(j.x)>
+Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=m.y-c.y,j=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,j=0,g=0,m=0,n=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,g=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,g=1);e.origin.y<c.min.y?(h=c.min.y-e.origin.y,h/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y,
-p=!1,m=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;h>f&&(p=1,f=h);j>f&&(p=2,f=j);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(g,0,0);break;case 1:g=e.origin.x+e.direction.x*f;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
-f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:g=e.origin.x+e.direction.x*f;if(g<c.min.x||g>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,j=0,h=0,m=0,p=0,n=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,n=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,n=!1,h=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,n=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
+n=!1,m=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,n=!1,p=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,n=!1,p=1);if(n)return-1;n=0;g>f&&(n=1,f=g);j>f&&(n=2,f=j);switch(n){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
+f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,j=new THREE.Camera,g=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;h.useTarget=j.useTarget=!1;h.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,p,n,o;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var w=e.projectionMatrix.clone(),H=125/30*0.5,B=H*p/125,J=p*Math.tan(o*Math.PI/360),C;g.n14=H;m.n14=-H;H=-J*n+B;C=J*n+B;w.n11=2*p/(C-H);w.n13=(C+H)/(C-H);h.projectionMatrix=w.clone();H=-J*n-B;C=J*n-B;w.n11=2*p/(C-H);
-w.n13=(C+H)/(C-H);j.projectionMatrix=w.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);j.matrix=e.matrixWorld.clone().multiplySelf(g);j.update(null,!0);j.position.copy(e.position);j.near=p;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,y,u)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,j,g=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;j=f};this.render=function(b,e){this.clear();g.fov=e.fov;g.aspect=0.5*e.aspect;g.near=e.near;g.far=e.far;
-g.updateProjectionMatrix();g.position.copy(e.position);g.target.position.copy(e.target.position);g.translateX(c.separation);m.projectionMatrix=g.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,h,j);f.call(c,b,g);this.setViewport(h,0,h,j);f.call(c,b,m,!1)}};
+var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||n!==e.near||o!==e.fov){p=e.aspect;n=e.near;o=e.fov;var x=e.projectionMatrix.clone(),H=125/30*0.5,B=H*n/125,F=n*Math.tan(o*Math.PI/360),J;h.n14=H;m.n14=-H;H=-F*p+B;J=F*p+B;x.n11=2*n/(J-H);x.n13=(J+H)/(J-H);g.projectionMatrix=x.clone();H=-F*p-B;J=F*p-B;x.n11=2*n/(J-H);
+x.n13=(J+H)/(J-H);j.projectionMatrix=x.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=n;g.far=e.far;f.call(c,b,g,t,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=n;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,u)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
+h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,m,!1)}};

+ 106 - 95
build/custom/ThreeExtras.js

@@ -1,8 +1,8 @@
 // ThreeExtras.js r42 - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.ColorUtils.clamp(f.h+b,0,1);f.s=THREE.ColorUtils.clamp(f.s+c,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),g=Math.min(Math.min(c,e),f);if(g==h)g=c=0;else{var j=h-g,g=j/h,c=c==h?(e-f)/j:e==h?2+(f-c)/j:4+(c-e)/j;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=h;return b},
 clamp:function(a,b,c){return a<b?b:a>c?c:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,h=a.vertices,g=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=g.length;m<n;m++){var o=new THREE.Vertex(g[m].position.clone());c&&b.matrix.multiplyVector3(o.position);h.push(o)}m=0;for(n=k.length;m<n;m++){var g=k[m],t,u,w=g.vertexNormals,o=g.vertexColors;g instanceof THREE.Face3?t=new THREE.Face3(g.a+e,g.b+e,g.c+
-e):g instanceof THREE.Face4&&(t=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));t.normal.copy(g.normal);c=0;for(h=w.length;c<h;c++)u=w[c],t.vertexNormals.push(u.clone());t.color.copy(g.color);c=0;for(h=o.length;c<h;c++)u=o[c],t.vertexColors.push(u.clone());t.materials=g.materials.slice();t.centroid.copy(g.centroid);j.push(t)}m=0;for(n=f.length;m<n;m++){e=f[m];j=[];c=0;for(h=e.length;c<h;c++)j.push(new THREE.UV(e[c].u,e[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,
+THREE.GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,f=c?b.geometry:b,h=a.vertices,g=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=g.length;m<n;m++){var o=new THREE.Vertex(g[m].position.clone());c&&b.matrix.multiplyVector3(o.position);h.push(o)}m=0;for(n=k.length;m<n;m++){var g=k[m],t,v,u=g.vertexNormals,o=g.vertexColors;g instanceof THREE.Face3?t=new THREE.Face3(g.a+e,g.b+e,g.c+
+e):g instanceof THREE.Face4&&(t=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));t.normal.copy(g.normal);c=0;for(h=u.length;c<h;c++)v=u[c],t.vertexNormals.push(v.clone());t.color.copy(g.color);c=0;for(h=o.length;c<h;c++)v=o[c],t.vertexColors.push(v.clone());t.materials=g.materials.slice();t.centroid.copy(g.centroid);j.push(t)}m=0;for(n=f.length;m<n;m++){e=f[m];j=[];c=0;for(h=e.length;c<h;c++)j.push(new THREE.UV(e[c].u,e[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,
 h=a.faceVertexUvs[0],a=0;for(c=e.length;a<c;a++){var g=new THREE.Vertex(e[a].position.clone());b.vertices.push(g)}a=0;for(c=f.length;a<c;a++){var j=f[a],k,l,m=j.vertexNormals,n=j.vertexColors;j instanceof THREE.Face3?k=new THREE.Face3(j.a,j.b,j.c):j instanceof THREE.Face4&&(k=new THREE.Face4(j.a,j.b,j.c,j.d));k.normal.copy(j.normal);e=0;for(g=m.length;e<g;e++)l=m[e],k.vertexNormals.push(l.clone());k.color.copy(j.color);e=0;for(g=n.length;e<g;e++)l=n[e],k.vertexColors.push(l.clone());k.materials=j.materials.slice();
 k.centroid.copy(j.centroid);b.faces.push(k)}a=0;for(c=h.length;a<c;a++){f=h[a];k=[];e=0;for(g=f.length;e<g;e++)k.push(new THREE.UV(f[e].u,f[e].v));b.faceVertexUvs[0].push(k)}return b},randomPointInTriangle:function(a,b,c){var e,f,h,g=new THREE.Vector3,j=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;g.copy(a);g.multiplyScalar(e);j.copy(b);j.multiplyScalar(f);g.addSelf(j);j.copy(c);j.multiplyScalar(h);g.addSelf(j);return g},randomPointInFace:function(a,
 b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position,h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),g=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(e,
@@ -30,8 +30,8 @@ THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.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];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)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix: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,h,g,j,k,l,m=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,u=this.hierarchy.length;t<u;t++)if(a=this.hierarchy[t],k=a.animationCache,this.JITCompile&&m[t][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){c=b[w];g=k.prevKey[c];j=k.nextKey[c];if(j.time<=o){if(n<o)if(this.loop){g=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(c,t,1);j.time<n;)g=j,j=this.getNextKeyWith(c,t,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,t,j.index+1);while(j.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,h,g,j,k,l,m=this.data.JIT.hierarchy,n,o;this.currentTime+=a*this.timeScale;o=this.currentTime;n=this.currentTime%=this.data.length;l=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,v=this.hierarchy.length;t<v;t++)if(a=this.hierarchy[t],k=a.animationCache,this.JITCompile&&m[t][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=m[t][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var u=0;u<3;u++){c=b[u];g=k.prevKey[c];j=k.nextKey[c];if(j.time<=o){if(n<o)if(this.loop){g=this.data.hierarchy[t].keys[0];for(j=this.getNextKeyWith(c,t,1);j.time<n;)g=j,j=this.getNextKeyWith(c,t,j.index+1)}else{this.stop();return}else{do g=j,j=this.getNextKeyWith(c,t,j.index+1);while(j.time<
 n)}k.prevKey[c]=g;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(n-g.time)/(j.time-g.time);f=g[c];h=j[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+t),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",t,g.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",t,j.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],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,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)m[t][l]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
@@ -48,7 +48,7 @@ this.moveRight&&this.translateX(b);this.moveUp&&this.translateY(b);this.moveDown
 1;this.constrainVertical&&(a=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;a=this.target.position;f=this.position;a.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=f.y+100*Math.cos(this.phi);a.z=f.z+100*Math.sin(this.phi)*
 Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);if(this.noFly)b.y=0;this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};
-THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),j=c.getLength(),k=f.length,v=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)v=e*j.chunks[h]/j.total,c.keys[h]={time:v,pos:f[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
+THREE.PathCamera=function(a){function b(a,c,b,e){var g={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),j=c.getLength(),k=f.length,w=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)w=e*j.chunks[h]/j.total,c.keys[h]={time:w,pos:f[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
 e,g=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),g.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}function e(a,b){var e=c(b,10),g=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.addChild(lineObj);particleObj.scale.set(1,1,1);a.addChild(particleObj);g=new THREE.SphereGeometry(1,
 16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(g,h),e.position.copy(b.points[i]),e.updateMatrix(),a.addChild(e)}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.lookHorizontal=
 this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==void 0)this.duration=a.duration*1E3;if(a.waypoints!==void 0)this.waypoints=a.waypoints;if(a.useConstantSpeed!==void 0)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==void 0)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==void 0)this.createDebugPath=a.createDebugPath;if(a.createDebugDummy!==
@@ -68,74 +68,83 @@ this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,this.mouseup),!1);window.addEventListener("keydown",b(this,this.keydown),!1);window.addEventListener("keyup",b(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,t=0,u=0,w=window.innerWidth/2,y=window.innerHeight/2;this.update=
-function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*t),this.rotateVertically(a*u));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*o);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(a,b,c,e){THREE.Camera.call(this,a,b,c,e);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,t=0,v=0,u=window.innerWidth/2,x=window.innerHeight/2;this.update=
+function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.delta=(a-this.lastUpdate)/1E3;this.lastUpdate=a;this.mouseLook&&(a=this.delta*this.lookSpeed,this.rotateHorizontally(a*t),this.rotateVertically(a*v));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*o);k&&(this.roll+=this.rollSpeed*this.delta*l);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);h.set(0,1,0);f.cross(h,g).normalize();h.cross(g,f).normalize();this.matrix.n11=f.x;this.matrix.n12=h.x;this.matrix.n13=g.x;this.matrix.n21=f.y;this.matrix.n22=h.y;this.matrix.n23=g.y;this.matrix.n31=f.z;this.matrix.n32=h.z;this.matrix.n33=g.z;j.identity();j.n11=Math.cos(this.roll);j.n12=-Math.sin(this.roll);j.n21=Math.sin(this.roll);j.n22=Math.cos(this.roll);this.matrix.multiplySelf(j);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(a){this.position.x+=this.matrix.n11*a;this.position.y+=this.matrix.n21*a;this.position.z+=this.matrix.n31*a};this.translateY=function(a){this.position.x+=this.matrix.n12*a;this.position.y+=this.matrix.n22*a;this.position.z+=this.matrix.n32*a};this.translateZ=function(a){this.position.x-=this.matrix.n13*a;this.position.y-=
 this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(a);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(a){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(a);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(a){t=(a.clientX-w)/window.innerWidth;u=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:n=-1;break;
+function(a){t=(a.clientX-u)/window.innerWidth;v=(a.clientY-x)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=1;break;case 2:m=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:m=0;break;case 2:m=0}},!1);this.domElement.addEventListener("keydown",function(a){switch(a.keyCode){case 38:case 87:m=1;break;case 37:case 65:n=-1;break;
 case 40:case 83:m=-1;break;case 39:case 68:n=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:o=1;break;case 70:o=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:m=0;break;case 37:case 65:n=0;break;case 40:case 83:m=0;break;case 39:case 68:n=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:o=0;break;case 70:o=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera=function(a){function b(a,c){return function(){c.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
-!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var c=!1,e=this.STATE.NONE,f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-
-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(f).setLength(b.x));e.addSelf(f.setLength(b.z));return e};
-this.rotateCamera=function(){var a=Math.acos(h.dot(g)/h.length()/g.length());if(a){var c=(new THREE.Vector3).cross(h,g).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(f);b.multiplyVector3(this.up);b.multiplyVector3(g);this.staticMoving?h=g:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),this.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};
+THREE.TrackballCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}a=a||{};THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.domElement=a.domElement||document;this.screen=a.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=a.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=a.rotateSpeed||1;this.zoomSpeed=a.zoomSpeed||1.2;this.panSpeed=a.panSpeed||0.3;this.noZoom=a.noZoom||!1;this.noPan=a.noPan||
+!1;this.staticMoving=a.staticMoving||!1;this.dynamicDampingFactor=a.dynamicDampingFactor||0.2;this.minDistance=a.minDistance||0;this.maxDistance=a.maxDistance||Infinity;this.keys=a.keys||[65,83,68];this.useTarget=!0;var c=!1,e=this.STATE.NONE,f=new THREE.Vector3,h=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-
+this.screen.offsetLeft)/this.radius*0.5,(b-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var c=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-b)/this.radius,0),e=c.length();e>1?c.normalize():c.z=Math.sqrt(1-e*e);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(c.y);e.addSelf(this.up.clone().crossSelf(f).setLength(c.x));e.addSelf(f.setLength(c.z));return e};
+this.rotateCamera=function(){var a=Math.acos(h.dot(g)/h.length()/g.length());if(a){var b=(new THREE.Vector3).cross(h,g).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(f);c.multiplyVector3(this.up);c.multiplyVector3(g);this.staticMoving?h=g:(c.setFromAxisAngle(b,a*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*this.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),this.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};
 this.panCamera=function(){var a=m.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(a.x);c.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?l=m:l.addSelf(a.sub(m,l).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
 f.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,f.setLength(this.minDistance))};this.update=function(a,c,b){f=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,f);this.checkDistances();this.supr.update.call(this,a,c,b)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
 b(this,function(a){c&&(h=g=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?g=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):e===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",b(this,function(a){a.preventDefault();
 a.stopPropagation();if(e===this.STATE.NONE)e=a.button,e===this.STATE.ROTATE?h=g=this.getMouseProjectionOnBall(a.clientX,a.clientY):e===this.STATE.ZOOM&&!this.noZoom?j=k=this.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=m=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",b(this,function(a){a.preventDefault();a.stopPropagation();e=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(e===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])e=
 this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheLengths&&this.cacheLengths.length==a)return this.cacheLengths;var b=[],c,e=this.getPoint(0),f,h=0;for(f=1;f<=a;f++)c=this.getPoint(f/a),h+=c.distanceTo(e),b.push(h),e=c;return this.cacheLengths=b};
-THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,f=c.length,h;for(h=b?b:a*c[f-1];e<f;){if(c[e]>h)break;e++}return e/f};THREE.LineCurve=function(a,b,c,e){this.x1=a;this.y1=b;this.x2=c;this.y2=e};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){return new THREE.Vector2(this.x1+(this.x2-this.x1)*a,this.y1+(this.y2-this.y1)*a)};
-THREE.QuadraticBezierCurve=function(a,b,c,e,f,h){this.x0=a;this.y0=b;this.x1=c;this.y1=e;this.x2=f;this.y2=h};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.x0,this.x1,this.x2);a=THREE.Shape.Utils.b2(a,this.y0,this.y1,this.y2);return new THREE.Vector2(b,a)};
-THREE.QuadraticBezierCurve.prototype.getNormalVector=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.x0,this.x1,this.x2);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.y0,this.y1,this.y2);return(new THREE.Vector2(-a,b)).unit()};THREE.CubicBezierCurve=function(a,b,c,e,f,h,g,j){this.x0=a;this.y0=b;this.x1=c;this.y1=e;this.x2=f;this.y2=h;this.x3=g;this.y3=j};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
-THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.x0,this.x1,this.x2,this.x3);a=THREE.Shape.Utils.b3(a,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(b,a)};THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
+THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
+THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,e=this.getPoint(0),f,h=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),h+=c.distanceTo(e),b.push(h),e=c;return this.cacheArcLengths=b};
+THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,f=c.length,h;h=b?b:a*c[f-1];time=Date.now();for(var g=0,j=f-1,k;g<=j;)if(e=Math.floor(g+(j-g)/2),k=c[e]-h,k<0)g=e+1;else if(k>0)j=e-1;else{j=e;break}e=j;if(c[e]==h)return e/(f-1);g=c[e];return c=(e+(h-g)/(c[e+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
+THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);var b=this.getPoint(b),a=this.getPoint(a),c=new THREE.Vector2;c.sub(a,b);return c.unit()};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,b,c,e){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,e))};THREE.LineCurve.prototype=new THREE.Curve;
+THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
+THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
+THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
+THREE.CubicBezierCurve=function(a,b,c,e){if(!(b instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),b=new THREE.Vector2(f[2],f[3]),c=new THREE.Vector2(f[4],f[5]),e=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
+THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};
+THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
 THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>e.length-2?a:a+1;c[3]=a>e.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(e[c[0]].x,e[c[1]].x,e[c[2]].x,e[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(e[c[0]].y,e[c[1]].y,e[c[2]].y,e[c[3]].y,f);return b};THREE.ArcCurve=function(a,b,c,e,f,h){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=h};
 THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*b;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,e){return 2*(1-a)*(c-b)+2*a*(e-c)},tangentSpline:function(){},interpolate:function(a,b,c,e,f){var a=(c-a)*0.5,e=(e-b)*0.5,h=f*f;return(2*b-2*c+a+e)*f*h+(-3*b+3*c-2*a-e)*h+a*f+b}};THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};
-THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(v2,v1);b.multiplyScalar(a);b.addSelf(this.v1);return b});THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
-THREE.Path=function(a){this.actions=[];this.curves=[];a&&this.fromPoints(a)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};
-THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=new THREE.LineCurve(e[e.length-2],e[e.length-1],a,b);this.curves.push(e);this.actions.push({action:THREE.PathActions.LINE_TO,args:c,curve:e})};
-THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.QuadraticBezierCurve(h[h.length-2],h[h.length-1],a,b,c,e);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f,curve:h})};
-THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args,j=new THREE.CubicBezierCurve(j[j.length-2],j[j.length-1],a,b,c,e,f,h);this.curves.push(j);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g,curve:j})};
-THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])],c=c.concat(a),c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b,curve:c})};
-THREE.Path.prototype.arc=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],e=0;e<a;e++)c.push(this.getPoint(e/a));b&&c.push(c[0]);return c};
-THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,g,j,k,l,m,n,o,t,u,w;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=h[2];k=h[3];n=h[0];o=h[1];c.length>0?(g=c[c.length-1],t=g.x,u=g.y):(g=this.actions[e-1].args,t=g[g.length-2],u=g[g.length-1]);for(g=1;g<=a;g++)w=g/a,h=THREE.Shape.Utils.b2(w,t,n,j),w=THREE.Shape.Utils.b2(w,u,o,
-k),c.push(new THREE.Vector2(h,w));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];o=h[1];l=h[2];m=h[3];c.length>0?(g=c[c.length-1],t=g.x,u=g.y):(g=this.actions[e-1].args,t=g[g.length-2],u=g[g.length-1]);for(g=1;g<=a;g++)w=g/a,h=THREE.Shape.Utils.b3(w,t,n,l,j),w=THREE.Shape.Utils.b3(w,u,o,m,k),c.push(new THREE.Vector2(h,w));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];w=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
-for(g=1;g<=w;g++)c.push(h.getPointAt(g/w));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;j=h[0];k=h[1];l=h[2];n=h[3];w=h[4];o=!!h[5];m=g[g.length-2];t=g[g.length-1];g.length==0&&(m=t=0);u=w-n;var y=a*2;for(g=1;g<=y;g++)w=g/y,o||(w=1-w),w=n+w*u,h=m+j+l*Math.cos(w),w=t+k+l*Math.sin(w),c.push(new THREE.Vector2(h,w))}b&&c.push(c[0]);return c};
-THREE.Path.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,e,f;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,g,j,k;k=new THREE.Vector2;g=0;for(j=a.length;g<j;g++){h=a[g];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<c)f=h.y;k.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:b,maxY:c,centroid:k.divideScalar(j)}};
-THREE.Path.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.sums,a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.Path.prototype.getLength=function(){var a=[],b=0,c,e=this.curves.length;for(c=0;c<e;c++)b+=this.curves[c].getLength(),a.push(b);this.sums=a;return b};THREE.Path.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
-THREE.Path.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.Path.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};
-THREE.Path.prototype.transform=function(a){a=new THREE.Path;a.moveTo(0,0);a.quadraticCurveTo(100,20,140,80);console.log(a.cacheArcLengths());var b=this.getBoundingBox(),c=this.getPoints(),e,f,h,g,j,k;e=0;for(f=c.length;e<f;e++)h=c[e],g=h.x,j=h.y,k=g/b.maxX,g=a.getPoint(k),j=a.getNormalVector(k).multiplyScalar(j),h.x=g.x+j.x,h.y=g.y+j.y;return c};
+THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,e){return 2*(1-a)*(c-b)+2*a*(e-c)},tangentCubicBezier:function(a,b,c,e,f){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,e,f){var a=(c-a)*0.5,e=(e-b)*0.5,h=f*f;return(2*b-2*c+a+e)*f*h+(-3*b+3*c-2*a-e)*h+a*f+b}};
+THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(v2,v1);b.multiplyScalar(a);b.addSelf(this.v1);return b});
+THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};
+THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
+THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,e=this.curves.length;for(c=0;c<e;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,e,f;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,g,j,k;k=new THREE.Vector2;g=0;for(j=a.length;g<j;g++){h=a[g];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<c)f=h.y;k.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:b,maxY:c,centroid:k.divideScalar(j)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
+THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
+THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};
+THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),e,f,h,g,j,k;e=0;for(f=a.length;e<f;e++)h=a[e],g=h.x,j=h.y,k=g/c.maxX,k=b.getUtoTmapping(k,g),g=b.getPoint(k),j=b.getNormalVector(k).multiplyScalar(j),h.x=g.x+j.x,h.y=g.y+j.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
+THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
+THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
+THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
+THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(j[j.length-2],j[j.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})};
+THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])],c=c.concat(a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,e,f,h){var g=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:g})};
+THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,g,j,k,l,m,n,o,t,v,u;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],g=h.action,h=h.args,g){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=h[2];k=h[3];n=h[0];o=h[1];c.length>0?(g=c[c.length-1],t=g.x,v=g.y):(g=this.actions[e-1].args,t=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b2(u,t,n,j),u=THREE.Shape.Utils.b2(u,v,o,
+k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];o=h[1];l=h[2];m=h[3];c.length>0?(g=c[c.length-1],t=g.x,v=g.y):(g=this.actions[e-1].args,t=g[g.length-2],v=g[g.length-1]);for(g=1;g<=a;g++)u=g/a,h=THREE.Shape.Utils.b3(u,t,n,l,j),u=THREE.Shape.Utils.b3(u,v,o,m,k),c.push(new THREE.Vector2(h,u));break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[e-1].args;g=[new THREE.Vector2(g[g.length-2],g[g.length-1])];u=a*h[0].length;g=g.concat(h[0]);h=new THREE.SplineCurve(g);
+for(g=1;g<=u;g++)c.push(h.getPointAt(g/u));break;case THREE.PathActions.ARC:g=this.actions[e-1].args;j=h[0];k=h[1];l=h[2];n=h[3];u=h[4];o=!!h[5];m=g[g.length-2];t=g[g.length-1];g.length==0&&(m=t=0);v=u-n;var x=a*2;for(g=1;g<=x;g++)u=g/x,o||(u=1-u),u=n+u*v,h=m+j+l*Math.cos(u),u=t+k+l*Math.sin(u),c.push(new THREE.Vector2(h,u))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
 THREE.Path.prototype.nltransform=function(a,b,c,e,f,h){var g=this.getPoints(),j,k,l,m,n;j=0;for(k=g.length;j<k;j++)l=g[j],m=l.x,n=l.y,l.x=a*m+b*n+c,l.y=e*n+f*m+h;return g};
 THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,e,f,a=0;for(c=this.actions.length;a<c;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&b[e].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";e=
 this.getPoints();a=0;for(c=e.length;a<c;a++)f=e[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,b,c,e,f=[],h=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],e=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(f.push(h),h=new THREE.Path),h[c].apply(h,e);h.actions.length!=0&&f.push(h);if(f.length==0)return[];var g,h=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g&&h.push(g),g=new THREE.Shape,g.actions=e.actions,g.curves=
 e.curves):g.holes.push(e);h.push(g)}else{g=new THREE.Shape;a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(g.actions=e.actions,g.curves=e.curves,h.push(g),g=new THREE.Shape):g.holes.push(e)}return h};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
-THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints(a);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints(a);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,g,j,k,l,m,n,o,t,u=[];for(k=0;k<b.length;k++){l=b[k];e=e.concat(l);h=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){o=l[f];t=[];for(n=0;n<c.length;n++)m=c[n],m=o.distanceToSquared(m),t.push(m),m<h&&(h=m,g=f,j=n)}f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;var w=[l[g],c[j],c[f]];n=THREE.FontUtils.Triangulate.area(w);var y=[l[g],l[h],c[j]];o=THREE.FontUtils.Triangulate.area(y);t=j;m=g;j+=1;g+=-1;j<0&&(j+=c.length);j%=
-c.length;g<0&&(g+=l.length);g%=l.length;f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;w=[l[g],c[j],c[f]];w=THREE.FontUtils.Triangulate.area(w);y=[l[g],l[h],c[j]];y=THREE.FontUtils.Triangulate.area(y);n+o>w+y&&(j=t,g=m,j<0&&(j+=c.length),j%=c.length,g<0&&(g+=l.length),g%=l.length,f=j-1>=0?j-1:c.length-1,h=g-1>=0?g-1:l.length-1);n=c.slice(0,j);o=c.slice(j);t=l.slice(g);m=l.slice(0,g);h=[l[g],l[h],c[j]];u.push([l[g],c[j],c[f]]);u.push(h);c=n.concat(t).concat(m).concat(o)}return{shape:c,isolatedPts:u,
+THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
+THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,g,j,k,l,m,n,o,t,v=[];for(k=0;k<b.length;k++){l=b[k];e=e.concat(l);h=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){o=l[f];t=[];for(n=0;n<c.length;n++)m=c[n],m=o.distanceToSquared(m),t.push(m),m<h&&(h=m,g=f,j=n)}f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;var u=[l[g],c[j],c[f]];n=THREE.FontUtils.Triangulate.area(u);var x=[l[g],l[h],c[j]];o=THREE.FontUtils.Triangulate.area(x);t=j;m=g;j+=1;g+=-1;j<0&&(j+=c.length);j%=
+c.length;g<0&&(g+=l.length);g%=l.length;f=j-1>=0?j-1:c.length-1;h=g-1>=0?g-1:l.length-1;u=[l[g],c[j],c[f]];u=THREE.FontUtils.Triangulate.area(u);x=[l[g],l[h],c[j]];x=THREE.FontUtils.Triangulate.area(x);n+o>u+x&&(j=t,g=m,j<0&&(j+=c.length),j%=c.length,g<0&&(g+=l.length),g%=l.length,f=j-1>=0?j-1:c.length-1,h=g-1>=0?g-1:l.length-1);n=c.slice(0,j);o=c.slice(j);t=l.slice(g);m=l.slice(0,g);h=[l[g],l[h],c[j]];v.push([l[g],c[j],c[f]]);v.push(h);c=n.concat(t).concat(m).concat(o)}return{shape:c,isolatedPts:v,
 allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,g,j,k,l={};h=0;for(g=e.length;h<g;h++)k=e[h].x+":"+e[h].y,l[k]!==void 0&&console.log("Duplicate point",k),l[k]=h;h=0;for(g=c.length;h<g;h++){j=c[h];for(e=0;e<3;e++)k=j[e].x+":"+j[e].y,k=l[k],k!==void 0&&(j[e]=k)}h=0;for(g=f.length;h<g;h++){j=f[h];for(e=0;e<3;e++)k=j[e].x+":"+j[e].y,k=l[k],k!==void 0&&(j[e]=k)}return c.concat(f)},isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<
 0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+this.b3p3(a,f)}};
 THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,e=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",h=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,e=a.length;c<e;c++)b=b.concat(a[c].toShapes());return b};
-THREE.CubeGeometry=function(a,b,c,e,f,h,g,j,k){function l(a,c,b,g,j,k,l,n){var t,o,u=e||1,w=f||1,E=j/2,F=k/2,L=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")t="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")t="y",w=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")t="x",u=h||1;var M=u+1,O=w+1;j/=u;var Q=k/w;for(o=0;o<O;o++)for(k=0;k<M;k++){var C=new THREE.Vector3;C[a]=(k*j-E)*b;C[c]=(o*Q-F)*g;C[t]=l;m.vertices.push(new THREE.Vertex(C))}for(o=0;o<w;o++)for(k=0;k<u;k++)m.faces.push(new THREE.Face4(k+M*o+
-L,k+M*(o+1)+L,k+1+M*(o+1)+L,k+1+M*o+L,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/u,o/w),new THREE.UV(k/u,(o+1)/w),new THREE.UV((k+1)/u,(o+1)/w),new THREE.UV((k+1)/u,o/w)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,t=c/2,j=j?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var w in k)this.sides[w]!=void 0&&(this.sides[w]=
-k[w]);this.sides.px&&l("z","y",1*j,-1,c,b,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,c,b,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,c,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=m.vertices.length;b<e;b++){for(var g=m.vertices[b],h=!1,f=0,j=a.length;f<j;f++){var k=a[f];if(g.position.x==k.position.x&&
+THREE.CubeGeometry=function(a,b,c,e,f,h,g,j,k){function l(a,c,b,g,j,k,l,n){var t,o,v=e||1,u=f||1,E=j/2,F=k/2,L=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")t="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")t="y",u=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")t="x",v=h||1;var M=v+1,O=u+1;j/=v;var Q=k/u;for(o=0;o<O;o++)for(k=0;k<M;k++){var C=new THREE.Vector3;C[a]=(k*j-E)*b;C[c]=(o*Q-F)*g;C[t]=l;m.vertices.push(new THREE.Vertex(C))}for(o=0;o<u;o++)for(k=0;k<v;k++)m.faces.push(new THREE.Face4(k+M*o+
+L,k+M*(o+1)+L,k+1+M*(o+1)+L,k+1+M*o+L,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/v,o/u),new THREE.UV(k/v,(o+1)/u),new THREE.UV((k+1)/v,(o+1)/u),new THREE.UV((k+1)/v,o/u)])}THREE.Geometry.call(this);var m=this,n=a/2,o=b/2,t=c/2,j=j?-1:1;if(g!==void 0)if(g instanceof Array)this.materials=g;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var u in k)this.sides[u]!=void 0&&(this.sides[u]=
+k[u]);this.sides.px&&l("z","y",1*j,-1,c,b,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,c,b,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,c,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=m.vertices.length;b<e;b++){for(var g=m.vertices[b],h=!1,f=0,j=a.length;f<j;f++){var k=a[f];if(g.position.x==k.position.x&&
 g.position.y==k.position.y&&g.position.z==k.position.z){c[b]=f;h=!0;break}}if(!h)c[b]=a.length,a.push(new THREE.Vertex(g.position.clone()))}b=0;for(e=m.faces.length;b<e;b++)g=m.faces[b],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];m.vertices=a})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
 THREE.CylinderGeometry=function(a,b,c,e,f,h){function g(a,c,b){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}THREE.Geometry.call(this);var j=this,k,l=Math.PI*2,m=e/2;for(k=0;k<a;k++)g(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)g(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,m);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(c>0){g(0,0,-m-(h||0));for(k=a;k<a+a/2;k++)j.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(b>0){g(0,0,m+
 (f||0));for(k=a+a/2;k<2*a;k++)j.faces.push(new THREE.Face4(2*a+1,(2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a))}k=0;for(a=this.faces.length;k<a;k++){var b=[],c=this.faces[k],f=this.vertices[c.a],h=this.vertices[c.b],m=this.vertices[c.c],n=this.vertices[c.d];b.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/e));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
 e));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/e));this.faceVertexUvs[0].push(b)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){if(typeof a!="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;for(c=0;c<e;c++)f=a[c],this.addShape(f,b)}};
 THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,j=THREE.ExtrudeGeometry.__v5,k=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);g.set(a.x-b.x,a.y-b.y);e=e.normalize();g=g.normalize();h.set(-e.y,e.x);f.set(g.y,-g.x);j.copy(a).addSelf(h);k.copy(a).addSelf(f);if(j.equals(k))return f.clone();
-j.copy(c).addSelf(h);k.copy(b).addSelf(f);h=e.dot(f);f=k.subSelf(j).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(j).subSelf(a).clone()}function f(a){for(z=a.length;--z>=0;){K=z;N=z-1;N<0&&(N=a.length-
-1);for(var c=0,c=0;c<t+m*2;c++){var b=L*c,e=L*(c+1),g=R+K+b,b=R+N+b,h=R+N+e,e=R+K+e;g+=B;b+=B;h+=B;e+=B;A.faces.push(new THREE.Face4(g,b,h,e))}}}function h(a,c,b){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b){a+=B;c+=B;b+=B;A.faces.push(new THREE.Face3(a,c,b))}var j=b.amount!==void 0?b.amount:100,k=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:k-2,m=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:
-!0,o=b.curveSegments!==void 0?b.curveSegments:12,t=b.steps!==void 0?b.steps:1,u=b.path!==void 0?b.path:null,w,y=!1;if(u)w=u.getPoints(o),t=w.length,y=!0,n=!1;n||(l=k=m=0);var x,v,p,A=this,B=this.vertices.length,o=a.extractAllPoints(o),u=o.shape,o=o.holes,G=!THREE.Shape.Utils.isClockWise(u);if(G){u=u.reverse();v=0;for(p=o.length;v<p;v++)x=o[v],THREE.Shape.Utils.isClockWise(x)&&(o[v]=x.reverse());G=!1}var G=THREE.Shape.Utils.triangulateShape(u,o),H=u;v=0;for(p=o.length;v<p;v++)x=o[v],u=u.concat(x);
-var z,D,J,I,E,F,L=u.length,M=G.length,O=[];z=0;D=H.length;K=D-1;for(N=z+1;z<D;z++,K++,N++)K==D&&(K=0),N==D&&(N=0),O[z]=e(H[z],H[K],H[N]);var Q=[],C,P=O.concat();v=0;for(p=o.length;v<p;v++){x=o[v];C=[];z=0;D=x.length;K=D-1;for(N=z+1;z<D;z++,K++,N++)K==D&&(K=0),N==D&&(N=0),C[z]=e(x[z],x[K],x[N]);Q.push(C);P=P.concat(C)}for(J=0;J<m;J++){I=J/m;E=k*(1-I);I=l*Math.sin(I*Math.PI/2);z=0;for(D=H.length;z<D;z++)F=c(H[z],O[z],I),h(F.x,F.y,-E);v=0;for(p=o.length;v<p;v++){x=o[v];C=Q[v];z=0;for(D=x.length;z<D;z++)F=
-c(x[z],C[z],I),h(F.x,F.y,-E)}}I=l;for(z=0;z<L;z++)F=n?c(u[z],P[z],I):u[z],y?h(F.x,F.y+w[0].y,w[0].x):h(F.x,F.y,0);for(J=1;J<=t;J++)for(z=0;z<L;z++)F=n?c(u[z],P[z],I):u[z],y?h(F.x,F.y+w[J-1].y,w[J-1].x):h(F.x,F.y,j/t*J);for(J=m-1;J>=0;J--){I=J/m;E=k*(1-I);I=l*Math.sin(I*Math.PI/2);z=0;for(D=H.length;z<D;z++)F=c(H[z],O[z],I),h(F.x,F.y,j+E);v=0;for(p=o.length;v<p;v++){x=o[v];C=Q[v];z=0;for(D=x.length;z<D;z++)F=c(x[z],C[z],I),y?h(F.x,F.y+w[t-1].y,w[t-1].x+E):h(F.x,F.y,j+E)}}if(n){k=L*0;for(z=0;z<M;z++)j=
-G[z],g(j[2]+k,j[1]+k,j[0]+k);k=L*(t+m*2);for(z=0;z<M;z++)j=G[z],g(j[0]+k,j[1]+k,j[2]+k)}else{for(z=0;z<M;z++)j=G[z],g(j[2],j[1],j[0]);for(z=0;z<M;z++)j=G[z],g(j[0]+L*t,j[1]+L*t,j[2]+L*t)}var K,N,R=0;f(H);R+=H.length;v=0;for(p=o.length;v<p;v++)x=o[v],f(x),R+=x.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
-THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
+j.copy(c).addSelf(h);k.copy(b).addSelf(f);h=e.dot(f);f=k.subSelf(j).dot(f);h==0&&(console.log("Either infinite or no solutions!"),f==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(j).subSelf(a).clone()}function f(a){for(A=a.length;--A>=0;){K=A;N=A-1;N<0&&(N=a.length-
+1);for(var c=0,c=0;c<t+m*2;c++){var b=L*c,e=L*(c+1),g=R+K+b,b=R+N+b,h=R+N+e,e=R+K+e;g+=H;b+=H;h+=H;e+=H;G.faces.push(new THREE.Face4(g,b,h,e))}}}function h(a,c,b){G.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function g(a,c,b){a+=H;c+=H;b+=H;G.faces.push(new THREE.Face3(a,c,b))}var j=b.amount!==void 0?b.amount:100,k=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:k-2,m=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:
+!0,o=b.curveSegments!==void 0?b.curveSegments:12,t=b.steps!==void 0?b.steps:1,v=b.bendPath,u=b.extrudePath,x,y=!1,w=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1;if(u)x=u.getPoints(o),t=x.length,y=!0,n=!1;n||(l=k=m=0);var p,z,B,G=this,H=this.vertices.length;v&&a.addWrapPath(v);o=w?a.extractAllSpacedPoints(o):a.extractAllPoints(o);v=o.shape;o=o.holes;if(u=!THREE.Shape.Utils.isClockWise(v)){v=v.reverse();z=0;for(B=o.length;z<B;z++)p=o[z],THREE.Shape.Utils.isClockWise(p)&&(o[z]=p.reverse());u=!1}u=
+THREE.Shape.Utils.triangulateShape(v,o);w=v;z=0;for(B=o.length;z<B;z++)p=o[z],v=v.concat(p);var A,D,J,I,E,F,L=v.length,M=u.length,O=[];A=0;D=w.length;K=D-1;for(N=A+1;A<D;A++,K++,N++)K==D&&(K=0),N==D&&(N=0),O[A]=e(w[A],w[K],w[N]);var Q=[],C,P=O.concat();z=0;for(B=o.length;z<B;z++){p=o[z];C=[];A=0;D=p.length;K=D-1;for(N=A+1;A<D;A++,K++,N++)K==D&&(K=0),N==D&&(N=0),C[A]=e(p[A],p[K],p[N]);Q.push(C);P=P.concat(C)}for(J=0;J<m;J++){I=J/m;E=k*(1-I);I=l*Math.sin(I*Math.PI/2);A=0;for(D=w.length;A<D;A++)F=c(w[A],
+O[A],I),h(F.x,F.y,-E);z=0;for(B=o.length;z<B;z++){p=o[z];C=Q[z];A=0;for(D=p.length;A<D;A++)F=c(p[A],C[A],I),h(F.x,F.y,-E)}}I=l;for(A=0;A<L;A++)F=n?c(v[A],P[A],I):v[A],y?h(F.x,F.y+x[0].y,x[0].x):h(F.x,F.y,0);for(J=1;J<=t;J++)for(A=0;A<L;A++)F=n?c(v[A],P[A],I):v[A],y?h(F.x,F.y+x[J-1].y,x[J-1].x):h(F.x,F.y,j/t*J);for(J=m-1;J>=0;J--){I=J/m;E=k*(1-I);I=l*Math.sin(I*Math.PI/2);A=0;for(D=w.length;A<D;A++)F=c(w[A],O[A],I),h(F.x,F.y,j+E);z=0;for(B=o.length;z<B;z++){p=o[z];C=Q[z];A=0;for(D=p.length;A<D;A++)F=
+c(p[A],C[A],I),y?h(F.x,F.y+x[t-1].y,x[t-1].x+E):h(F.x,F.y,j+E)}}if(n){k=L*0;for(A=0;A<M;A++)j=u[A],g(j[2]+k,j[1]+k,j[0]+k);k=L*(t+m*2);for(A=0;A<M;A++)j=u[A],g(j[0]+k,j[1]+k,j[2]+k)}else{for(A=0;A<M;A++)j=u[A],g(j[2],j[1],j[0]);for(A=0;A<M;A++)j=u[A],g(j[0]+L*t,j[1]+L*t,j[2]+L*t)}var K,N,R=0;f(w);R+=w.length;z=0;for(B=o.length;z<B;z++)p=o[z],f(p),R+=p.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,g=f.vertices[c].position;return b((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
 -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(a=0;a<this.subdivisions;a++){g=new THREE.Geometry;for(var j in h.faces){var k=e(h.faces[j].a,h.faces[j].b),l=e(h.faces[j].b,h.faces[j].c),m=e(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,g);c(h.faces[j].b,l,k,g);
 c(h.faces[j].c,m,l,g);c(k,l,m,g)}h.faces=g.faces}f.faces=h.faces;delete h;delete g;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
@@ -143,21 +152,23 @@ THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;t
 for(j=0;j<e.length-1;j++)this.faces.push(new THREE.Face4(f[j],f[j+1],e[j+1],e[j])),this.faceVertexUvs[0].push([new THREE.UV(1-k/this.angle,j/a.length),new THREE.UV(1-k/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-b)/this.angle,j/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,g=b/2,c=c||1,e=e||1,j=c+1,k=e+1;a/=c;var l=b/e;for(f=0;f<k;f++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*l-g),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*f,b+j*(f+1),b+1+j*(f+1),b+1+j*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){e=c/g;var j=a*Math.cos(e*f),k=a*Math.sin(e*f),l=[],m=0;for(e=0;e<h;e++){var n=2*e/h,o=k*Math.sin(n*f),n=k*Math.cos(n*f);(c==0||c==g)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}b.push(l)}for(var t,u,w,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){l=e==h-1;g=b[c][l?0:e+1];j=b[c][l?h-1:e];k=b[c-1][l?
-h-1:e];l=b[c-1][l?0:e+1];o=c/(f-1);t=(c-1)/(f-1);u=(e+1)/h;var n=e/h,m=new THREE.UV(1-u,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,t),y=new THREE.UV(1-u,t);c<b.length-1&&(t=this.vertices[g].position.clone(),u=this.vertices[j].position.clone(),w=this.vertices[k].position.clone(),t.normalize(),u.normalize(),w.normalize(),this.faces.push(new THREE.Face3(g,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,o,n]));c>1&&(t=
-this.vertices[g].position.clone(),u=this.vertices[k].position.clone(),w=this.vertices[l].position.clone(),t.normalize(),u.normalize(),w.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,n,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
-THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
+THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),g=Math.max(2,c||6),b=[],c=0;c<g+1;c++){e=c/g;var j=a*Math.cos(e*f),k=a*Math.sin(e*f),l=[],m=0;for(e=0;e<h;e++){var n=2*e/h,o=k*Math.sin(n*f),n=k*Math.cos(n*f);(c==0||c==g)&&e>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}b.push(l)}for(var t,v,u,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){l=e==h-1;g=b[c][l?0:e+1];j=b[c][l?h-1:e];k=b[c-1][l?
+h-1:e];l=b[c-1][l?0:e+1];o=c/(f-1);t=(c-1)/(f-1);v=(e+1)/h;var n=e/h,m=new THREE.UV(1-v,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,t),x=new THREE.UV(1-v,t);c<b.length-1&&(t=this.vertices[g].position.clone(),v=this.vertices[j].position.clone(),u=this.vertices[k].position.clone(),t.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,o,n]));c>1&&(t=
+this.vertices[g].position.clone(),v=this.vertices[k].position.clone(),u=this.vertices[l].position.clone(),t.normalize(),v.normalize(),u.normalize(),this.faces.push(new THREE.Face3(g,k,l,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([m,n,x]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
+THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
+THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=
-this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(f[a],b,c,e,j);e+=j.offset;g.push(j.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],g,j,k,l,m,n,o,t,u,w,y=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){b=y._cachedOutline||(y._cachedOutline=y.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,
-l));f.moveTo(j,l);break;case "l":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,l));f.lineTo(j,l);break;case "q":j=b[a++]*c+e;l=b[a++]*c;o=b[a++]*c+e;t=b[a++]*c;f.quadraticCurveTo(o,t,j,l);if(g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var x=g/divisions,v=THREE.Shape.Utils.b2(x,m,o,j),x=THREE.Shape.Utils.b2(x,n,t,l);h.push(new THREE.Vector2(v,x))}}break;case "b":if(j=b[a++]*c+e,l=b[a++]*c,o=b[a++]*c+e,t=b[a++]*-c,u=b[a++]*c+e,w=b[a++]*-c,f.bezierCurveTo(j,l,
-o,t,u,w),g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)x=g/divisions,v=THREE.Shape.Utils.b3(x,m,o,u,j),x=THREE.Shape.Utils.b3(x,n,t,w,l),h.push(new THREE.Vector2(v,x))}}}return{offset:y.ha*c,points:h,path:f}}}};
-(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,g=0;g<b;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return j;return h}k=l;f<=k&&(k=0);l=k+1;f<=l&&(l=0);m=l+1;f<=m&&(m=0);var o;a:{o=a;var t=k,u=l,w=m,y=f,x=g,v=void 0,p=void 0,A=void 0,
-B=void 0,G=void 0,H=void 0,z=void 0,D=void 0,J=void 0,p=o[x[t]].x,A=o[x[t]].y,B=o[x[u]].x,G=o[x[u]].y,H=o[x[w]].x,z=o[x[w]].y;if(1.0E-10>(B-p)*(z-A)-(G-A)*(H-p))o=!1;else{for(v=0;v<y;v++)if(!(v==t||v==u||v==w)){var D=o[x[v]].x,J=o[x[v]].y,I=void 0,E=void 0,F=void 0,L=void 0,M=void 0,O=void 0,Q=void 0,C=void 0,P=void 0,K=void 0,N=void 0,R=void 0,I=F=M=void 0,I=H-B,E=z-G,F=p-H,L=A-z,M=B-p,O=G-A,Q=D-p,C=J-A,P=D-B,K=J-G,N=D-H,R=J-z,I=I*K-E*P,M=M*C-O*Q,F=F*R-L*N;if(I>=0&&F>=0&&M>=0){o=!1;break a}}o=!0}}if(o){h.push([a[g[k]],
+this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,g=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(f[a],b,c,e,j);e+=j.offset;g.push(j.path)}return{paths:g,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],g,j,k,l,m,n,o,t,v,u,x=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){b=x._cachedOutline||(x._cachedOutline=x.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,
+l));f.moveTo(j,l);break;case "l":j=b[a++]*c+e;l=b[a++]*c;h.push(new THREE.Vector2(j,l));f.lineTo(j,l);break;case "q":j=b[a++]*c+e;l=b[a++]*c;o=b[a++]*c+e;t=b[a++]*c;f.quadraticCurveTo(o,t,j,l);if(g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var y=g/divisions,w=THREE.Shape.Utils.b2(y,m,o,j),y=THREE.Shape.Utils.b2(y,n,t,l);h.push(new THREE.Vector2(w,y))}}break;case "b":if(j=b[a++]*c+e,l=b[a++]*c,o=b[a++]*c+e,t=b[a++]*-c,v=b[a++]*c+e,u=b[a++]*-c,f.bezierCurveTo(j,l,
+o,t,v,u),g=h[h.length-1]){m=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)y=g/divisions,w=THREE.Shape.Utils.b3(y,m,o,v,j),y=THREE.Shape.Utils.b3(y,n,t,u,l),h.push(new THREE.Vector2(w,y))}}}return{offset:x.ha*c,points:h,path:f}}}};
+(function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,g=0;g<b;h=g++)f+=a[h].x*a[g].y-a[g].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],g=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return j;return h}k=l;f<=k&&(k=0);l=k+1;f<=l&&(l=0);m=l+1;f<=m&&(m=0);var o;a:{o=a;var t=k,v=l,u=m,x=f,y=g,w=void 0,p=void 0,z=void 0,
+B=void 0,G=void 0,H=void 0,A=void 0,D=void 0,J=void 0,p=o[y[t]].x,z=o[y[t]].y,B=o[y[v]].x,G=o[y[v]].y,H=o[y[u]].x,A=o[y[u]].y;if(1.0E-10>(B-p)*(A-z)-(G-z)*(H-p))o=!1;else{for(w=0;w<x;w++)if(!(w==t||w==v||w==u)){var D=o[y[w]].x,J=o[y[w]].y,I=void 0,E=void 0,F=void 0,L=void 0,M=void 0,O=void 0,Q=void 0,C=void 0,P=void 0,K=void 0,N=void 0,R=void 0,I=F=M=void 0,I=H-B,E=A-G,F=p-H,L=z-A,M=B-p,O=G-z,Q=D-p,C=J-z,P=D-B,K=J-G,N=D-H,R=J-A,I=I*K-E*P,M=M*C-O*Q,F=F*R-L*N;if(I>=0&&F>=0&&M>=0){o=!1;break a}}o=!0}}if(o){h.push([a[g[k]],
 a[g[l]],a[g[m]]]);j.push([g[k],g[l],g[m]]);k=l;for(m=l+1;m<f;k++,m++)g[k]=g[m];f--;n=2*f}}if(e)return j;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,b,c,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var e=c/this.segmentsT*2*Math.PI,f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 1;c<=this.segmentsT;++c){var e=(this.segmentsT+1)*b+c,f=(this.segmentsT+1)*b+c-1,h=(this.segmentsT+1)*(b-1)+c-1,g=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(e,f,h,g));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[g][0],a[g][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
 THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,b,c,e,f,h,g){function j(a,c,b,e,g,h){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(g*(2+b)*0.5*Math.cos(a),g*(2+b)*Math.sin(a)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
+THREE.TorusKnotGeometry=function(a,b,c,e,f,h,g){function j(a,b,c,e,g,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(g*(2+c)*0.5*Math.cos(a),g*(2+c)*Math.sin(a)*0.5,h*g*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=g||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
 this.segmentsT;++b){var k=a/this.segmentsR*2*this.p*Math.PI,g=b/this.segmentsT*2*Math.PI,f=j(k,g,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,g,this.q,this.p,this.radius,this.heightScale);c.x=k.x-f.x;c.y=k.y-f.y;c.z=k.z-f.z;e.x=k.x+f.x;e.y=k.y+f.y;e.z=k.z+f.z;h.cross(c,e);e.cross(h,c);h.normalize();e.normalize();k=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x+=k*e.x+g*h.x;f.y+=k*e.y+g*h.y;f.z+=k*e.z+g*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
 f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][h],h=this.grid[a][h],g=new THREE.UV(a/this.segmentsR,b/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,h));this.faceVertexUvs[0].push([g,k,l,m])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
@@ -170,54 +181,54 @@ else if(a.DbgColor)g.color=a.DbgColor;if(a.colorSpecular)g.specular=h(a.colorSpe
 a.mapSpecular&&b&&f(g,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),n=g.color;j=g.specular;k=g.ambient;var o=g.shininess;m.tNormal.texture=g.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(g.map)m.tDiffuse.texture=g.map,m.enableDiffuse.value=!0;if(g.specularMap)m.tSpecular.texture=g.specularMap,m.enableSpecular.value=!0;if(g.lightMap)m.tAO.texture=
 g.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(n);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=o;if(g.opacity)m.uOpacity.value=g.opacity;g=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else g=new THREE[j](g);return g},constructor:THREE.Loader};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var b=this,c=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,e,f);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,k,l,m,n,o,t,u,w,y,x,v,p,A=a.faces;n=a.vertices;var B=a.normals,G=a.colors,H=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&H++;for(b=0;b<H;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*c,o.position.y=
-n[l++]*c,o.position.z=n[l++]*c,e.vertices.push(o);l=0;for(m=A.length;l<m;){c=A[l++];n=c&1;k=c&2;b=c&4;f=c&8;t=c&16;o=c&32;w=c&64;c&=128;n?(y=new THREE.Face4,y.a=A[l++],y.b=A[l++],y.c=A[l++],y.d=A[l++],n=4):(y=new THREE.Face3,y.a=A[l++],y.b=A[l++],y.c=A[l++],n=3);if(k)k=A[l++],y.materials=e.materials[k];k=e.faces.length;if(b)for(b=0;b<H;b++)x=a.uvs[b],u=A[l++],p=x[u*2],u=x[u*2+1],e.faceUvs[b][k]=new THREE.UV(p,u);if(f)for(b=0;b<H;b++){x=a.uvs[b];v=[];for(f=0;f<n;f++)u=A[l++],p=x[u*2],u=x[u*2+1],v[f]=
-new THREE.UV(p,u);e.faceVertexUvs[b][k]=v}if(t)t=A[l++]*3,f=new THREE.Vector3,f.x=B[t++],f.y=B[t++],f.z=B[t],y.normal=f;if(o)for(b=0;b<n;b++)t=A[l++]*3,f=new THREE.Vector3,f.x=B[t++],f.y=B[t++],f.z=B[t],y.vertexNormals.push(f);if(w)o=A[l++],o=new THREE.Color(G[o]),y.color=o;if(c)for(b=0;b<n;b++)o=A[l++],o=new THREE.Color(G[o]),y.vertexColors.push(o);e.faces.push(y)}}})(f);(function(){var c,b,f,k;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],k=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
-k,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],k=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,k,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,k,l,m,n,o,t,u;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];t=e.morphTargets[b].vertices;u=a.morphTargets[b].vertices;k=0;for(l=u.length;k<l;k+=3)m=u[k]*c,n=u[k+1]*
-c,o=u[k+2]*c,t.push(new THREE.Vertex(new THREE.Vector3(m,n,o)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];l=e.morphColors[b].colors;m=a.morphColors[b].colors;c=0;for(k=m.length;c<k;c+=3)n=new THREE.Color(16755200),n.setRGB(m[c],m[c+1],m[c+2]),l.push(n)}}})(f);(function(){if(a.edges!==void 0){var c,b,f;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],f=a.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[b],
-e.vertices[f],b,f))}})();e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,k,l,m,n,o,t,v,u,x,y,w,p,z=a.faces;n=a.vertices;var B=a.normals,G=a.colors,H=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&H++;for(b=0;b<H;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*c,o.position.y=
+n[l++]*c,o.position.z=n[l++]*c,e.vertices.push(o);l=0;for(m=z.length;l<m;){c=z[l++];n=c&1;k=c&2;b=c&4;f=c&8;t=c&16;o=c&32;u=c&64;c&=128;n?(x=new THREE.Face4,x.a=z[l++],x.b=z[l++],x.c=z[l++],x.d=z[l++],n=4):(x=new THREE.Face3,x.a=z[l++],x.b=z[l++],x.c=z[l++],n=3);if(k)k=z[l++],x.materials=e.materials[k];k=e.faces.length;if(b)for(b=0;b<H;b++)y=a.uvs[b],v=z[l++],p=y[v*2],v=y[v*2+1],e.faceUvs[b][k]=new THREE.UV(p,v);if(f)for(b=0;b<H;b++){y=a.uvs[b];w=[];for(f=0;f<n;f++)v=z[l++],p=y[v*2],v=y[v*2+1],w[f]=
+new THREE.UV(p,v);e.faceVertexUvs[b][k]=w}if(t)t=z[l++]*3,f=new THREE.Vector3,f.x=B[t++],f.y=B[t++],f.z=B[t],x.normal=f;if(o)for(b=0;b<n;b++)t=z[l++]*3,f=new THREE.Vector3,f.x=B[t++],f.y=B[t++],f.z=B[t],x.vertexNormals.push(f);if(u)o=z[l++],o=new THREE.Color(G[o]),x.color=o;if(c)for(b=0;b<n;b++)o=z[l++],o=new THREE.Color(G[o]),x.vertexColors.push(o);e.faces.push(x)}}})(f);(function(){var b,c,f,k;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],k=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(f,
+k,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)f=a.skinIndices[b],k=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(f,k,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,k,l,m,n,o,t,v;c=0;for(f=a.morphTargets.length;c<f;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];t=e.morphTargets[c].vertices;v=a.morphTargets[c].vertices;k=0;for(l=v.length;k<l;k+=3)m=v[k]*b,n=v[k+1]*
+b,o=v[k+2]*b,t.push(new THREE.Vertex(new THREE.Vector3(m,n,o)))}}if(a.morphColors!==void 0){c=0;for(f=a.morphColors.length;c<f;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];l=e.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(k=m.length;b<k;b+=3)n=new THREE.Color(16755200),n.setRGB(m[b],m[b+1],m[b+2]),l.push(n)}}})(f);(function(){if(a.edges!==void 0){var b,c,f;for(b=0;b<a.edges.length;b+=2)c=a.edges[b],f=a.edges[b+1],e.edges.push(new THREE.Edge(e.vertices[c],
+e.vertices[f],c,f))}})();e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype={load:function(a){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b),a=(new Date).getTime(),b=new Worker(b),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,c,f,e,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
 b.postMessage(a)},loadAjaxBuffers:function(a,b,c,e,f,h){var g=new XMLHttpRequest,j=e+"/"+a,k=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.responseText,c,f,b):alert("Couldn't load ["+j+"] ["+g.status+"]"):g.readyState==3?h&&(k==0&&(k=g.getResponseHeader("Content-Length")),h({total:k,loaded:g.responseText.length})):g.readyState==2&&(k=g.getResponseHeader("Content-Length"))};g.open("GET",j,!0);g.overrideMimeType("text/plain; charset=x-user-defined");
-g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,b,c,e){var f=function(c){function b(a,c){var e=m(a,c),f=m(a,c+1),g=m(a,c+2),h=m(a,c+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,c){var b=m(a,c),e=m(a,c+1),g=m(a,c+2);return(m(a,c+3)<<24)+(g<<16)+(e<<8)+b}function k(a,c){var b=m(a,c);return(m(a,c+1)<<8)+b}function l(a,c){var b=m(a,c);return b>127?b-256:b}function m(a,
-c){return a.charCodeAt(c)&255}function n(c){var b,e,g;b=f(a,c);e=f(a,c+G);g=f(a,c+H);c=k(a,c+z);THREE.BinaryLoader.prototype.f3(x,b,e,g,c)}function o(c){var b,e,g,h,l,m;b=f(a,c);e=f(a,c+G);g=f(a,c+H);h=k(a,c+z);l=f(a,c+D);m=f(a,c+J);c=f(a,c+I);THREE.BinaryLoader.prototype.f3n(x,A,b,e,g,h,l,m,c)}function t(c){var b,e,g,h;b=f(a,c);e=f(a,c+E);g=f(a,c+F);h=f(a,c+L);c=k(a,c+M);THREE.BinaryLoader.prototype.f4(x,b,e,g,h,c)}function u(c){var b,e,g,h,l,m,n,o;b=f(a,c);e=f(a,c+E);g=f(a,c+F);h=f(a,c+L);l=k(a,
-c+M);m=f(a,c+O);n=f(a,c+Q);o=f(a,c+C);c=f(a,c+P);THREE.BinaryLoader.prototype.f4n(x,A,b,e,g,h,l,m,n,o,c)}function w(c){var b,e;b=f(a,c);e=f(a,c+K);c=f(a,c+N);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],B[b*2],B[b*2+1],B[e*2],B[e*2+1],B[c*2],B[c*2+1])}function y(c){var b,e,g;b=f(a,c);e=f(a,c+R);g=f(a,c+Y);c=f(a,c+Z);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],B[b*2],B[b*2+1],B[e*2],B[e*2+1],B[g*2],B[g*2+1],B[c*2],B[c*2+1])}var x=this,v=0,p,A=[],B=[],G,H,z,D,J,I,E,F,L,M,O,Q,C,P,K,N,
-R,Y,Z,T,U,V,W,X,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,e,c);p={signature:a.substr(v,8),header_bytes:m(a,v+8),vertex_coordinate_bytes:m(a,v+9),normal_coordinate_bytes:m(a,v+10),uv_coordinate_bytes:m(a,v+11),vertex_index_bytes:m(a,v+12),normal_index_bytes:m(a,v+13),uv_index_bytes:m(a,v+14),material_index_bytes:m(a,v+15),nvertices:f(a,v+16),nnormals:f(a,v+16+4),nuvs:f(a,v+16+8),ntri_flat:f(a,v+16+12),ntri_smooth:f(a,v+16+16),ntri_flat_uv:f(a,v+16+20),ntri_smooth_uv:f(a,v+
-16+24),nquad_flat:f(a,v+16+28),nquad_smooth:f(a,v+16+32),nquad_flat_uv:f(a,v+16+36),nquad_smooth_uv:f(a,v+16+40)};v+=p.header_bytes;G=p.vertex_index_bytes;H=p.vertex_index_bytes*2;z=p.vertex_index_bytes*3;D=p.vertex_index_bytes*3+p.material_index_bytes;J=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;I=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;E=p.vertex_index_bytes;F=p.vertex_index_bytes*2;L=p.vertex_index_bytes*3;M=p.vertex_index_bytes*4;O=p.vertex_index_bytes*
-4+p.material_index_bytes;Q=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;C=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;P=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;K=p.uv_index_bytes;N=p.uv_index_bytes*2;R=p.uv_index_bytes;Y=p.uv_index_bytes*2;Z=p.uv_index_bytes*3;c=p.vertex_index_bytes*3+p.material_index_bytes;S=p.vertex_index_bytes*4+p.material_index_bytes;T=p.ntri_flat*c;U=p.ntri_smooth*(c+p.normal_index_bytes*3);V=p.ntri_flat_uv*
-(c+p.uv_index_bytes*3);W=p.ntri_smooth_uv*(c+p.normal_index_bytes*3+p.uv_index_bytes*3);X=p.nquad_flat*S;c=p.nquad_smooth*(S+p.normal_index_bytes*4);S=p.nquad_flat_uv*(S+p.uv_index_bytes*4);v+=function(c){for(var e,f,h,j=p.vertex_coordinate_bytes*3,k=c+p.nvertices*j;c<k;c+=j)e=b(a,c),f=b(a,c+p.vertex_coordinate_bytes),h=b(a,c+p.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,e,f,h);return p.nvertices*j}(v);v+=function(c){for(var b,e,f,g=p.normal_coordinate_bytes*3,h=c+p.nnormals*g;c<h;c+=
-g)b=l(a,c),e=l(a,c+p.normal_coordinate_bytes),f=l(a,c+p.normal_coordinate_bytes*2),A.push(b/127,e/127,f/127);return p.nnormals*g}(v);v+=function(c){for(var e,f,h=p.uv_coordinate_bytes*2,j=c+p.nuvs*h;c<j;c+=h)e=b(a,c),f=b(a,c+p.uv_coordinate_bytes),B.push(e,f);return p.nuvs*h}(v);T=v+T;U=T+U;V=U+V;W=V+W;X=W+X;c=X+c;S=c+S;(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes,e=b+p.uv_index_bytes*3,f=a+p.ntri_flat_uv*e;for(c=a;c<f;c+=e)n(c),w(c+b);return f-a})(U);(function(a){var c,b=p.vertex_index_bytes*
-3+p.material_index_bytes+p.normal_index_bytes*3,e=b+p.uv_index_bytes*3,f=a+p.ntri_smooth_uv*e;for(c=a;c<f;c+=e)o(c),w(c+b);return f-a})(V);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,e=b+p.uv_index_bytes*4,f=a+p.nquad_flat_uv*e;for(c=a;c<f;c+=e)t(c),y(c+b);return f-a})(c);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=b+p.uv_index_bytes*4,f=a+p.nquad_smooth_uv*e;for(c=a;c<f;c+=e)u(c),y(c+b);return f-a})(S);(function(a){var c,b=p.vertex_index_bytes*
-3+p.material_index_bytes,e=a+p.ntri_flat*b;for(c=a;c<e;c+=b)n(c);return e-a})(v);(function(a){var c,b=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,e=a+p.ntri_smooth*b;for(c=a;c<e;c+=b)o(c);return e-a})(T);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes,e=a+p.nquad_flat*b;for(c=a;c<e;c+=b)t(c);return e-a})(W);(function(a){var c,b=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=a+p.nquad_smooth*b;for(c=a;c<e;c+=b)u(c);return e-a})(X);
+g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,b,c,e){var f=function(b){function c(a,b){var e=m(a,b),f=m(a,b+1),g=m(a,b+2),h=m(a,b+3),j=(h<<1&255|g>>7)-127;e|=(g&127)<<16|f<<8;if(e==0&&j==-127)return 0;return(1-2*(h>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,j)}function f(a,b){var c=m(a,b),e=m(a,b+1),g=m(a,b+2);return(m(a,b+3)<<24)+(g<<16)+(e<<8)+c}function k(a,b){var c=m(a,b);return(m(a,b+1)<<8)+c}function l(a,b){var c=m(a,b);return c>127?c-256:c}function m(a,
+b){return a.charCodeAt(b)&255}function n(b){var c,e,g;c=f(a,b);e=f(a,b+G);g=f(a,b+H);b=k(a,b+A);THREE.BinaryLoader.prototype.f3(y,c,e,g,b)}function o(b){var c,e,g,h,l,m;c=f(a,b);e=f(a,b+G);g=f(a,b+H);h=k(a,b+A);l=f(a,b+D);m=f(a,b+J);b=f(a,b+I);THREE.BinaryLoader.prototype.f3n(y,z,c,e,g,h,l,m,b)}function t(b){var c,e,g,h;c=f(a,b);e=f(a,b+E);g=f(a,b+F);h=f(a,b+L);b=k(a,b+M);THREE.BinaryLoader.prototype.f4(y,c,e,g,h,b)}function v(b){var c,e,g,h,l,m,n,o;c=f(a,b);e=f(a,b+E);g=f(a,b+F);h=f(a,b+L);l=k(a,
+b+M);m=f(a,b+O);n=f(a,b+Q);o=f(a,b+C);b=f(a,b+P);THREE.BinaryLoader.prototype.f4n(y,z,c,e,g,h,l,m,n,o,b)}function u(b){var c,e;c=f(a,b);e=f(a,b+K);b=f(a,b+N);THREE.BinaryLoader.prototype.uv3(y.faceVertexUvs[0],B[c*2],B[c*2+1],B[e*2],B[e*2+1],B[b*2],B[b*2+1])}function x(b){var c,e,g;c=f(a,b);e=f(a,b+R);g=f(a,b+Y);b=f(a,b+Z);THREE.BinaryLoader.prototype.uv4(y.faceVertexUvs[0],B[c*2],B[c*2+1],B[e*2],B[e*2+1],B[g*2],B[g*2+1],B[b*2],B[b*2+1])}var y=this,w=0,p,z=[],B=[],G,H,A,D,J,I,E,F,L,M,O,Q,C,P,K,N,
+R,Y,Z,T,U,V,W,X,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(y,e,b);p={signature:a.substr(w,8),header_bytes:m(a,w+8),vertex_coordinate_bytes:m(a,w+9),normal_coordinate_bytes:m(a,w+10),uv_coordinate_bytes:m(a,w+11),vertex_index_bytes:m(a,w+12),normal_index_bytes:m(a,w+13),uv_index_bytes:m(a,w+14),material_index_bytes:m(a,w+15),nvertices:f(a,w+16),nnormals:f(a,w+16+4),nuvs:f(a,w+16+8),ntri_flat:f(a,w+16+12),ntri_smooth:f(a,w+16+16),ntri_flat_uv:f(a,w+16+20),ntri_smooth_uv:f(a,w+
+16+24),nquad_flat:f(a,w+16+28),nquad_smooth:f(a,w+16+32),nquad_flat_uv:f(a,w+16+36),nquad_smooth_uv:f(a,w+16+40)};w+=p.header_bytes;G=p.vertex_index_bytes;H=p.vertex_index_bytes*2;A=p.vertex_index_bytes*3;D=p.vertex_index_bytes*3+p.material_index_bytes;J=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;I=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;E=p.vertex_index_bytes;F=p.vertex_index_bytes*2;L=p.vertex_index_bytes*3;M=p.vertex_index_bytes*4;O=p.vertex_index_bytes*
+4+p.material_index_bytes;Q=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;C=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;P=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;K=p.uv_index_bytes;N=p.uv_index_bytes*2;R=p.uv_index_bytes;Y=p.uv_index_bytes*2;Z=p.uv_index_bytes*3;b=p.vertex_index_bytes*3+p.material_index_bytes;S=p.vertex_index_bytes*4+p.material_index_bytes;T=p.ntri_flat*b;U=p.ntri_smooth*(b+p.normal_index_bytes*3);V=p.ntri_flat_uv*
+(b+p.uv_index_bytes*3);W=p.ntri_smooth_uv*(b+p.normal_index_bytes*3+p.uv_index_bytes*3);X=p.nquad_flat*S;b=p.nquad_smooth*(S+p.normal_index_bytes*4);S=p.nquad_flat_uv*(S+p.uv_index_bytes*4);w+=function(b){for(var e,f,h,j=p.vertex_coordinate_bytes*3,k=b+p.nvertices*j;b<k;b+=j)e=c(a,b),f=c(a,b+p.vertex_coordinate_bytes),h=c(a,b+p.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(y,e,f,h);return p.nvertices*j}(w);w+=function(b){for(var c,e,f,g=p.normal_coordinate_bytes*3,h=b+p.nnormals*g;b<h;b+=
+g)c=l(a,b),e=l(a,b+p.normal_coordinate_bytes),f=l(a,b+p.normal_coordinate_bytes*2),z.push(c/127,e/127,f/127);return p.nnormals*g}(w);w+=function(b){for(var e,f,h=p.uv_coordinate_bytes*2,j=b+p.nuvs*h;b<j;b+=h)e=c(a,b),f=c(a,b+p.uv_coordinate_bytes),B.push(e,f);return p.nuvs*h}(w);T=w+T;U=T+U;V=U+V;W=V+W;X=W+X;b=X+b;S=b+S;(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes,e=c+p.uv_index_bytes*3,f=a+p.ntri_flat_uv*e;for(b=a;b<f;b+=e)n(b),u(b+c);return f-a})(U);(function(a){var b,c=p.vertex_index_bytes*
+3+p.material_index_bytes+p.normal_index_bytes*3,e=c+p.uv_index_bytes*3,f=a+p.ntri_smooth_uv*e;for(b=a;b<f;b+=e)o(b),u(b+c);return f-a})(V);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes,e=c+p.uv_index_bytes*4,f=a+p.nquad_flat_uv*e;for(b=a;b<f;b+=e)t(b),x(b+c);return f-a})(b);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=c+p.uv_index_bytes*4,f=a+p.nquad_smooth_uv*e;for(b=a;b<f;b+=e)v(b),x(b+c);return f-a})(S);(function(a){var b,c=p.vertex_index_bytes*
+3+p.material_index_bytes,e=a+p.ntri_flat*c;for(b=a;b<e;b+=c)n(b);return e-a})(w);(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,e=a+p.ntri_smooth*c;for(b=a;b<e;b+=c)o(b);return e-a})(T);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes,e=a+p.nquad_flat*c;for(b=a;b<e;b+=c)t(b);return e-a})(W);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,e=a+p.nquad_smooth*c;for(b=a;b<e;b+=c)v(b);return e-a})(X);
 this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},f3:function(a,b,c,e,f){a.faces.push(new THREE.Face3(b,c,e,null,null,a.materials[f]))},f4:function(a,b,c,e,f,h){a.faces.push(new THREE.Face4(b,c,e,f,null,null,a.materials[h]))},f3n:function(a,b,c,e,f,h,g,j,k){var h=a.materials[h],l=b[j*
-3],m=b[j*3+1],j=b[j*3+2],n=b[k*3],o=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(b[g*3],b[g*3+1],b[g*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,o,k)],null,h))},f4n:function(a,b,c,e,f,h,g,j,k,l,m){var g=a.materials[g],n=b[k*3],o=b[k*3+1],k=b[k*3+2],t=b[l*3],u=b[l*3+1],l=b[l*3+2],w=b[m*3],y=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(t,u,l),new THREE.Vector3(w,y,
+3],m=b[j*3+1],j=b[j*3+2],n=b[k*3],o=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(b[g*3],b[g*3+1],b[g*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,o,k)],null,h))},f4n:function(a,b,c,e,f,h,g,j,k,l,m){var g=a.materials[g],n=b[k*3],o=b[k*3+1],k=b[k*3+2],t=b[l*3],v=b[l*3+1],l=b[l*3+2],u=b[m*3],x=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(t,v,l),new THREE.Vector3(u,x,
 m)],null,g))},uv3:function(a,b,c,e,f,h,g){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(e,f));j.push(new THREE.UV(h,g));a.push(j)},uv4:function(a,b,c,e,f,h,g,j,k){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(e,f));l.push(new THREE.UV(h,g));l.push(new THREE.UV(j,k));a.push(l)},constructor:THREE.BinaryLoader};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function j(){for(t in E.objects)if(!C.objects[t])if(v=E.objects[t],v.geometry!==void 0){if(G=C.geometries[v.geometry]){var a=!1;J=[];for(K=0;K<v.materials.length;K++)J[K]=C.materials[v.materials[K]],a=J[K]instanceof THREE.MeshShaderMaterial;a&&G.computeTangents();p=v.position;r=v.rotation;
-q=v.quaternion;s=v.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);J.length>1&&(J=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,J);object.name=t;object.position.set(p[0],p[1],p[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=v.visible;C.scene.addObject(object);C.objects[t]=object;v.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),C.scene.collisions.colliders.push(a));
-if(v.castsShadow)a=new THREE.ShadowVolume(G),C.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;v.trigger&&v.trigger.toLowerCase()!="none"&&(a={type:v.trigger,object:v},C.triggers[object.name]=a)}}else p=v.position,r=v.rotation,q=v.quaternion,s=v.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(p[0],p[1],p[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=v.visible!==void 0?v.visible:!1,C.scene.addObject(object),C.objects[t]=object,C.empties[t]=object,v.trigger&&v.trigger.toLowerCase()!="none"&&(a={type:v.trigger,object:v},C.triggers[object.name]=a)}function k(a){return function(b){C.geometries[a]=b;j();L-=1;c.onLoadComplete();m()}}function l(a){return function(c){C.geometries[a]=c}}function m(){c.callbackProgress({totalModels:O,totalTextures:Q,loadedModels:O-L,loadedTextures:Q-M},C);c.onLoadProgress();L==0&&M==0&&b(C)}var n,
-o,t,u,w,y,x,v,p,A,B,G,H,z,D,J,I,E,F,L,M,O,Q,C;E=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;M=L=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in E.objects)if(v=E.objects[t],v.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(E.transform){a=E.transform.position;A=E.transform.rotation;var P=E.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);A&&C.scene.rotation.set(A[0],
-A[1],A[2]);P&&C.scene.scale.set(P[0],P[1],P[2]);(a||A||P)&&C.scene.updateMatrix()}a=function(){M-=1;m();c.onLoadComplete()};for(w in E.cameras){A=E.cameras[w];if(A.type=="perspective")H=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")H=new THREE.Camera,H.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);p=A.position;A=A.target;H.position.set(p[0],p[1],p[2]);H.target.position.set(A[0],A[1],A[2]);C.cameras[w]=H}for(u in E.lights)w=E.lights[u],
-H=w.color!==void 0?w.color:16777215,A=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(p=w.direction,I=new THREE.DirectionalLight(H,A),I.position.set(p[0],p[1],p[2]),I.position.normalize()):w.type=="point"?(p=w.position,d=w.distance,I=new THREE.PointLight(H,A,d),I.position.set(p[0],p[1],p[2])):w.type=="ambient"&&(I=new THREE.AmbientLight(H)),C.scene.addLight(I),C.lights[u]=I;for(y in E.fogs)u=E.fogs[y],u.type=="linear"?z=new THREE.Fog(0,u.near,u.far):u.type=="exp2"&&(z=new THREE.FogExp2(0,
-u.density)),A=u.color,z.color.setRGB(A[0],A[1],A[2]),C.fogs[y]=z;if(C.cameras&&E.defaults.camera)C.currentCamera=C.cameras[E.defaults.camera];if(C.fogs&&E.defaults.fog)C.scene.fog=C.fogs[E.defaults.fog];A=E.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(A[0],A[1],A[2]);C.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(y=E.geometries[n],y.type=="bin_mesh"||y.type=="ascii_mesh")L+=1,c.onLoadStart();O=L;for(n in E.geometries)y=E.geometries[n],y.type=="cube"?(G=new THREE.CubeGeometry(y.width,
-y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),C.geometries[n]=G):y.type=="plane"?(G=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),C.geometries[n]=G):y.type=="sphere"?(G=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),C.geometries[n]=G):y.type=="cylinder"?(G=new THREE.CylinderGeometry(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset),C.geometries[n]=G):y.type=="torus"?(G=new THREE.TorusGeometry(y.radius,
-y.tube,y.segmentsR,y.segmentsT),C.geometries[n]=G):y.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(y.subdivisions),C.geometries[n]=G):y.type=="bin_mesh"?D.load({model:e(y.url,E.urlBaseType),callback:k(n)}):y.type=="ascii_mesh"?F.load({model:e(y.url,E.urlBaseType),callback:k(n)}):y.type=="embedded_mesh"&&(y=E.embeds[y.id])&&F.createModel(y,l(n),"");for(x in E.textures)if(n=E.textures[x],n.url instanceof Array){M+=n.url.length;for(D=0;D<n.url.length;D++)c.onLoadStart()}else M+=1,c.onLoadStart();
-Q=M;for(x in E.textures){n=E.textures[x];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){D=[];for(var K=0;K<n.url.length;K++)D[K]=e(n.url[K],E.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,n.mapping,a)}else{D=THREE.ImageUtils.loadTexture(e(n.url,E.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)D.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)D.magFilter=THREE[n.magFilter];if(n.repeat){D.repeat.set(n.repeat[0],n.repeat[1]);
-if(n.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}n.offset&&D.offset.set(n.offset[0],n.offset[1]);if(n.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[n.wrap[0]]!==void 0)D.wrapS=F[n.wrap[0]];if(F[n.wrap[1]]!==void 0)D.wrapT=F[n.wrap[1]]}}C.textures[x]=D}for(o in E.materials){x=E.materials[o];for(B in x.parameters)if(B=="envMap"||B=="map"||B=="lightMap")x.parameters[B]=C.textures[x.parameters[B]];else if(B=="shading")x.parameters[B]=
-x.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")x.parameters[B]=THREE[x.parameters[B]]?THREE[x.parameters[B]]:THREE.NormalBlending;else if(B=="combine")x.parameters[B]=x.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(x.parameters[B]=="face")x.parameters[B]=THREE.FaceColors;else if(x.parameters[B])x.parameters[B]=THREE.VertexColors;if(x.parameters.opacity!==void 0&&x.parameters.opacity<1)x.parameters.transparent=
-!0;if(x.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);D=x.parameters.color;F=x.parameters.specular;y=x.parameters.ambient;z=x.parameters.shininess;a.tNormal.texture=C.textures[x.parameters.normalMap];if(x.parameters.normalMapFactor)a.uNormalScale.value=x.parameters.normalMapFactor;if(x.parameters.map)a.tDiffuse.texture=x.parameters.map,a.enableDiffuse.value=!0;if(x.parameters.lightMap)a.tAO.texture=x.parameters.lightMap,a.enableAO.value=!0;if(x.parameters.specularMap)a.tSpecular.texture=
-C.textures[x.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(y);a.uShininess.value=z;if(x.parameters.opacity)a.uOpacity.value=x.parameters.opacity;x=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else x=new THREE[x.type](x.parameters);C.materials[o]=x}j();c.callbackSync(C)}},constructor:THREE.SceneLoader};
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:f+"/"+a}function j(){for(t in E.objects)if(!C.objects[t])if(w=E.objects[t],w.geometry!==void 0){if(G=C.geometries[w.geometry]){var a=!1;J=[];for(K=0;K<w.materials.length;K++)J[K]=C.materials[w.materials[K]],a=J[K]instanceof THREE.MeshShaderMaterial;a&&G.computeTangents();p=w.position;r=w.rotation;
+q=w.quaternion;s=w.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);J.length>1&&(J=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(G,J);object.name=t;object.position.set(p[0],p[1],p[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=w.visible;C.scene.addObject(object);C.objects[t]=object;w.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),C.scene.collisions.colliders.push(a));
+if(w.castsShadow)a=new THREE.ShadowVolume(G),C.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},C.triggers[object.name]=a)}}else p=w.position,r=w.rotation,q=w.quaternion,s=w.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(p[0],p[1],p[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
+s[1],s[2]),object.visible=w.visible!==void 0?w.visible:!1,C.scene.addObject(object),C.objects[t]=object,C.empties[t]=object,w.trigger&&w.trigger.toLowerCase()!="none"&&(a={type:w.trigger,object:w},C.triggers[object.name]=a)}function k(a){return function(b){C.geometries[a]=b;j();L-=1;c.onLoadComplete();m()}}function l(a){return function(b){C.geometries[a]=b}}function m(){c.callbackProgress({totalModels:O,totalTextures:Q,loadedModels:O-L,loadedTextures:Q-M},C);c.onLoadProgress();L==0&&M==0&&b(C)}var n,
+o,t,v,u,x,y,w,p,z,B,G,H,A,D,J,I,E,F,L,M,O,Q,C;E=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;M=L=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(t in E.objects)if(w=E.objects[t],w.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(E.transform){a=E.transform.position;z=E.transform.rotation;var P=E.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);z&&C.scene.rotation.set(z[0],
+z[1],z[2]);P&&C.scene.scale.set(P[0],P[1],P[2]);(a||z||P)&&C.scene.updateMatrix()}a=function(){M-=1;m();c.onLoadComplete()};for(u in E.cameras){z=E.cameras[u];if(z.type=="perspective")H=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")H=new THREE.Camera,H.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);p=z.position;z=z.target;H.position.set(p[0],p[1],p[2]);H.target.position.set(z[0],z[1],z[2]);C.cameras[u]=H}for(v in E.lights)u=E.lights[v],
+H=u.color!==void 0?u.color:16777215,z=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(p=u.direction,I=new THREE.DirectionalLight(H,z),I.position.set(p[0],p[1],p[2]),I.position.normalize()):u.type=="point"?(p=u.position,d=u.distance,I=new THREE.PointLight(H,z,d),I.position.set(p[0],p[1],p[2])):u.type=="ambient"&&(I=new THREE.AmbientLight(H)),C.scene.addLight(I),C.lights[v]=I;for(x in E.fogs)v=E.fogs[x],v.type=="linear"?A=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(A=new THREE.FogExp2(0,
+v.density)),z=v.color,A.color.setRGB(z[0],z[1],z[2]),C.fogs[x]=A;if(C.cameras&&E.defaults.camera)C.currentCamera=C.cameras[E.defaults.camera];if(C.fogs&&E.defaults.fog)C.scene.fog=C.fogs[E.defaults.fog];z=E.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(z[0],z[1],z[2]);C.bgColorAlpha=E.defaults.bgalpha;for(n in E.geometries)if(x=E.geometries[n],x.type=="bin_mesh"||x.type=="ascii_mesh")L+=1,c.onLoadStart();O=L;for(n in E.geometries)x=E.geometries[n],x.type=="cube"?(G=new THREE.CubeGeometry(x.width,
+x.height,x.depth,x.segmentsWidth,x.segmentsHeight,x.segmentsDepth,null,x.flipped,x.sides),C.geometries[n]=G):x.type=="plane"?(G=new THREE.PlaneGeometry(x.width,x.height,x.segmentsWidth,x.segmentsHeight),C.geometries[n]=G):x.type=="sphere"?(G=new THREE.SphereGeometry(x.radius,x.segmentsWidth,x.segmentsHeight),C.geometries[n]=G):x.type=="cylinder"?(G=new THREE.CylinderGeometry(x.numSegs,x.topRad,x.botRad,x.height,x.topOffset,x.botOffset),C.geometries[n]=G):x.type=="torus"?(G=new THREE.TorusGeometry(x.radius,
+x.tube,x.segmentsR,x.segmentsT),C.geometries[n]=G):x.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(x.subdivisions),C.geometries[n]=G):x.type=="bin_mesh"?D.load({model:e(x.url,E.urlBaseType),callback:k(n)}):x.type=="ascii_mesh"?F.load({model:e(x.url,E.urlBaseType),callback:k(n)}):x.type=="embedded_mesh"&&(x=E.embeds[x.id])&&F.createModel(x,l(n),"");for(y in E.textures)if(n=E.textures[y],n.url instanceof Array){M+=n.url.length;for(D=0;D<n.url.length;D++)c.onLoadStart()}else M+=1,c.onLoadStart();
+Q=M;for(y in E.textures){n=E.textures[y];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){D=[];for(var K=0;K<n.url.length;K++)D[K]=e(n.url[K],E.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,n.mapping,a)}else{D=THREE.ImageUtils.loadTexture(e(n.url,E.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)D.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)D.magFilter=THREE[n.magFilter];if(n.repeat){D.repeat.set(n.repeat[0],n.repeat[1]);
+if(n.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}n.offset&&D.offset.set(n.offset[0],n.offset[1]);if(n.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[n.wrap[0]]!==void 0)D.wrapS=F[n.wrap[0]];if(F[n.wrap[1]]!==void 0)D.wrapT=F[n.wrap[1]]}}C.textures[y]=D}for(o in E.materials){y=E.materials[o];for(B in y.parameters)if(B=="envMap"||B=="map"||B=="lightMap")y.parameters[B]=C.textures[y.parameters[B]];else if(B=="shading")y.parameters[B]=
+y.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")y.parameters[B]=THREE[y.parameters[B]]?THREE[y.parameters[B]]:THREE.NormalBlending;else if(B=="combine")y.parameters[B]=y.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(y.parameters[B]=="face")y.parameters[B]=THREE.FaceColors;else if(y.parameters[B])y.parameters[B]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=
+!0;if(y.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);D=y.parameters.color;F=y.parameters.specular;x=y.parameters.ambient;A=y.parameters.shininess;a.tNormal.texture=C.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=
+C.textures[y.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(x);a.uShininess.value=A;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);C.materials[o]=y}j();c.callbackSync(C)}},constructor:THREE.SceneLoader};
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j+g*this.delta;b[h+1]=k;b[h+2]=l;f[h]=this.lerp(m[a],m[a+3],g);f[h+1]=this.lerp(m[a+1],m[a+4],g);f[h+2]=this.lerp(m[a+2],m[a+5],g)};this.VIntY=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k+g*this.delta;b[h+
 2]=l;b=a+this.yd*3;f[h]=this.lerp(m[a],m[b],g);f[h+1]=this.lerp(m[a+1],m[b+1],g);f[h+2]=this.lerp(m[a+2],m[b+2],g)};this.VIntZ=function(a,b,f,h,g,j,k,l,m,n){g=(g-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k;b[h+2]=l+g*this.delta;b=a+this.zd*3;f[h]=this.lerp(m[a],m[b],g);f[h+1]=this.lerp(m[a+1],m[b+1],g);f[h+2]=this.lerp(m[a+2],m[b+2],g)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]==0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,g,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,o=k+this.zd,t=h+this.yd+this.zd,u=k+this.yd+this.zd,w=0,y=this.field[h],x=this.field[k],v=this.field[l],p=this.field[n],A=this.field[m],B=this.field[o],G=this.field[t],H=this.field[u];y<g&&(w|=1);x<g&&(w|=2);v<g&&(w|=8);p<g&&(w|=4);A<g&&(w|=16);B<g&&(w|=32);G<g&&(w|=128);H<g&&(w|=64);var z=THREE.edgeTable[w];if(z==0)return 0;var D=this.delta,
-J=a+D,I=b+D,D=f+D;z&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,b,f,y,x));z&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,g,J,b,f,x,p));z&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,g,a,I,f,v,p));z&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,b,f,y,v));z&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,g,a,b,D,A,B));z&32&&(this.compNorm(o),
-this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,15,g,J,b,D,B,H));z&64&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,I,D,G,H));z&128&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,21,g,a,b,D,A,G));z&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,b,f,y,A));z&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,g,J,b,f,x,B));z&1024&&(this.compNorm(n),this.compNorm(u),this.VIntZ(n*
-3,this.vlist,this.nlist,30,g,J,I,f,p,H));z&2048&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,33,g,a,I,f,v,G));w<<=4;for(g=h=0;THREE.triTable[w+g]!=-1;)a=w+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],j),g+=3,h++;return h};this.posnormtriv=function(a,b,f,h,g,j){var k=this.count*3;this.positionArray[k]=a[f];this.positionArray[k+1]=a[f+1];this.positionArray[k+2]=a[f+2];this.positionArray[k+3]=a[h];this.positionArray[k+
+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,g,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,o=k+this.zd,t=h+this.yd+this.zd,v=k+this.yd+this.zd,u=0,x=this.field[h],y=this.field[k],w=this.field[l],p=this.field[n],z=this.field[m],B=this.field[o],G=this.field[t],H=this.field[v];x<g&&(u|=1);y<g&&(u|=2);w<g&&(u|=8);p<g&&(u|=4);z<g&&(u|=16);B<g&&(u|=32);G<g&&(u|=128);H<g&&(u|=64);var A=THREE.edgeTable[u];if(A==0)return 0;var D=this.delta,
+J=a+D,I=b+D,D=f+D;A&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,g,a,b,f,x,y));A&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,g,J,b,f,y,p));A&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,g,a,I,f,w,p));A&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,g,a,b,f,x,w));A&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,g,a,b,D,z,B));A&32&&(this.compNorm(o),
+this.compNorm(v),this.VIntY(o*3,this.vlist,this.nlist,15,g,J,b,D,B,H));A&64&&(this.compNorm(t),this.compNorm(v),this.VIntX(t*3,this.vlist,this.nlist,18,g,a,I,D,G,H));A&128&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,21,g,a,b,D,z,G));A&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,g,a,b,f,x,z));A&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,g,J,b,f,y,B));A&1024&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*
+3,this.vlist,this.nlist,30,g,J,I,f,p,H));A&2048&&(this.compNorm(l),this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,33,g,a,I,f,w,G));u<<=4;for(g=h=0;THREE.triTable[u+g]!=-1;)a=u+g,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],j),g+=3,h++;return h};this.posnormtriv=function(a,b,f,h,g,j){var k=this.count*3;this.positionArray[k]=a[f];this.positionArray[k+1]=a[f+1];this.positionArray[k+2]=a[f+2];this.positionArray[k+3]=a[h];this.positionArray[k+
 4]=a[h+1];this.positionArray[k+5]=a[h+2];this.positionArray[k+6]=a[g];this.positionArray[k+7]=a[g+1];this.positionArray[k+8]=a[g+2];this.normalArray[k]=b[f];this.normalArray[k+1]=b[f+1];this.normalArray[k+2]=b[f+2];this.normalArray[k+3]=b[h];this.normalArray[k+4]=b[h+1];this.normalArray[k+5]=b[h+2];this.normalArray[k+6]=b[g];this.normalArray[k+7]=b[g+1];this.normalArray[k+8]=b[g+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=function(){this.count=0;
 this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!=0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,g){var j=this.size*Math.sqrt(h/g),k=f*this.size,l=b*this.size,m=a*this.size,n=Math.floor(k-j);n<1&&(n=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var o=Math.floor(l-j);o<1&&(o=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var t=Math.floor(m-j);t<1&&(t=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
-1);for(var u,w,y,x,v,p;n<k;n++){m=this.size2*n;w=n/this.size-f;v=w*w;for(w=o;w<l;w++){y=m+this.size*w;u=w/this.size-b;p=u*u;for(u=t;u<j;u++)x=u/this.size-a,x=h/(1.0E-6+x*x+p+v)-g,x>0&&(this.field[y+u]+=x)}}};this.addPlaneX=function(a,b){var f,h,g,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,t=l*Math.sqrt(a/b);t>l&&(t=l);for(f=0;f<t;f++)if(h=f/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=f+h*m;for(g=0;g<l;g++)o[n*g+k]+=j}};this.addPlaneY=function(a,b){var f,h,g,j,k,l,m=this.size,n=this.yd,o=
-this.zd,t=this.field,u=m*Math.sqrt(a/b);u>m&&(u=m);for(h=0;h<u;h++)if(f=h/m,f*=f,j=a/(1.0E-4+f)-b,j>0){k=h*n;for(f=0;f<m;f++){l=k+f;for(g=0;g<m;g++)t[o*g+l]+=j}}};this.addPlaneZ=function(a,b){var f,h,g,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,j=a/(1.0E-4+f)-b,j>0){k=zd*g;for(h=0;h<size;h++){l=k+h*yd;for(f=0;f<size;f++)field[l+f]+=j}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
+1);for(var v,u,x,y,w,p;n<k;n++){m=this.size2*n;u=n/this.size-f;w=u*u;for(u=o;u<l;u++){x=m+this.size*u;v=u/this.size-b;p=v*v;for(v=t;v<j;v++)y=v/this.size-a,y=h/(1.0E-6+y*y+p+w)-g,y>0&&(this.field[x+v]+=y)}}};this.addPlaneX=function(a,b){var f,h,g,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,t=l*Math.sqrt(a/b);t>l&&(t=l);for(f=0;f<t;f++)if(h=f/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=f+h*m;for(g=0;g<l;g++)o[n*g+k]+=j}};this.addPlaneY=function(a,b){var f,h,g,j,k,l,m=this.size,n=this.yd,o=
+this.zd,t=this.field,v=m*Math.sqrt(a/b);v>m&&(v=m);for(h=0;h<v;h++)if(f=h/m,f*=f,j=a/(1.0E-4+f)-b,j>0){k=h*n;for(f=0;f<m;f++){l=k+f;for(g=0;g<m;g++)t[o*g+l]+=j}}};this.addPlaneZ=function(a,b){var f,h,g,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(g=0;g<dist;g++)if(f=g/size,f*=f,j=a/(1.0E-4+f)-b,j>0){k=zd*g;for(h=0;h<size;h++){l=k+h*yd;for(f=0;f<size;f++)field[l+f]+=j}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*
 3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,h,g,j,k,l,m,n,o=this.size-2;for(g=1;g<o;g++){n=this.size2*g;l=(g-this.halfsize)/this.halfsize;for(h=1;h<o;h++){m=n+this.size*h;k=(h-this.halfsize)/this.halfsize;for(f=1;f<o;f++)j=(f-this.halfsize)/this.halfsize,b=m+f,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var g,j,k,l,m,n,o,t;for(g=0;g<h.count;g++)o=g*3,m=o+1,t=o+2,j=h.positionArray[o],
 k=h.positionArray[m],l=h.positionArray[t],n=new THREE.Vector3(j,k,l),j=h.normalArray[o],k=h.normalArray[m],l=h.normalArray[t],o=new THREE.Vector3(j,k,l),o.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),f.push(o);nfaces=h.count/3;for(g=0;g<nfaces;g++)o=(a+g)*3,m=o+1,t=o+2,n=f[o],j=f[m],k=f[t],o=new THREE.Face3(o,m,t,[n,j,k]),b.faces.push(o);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
@@ -264,7 +275,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
 if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.Camera,h=new THREE.Camera,g=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;f.useTarget=h.useTarget=!1;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.Camera(53,1,1,1E4);t.position.z=
 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var u=new THREE.Scene;u.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,c){c.update(null,!0);if(k!==c.aspect||l!==c.near||m!==c.fov){k=c.aspect;l=c.near;m=c.fov;var x=c.projectionMatrix.clone(),v=125/30*0.5,p=v*l/125,A=l*Math.tan(m*Math.PI/360),B;g.n14=v;j.n14=-v;v=-A*k+p;B=A*k+p;x.n11=2*l/(B-v);x.n13=(B+v)/(B-v);f.projectionMatrix=x.clone();v=-A*k-p;B=A*k-p;x.n11=2*l/(B-v);
-x.n13=(B+v)/(B-v);h.projectionMatrix=x.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(j);f.update(null,!0);f.position.copy(c.position);f.near=l;f.far=c.far;e.call(b,a,f,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;e.call(b,a,h,o,!0);e.call(b,u,t)}};
+var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,c){c.update(null,!0);if(k!==c.aspect||l!==c.near||m!==c.fov){k=c.aspect;l=c.near;m=c.fov;var y=c.projectionMatrix.clone(),w=125/30*0.5,p=w*l/125,z=l*Math.tan(m*Math.PI/360),B;g.n14=w;j.n14=-w;w=-z*k+p;B=z*k+p;y.n11=2*l/(B-w);y.n13=(B+w)/(B-w);f.projectionMatrix=y.clone();w=-z*k-p;B=z*k-p;y.n11=2*l/(B-w);
+y.n13=(B+w)/(B-w);h.projectionMatrix=y.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(j);f.update(null,!0);f.position.copy(c.position);f.near=l;f.far=c.far;e.call(b,a,f,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(g);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;e.call(b,a,h,o,!0);e.call(b,v,t)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,g=new THREE.Camera,j=new THREE.Camera;b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){c.call(b,a,e);f=a/2;h=e};this.render=function(a,c){this.clear();g.fov=c.fov;g.aspect=0.5*c.aspect;g.near=c.near;g.far=c.far;
 g.updateProjectionMatrix();g.position.copy(c.position);g.target.position.copy(c.target.position);g.translateX(b.separation);j.projectionMatrix=g.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,f,h);e.call(b,a,g);this.setViewport(f,0,f,h);e.call(b,a,j,!1)}};

+ 12 - 12
examples/webgl_geometry_shapes.html

@@ -291,9 +291,9 @@
 				var arc3d = arcShape.extrude( extrudeSettings );
 				var arcPoints = arcShape.createPointsGeometry();
 				var arcSpacedPoints = arcShape.createSpacedPointsGeometry();
-				
-				
-				// Smiley 
+
+
+				// Smiley
 
 				var smileyShape = new THREE.Shape();
 				smileyShape.moveTo( 0, 0 );
@@ -303,12 +303,12 @@
 				smileyEye1Path.moveTo( 0, 0 );
 				smileyEye1Path.arc( 25, 20, 10, 0, Math.PI*2, true );
 				smileyShape.holes.push( smileyEye1Path );
-				
+
 				var smileyEye2Path = new THREE.Path();
 				smileyEye2Path.moveTo( 0, 0 );
 				smileyEye2Path.arc( 55, 20, 10, 0, Math.PI*2, true );
 				smileyShape.holes.push( smileyEye2Path );
-			
+
 				var smileyMouthPath = new THREE.Path();
 				// ugly box mouth
 				// smileyMouthPath.moveTo( 20, 40 );
@@ -316,16 +316,16 @@
 				// smileyMouthPath.lineTo( 60, 60 );
 				// smileyMouthPath.lineTo( 20, 60 );
 				// smileyMouthPath.lineTo( 20, 40 );
-				
+
 				smileyMouthPath.moveTo( 20, 40 );
 				smileyMouthPath.quadraticCurveTo( 40, 60, 60, 40 );
 				smileyMouthPath.bezierCurveTo( 70, 45, 70, 50, 60, 60 );
 				smileyMouthPath.quadraticCurveTo( 40, 80, 20, 60 );
 				smileyMouthPath.quadraticCurveTo( 5, 50, 20, 40 );
-				
+
 				smileyShape.holes.push( smileyMouthPath );
-				
-				
+
+
 				var smiley3d = smileyShape.extrude( extrudeSettings );
 				var smileyPoints = smileyShape.createPointsGeometry();
 				var smileySpacedPoints = smileyShape.createSpacedPointsGeometry();
@@ -351,7 +351,7 @@
 				extrudePath.quadraticCurveTo( 80, 60, 160, 10 );
 				extrudePath.quadraticCurveTo( 240, -40, 320, 10 );
 
-				extrudeSettings.path = extrudePath;
+				extrudeSettings.extrudePath = extrudePath;
 				extrudeSettings.bevelEnabled = false;
 
 				var splineShape3d = splineShape.extrude( extrudeSettings );
@@ -368,8 +368,8 @@
 				addGeometry( splineShape3d, splinePoints, splineSpacedPoints,			0x888888,  -50,  -100, -50,  0, 0, 0, 0.2 );
 				addGeometry( arc3d, arcPoints, arcSpacedPoints,							0xbb4422,  150,    0, 0,     0, 0, 0, 1 );
 				addGeometry( smiley3d, smileyPoints, smileySpacedPoints,				0xee00ff,  -270,    250, 0,     Math.PI, 0, 0, 1 );
-			
-				
+
+
 				//
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );

+ 20 - 10
examples/webgl_geometry_text.html

@@ -33,6 +33,7 @@
 			<span class="button" id="font">change font</span>,
 			<span class="button" id="weight">change weight</span>,
 			<span class="button" id="bevel">change bevel</span>,
+			<span class="button" id="bend">bend</span>,
 			<span class="button" id="postprocessing">change postprocessing</span>,
 			<a id="permalink" href="#">permalink</a>
 		</div>
@@ -44,12 +45,8 @@
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 
-		<!-- load the font file from canvas-text -->
+		<!-- load the font files -->
 
-		<!--
-
-
-		-->
 		<script type="text/javascript" src="fonts/gentilis_bold.typeface.js"></script>
 		<script type="text/javascript" src="fonts/gentilis_regular.typeface.js"></script>
 		<script type="text/javascript" src="fonts/optimer_bold.typeface.js"></script>
@@ -61,6 +58,7 @@
 		<script type="text/javascript" src="fonts/droid/droid_serif_regular.typeface.js"></script>
 		<script type="text/javascript" src="fonts/droid/droid_serif_bold.typeface.js"></script>
 
+		<!-- todo async loader for fonts -->
 
 		<script type="text/javascript">
 
@@ -86,6 +84,7 @@
 				bevelSize = 1.5,
 				bevelSegments = 3,
 				bevelEnabled = true,
+				bend = true,
 
 				font = "optimer", 		// helvetiker, optimer, gentilis, droid sans, droid serif
 				weight = "bold",		// normal bold
@@ -164,7 +163,7 @@
 				scene.addLight( dirLight );
 
 				var pointLight = new THREE.PointLight( 0xffffff, 1.5 );
-				pointLight.position.set( 0, 100, 50 );
+				pointLight.position.set( 0, 100, 90 );
 				scene.addLight( pointLight );
 
 				//text = capitalize( font ) + " " + capitalize( weight );
@@ -182,7 +181,8 @@
 					var weighthash = hash.substring( 7, 8 );
 					var pphash 	   = hash.substring( 8, 9 );
 					var bevelhash  = hash.substring( 9, 10 );
-					var texthash   = hash.substring( 11 );
+					var bendhash   = hash.substring( 10, 11 );
+					var texthash   = hash.substring( 12 );
 
 					hex = colorhash;
 					pointLight.color.setHex( parseInt( colorhash, 16 ) );
@@ -192,6 +192,7 @@
 
 					postprocessing.enabled = parseInt( pphash );
 					bevelEnabled = parseInt( bevelhash );
+					bend = parseInt( bendhash );
 
 					text = decodeURI( texthash );
 
@@ -297,6 +298,13 @@
 
 				}, false );
 
+				document.getElementById( "bend" ).addEventListener( 'click', function() {
+
+					bend = !bend;
+					refreshText();
+
+				}, false );
+
 				document.getElementById( "postprocessing" ).addEventListener( 'click', function() {
 
 					postprocessing.enabled = !postprocessing.enabled;
@@ -319,7 +327,8 @@
 
 			function updatePermalink() {
 
-				var link = hex + fontMap[ font ] + weightMap[ weight ] + boolToNum( postprocessing.enabled ) + boolToNum( bevelEnabled ) + "#" + encodeURI( text );
+				var link = hex + fontMap[ font ] + weightMap[ weight ] + boolToNum( postprocessing.enabled ) + boolToNum( bevelEnabled )
+				+ boolToNum( bend ) + "#" + encodeURI( text );
 
 				permalink.href = "#" + link;
 				window.location.hash = link;
@@ -374,7 +383,6 @@
 			}
 
 			function createText() {
-
 				textGeo = new THREE.TextGeometry( text, {
 
 					size: size,
@@ -387,7 +395,9 @@
 
 					bevelThickness: bevelThickness,
 					bevelSize: bevelSize,
-					bevelEnabled: bevelEnabled
+					bevelEnabled: bevelEnabled,
+
+					bend: bend
 
 				});
 

+ 243 - 62
src/extras/geometries/Curve.js

@@ -92,10 +92,10 @@ THREE.Curve.prototype.getLengths = function ( divisions ) {
 
 	if ( !divisions ) divisions = 200;
 
-	if ( this.cacheLengths && ( this.cacheLengths.length == divisions ) ) {
+	if ( this.cacheArcLengths && ( this.cacheArcLengths.length == divisions + 1 ) ) {
 
-		//console.log( "cached", this.cacheLengths );
-		return this.cacheLengths;
+		//console.log( "cached", this.cacheArcLengths );
+		return this.cacheArcLengths;
 
 	}
 
@@ -103,7 +103,9 @@ THREE.Curve.prototype.getLengths = function ( divisions ) {
 	var current, last = this.getPoint( 0 );
 	var p, sum = 0;
 
-	for ( p = 1; p <= divisions; p++ ) {
+	cache.push( 0 );
+
+	for ( p = 1; p <= divisions; p ++ ) {
 
 		current = this.getPoint ( p / divisions );
 		sum += current.distanceTo( last );
@@ -112,7 +114,8 @@ THREE.Curve.prototype.getLengths = function ( divisions ) {
 
 	}
 
-	this.cacheLengths = cache;
+	this.cacheArcLengths = cache;
+
 	return cache; // { sums: cache, sum:sum }; Sum is in the last element.
 
 };
@@ -121,48 +124,156 @@ THREE.Curve.prototype.getLengths = function ( divisions ) {
 
 THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {
 
-	var lengths = this.getLengths();
-	var i = 0, il = lengths.length;
+	var arcLengths = this.getLengths();
 
-	var distanceForU;
+	var i = 0, il = arcLengths.length;
+
+	var targetArcLength; // The targeted u distance value to get
 
 	if ( distance ) {
 
-		distanceForU = distance;
+		targetArcLength = distance;
 
 	} else {
 
-		distanceForU = u * lengths[ il - 1 ];
+		targetArcLength = u * arcLengths[ il - 1 ];
 
 	}
 
-	// TODO Should do binary search + sub division + interpolation when needed
+	// // TODO Should do binary search + sub division + interpolation when needed
+	// time = Date.now();
+	// while ( i < il ) {
+	//
+	// 	i++;
+	//
+	// 	if ( targetArcLength < arcLengths[ i ] ) break;
+	//
+	// }
+	//
+	// i--;
+	// console.log('o' , i, Date.now()- time);
+
+	time = Date.now();
+
+	// binary search for the index with largest value smaller than target u distance
+
+	var low = 0, high = il - 1, comparison;
+
+	while ( low <= high ) {
+
+		i = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats
+
+	  	comparison = arcLengths[ i ] - targetArcLength;
+
+	  	if ( comparison < 0 ) {
+
+			low = i + 1;
+			continue;
 
-	while ( i < il ) {
+		} else if ( comparison > 0 ) {
 
-		if ( lengths[ i ] > distanceForU ) break;
+			high = i - 1;
+			continue;
 
-		i++;
+		} else {
+
+			high = i;
+			break;
+
+			// DONE
+
+		}
 
 	}
 
-	var t = i / il;
+	i = high;
+
+	//console.log('b' , i, low, high, Date.now()- time);
+
+	if ( arcLengths[ i ] == targetArcLength ) {
+
+		var t = i / ( il - 1 );
+		return t;
+
+	}
+
+	// we could get finer grain at lengths, or use simple interpolatation between two points
+
+	var lengthBefore = arcLengths[ i ];
+    var lengthAfter = arcLengths[ i + 1 ];
+
+    var segmentLength = lengthAfter - lengthBefore;
+
+    // determine where we are between the 'before' and 'after' points
+
+    var segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;
+
+    // add that fractional amount to t
+
+    t = ( i + segmentFraction ) / ( il -1 );
+
 	return t;
 
 };
 
+// In case any sub curve does not implement its tangent / normal finding,
+// we get 2 points with a small delta and find a gradient of the 2 points
+// which seems to make a reasonable approximation
+
+THREE.Curve.prototype.getNormalVector = function( t ) {
+
+	var vec = this.getTangent( t );
+
+	return new THREE.Vector2( -vec.y , vec.x );
+
+};
+
+// Returns a unit vector tangent at t
+
+THREE.Curve.prototype.getTangent = function( t ) {
+
+	var delta = 0.0001;
+	var t1 = t - delta;
+	var t2 = t + delta;
+
+	// Capping in case of danger
+
+	if ( t1 < 0 ) t1 = 0;
+	if ( t2 > 1 ) t2 = 1;
+
+	var pt1 = this.getPoint( t1 );
+	var pt2 = this.getPoint( t2 );
+
+	var vec = new THREE.Vector2();
+	vec.sub( pt2, pt1 );
+	return vec.unit();
+
+};
+
 
 /**************************************************************
  *	Line
  **************************************************************/
 
-THREE.LineCurve = function ( x1, y1, x2, y2 ) {
+THREE.LineCurve = function ( v1, v2 ) {
+
+	if ( ! ( v1 instanceof THREE.Vector2 ) ) {
+
+		// Fall back for old constuctor signature - should be removed over time
 
-	this.x1 = x1;
-	this.y1 = y1;
+		THREE.LineCurve.oldConstructor.apply( this, arguments );
+		return;
 
-	this.x2 = x2;
-	this.y2 = y2;
+	}
+
+	this.v1 = v1;
+	this.v2 = v2;
+
+};
+
+THREE.LineCurve.oldConstructor = function ( x1, y1, x2, y2 ) {
+
+	this.constructor( new THREE.Vector2( x1, y1 ), new THREE.Vector2( x2, y2 ) );
 
 };
 
@@ -171,13 +282,39 @@ THREE.LineCurve.prototype.constructor = THREE.LineCurve;
 
 THREE.LineCurve.prototype.getPoint = function ( t ) {
 
-	var dx = this.x2 - this.x1;
-	var dy = this.y2 - this.y1;
+	var point = new THREE.Vector2();
 
-	var tx = this.x1 + dx * t;
-	var ty = this.y1 + dy * t;
+	point.sub( this.v2, this.v1 );
+	point.multiplyScalar( t ).addSelf( this.v1 );
 
-	return new THREE.Vector2( tx, ty );
+	return point;
+
+	// 	var dx = this.x2 - this.x1;
+	// 	var dy = this.y2 - this.y1;
+	//
+	// 	var tx = this.x1 + dx * t;
+	// 	var ty = this.y1 + dy * t;
+	//
+	// 	return new THREE.Vector2( tx, ty );
+
+};
+
+// Line curve is linear, so we can overwrite default getPointAt
+
+THREE.LineCurve.prototype.getPointAt = function ( u ) {
+
+	return this.getPoint( u );
+
+};
+
+THREE.LineCurve.prototype.getTangent = function( t ) {
+
+	var tangent = new THREE.Vector2();
+
+	tangent.sub( this.v2, this.v1 );
+	tangent.normalize();
+
+	return tangent;
 
 };
 
@@ -185,16 +322,22 @@ THREE.LineCurve.prototype.getPoint = function ( t ) {
  *	Quadratic Bezier curve
  **************************************************************/
 
-THREE.QuadraticBezierCurve = function ( x0, y0, x1, y1, x2, y2 ) {
 
-	this.x0 = x0;
-	this.y0 = y0;
+THREE.QuadraticBezierCurve = function ( v0, v1, v2 ) {
+
+	if ( !( v1 instanceof THREE.Vector2 ) ) {
+
+		var args = Array.prototype.slice.call( arguments );
 
-	this.x1 = x1;
-	this.y1 = y1;
+		v0 = new THREE.Vector2( args[ 0 ], args[ 1 ] );
+		v1 = new THREE.Vector2( args[ 2 ], args[ 3 ] );
+		v2 = new THREE.Vector2( args[ 4 ], args[ 5 ] );
+
+	}
 
-	this.x2 = x2;
-	this.y2 = y2;
+	this.v0 = v0;
+	this.v1 = v1;
+	this.v2 = v2;
 
 };
 
@@ -206,39 +349,43 @@ THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) {
 
 	var tx, ty;
 
-	tx = THREE.Shape.Utils.b2( t, this.x0, this.x1, this.x2 );
-	ty = THREE.Shape.Utils.b2( t, this.y0, this.y1, this.y2 );
+	tx = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x );
+	ty = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y );
 
 	return new THREE.Vector2( tx, ty );
 
 };
 
 
-THREE.QuadraticBezierCurve.prototype.getNormalVector = function( t ) {
+THREE.QuadraticBezierCurve.prototype.getTangent = function( t ) {
 
 	// iterate sub segments
 	// 	get lengths for sub segments
 	// 	if segment is bezier
-	//		perform subdivisions or perform integrals
+	//		perform subdivisions
 
-	var x0, y0, x1, y1, x2, y2;
+	// var x0, y0, x1, y1, x2, y2;
 
-	x0 = this.actions[ 0 ].args[ 0 ];
-	y0 = this.actions[ 0 ].args[ 1 ];
+	// x0 = this.actions[ 0 ].args[ 0 ];
+	// y0 = this.actions[ 0 ].args[ 1 ];
+	//
+	// x1 = this.actions[ 1 ].args[ 0 ];
+	// y1 = this.actions[ 1 ].args[ 1 ];
+	//
+	// x2 = this.actions[ 1 ].args[ 2 ];
+	// y2 = this.actions[ 1 ].args[ 3 ];
 
-	x1 = this.actions[ 1 ].args[ 0 ];
-	y1 = this.actions[ 1 ].args[ 1 ];
+	var tx, ty;
 
-	x2 = this.actions[ 1 ].args[ 2 ];
-	y2 = this.actions[ 1 ].args[ 3 ];
+	tx = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x );
+	ty = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y );
 
-	var tx, ty;
+	// returns unit vector
 
-	tx = THREE.Curve.Utils.tangentQuadraticBezier( t, this.x0, this.x1, this.x2 );
-	ty = THREE.Curve.Utils.tangentQuadraticBezier( t, this.y0, this.y1, this.y2 );
+	var tangent = new THREE.Vector2( tx, ty );
+	tangent.normalize();
 
-	// return normal unit vector
-	return new THREE.Vector2( -ty , tx ).unit();
+	return tangent;
 
 };
 
@@ -247,19 +394,23 @@ THREE.QuadraticBezierCurve.prototype.getNormalVector = function( t ) {
  *	Cubic Bezier curve
  **************************************************************/
 
-THREE.CubicBezierCurve = function ( x0, y0, x1, y1, x2, y2, x3, y3 ) {
+THREE.CubicBezierCurve = function ( v0, v1, v2, v3 ) {
 
-	this.x0 = x0;
-	this.y0 = y0;
+	if ( ! ( v1 instanceof THREE.Vector2 ) ) {
 
-	this.x1 = x1;
-	this.y1 = y1;
+		var args = Array.prototype.slice.call( arguments );
 
-	this.x2 = x2;
-	this.y2 = y2;
+		v0 = new THREE.Vector2( args[ 0 ], args[ 1 ] );
+		v1 = new THREE.Vector2( args[ 2 ], args[ 3 ] );
+		v2 = new THREE.Vector2( args[ 4 ], args[ 5 ] );
+		v3 = new THREE.Vector2( args[ 6 ], args[ 7 ] );
 
-	this.x3 = x3;
-	this.y3 = y3;
+	}
+
+	this.v0 = v0;
+	this.v1 = v1;
+	this.v2 = v2;
+	this.v3 = v3;
 
 };
 
@@ -270,18 +421,35 @@ THREE.CubicBezierCurve.prototype.getPoint = function ( t ) {
 
 	var tx, ty;
 
-	tx = THREE.Shape.Utils.b3( t, this.x0, this.x1, this.x2, this.x3 );
-	ty = THREE.Shape.Utils.b3( t, this.y0, this.y1, this.y2, this.y3 );
+	tx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );
+	ty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );
 
 	return new THREE.Vector2( tx, ty );
 
 };
 
+THREE.CubicBezierCurve.prototype.getTangent = function( t ) {
+
+	var tx, ty;
+
+	tx = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );
+	ty = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );
+
+	// return normal unit vector
+
+	var tangent = new THREE.Vector2( tx, ty );
+	tangent.normalize();
+
+	return tangent;
+
+};
+
+
 /**************************************************************
  *	Spline curve
  **************************************************************/
 
-THREE.SplineCurve = function ( points /* array of Vector2*/ ) {
+THREE.SplineCurve = function ( points /* array of Vector2 */ ) {
 
 	this.points = points;
 
@@ -366,6 +534,17 @@ THREE.Curve.Utils = {
 
 	},
 
+	// Puay Bing, thanks for helping with this derivative!
+
+	tangentCubicBezier: function (t, p0, p1, p2, p3 ) {
+
+		return -3 * p0 * (1 - t) * (1 - t)  +
+			3 * p1 * (1 - t) * (1-t) - 6 *t *p1 * (1-t) +
+			6 * t *  p2 * (1-t) - 3 * t * t * p2 +
+			3 * t * t * p3;
+	},
+
+
 	tangentSpline: function ( t, p0, p1, p2, p3 ) {
 
 		// To check if my formulas are correct
@@ -375,6 +554,8 @@ THREE.Curve.Utils = {
 		var h01 = -6 * t * t + 6 * t; 	// − 2t3 + 3t2
 		var h11 = 3 * t * t - 2 * t;	// t3 − t2
 
+		return h00 + h10 + h01 + h11;
+
 	},
 
 	// Catmull-Rom
@@ -400,7 +581,7 @@ getLengths DONE
 curve.getPoints(); DONE
 curve.getPointAtArcLength(t); DONE
 curve.transform(params);
-curve.getTangentAt(t)
+curve.getTangentAt(t); DONE
 */
 
 /**************************************************************
@@ -458,7 +639,7 @@ THREE.LineCurve3 = THREE.Curve.create(
 
 THREE.QuadraticBezierCurve3 = THREE.Curve.create(
 
-	function ( v0, v1, v2 ) { // Qn should we use 2 Vector3 instead?
+	function ( v0, v1, v2 ) {
 
 		this.v0 = v0;
 		this.v1 = v1;

+ 298 - 0
src/extras/geometries/CurvePath.js

@@ -0,0 +1,298 @@
+/**
+ * @author zz85 / http://www.lab4games.net/zz85/blog
+ *
+ **/
+
+/**************************************************************
+ *	Curved Path - a curve path is simply a array of connected
+ *  curves, but retains the api of a curve
+ **************************************************************/
+
+THREE.CurvePath = function () {
+
+	this.curves = [];
+	this.bends = [];
+
+};
+
+THREE.CurvePath.prototype = new THREE.Curve();
+THREE.CurvePath.prototype.constructor = THREE.CurvePath;
+
+THREE.CurvePath.prototype.add = function ( curve ) {
+
+	this.curves.push( curve );
+
+};
+
+THREE.CurvePath.prototype.checkConnection = function() {
+
+};
+
+// Add a line curve  if start and end of lines are not connected
+
+THREE.CurvePath.prototype.closePath = function() {
+
+};
+
+// To get accurate point with reference to
+// entire path distance at time t,
+// following has to be done:
+
+// 1. Length of each sub path have to be known
+// 2. Locate and identify type of curve
+// 3. Get t for the curve
+// 4. Return curve.getPointAt(t')
+
+THREE.CurvePath.prototype.getPoint = function( t ) {
+
+	var d = t * this.getLength();
+	var curveLengths = this.getCurveLengths();
+	var i = 0, diff, curve;
+
+	// To think about boundaries points.
+
+	while ( i < curveLengths.length ) {
+
+		if ( curveLengths[ i ] >= d ) {
+
+			diff = curveLengths[ i ] - d;
+			curve = this.curves[ i ];
+
+			var u = 1 - diff / curve.getLength();
+
+			return curve.getPointAt( u );
+
+			break;
+		}
+
+		i ++;
+
+	}
+
+	return null;
+
+	// loop where sum != 0, sum > d , sum+1 <d
+
+};
+
+/*
+THREE.CurvePath.prototype.getTangent = function( t ) {
+};*/
+
+
+// We cannot use the default THREE.Curve getPoint() with getLength() because in
+// THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath
+// getPoint() depends on getLength
+
+THREE.CurvePath.prototype.getLength = function() {
+
+	var lens = this.getCurveLengths();
+	return lens[ lens.length - 1 ];
+
+};
+
+// Compute lengths and cache them
+// We cannot overwrite getLengths() because UtoT mapping uses it.
+
+THREE.CurvePath.prototype.getCurveLengths = function() {
+
+	// We use cache values if curves and cache array are same length
+
+	if ( this.cacheLengths && this.cacheLengths.length == this.curves.length ) {
+
+		return this.cacheLengths;
+
+	};
+
+	// Get length of subsurve
+	// Push sums into cached array
+
+	var lengths = [], sums = 0;
+	var i, il = this.curves.length;
+
+	for ( i = 0; i < il; i ++ ) {
+
+		sums += this.curves[ i ].getLength();
+		lengths.push( sums );
+
+	}
+
+	this.cacheLengths = lengths;
+
+	return lengths;
+
+};
+
+
+
+// Returns min and max coordinates, as well as centroid
+
+THREE.CurvePath.prototype.getBoundingBox = function () {
+
+	var points = this.getPoints();
+
+	var maxX, maxY;
+	var minX, minY;
+
+	maxX = maxY = Number.NEGATIVE_INFINITY;
+	minX = minY = Number.POSITIVE_INFINITY;
+
+	var p, i, il, sum;
+
+	sum = new THREE.Vector2();
+
+	for ( i = 0, il = points.length; i < il; i ++ ) {
+
+		p = points[ i ];
+
+		if ( p.x > maxX ) maxX = p.x;
+		else if ( p.x < minX ) minX = p.x;
+
+		if ( p.y > maxY ) maxY = p.y;
+		else if ( p.y < maxY ) minY = p.y;
+
+		sum.addSelf( p.x, p.y );
+
+	}
+
+	return {
+
+		minX: minX,
+		minY: minY,
+		maxX: maxX,
+		maxY: maxY,
+		centroid: sum.divideScalar( il )
+
+	};
+
+};
+
+/**************************************************************
+ *	Create Geometries Helpers
+ **************************************************************/
+
+/// Generate geometry from path points (for Line or ParticleSystem objects)
+
+THREE.CurvePath.prototype.createPointsGeometry = function( divisions ) {
+
+    var pts = this.getPoints( divisions, true );
+	return this.createGeometry( pts );
+
+};
+
+// Generate geometry from equidistance sampling along the path
+
+THREE.CurvePath.prototype.createSpacedPointsGeometry = function( divisions ) {
+
+    var pts = this.getSpacedPoints( divisions, true );
+	return this.createGeometry( pts );
+
+};
+
+THREE.CurvePath.prototype.createGeometry = function( points ) {
+
+	var geometry = new THREE.Geometry();
+
+    for( var i = 0; i < points.length; i ++ ) {
+
+        geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( points[ i ].x, points[ i ].y, 0 ) ) );
+
+    }
+
+    return geometry;
+
+};
+
+
+/**************************************************************
+ *	Bend / Wrap Helper Methods
+ **************************************************************/
+
+// Wrap path / Bend modifiers?
+
+THREE.CurvePath.prototype.addWrapPath = function ( bendpath ) {
+
+	this.bends.push( bendpath );
+
+};
+
+THREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) {
+
+	var oldPts = this.getPoints( segments ); // getPoints getSpacedPoints
+	var i, il;
+
+	if ( !bends ) {
+
+		bends = this.bends;
+
+	}
+
+	for ( i = 0, il = bends.length; i < il; i ++ ) {
+
+		oldPts = this.getWrapPoints( oldPts, bends[ i ] );
+
+	}
+
+	return oldPts;
+
+};
+
+THREE.CurvePath.prototype.getTransformedSpacedPoints = function( segments, bends ) {
+
+	var oldPts = this.getSpacedPoints( segments );
+
+	var i, il;
+
+	if ( !bends ) {
+
+		bends = this.bends;
+
+	}
+
+	for ( i = 0, il = bends.length; i < il; i ++ ) {
+
+		oldPts = this.getWrapPoints( oldPts, bends[ i ] );
+
+	}
+
+	return oldPts;
+
+};
+
+// This returns getPoints() bend/wrapped around the contour of a path.
+// Read http://www.planetclegg.com/projects/WarpingTextToSplines.html
+
+THREE.CurvePath.prototype.getWrapPoints = function ( oldPts, path ) {
+
+	var bounds = this.getBoundingBox();
+
+	var i, il, p, oldX, oldY, xNorm;
+
+	for ( i = 0, il = oldPts.length; i < il; i ++ ) {
+
+		p = oldPts[ i ];
+
+		oldX = p.x;
+		oldY = p.y;
+
+		var xNorm = oldX/ bounds.maxX;
+
+		// If using actual distance, for length > path, requires line extrusions
+		//xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance
+
+		xNorm = path.getUtoTmapping( xNorm, oldX );
+
+		// check for out of bounds?
+
+		var pathPt = path.getPoint( xNorm );
+		var normal = path.getNormalVector( xNorm ).multiplyScalar( oldY );
+
+		p.x = pathPt.x + normal.x;
+		p.y = pathPt.y + normal.y;
+
+	}
+
+	return oldPts;
+
+};
+

+ 35 - 2
src/extras/geometries/ExtrudeGeometry.js

@@ -16,6 +16,9 @@
  *  bevelThickness: <float>, 		// how deep into text bevel goes
  *  bevelSize:		<float>, 		// how far from text outline is bevel
  *  bevelSegments:	<int>, 			// number of bevel layers
+ *
+ *  extrudePath:	<THREE.CurvePath>	// path to extrude shape along
+ *  bendPath:		<THREE.CurvePath> 	// path to bend the geometry around
  *  }
   **/
 
@@ -64,9 +67,13 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 	var steps = options.steps !== undefined ? options.steps : 1;
 
-	var extrudePath = options.path !== undefined ? options.path : null;
+	var bendPath = options.bendPath;
+
+	var extrudePath = options.extrudePath;
 	var extrudePts, extrudeByPath = false;
 
+	var useSpacedPoints = options.useSpacedPoints !== undefined ? options.useSpacedPoints : false;
+
 	if ( extrudePath ) {
 
 		extrudePts = extrudePath.getPoints( curveSegments );
@@ -97,7 +104,28 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 	var shapesOffset = this.vertices.length;
 
-	var shapePoints = shape.extractAllPoints( curveSegments ); // use shape.extractAllSpacedPoints( curveSegments ) for points with equal divisions
+
+	if ( bendPath ) {
+
+		shape.addWrapPath( bendPath );
+
+		//shapePoints = shape.extractAllPointsWithBend( curveSegments, bendPath );
+
+	}
+
+	var shapePoints;
+
+	if ( !useSpacedPoints ) {
+
+	  	shapePoints = shape.extractAllPoints( curveSegments ); //
+
+	} else {
+
+		// QN - Would it be better to pass useSpacePoints parameter to shape, just like bendpath ?
+
+		shapePoints = shape.extractAllSpacedPoints( curveSegments ) // for points with equal divisions
+
+	}
 
     var vertices = shapePoints.shape;
 	var holes = shapePoints.holes;
@@ -130,6 +158,11 @@ THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 	var faces = THREE.Shape.Utils.triangulateShape ( vertices, holes );
 	//var faces = THREE.Shape.Utils.triangulate2( vertices, holes );
 
+	// Would it be better to move points after triangulation?
+	// shapePoints = shape.extractAllPointsWithBend( curveSegments, bendPath );
+	// 	vertices = shapePoints.shape;
+	// 	holes = shapePoints.holes;
+
 	//console.log(faces);
 
 	////

+ 35 - 202
src/extras/geometries/Path.js

@@ -6,8 +6,9 @@
 
 THREE.Path = function ( points ) {
 
+	THREE.CurvePath.call(this);
+
 	this.actions = [];
-	this.curves = [];
 
 	if ( points ) {
 
@@ -17,6 +18,10 @@ THREE.Path = function ( points ) {
 
 };
 
+THREE.Path.prototype = new THREE.CurvePath();
+THREE.Path.prototype.constructor = THREE.Path;
+
+
 THREE.PathActions = {
 
 	MOVE_TO: 'moveTo',
@@ -65,10 +70,10 @@ THREE.Path.prototype.lineTo = function ( x, y ) {
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 
-	var curve = new THREE.LineCurve( x0, y0, x, y );
+	var curve = new THREE.LineCurve( new THREE.Vector2( x0, y0 ), new THREE.Vector2( x, y ) );
 	this.curves.push( curve );
 
-	this.actions.push( { action: THREE.PathActions.LINE_TO, args: args, curve: curve } );
+	this.actions.push( { action: THREE.PathActions.LINE_TO, args: args } );
 
 };
 
@@ -81,13 +86,12 @@ THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) {
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 
-	var curve = new THREE.QuadraticBezierCurve( x0, y0, aCPx, aCPy, aX, aY );
+	var curve = new THREE.QuadraticBezierCurve( new THREE.Vector2( x0, y0 ),
+												new THREE.Vector2( aCPx, aCPy ),
+												new THREE.Vector2( aX, aY ) );
 	this.curves.push( curve );
 
-	this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args, curve: curve } );
-
-	//console.log( curve, curve.getPoints(), curve.getSpacedPoints() );
-	//console.log( curve.getPointAt(0), curve.getPointAt(0), curve.getUtoTmapping(0), curve.getSpacedPoints() );
+	this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args } );
 
 };
 
@@ -102,12 +106,13 @@ THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y,
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 
-	var curve = new THREE.CubicBezierCurve( x0, y0, aCP1x, aCP1y,
-	                                                aCP2x, aCP2y,
-	                                                aX, aY );
+	var curve = new THREE.CubicBezierCurve( new THREE.Vector2( x0, y0 ),
+											new THREE.Vector2( aCP1x, aCP1y ),
+											new THREE.Vector2( aCP2x, aCP2y ),
+											new THREE.Vector2( aX, aY ) );
 	this.curves.push( curve );
 
-	this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args, curve: curve } );
+	this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } );
 
 };
 
@@ -125,9 +130,7 @@ THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {
 	var curve = new THREE.SplineCurve( npts );
 	this.curves.push( curve );
 
-	this.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args, curve: curve } );
-
-	//console.log( curve, curve.getPoints(), curve.getSpacedPoints() );
+	this.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args } );
 
 };
 
@@ -156,7 +159,7 @@ THREE.Path.prototype.getSpacedPoints = function ( divisions, closedPath ) {
 
 	var points = [];
 
-	for ( var i = 0; i < divisions; i++ ) {
+	for ( var i = 0; i < divisions; i ++ ) {
 
 		points.push( this.getPoint( i / divisions ) );
 
@@ -164,11 +167,11 @@ THREE.Path.prototype.getSpacedPoints = function ( divisions, closedPath ) {
 
 	}
 
-	if ( closedPath ) {
-
-		points.push( points[ 0 ] );
-
-	}
+	// if ( closedPath ) {
+	//
+	// 	points.push( points[ 0 ] );
+	//
+	// }
 
 	return points;
 
@@ -187,7 +190,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 		laste, j,
 		t, tx, ty;
 
-	for ( i = 0, il = this.actions.length; i < il; i++ ) {
+	for ( i = 0, il = this.actions.length; i < il; i ++ ) {
 
 		item = this.actions[ i ];
 
@@ -298,6 +301,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 			spts = spts.concat( args[ 0 ] );
 
 			var spline = new THREE.SplineCurve( spts );
+
 			for ( j = 1; j <= n; j ++ ) {
 
 				points.push( spline.getPointAt( j / n ) ) ;
@@ -370,190 +374,19 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 };
 
 
-// Returns min and max coordinates, as well as centroid
-
-THREE.Path.prototype.getBoundingBox = function () {
-
-	var points = this.getPoints();
-
-	var maxX, maxY;
-	var minX, minY;
-
-	maxX = maxY = Number.NEGATIVE_INFINITY;
-	minX = minY = Number.POSITIVE_INFINITY;
-
-	var p, i, il, sum;
-
-	sum = new THREE.Vector2();
-
-	for ( i = 0, il = points.length; i < il; i ++ ) {
-
-		p = points[ i ];
-
-		if ( p.x > maxX ) maxX = p.x;
-		else if ( p.x < minX ) minX = p.x;
-
-		if ( p.y > maxY ) maxY = p.y;
-		else if ( p.y < maxY ) minY = p.y;
-
-		sum.addSelf( p.x, p.y );
-
-	}
 
-	return {
-
-		minX: minX,
-		minY: minY,
-		maxX: maxX,
-		maxY: maxY,
-		centroid: sum.divideScalar( il )
-
-	};
-
-};
-
-
-// To get accurate point with reference to
-// entire path distance at time t,
-// following has to be done
-
-// 1. Length of each sub path have to be known
-// 2. Locate and identify type of curve
-// 3. Get t for the curve
-// 4. Return curve.getPointAt(t')
-
-THREE.Path.prototype.getPoint = function( t ) {
-
-	var d = t * this.getLength();
-	var curveLengths = this.sums;
-	var i = 0, diff, curve;
-
-	// To think about boundaries points.
-
-	while ( i < curveLengths.length ) {
-
-		if ( curveLengths[ i ] >= d ) {
-
-			diff = curveLengths[ i ] - d;
-			curve = this.curves[ i ];
-
-			var u = 1 - diff / curve.getLength();
-
-			return curve.getPointAt( u );
-
-			break;
-		}
-
-		i++;
-
-	}
-
-	return null;
-
-	// loop where sum != 0, sum > d , sum+1 <d
-
-};
+// This was used for testing purposes. Should be removed soon.
 
-// Compute lengths and cache them
+THREE.Path.prototype.transform = function( path, segments ) {
 
-THREE.Path.prototype.getLength = function() {
-
-	// Loop all actions/path
-	// Push sums into cached array
-
-	var lengths = [], sums = 0;
-	var i, il = this.curves.length;
-
-	for ( i = 0; i < il ; i++ ) {
-
-		sums += this.curves[ i ].getLength();
-		lengths.push( sums );
-
-	}
-
-	this.sums = lengths;
-
-	return sums;
-
-};
-
-
-/// Generate geometry from path points (for Line or ParticleSystem objects)
-
-THREE.Path.prototype.createPointsGeometry = function( divisions ) {
-
-    var pts = this.getPoints( divisions, true );
-	return this.createGeometry( pts );
-
-};
-
-// Generate geometry from equidistance sampling along the path
-
-THREE.Path.prototype.createSpacedPointsGeometry = function( divisions ) {
-
-    var pts = this.getSpacedPoints( divisions, true );
-	return this.createGeometry( pts );
-
-};
-
-THREE.Path.prototype.createGeometry = function( points ) {
-
-	var geometry = new THREE.Geometry();
-
-    for( var i = 0; i < points.length; i ++ ) {
-
-        geometry.vertices.push( new THREE.Vertex( new THREE.Vector3( points[ i ].x, points[ i ].y, 0 ) ) );
-
-    }
-
-    return geometry;
-
-};
-
-
-// ALL THINGS BELOW TO BE REFACTORED
-// QN: Transform final pts or transform ACTIONS or add transform filters?
-
-// FUTURE refactor path = an array of lines -> straight, bezier, splines, arc, funcexpr lines
-// Read http://www.planetclegg.com/projects/WarpingTextToSplines.html
-
-THREE.Path.prototype.transform = function( path ) {
-
-	path = new THREE.Path();
-	path.moveTo( 0, 0 );
-	path.quadraticCurveTo( 100, 20, 140, 80 );
-
-	console.log( path.cacheArcLengths() );
-
-	var thisBounds = this.getBoundingBox();
-	var oldPts = this.getPoints();
-
-	var i, il, p, oldX, oldY, xNorm;
-
-	for ( i = 0, il = oldPts.length; i < il; i ++ ) {
-
-		p = oldPts[ i ];
-
-		oldX = p.x;
-		oldY = p.y;
-
-		var xNorm = oldX/ thisBounds.maxX;
-
-		// If using actual distance, for length > path, requires line extrusions
-		//xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance
-
-		var pathPt = path.getPoint( xNorm );
-		var normal = path.getNormalVector( xNorm ).multiplyScalar( oldY );
-
-		p.x = pathPt.x + normal.x;
-		p.y = pathPt.y + normal.y;
-
-		//p.x = a * oldX + b * oldY + c;
-		//p.y = d * oldY + e * oldX + f;
+	var bounds = this.getBoundingBox();
+	var oldPts = this.getPoints( segments ); // getPoints getSpacedPoints
 
-	}
+	//console.log( path.cacheArcLengths() );
+	//path.getLengths(400);
+	//segments = 40;
 
-	return oldPts;
+	return this.getWrapPoints( oldPts, path );
 
 };
 
@@ -736,7 +569,7 @@ THREE.Path.prototype.toShapes = function() {
 
 	//console.log(subPaths);
 
-	if ( subPaths.length ==0 ) return [];
+	if ( subPaths.length == 0 ) return [];
 
 	var holesFirst = !THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() );
 

+ 17 - 10
src/extras/geometries/Shape.js

@@ -32,12 +32,11 @@ THREE.Shape.prototype.extrude = function ( options ) {
 
 THREE.Shape.prototype.getPointsHoles = function ( divisions ) {
 
-
 	var i, il = this.holes.length, holesPts = [];
 
 	for ( i = 0; i < il; i ++ ) {
 
-		holesPts[ i ] = this.holes[ i ].getPoints( divisions );
+		holesPts[ i ] = this.holes[ i ].getTransformedPoints( divisions, this.bends );
 
 	}
 
@@ -53,7 +52,7 @@ THREE.Shape.prototype.getSpacedPointsHoles = function ( divisions ) {
 
 	for ( i = 0; i < il; i ++ ) {
 
-		holesPts[ i ] = this.holes[ i ].getSpacedPoints( divisions );
+		holesPts[ i ] = this.holes[ i ].getTransformedSpacedPoints( divisions, this.bends );
 
 	}
 
@@ -68,20 +67,32 @@ THREE.Shape.prototype.extractAllPoints = function ( divisions ) {
 
 	return {
 
-		shape: this.getPoints( divisions ),
+		shape: this.getTransformedPoints( divisions ),
 		holes: this.getPointsHoles( divisions )
 
 	};
 
 };
 
+//
+// THREE.Shape.prototype.extractAllPointsWithBend = function ( divisions, bend ) {
+//
+// 	return {
+//
+// 		shape: this.transform( bend, divisions ),
+// 		holes: this.getPointsHoles( divisions, bend )
+//
+// 	};
+//
+// };
+
 // Get points of shape and holes (spaced by regular distance)
 
 THREE.Shape.prototype.extractAllSpacedPoints = function ( divisions ) {
 
 	return {
 
-		shape: this.getSpacedPoints( divisions ),
+		shape: this.getTransformedSpacedPoints( divisions ),
 		holes: this.getSpacedPointsHoles( divisions )
 
 	};
@@ -118,7 +129,7 @@ THREE.Shape.Utils = {
 			tmpHole1, tmpHole2,
 			verts = [];
 
-		for ( h = 0; h < holes.length; h++ ) {
+		for ( h = 0; h < holes.length; h ++ ) {
 
 			hole = holes[ h ];
 
@@ -131,15 +142,12 @@ THREE.Shape.Utils = {
 
 			shortest = Number.POSITIVE_INFINITY;
 
-			// THIS THING NEEDS TO BE DONE CORRECTLY AGAIN :(
 
 			// Find the shortest pair of pts between shape and hole
 
 			// Note: Actually, I'm not sure now if we could optimize this to be faster than O(m*n)
 			// Using distanceToSquared() intead of distanceTo() should speed a little
 			// since running square roots operations are reduced.
-			// http://en.wikipedia.org/wiki/Closest_pair_of_points
-			// http://stackoverflow.com/questions/1602164/shortest-distance-between-points-algorithm
 
 			for ( h2 = 0; h2 < hole.length; h2 ++ ) {
 
@@ -276,7 +284,6 @@ THREE.Shape.Utils = {
 			verts.push( triangleb );
 
 			shape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 );
-			//shape = tmpHole1.concat( tmpHole2 );
 
 		}
 

+ 57 - 0
src/extras/geometries/TextGeometry.js

@@ -18,6 +18,8 @@
  *  bevelEnabled:	<bool>,			// turn on bevel
  *  bevelThickness: <float>, 		// how deep into text bevel goes
  *  bevelSize:		<float>, 		// how far from text outline is bevel
+ *
+ *  bend:			<bool>			// bend according to hardcoded curve (for the moment)
  *  }
  *
  * It uses techniques used in:
@@ -50,6 +52,61 @@ THREE.TextGeometry = function ( text, parameters ) {
 	if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
 	if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
 
+	if ( parameters.bend ) {
+
+		var b = textShapes[ textShapes.length - 1 ].getBoundingBox();
+		var max = b.maxX;
+
+		parameters.bendPath = new THREE.QuadraticBezierCurve( new THREE.Vector2( 0, 0 ),
+															  new THREE.Vector2( max / 2, 120 ),
+															  new THREE.Vector2( max, 0 ) );
+
+	}
+
+	// // Bend Testings.
+	//
+	// var path = new THREE.CurvePath();
+	//
+	// path.add(new THREE.CubicBezierCurve(
+	// 		new THREE.Vector2(0, 0),
+	//   		new THREE.Vector2(10, 100),
+	// 		new THREE.Vector2(200, -10),
+	// 		new THREE.Vector2(300, 0)
+	// 	));
+	//
+	// path.add(new THREE.QuadraticBezierCurve(
+	// 	new THREE.Vector2(300, 0),
+	//   		new THREE.Vector2(450, -10),
+	// 	new THREE.Vector2(500, 100)
+	// ));
+	//
+	// parameters.bendPath = path;
+
+	// var path = new THREE.CurvePath();
+	// 	path.add(new THREE.LineCurve( 0, 0,  250, 0));
+	// 	path.add(new THREE.LineCurve( 250, 0,  300, 200));
+	//
+	// 	parameters.bendPath = path;
+
+	// var path = new THREE.SplineCurve([
+	// 		new THREE.Vector2(0, 0),
+	// 		new THREE.Vector2(100, 40),
+	// 		new THREE.Vector2(200, 0),
+	// 		new THREE.Vector2(400, 20)
+	// 	]);
+	//
+	// console.log(path);
+	//
+	// path = new THREE.LineCurve( new THREE.Vector2(0, 0),  new THREE.Vector2(400, 100));
+
+	// var bend = new THREE.Path();
+	// 	bend.moveTo(0,0);
+	// 	bend.quadraticCurveTo( 500, 100, 1000, 0 );
+	//
+	// 	parameters.bendPath = bend;
+
+
+
 	THREE.ExtrudeGeometry.call( this, textShapes, parameters );
 
 };

+ 1 - 0
utils/build.py

@@ -96,6 +96,7 @@ EXTRAS_FILES = [
 'extras/cameras/TrackballCamera.js',
 'extras/cameras/QuakeCamera.js',
 'extras/geometries/Curve.js',
+'extras/geometries/CurvePath.js',
 'extras/geometries/Path.js',
 'extras/geometries/Shape.js',
 'extras/geometries/TextPath.js',