Explorar o código

Merged with zz85's shape / path / extrude / bevel / text updates.

- moved 3d-only text parameters from TextPath into TextGeometry
- added safeguard for bevelSize and bevelThickness not affecting shape size if bevel is disabled
- updated text examples as now TextGeometry is not anymore centered
alteredq %!s(int64=14) %!d(string=hai) anos
pai
achega
c0d371be7c

+ 414 - 416
build/Three.js

@@ -1,7 +1,7 @@
 // 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){this.setHex(b)};
-THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,k,h,m,o;if(e==0)f=g=k=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),o=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=o;g=e;k=b;break;case 2:f=b;g=e;k=c;break;case 3:f=b;g=o;k=e;break;case 4:f=c;g=b;k=e;break;case 5:f=e;g=b;k=o;break;case 6:case 0:f=e,g=c,k=b}this.setRGB(f,
-g,k)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
+THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,h,g,j,m,p;if(e==0)f=h=g=0;else switch(j=Math.floor(b*6),m=b*6-j,b=e*(1-c),p=e*(1-c*m),c=e*(1-c*(1-m)),j){case 1:f=p;h=e;g=b;break;case 2:f=b;h=e;g=c;break;case 3:f=b;h=p;g=e;break;case 4:f=c;h=b;g=e;break;case 5:f=e;h=b;g=p;break;case 6:case 0:f=e,h=c,g=b}this.setRGB(f,
+h,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
 THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.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},divideScalar:function(b){b?
 (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
 unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
@@ -14,74 +14,74 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w
 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={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),
-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,k,h,m,o,t,n,p,u,v,x=b.geometry,
-z=x.vertices,y=[],f=0;for(g=x.faces.length;f<g;f++)if(k=x.faces[f],u=this.origin.clone(),v=this.direction.clone(),t=b.matrixWorld,h=t.multiplyVector3(z[k.a].position.clone()),m=t.multiplyVector3(z[k.b].position.clone()),o=t.multiplyVector3(z[k.c].position.clone()),t=k instanceof THREE.Face4?t.multiplyVector3(z[k.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),p=v.dot(n),b.doubleSided||(b.flipSided?p>0:p<0))if(n=n.dot((new THREE.Vector3).sub(h,u))/p,u=u.addSelf(v.multiplyScalar(n)),
-k instanceof THREE.Face3)e(u,h,m,o)&&(k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},y.push(k));else if(k instanceof THREE.Face4&&(e(u,h,m,t)||e(u,m,o,t)))k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},y.push(k);return y}else return[]}};
-THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};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,k,n,p){m=!1;c=h;e=k;f=n;g=p;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,g=g>k?g:k);b()};this.add3Points=
-function(h,k,n,p,u,v){m?(m=!1,c=h<n?h<u?h:u:n<u?n:u,e=k<p?k<v?k:v:p<v?p:v,f=h>n?h>u?h:u:n>u?n:u,g=k>p?k>v?k:v:p>v?p:v):(c=h<n?h<u?h<c?h:c:u<c?u:c:n<u?n<c?n:c:u<c?u:c,e=k<p?k<v?k<e?k:e:v<e?v:e:p<v?p<e?p:e:v<e?v:e,f=h>n?h>u?h>f?h:f:u>f?u:f:n>u?n>f?n:f:u>f?u:f,g=k>p?k>v?k>g?k:g:v>g?v:g:p>v?p>g?p:g:v>g?v: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={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,k,h,m,o,t,n,p,u,v,x,z){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,o||0,t||0,n||1,p||0,u||0,v||0,x||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,o,t,n,p,u,v,x,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=o;this.n32=t;this.n33=n;this.n34=p;this.n41=u;this.n42=v;this.n43=x;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,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());g.cross(k,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=k.x;this.n21=f.y;this.n22=g.y;this.n23=k.y;this.n31=f.z;this.n32=g.z;this.n33=k.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,k=b.n14,h=b.n21,m=b.n22,o=b.n23,t=b.n24,n=b.n31,p=b.n32,u=b.n33,v=b.n34,x=b.n41,z=b.n42,y=b.n43,w=b.n44,H=c.n11,A=c.n12,J=c.n13,G=c.n14,C=c.n21,P=c.n22,
-F=c.n23,K=c.n24,I=c.n31,V=c.n32,E=c.n33,$=c.n34,Q=c.n41,S=c.n42,T=c.n43,j=c.n44;this.n11=e*H+f*C+g*I+k*Q;this.n12=e*A+f*P+g*V+k*S;this.n13=e*J+f*F+g*E+k*T;this.n14=e*G+f*K+g*$+k*j;this.n21=h*H+m*C+o*I+t*Q;this.n22=h*A+m*P+o*V+t*S;this.n23=h*J+m*F+o*E+t*T;this.n24=h*G+m*K+o*$+t*j;this.n31=n*H+p*C+u*I+v*Q;this.n32=n*A+p*P+u*V+v*S;this.n33=n*J+p*F+u*E+v*T;this.n34=n*G+p*K+u*$+v*j;this.n41=x*H+z*C+y*I+w*Q;this.n42=x*A+z*P+y*V+w*S;this.n43=x*J+z*F+y*E+w*T;this.n44=x*G+z*K+y*$+w*j;return this},multiplyToArray:function(b,
+j=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(j),h=c.dot(c),c=c.dot(j),j=1/(b*h-e*e),h=(h*f-e*c)*j,b=(b*c-e*f)*j;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 h,g,j,m,p,t,n,o,v,u,x=b.geometry,
+z=x.vertices,y=[],f=0;for(h=x.faces.length;f<h;f++)if(g=x.faces[f],v=this.origin.clone(),u=this.direction.clone(),t=b.matrixWorld,j=t.multiplyVector3(z[g.a].position.clone()),m=t.multiplyVector3(z[g.b].position.clone()),p=t.multiplyVector3(z[g.c].position.clone()),t=g instanceof THREE.Face4?t.multiplyVector3(z[g.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),o=u.dot(n),b.doubleSided||(b.flipSided?o>0:o<0))if(n=n.dot((new THREE.Vector3).sub(j,v))/o,v=v.addSelf(u.multiplyScalar(n)),
+g instanceof THREE.Face3)e(v,j,m,p)&&(g={distance:this.origin.distanceTo(v),point:v,face:g,object:b},y.push(g));else if(g instanceof THREE.Face4&&(e(v,j,m,t)||e(v,m,p,t)))g={distance:this.origin.distanceTo(v),point:v,face:g,object:b},y.push(g);return y}else return[]}};
+THREE.Rectangle=function(){function b(){g=f-c;j=h-e}var c,e,f,h,g,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,g,n,o){m=!1;c=j;e=g;f=n;h=o;b()};this.addPoint=function(j,g){m?(m=!1,c=j,e=g,f=j,h=g):(c=c<j?c:j,e=e<g?e:g,f=f>j?f:j,h=h>g?h:g);b()};this.add3Points=
+function(j,g,n,o,v,u){m?(m=!1,c=j<n?j<v?j:v:n<v?n:v,e=g<o?g<u?g:u:o<u?o:u,f=j>n?j>v?j:v:n>v?n:v,h=g>o?g>u?g:u:o>u?o:u):(c=j<n?j<v?j<c?j:c:v<c?v:c:n<v?n<c?n:c:v<c?v:c,e=g<o?g<u?g<e?g:e:u<e?u:e:o<u?o<e?o:e:u<e?u:e,f=j>n?j>v?j>f?j:f:v>f?v:f:n>v?n>f?n:f:v>f?v:f,h=g>o?g>u?g>h?g:h:u>h?u:h:o>u?o>h?o:h:u>h?u:h);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),h=j.getBottom()):(c=c<j.getLeft()?c:j.getLeft(),e=e<j.getTop()?e:j.getTop(),f=f>j.getRight()?f:j.getRight(),h=h>
+j.getBottom()?h:j.getBottom());b()};this.inflate=function(j){c-=j;e-=j;f+=j;h+=j;b()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();e=e>j.getTop()?e:j.getTop();f=f<j.getRight()?f:j.getRight();h=h<j.getBottom()?h:j.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={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,g,j,m,p,t,n,o,v,u,x,z){this.set(b||1,c||0,e||0,f||0,h||0,g||1,j||0,m||0,p||0,t||0,n||1,o||0,v||0,u||0,x||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(b,c,e,f,h,g,j,m,p,t,n,o,v,u,x,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=g;this.n23=j;this.n24=m;this.n31=p;this.n32=t;this.n33=n;this.n34=o;this.n41=v;this.n42=u;this.n43=x;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,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;f.cross(e,g).normalize();f.length()===0&&(g.x+=1.0E-4,f.cross(e,g).normalize());h.cross(g,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=g.x;this.n21=f.y;this.n22=h.y;this.n23=g.y;this.n31=f.z;this.n32=h.z;this.n33=g.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,g=b.n14,j=b.n21,m=b.n22,p=b.n23,t=b.n24,n=b.n31,o=b.n32,v=b.n33,u=b.n34,x=b.n41,z=b.n42,y=b.n43,w=b.n44,I=c.n11,C=c.n12,K=c.n13,F=c.n14,B=c.n21,O=c.n22,
+E=c.n23,H=c.n24,P=c.n31,V=c.n32,G=c.n33,aa=c.n34,Q=c.n41,S=c.n42,T=c.n43,k=c.n44;this.n11=e*I+f*B+h*P+g*Q;this.n12=e*C+f*O+h*V+g*S;this.n13=e*K+f*E+h*G+g*T;this.n14=e*F+f*H+h*aa+g*k;this.n21=j*I+m*B+p*P+t*Q;this.n22=j*C+m*O+p*V+t*S;this.n23=j*K+m*E+p*G+t*T;this.n24=j*F+m*H+p*aa+t*k;this.n31=n*I+o*B+v*P+u*Q;this.n32=n*C+o*O+v*V+u*S;this.n33=n*K+o*E+v*G+u*T;this.n34=n*F+o*H+v*aa+u*k;this.n41=x*I+z*B+y*P+w*Q;this.n42=x*C+z*O+y*V+w*S;this.n43=x*K+z*E+y*G+w*T;this.n44=x*F+z*H+y*aa+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,g=this.n21,k=this.n22,h=this.n23,m=this.n24,o=this.n31,t=this.n32,n=this.n33,p=this.n34,u=this.n41,v=this.n42,x=this.n43,z=this.n44;return f*h*t*u-e*m*t*u-f*k*n*u+c*m*n*u+e*k*p*u-c*h*p*u-f*h*o*v+e*m*o*v+f*g*n*v-b*m*n*v-e*g*p*v+b*h*p*v+f*k*o*x-c*m*o*x-f*g*t*x+b*m*t*x+c*g*p*x-b*k*p*x-e*k*o*z+c*h*o*z+e*g*t*z-b*h*t*z-c*g*n*z+b*k*n*z},transpose:function(){var b;b=this.n21;this.n21=
+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,g=this.n22,j=this.n23,m=this.n24,p=this.n31,t=this.n32,n=this.n33,o=this.n34,v=this.n41,u=this.n42,x=this.n43,z=this.n44;return f*j*t*v-e*m*t*v-f*g*n*v+c*m*n*v+e*g*o*v-c*j*o*v-f*j*p*u+e*m*p*u+f*h*n*u-b*m*n*u-e*h*o*u+b*j*o*u+f*g*p*x-c*m*p*x-f*h*t*x+b*m*t*x+c*h*o*x-b*g*o*x-e*g*p*z+c*j*p*z+e*h*t*z-b*j*t*z-c*h*n*z+b*g*n*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),g=1-e,k=b.x,h=b.y,m=b.z,o=g*k,t=g*h;this.set(o*k+e,o*h-f*m,o*m+f*h,0,o*h+f*m,t*h+e,t*m-f*k,0,o*m-f*h,t*m+f*k,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,k=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 o=h*m,t=h*g,n=f*m,p=f*g;this.n11=o+p*e;this.n12=
-n*e-t;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=t*e-n;this.n32=p+o*e;this.n33=k*h;break;case "ZXY":o=h*m;t=h*g;n=f*m;p=f*g;this.n11=o-p*e;this.n12=-k*g;this.n13=n+t*e;this.n21=t+n*e;this.n22=k*m;this.n23=p-o*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":o=k*m;t=k*g;n=e*m;p=e*g;this.n11=h*m;this.n12=n*f-t;this.n13=o*f+p;this.n21=h*g;this.n22=p*f+o;this.n23=t*f-n;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":o=k*h;t=k*f;n=e*h;p=e*f;this.n11=h*m;this.n12=p-o*g;this.n13=
-n*g+t;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=t*g+n;this.n33=o-p*g;break;case "XZY":o=k*h;t=k*f;n=e*h;p=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=o*g+p;this.n22=k*m;this.n23=t*g-n;this.n31=n*g-t;this.n32=e*m;this.n33=p*g+o;break;default:o=k*m,t=k*g,n=e*m,p=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=t+n*f,this.n22=o-p*f,this.n23=-e*h,this.n31=p-o*f,this.n32=n+t*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,k=c+c,
-h=e+e,m=f+f,b=c*k,o=c*h;c*=m;var t=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(t+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-k;this.n31=c-h;this.n32=e+k;this.n33=1-(b+t);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,k=b.n14,h=b.n21,m=b.n22,o=b.n23,t=b.n24,n=b.n31,p=b.n32,u=b.n33,v=b.n34,x=b.n41,z=b.n42,y=b.n43,w=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*v*z-t*u*z+t*p*y-m*v*y-o*p*w+m*u*w;c.n12=k*u*z-g*v*z-k*p*y+f*v*y+g*p*w-f*u*w;c.n13=g*t*z-k*o*z+k*m*y-f*t*y-g*m*w+f*o*w;c.n14=k*o*p-g*t*p-k*m*u+f*t*u+g*m*v-f*o*v;c.n21=t*u*x-o*v*x-t*n*y+h*v*y+o*n*w-h*u*w;c.n22=g*v*x-k*u*x+k*n*y-e*v*y-g*n*w+e*u*w;c.n23=k*o*x-g*t*x-k*h*y+e*t*y+g*h*w-e*o*w;c.n24=
-g*t*n-k*o*n+k*h*u-e*t*u-g*h*v+e*o*v;c.n31=m*v*x-t*p*x+t*n*z-h*v*z-m*n*w+h*p*w;c.n32=k*p*x-f*v*x-k*n*z+e*v*z+f*n*w-e*p*w;c.n33=g*t*x-k*m*x+k*h*z-e*t*z-f*h*w+e*m*w;c.n34=k*m*n-f*t*n-k*h*p+e*t*p+f*h*v-e*m*v;c.n41=o*p*x-m*u*x-o*n*z+h*u*z+m*n*y-h*p*y;c.n42=f*u*x-g*p*x+g*n*z-e*u*z-f*n*y+e*p*y;c.n43=g*m*x-f*o*x-g*h*z+e*o*z+f*h*y-e*m*y;c.n44=f*o*n-g*m*n+g*h*p-e*o*p-f*h*u+e*m*u;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,k=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,o=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*k;e[3]=b*h;e[4]=b*m;e[5]=b*o;e[6]=b*t;e[7]=b*n;e[8]=b*p;return c};
-THREE.Matrix4.makeFrustum=function(b,c,e,f,g,k){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=-(k+g)/(k-g);h.n34=-2*k*g/(k-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,k){var h,m,o,t;h=new THREE.Matrix4;m=c-b;o=e-f;t=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((k+g)/t);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;
+c){var e=Math.cos(c),f=Math.sin(c),h=1-e,g=b.x,j=b.y,m=b.z,p=h*g,t=h*j;this.set(p*g+e,p*j-f*m,p*m+f*j,0,p*j+f*m,t*j+e,t*m-f*g,0,p*m-f*j,t*m+f*g,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,g=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p=j*m,t=j*h,n=f*m,o=f*h;this.n11=p+o*e;this.n12=
+n*e-t;this.n13=g*f;this.n21=g*h;this.n22=g*m;this.n23=-e;this.n31=t*e-n;this.n32=o+p*e;this.n33=g*j;break;case "ZXY":p=j*m;t=j*h;n=f*m;o=f*h;this.n11=p-o*e;this.n12=-g*h;this.n13=n+t*e;this.n21=t+n*e;this.n22=g*m;this.n23=o-p*e;this.n31=-g*f;this.n32=e;this.n33=g*j;break;case "ZYX":p=g*m;t=g*h;n=e*m;o=e*h;this.n11=j*m;this.n12=n*f-t;this.n13=p*f+o;this.n21=j*h;this.n22=o*f+p;this.n23=t*f-n;this.n31=-f;this.n32=e*j;this.n33=g*j;break;case "YZX":p=g*j;t=g*f;n=e*j;o=e*f;this.n11=j*m;this.n12=o-p*h;this.n13=
+n*h+t;this.n21=h;this.n22=g*m;this.n23=-e*m;this.n31=-f*m;this.n32=t*h+n;this.n33=p-o*h;break;case "XZY":p=g*j;t=g*f;n=e*j;o=e*f;this.n11=j*m;this.n12=-h;this.n13=f*m;this.n21=p*h+o;this.n22=g*m;this.n23=t*h-n;this.n31=n*h-t;this.n32=e*m;this.n33=o*h+p;break;default:p=g*m,t=g*h,n=e*m,o=e*h,this.n11=j*m,this.n12=-j*h,this.n13=f,this.n21=t+n*f,this.n22=p-o*f,this.n23=-e*j,this.n31=o-p*f,this.n32=n+t*f,this.n33=g*j}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,h=b.w,g=c+c,
+j=e+e,m=f+f,b=c*g,p=c*j;c*=m;var t=e*j;e*=m;f*=m;g*=h;j*=h;h*=m;this.n11=1-(t+f);this.n12=p-h;this.n13=c+j;this.n21=p+h;this.n22=1-(b+f);this.n23=e-g;this.n31=c-j;this.n32=e+g;this.n33=1-(b+t);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,g=b.n14,j=b.n21,m=b.n22,p=b.n23,t=b.n24,n=b.n31,o=b.n32,v=b.n33,u=b.n34,x=b.n41,z=b.n42,y=b.n43,w=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*u*z-t*v*z+t*o*y-m*u*y-p*o*w+m*v*w;c.n12=g*v*z-h*u*z-g*o*y+f*u*y+h*o*w-f*v*w;c.n13=h*t*z-g*p*z+g*m*y-f*t*y-h*m*w+f*p*w;c.n14=g*p*o-h*t*o-g*m*v+f*t*v+h*m*u-f*p*u;c.n21=t*v*x-p*u*x-t*n*y+j*u*y+p*n*w-j*v*w;c.n22=h*u*x-g*v*x+g*n*y-e*u*y-h*n*w+e*v*w;c.n23=g*p*x-h*t*x-g*j*y+e*t*y+h*j*w-e*p*w;c.n24=
+h*t*n-g*p*n+g*j*v-e*t*v-h*j*u+e*p*u;c.n31=m*u*x-t*o*x+t*n*z-j*u*z-m*n*w+j*o*w;c.n32=g*o*x-f*u*x-g*n*z+e*u*z+f*n*w-e*o*w;c.n33=h*t*x-g*m*x+g*j*z-e*t*z-f*j*w+e*m*w;c.n34=g*m*n-f*t*n-g*j*o+e*t*o+f*j*u-e*m*u;c.n41=p*o*x-m*v*x-p*n*z+j*v*z+m*n*y-j*o*y;c.n42=f*v*x-h*o*x+h*n*z-e*v*z-f*n*y+e*o*y;c.n43=h*m*x-f*p*x-h*j*z+e*p*z+f*j*y-e*m*y;c.n44=f*p*n-h*m*n+h*j*o-e*p*o-f*j*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,g=b.n32*b.n21-b.n31*b.n22,j=-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,t=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,o=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*g;e[3]=b*j;e[4]=b*m;e[5]=b*p;e[6]=b*t;e[7]=b*n;e[8]=b*o;return c};
+THREE.Matrix4.makeFrustum=function(b,c,e,f,h,g){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+h)/(g-h);j.n34=-2*g*h/(g-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};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,g){var j,m,p,t;j=new THREE.Matrix4;m=c-b;p=e-f;t=g-h;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+f)/p);j.n31=0;j.n32=0;j.n33=-2/t;j.n34=-((g+h)/t);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=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={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,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);
+-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);
 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={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),k=Math.cos(e),e=Math.sin(e),h=b*c,m=f*g;this.w=h*k-m*e;this.x=h*e+m*k;this.y=f*c*k+b*g*e;this.z=b*g*k-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*
+THREE.Quaternion.prototype={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),g=Math.cos(e),e=Math.sin(e),j=b*c,m=f*h;this.w=j*g-m*e;this.x=j*e+m*g;this.y=f*c*g+b*h*e;this.z=b*h*g-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,g=this.w,k=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*k+e*m-f*h;this.y=e*b+g*h+f*k-c*m;this.z=f*b+g*m+c*h-e*k;this.w=g*b-c*k-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,k=this.x,h=this.y,m=this.z,o=this.w,t=o*e+h*g-m*f,n=
-o*f+m*e-k*g,p=o*g+k*f-h*e,e=-k*e-h*f-m*g;c.x=t*o+e*-k+n*-m-p*-h;c.y=n*o+e*-h+p*-k-t*-m;c.z=p*o+e*-m+t*-h-n*-k;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 k=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)*k)/h;f=Math.sin(f*k)/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,k){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=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
-THREE.Face4=function(b,c,e,f,g,k,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=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];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)};
+multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,h=this.w,g=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+h*g+e*m-f*j;this.y=e*b+h*j+f*g-c*m;this.z=f*b+h*m+c*j-e*g;this.w=h*b-c*g-e*j-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,g=this.x,j=this.y,m=this.z,p=this.w,t=p*e+j*h-m*f,n=
+p*f+m*e-g*h,o=p*h+g*f-j*e,e=-g*e-j*f-m*h;c.x=t*p+e*-g+n*-m-o*-j;c.y=n*p+e*-j+o*-g-t*-m;c.z=o*p+e*-m+t*-j-n*-g;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 g=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<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)*g)/j;f=Math.sin(f*g)/j;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,g){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=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
+THREE.Face4=function(b,c,e,f,h,g,j){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=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.UV=function(b,c){this.set(b||0,c||0)};
 THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var b,c,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,g,k,h,m=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){k=this.faces[f];if(b&&k.vertexNormals.length){m.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)m.addSelf(k.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],h=this.vertices[k.c],m.sub(h.position,e.position),o.sub(c.position,e.position),m.crossSelf(o);m.isZero()||
-m.normalize();k.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=
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,h,g,j,m=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){g=this.faces[f];if(b&&g.vertexNormals.length){m.set(0,0,0);c=0;for(e=g.vertexNormals.length;c<e;c++)m.addSelf(g.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[g.a],e=this.vertices[g.b],j=this.vertices[g.c],m.sub(j.position,e.position),p.sub(c.position,e.position),m.crossSelf(p);m.isZero()||
+m.normalize();g.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,g,k,F){m=b.vertices[e].position;o=b.vertices[c].position;t=b.vertices[f].position;n=h[g];p=h[k];u=h[F];v=o.x-m.x;x=t.x-m.x;z=o.y-m.y;y=t.y-m.y;w=o.z-m.z;H=t.z-m.z;A=p.u-n.u;J=u.u-n.u;G=p.v-n.v;C=u.v-n.v;P=1/(A*C-J*G);V.set((C*v-G*x)*
-P,(C*z-G*y)*P,(C*w-G*H)*P);E.set((A*x-J*v)*P,(A*y-J*z)*P,(A*H-J*w)*P);K[e].addSelf(V);K[c].addSelf(V);K[f].addSelf(V);I[e].addSelf(E);I[c].addSelf(E);I[f].addSelf(E)}var c,e,f,g,k,h,m,o,t,n,p,u,v,x,z,y,w,H,A,J,G,C,P,F,K=[],I=[],V=new THREE.Vector3,E=new THREE.Vector3,$=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,I[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],h=this.faceVertexUvs[0][c],k instanceof
-THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var T=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)S.copy(k.vertexNormals[f]),g=k[T[f]],F=K[g],$.copy(F),$.subSelf(S.multiplyScalar(S.dot(F))).normalize(),Q.cross(k.vertexNormals[f],F),g=Q.dot(I[g]),g=g<0?-1:1,k.vertexTangents[f]=new THREE.Vector4($.x,$.y,$.z,g)}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,h,E){m=b.vertices[e].position;p=b.vertices[c].position;t=b.vertices[f].position;n=j[g];o=j[h];v=j[E];u=p.x-m.x;x=t.x-m.x;z=p.y-m.y;y=t.y-m.y;w=p.z-m.z;I=t.z-m.z;C=o.u-n.u;K=v.u-n.u;F=o.v-n.v;B=v.v-n.v;O=1/(C*B-K*F);V.set((B*u-F*x)*
+O,(B*z-F*y)*O,(B*w-F*I)*O);G.set((C*x-K*u)*O,(C*y-K*z)*O,(C*I-K*w)*O);H[e].addSelf(V);H[c].addSelf(V);H[f].addSelf(V);P[e].addSelf(G);P[c].addSelf(G);P[f].addSelf(G)}var c,e,f,h,g,j,m,p,t,n,o,v,u,x,z,y,w,I,C,K,F,B,O,E,H=[],P=[],V=new THREE.Vector3,G=new THREE.Vector3,aa=new THREE.Vector3,Q=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)H[c]=new THREE.Vector3,P[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],g instanceof
+THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var T=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){g=this.faces[c];for(f=0;f<g.vertexNormals.length;f++)S.copy(g.vertexNormals[f]),h=g[T[f]],E=H[h],aa.copy(E),aa.subSelf(S.multiplyScalar(S.dot(E))).normalize(),Q.cross(g.vertexNormals[f],E),h=Q.dot(P[h]),h=h<0?-1:1,g.vertexTangents[f]=new THREE.Vector4(aa.x,aa.y,aa.z,h)}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,g,k,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];k=h.vertexIndices[1];
-h.faceIndices=m[b(g,k)].array;for(g=0;g<h.faceIndices.length;g++)k=h.faceIndices[g],h.faces.push(this.faces[k])}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(b){function c(b,e,c,f,h,g,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*g+b*h+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,k,h,m,o,t,n,p,u;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;k=Math.floor(g);h=g-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;t=this.points[e[0]];n=this.points[e[1]];
-p=this.points[e[2]];u=this.points[e[3]];m=h*h;o=h*m;f.x=c(t.x,n.x,p.x,u.x,h,m,o);f.y=c(t.y,n.y,p.y,u.y,h,m,o);f.z=c(t.z,n.z,p.z,u.z,h,m,o);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,k=[],m=0;k[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&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,h,g,k,m=[],o=new THREE.Vector3,t=this.getLength();m.push(o.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=t.chunks[e]-t.chunks[e-1];k=Math.ceil(b*c/t.total);h=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<k-1;c++)f=h+c*(1/k)*(g-h),position=this.getPoint(f),m.push(o.copy(position).clone());
-m.push(o.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;
+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,g,j,m={};e=0;for(f=this.faces.length;e<f;e++)j=this.faces[e],j instanceof THREE.Face3?(h=b(j.a,j.b),c(m,h,e),h=b(j.b,j.c),c(m,h,e),h=b(j.a,j.c),c(m,h,e)):j instanceof THREE.Face4&&(h=b(j.b,j.d),c(m,h,e),h=b(j.a,j.b),c(m,h,e),h=b(j.a,j.d),c(m,h,e),h=b(j.b,j.c),c(m,h,e),h=b(j.c,j.d),c(m,h,e));e=0;for(f=this.edges.length;e<f;e++){j=this.edges[e];h=j.vertexIndices[0];g=j.vertexIndices[1];
+j.faceIndices=m[b(h,g)].array;for(h=0;h<j.faceIndices.length;h++)g=j.faceIndices[h],j.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;
+THREE.Spline=function(b){function c(b,e,c,f,j,g,h){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*h+(-3*(e-c)-2*b-f)*g+b*j+e}this.points=b;var e=[],f={x:0,y:0,z:0},h,g,j,m,p,t,n,o,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;g=Math.floor(h);j=h-g;e[0]=g==0?g:g-1;e[1]=g;e[2]=g>this.points.length-2?g:g+1;e[3]=g>this.points.length-3?g:g+2;t=this.points[e[0]];n=this.points[e[1]];
+o=this.points[e[2]];v=this.points[e[3]];m=j*j;p=j*m;f.x=c(t.x,n.x,o.x,v.x,j,m,p);f.y=c(t.y,n.y,o.y,v.y,j,m,p);f.z=c(t.z,n.z,o.z,v.z,j,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,j=new THREE.Vector3,g=new THREE.Vector3,h=[],m=0;h[0]=0;b||(b=100);c=this.points.length*b;j.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),g.copy(position),
+m+=g.distanceTo(j),j.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,j,g,h,m=[],p=new THREE.Vector3,t=this.getLength();m.push(p.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=t.chunks[e]-t.chunks[e-1];h=Math.ceil(b*c/t.total);j=(e-1)/(this.points.length-1);g=e/(this.points.length-1);for(c=1;c<h-1;c++)f=j+c*(1/h)*(g-j),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,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;
 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,g,k){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=k;this.updateProjectionMatrix()};
+THREE.Camera.prototype.setViewOffset=function(b,c,e,f,h,g){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=h;this.height=g;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,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.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.Material=function(b){this.id=THREE.MaterialCounter.value++;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};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.MaterialCounter={value:0};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};THREE.LineBasicMaterial.prototype=new THREE.Material;
@@ -104,7 +104,7 @@ 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,g,k){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=k!==void 0?k: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,h,g){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=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={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.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;
 THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(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;
@@ -112,25 +112,25 @@ 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,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,
+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,
 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,g,k,h,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],k=g.pos,h=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(k[0],k[1],k[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,
+THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,h,g,j,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)h=this.geometry.bones[e],g=h.pos,j=h.rotq,m=h.scl,f=this.addBone(),f.name=h.name,f.position.set(g[0],g[1],g[2]),f.quaternion.set(j[0],j[1],j[2],j[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,
 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,g=this.geometry.skinIndices[b].x,k=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[k].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,h=this.geometry.skinIndices[b].x,g=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[g].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,g,k,h,m,o,t,n,p,u,v,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var z=x.egdes=this.geometry.edges,y=x.edgeFaces=[];g=0;var w=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],w.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],k=m.faceIndices[1],h=m.vertexIndices[0],m=m.vertexIndices[1],e.a===h?(o="a",n=w[g]+0):e.b===h?(o="b",n=w[g]+1):e.c===h?(o="c",n=w[g]+2):e.d===h&&(o="d",n=w[g]+3),e.a===m?(o+="a",p=w[g]+0):e.b===m?(o+="b",p=w[g]+1):e.c===m?(o+="c",p=w[g]+2):e.d===m&&(o+="d",p=w[g]+3),f.a===h?(t="a",u=w[k]+0):f.b===h?(t="b",u=w[k]+1):f.c===h?(t="c",u=w[k]+2):f.d===h&&(t="d",u=w[k]+3),f.a===m?(t+="a",v=w[k]+0):f.b===m?(t+="b",v=w[k]+
-1):f.c===m?(t+="c",v=w[k]+2):f.d===m&&(t+="d",v=w[k]+3),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>p&&(e=n,n=p,p=e):n<p&&(e=n,n=p,p=e),t==="ac"||t==="ad"||t==="ca"||t==="da"?u>v&&(e=u,u=v,v=e):u<v&&(e=u,u=v,v=e),e=new THREE.Face4(n,p,u,v),e.normal.set(1,0,0),y.push(e);this.geometry=x}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,k=g.length,h,m,o,t,n,p=["a","b","c","d"];for(o=0;o<k;o++){m=c.length;h=g[o];h instanceof THREE.Face4?(t=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(t=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(h.normal);e.push(m);
-for(m=0;m<t;m++)n=b[h[p[m]]],c.push(new THREE.Vertex(n.position.clone()))}for(k=0;k<g.length-1;k++){b=e[k];for(h=k+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,k,h,m,o,t,n,p,u,v,x,z,y=0,w=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){k=c[w[x]];m=b[k];for(z=0;z<g;z++)if(h=e[w[z]],o=b[h],Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4&&(y++,y===1&&(t=m,n=o,p=k,u=h,v=w[x]),y===2))return v+=w[x],v==="ad"||v==="ac"?{faces:[c,e],vertices:[t,n,o,m],indices:[p,u,
-h,k],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[t,m,o,n],indices:[p,k,h,u],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,h,g,j,m,p,t,n,o,v,u,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var z=x.egdes=this.geometry.edges,y=x.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],g=m.faceIndices[1],j=m.vertexIndices[0],m=m.vertexIndices[1],e.a===j?(p="a",n=w[h]+0):e.b===j?(p="b",n=w[h]+1):e.c===j?(p="c",n=w[h]+2):e.d===j&&(p="d",n=w[h]+3),e.a===m?(p+="a",o=w[h]+0):e.b===m?(p+="b",o=w[h]+1):e.c===m?(p+="c",o=w[h]+2):e.d===m&&(p+="d",o=w[h]+3),f.a===j?(t="a",v=w[g]+0):f.b===j?(t="b",v=w[g]+1):f.c===j?(t="c",v=w[g]+2):f.d===j&&(t="d",v=w[g]+3),f.a===m?(t+="a",u=w[g]+0):f.b===m?(t+="b",u=w[g]+
+1):f.c===m?(t+="c",u=w[g]+2):f.d===m&&(t+="d",u=w[g]+3),p==="ac"||p==="ad"||p==="ca"||p==="da"?n>o&&(e=n,n=o,o=e):n<o&&(e=n,n=o,o=e),t==="ac"||t==="ad"||t==="ca"||t==="da"?v>u&&(e=v,v=u,u=e):v<u&&(e=v,v=u,u=e),e=new THREE.Face4(n,o,v,u),e.normal.set(1,0,0),y.push(e);this.geometry=x}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,g=h.length,j,m,p,t,n,o=["a","b","c","d"];for(p=0;p<g;p++){m=c.length;j=h[p];j instanceof THREE.Face4?(t=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(t=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(j.normal);e.push(m);
+for(m=0;m<t;m++)n=b[j[o[m]]],c.push(new THREE.Vertex(n.position.clone()))}for(g=0;g<h.length-1;g++){b=e[g];for(j=g+1;j<h.length;j++)m=e[j],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,g,j,m,p,t,n,o,v,u,x,z,y=0,w=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;h=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){g=c[w[x]];m=b[g];for(z=0;z<h;z++)if(j=e[w[z]],p=b[j],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&&(t=m,n=p,o=g,v=j,u=w[x]),y===2))return u+=w[x],u==="ad"||u==="ac"?{faces:[c,e],vertices:[t,n,p,m],indices:[o,v,
+j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[t,m,p,n],indices:[o,g,j,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);
@@ -139,57 +139,56 @@ 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=o[m]=o[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,j=-b.z+b.w,k=-e.z+e.w;return h>=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?c=Math.max(c,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,k=[],h,m,o=[],t,n,p=[],u,v=[],x,z,y=[],w,H,A=[],J=new THREE.Vector4,G=new THREE.Vector4,
-C=new THREE.Matrix4,P=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Vector4,I=new THREE.Vector4;this.projectVector=function(b,e){C.multiply(e.projectionMatrix,e.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,e){C.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,o,t;g=0;o=
-b.objects;b=0;for(m=o.length;b<m;b++){t=o[b];var j;if(!(j=!t.visible))if(j=t instanceof THREE.Mesh){a:{j=void 0;for(var n=t.matrixWorld,p=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),u=0;u<6;u++)if(j=F[u].x*n.n14+F[u].y*n.n24+F[u].z*n.n34+F[u].w,j<=p){j=!1;break a}j=!0}j=!j}if(!j)j=k[g]=k[g]||new THREE.RenderableObject,g++,f=j,J.copy(t.position),C.multiplyVector3(J),f.object=t,f.z=J.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,k){var J=[],
-S=g.near,T=g.far,j,L,fa,Y,ga,ea,ia,qa,ha,M,ma,aa,ca,ja,U,W,oa;H=z=u=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);C.multiply(g.projectionMatrix,g.matrixWorldInverse);F[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);F[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);F[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);F[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);F[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);F[5].set(C.n41+C.n31,C.n42+
-C.n32,C.n43+C.n33,C.n44+C.n34);for(j=0;j<6;j++)ha=F[j],ha.divideScalar(Math.sqrt(ha.x*ha.x+ha.y*ha.y+ha.z*ha.z));ha=this.projectObjects(f,g,!0);f=0;for(j=ha.length;f<j;f++)if(M=ha[f].object,M.visible)if(ma=M.matrixWorld,aa=M.matrixRotationWorld,ca=M.materials,ja=M.overdraw,m=0,M instanceof THREE.Mesh){U=M.geometry;Y=U.vertices;W=U.faces;U=U.faceVertexUvs;L=0;for(fa=Y.length;L<fa;L++)h=b(),h.positionWorld.copy(Y[L].position),ma.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
-C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>S&&h.positionScreen.z<T;Y=0;for(L=W.length;Y<L;Y++){fa=W[Y];if(fa instanceof THREE.Face3)if(ga=o[fa.a],ea=o[fa.b],ia=o[fa.c],ga.visible&&ea.visible&&ia.visible&&(M.doubleSided||M.flipSided!=(ia.positionScreen.x-ga.positionScreen.x)*(ea.positionScreen.y-ga.positionScreen.y)-(ia.positionScreen.y-ga.positionScreen.y)*(ea.positionScreen.x-ga.positionScreen.x)<
-0))qa=p[n]=p[n]||new THREE.RenderableFace3,n++,t=qa,t.v1.copy(ga),t.v2.copy(ea),t.v3.copy(ia);else continue;else if(fa instanceof THREE.Face4)if(ga=o[fa.a],ea=o[fa.b],ia=o[fa.c],qa=o[fa.d],ga.visible&&ea.visible&&ia.visible&&qa.visible&&(M.doubleSided||M.flipSided!=((qa.positionScreen.x-ga.positionScreen.x)*(ea.positionScreen.y-ga.positionScreen.y)-(qa.positionScreen.y-ga.positionScreen.y)*(ea.positionScreen.x-ga.positionScreen.x)<0||(ea.positionScreen.x-ia.positionScreen.x)*(qa.positionScreen.y-
-ia.positionScreen.y)-(ea.positionScreen.y-ia.positionScreen.y)*(qa.positionScreen.x-ia.positionScreen.x)<0)))oa=v[u]=v[u]||new THREE.RenderableFace4,u++,t=oa,t.v1.copy(ga),t.v2.copy(ea),t.v3.copy(ia),t.v4.copy(qa);else continue;t.normalWorld.copy(fa.normal);aa.multiplyVector3(t.normalWorld);t.centroidWorld.copy(fa.centroid);ma.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);C.multiplyVector3(t.centroidScreen);ia=fa.vertexNormals;ga=0;for(ea=ia.length;ga<ea;ga++)qa=t.vertexNormalsWorld[ga],
-qa.copy(ia[ga]),aa.multiplyVector3(qa);ga=0;for(ea=U.length;ga<ea;ga++)if(oa=U[ga][Y]){ia=0;for(qa=oa.length;ia<qa;ia++)t.uvs[ga][ia]=oa[ia]}t.meshMaterials=ca;t.faceMaterials=fa.materials;t.overdraw=ja;t.z=t.centroidScreen.z;J.push(t)}}else if(M instanceof THREE.Line){P.multiply(C,ma);Y=M.geometry.vertices;ga=b();ga.positionScreen.copy(Y[0].position);P.multiplyVector4(ga.positionScreen);L=1;for(fa=Y.length;L<fa;L++)if(ga=b(),ga.positionScreen.copy(Y[L].position),P.multiplyVector4(ga.positionScreen),
-ea=o[m-2],K.copy(ga.positionScreen),I.copy(ea.positionScreen),e(K,I))K.multiplyScalar(1/K.w),I.multiplyScalar(1/I.w),ma=y[z]=y[z]||new THREE.RenderableLine,z++,x=ma,x.v1.positionScreen.copy(K),x.v2.positionScreen.copy(I),x.z=Math.max(K.z,I.z),x.materials=M.materials,J.push(x)}else if(M instanceof THREE.Particle&&(G.set(M.matrixWorld.n14,M.matrixWorld.n24,M.matrixWorld.n34,1),C.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))ma=A[H]=A[H]||new THREE.RenderableParticle,H++,w=ma,w.x=G.x/G.w,w.y=G.y/G.w,w.z=
-G.z,w.rotation=M.rotation.z,w.scale.x=M.scale.x*Math.abs(w.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),w.scale.y=M.scale.y*Math.abs(w.y-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),w.materials=M.materials,J.push(w);k&&J.sort(c);return J}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var o,t,n,p,u,v,x,z;b=c.projectScene(e,f);o=0;for(t=b.length;o<t;o++)if(u=b[o],u instanceof THREE.RenderableParticle){x=u.x*g+g;z=u.y*k+k;n=0;for(p=u.material.length;n<p;n++)if(v=u.material[n],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=x+"px",v.style.top=z+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(w!=b)x.globalAlpha=w=b}function e(b){if(H!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}H=b}}function f(b){if(A!=b.hex)A=b.hex,x.strokeStyle="#"+k(A.toString(16))}function g(b){if(J!=b.hex)J=b.hex,x.fillStyle="#"+k(J.toString(16))}function k(b){for(;b.length<6;)b="0"+b;return b}
-var h=this,m=null,o=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,p,u,v,x=t.getContext("2d"),z=new THREE.Color(0),y=0,w=1,H=0,A=null,J=null,G=null,C=null,P=null,F,K,I,V,E=new THREE.RenderableVertex,$=new THREE.RenderableVertex,Q,S,T,j,L,fa,Y,ga,ea,ia,qa,ha,M=new THREE.Color(0),ma=new THREE.Color(0),aa=new THREE.Color(0),ca=new THREE.Color(0),ja=new THREE.Color(0),U,W,oa,ka,na,xa,Aa,Ia,Ba,Pa,Z=new THREE.Rectangle,la=new THREE.Rectangle,ra=new THREE.Rectangle,
-ta=!1,ua=new THREE.Color,wa=new THREE.Color,Da=new THREE.Color,ya=new THREE.Color,sa=new THREE.Vector3,Ea,X,R,va,N,za,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;X=Ea.getContext("2d");X.fillStyle="rgba(0,0,0,1)";X.fillRect(0,0,2,2);R=X.getImageData(0,0,2,2);va=R.data;N=document.createElement("canvas");N.width=N.height=b;za=N.getContext("2d");za.translate(-b/2,-b/2);za.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};
-this.setSize=function(b,e){n=b;p=e;u=n/2;v=p/2;t.width=n;t.height=p;Z.set(-u,-v,u,v);la.set(-u,-v,u,v);w=1;H=0;P=C=G=J=A=null};this.setClearColor=function(b,e){z=b;y=e;la.set(-u,-v,u,v)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;la.set(-u,-v,u,v)};this.clear=function(){x.setTransform(1,0,0,-1,u,v);if(!la.isEmpty())la.inflate(1),la.minSelf(Z),y==0?x.clearRect(la.getX(),la.getY(),la.getWidth(),la.getHeight()):(e(THREE.NormalBlending),c(1),J="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
-","+Math.floor(z.b*255)+","+y+")",x.fillStyle=J,x.fillRect(la.getX(),la.getY(),la.getWidth(),la.getHeight())),la.empty()};this.render=function(b,k){function t(b){var e,c,f,h=b.lights;wa.setRGB(0,0,0);Da.setRGB(0,0,0);ya.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.DirectionalLight?(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b):c instanceof THREE.PointLight&&(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b)}function n(b,e,c,f){var h,g,
-j,k,m=b.lights,b=0;for(h=m.length;b<h;b++)g=m[b],j=g.color,g instanceof THREE.DirectionalLight?(k=c.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=c.dot(sa.sub(g.position,e).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(e.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function p(b,h,j){c(j.opacity);e(j.blending);var k,m,o,t,n,da;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)t=j.map.image,
-n=t.width>>1,da=t.height>>1,j=h.scale.x*u,o=h.scale.y*v,k=j*n,m=o*da,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),Z.instersects(ra)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,-o),x.translate(-n,-da),x.drawImage(t,0,0),x.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,m=h.scale.y*v,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),Z.instersects(ra)&&(f(j.color),g(j.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,m),j.program(x),x.restore()))}function z(b,h,g,j){c(j.opacity);
-e(j.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(h.positionScreen.x,h.positionScreen.y);x.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(G!=b)x.lineWidth=G=b;b=j.linecap;if(C!=b)x.lineCap=C=b;b=j.linejoin;if(P!=b)x.lineJoin=P=b;f(j.color);x.stroke();ra.inflate(j.linewidth*2)}}function w(b,f,g,m,o,t,da,p,u){h.data.vertices+=3;h.data.faces++;c(p.opacity);e(p.blending);Q=b.positionScreen.x;S=b.positionScreen.y;T=f.positionScreen.x;j=f.positionScreen.y;
-L=g.positionScreen.x;fa=g.positionScreen.y;A(Q,S,T,j,L,fa);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ka=da.uvs[0],Ga(Q,S,T,j,L,fa,p.map.image,ka[m].u,ka[m].v,ka[o].u,ka[o].v,ka[t].u,ka[t].v));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,sa.copy(da.vertexNormalsWorld[0]),na=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,xa=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(da.vertexNormalsWorld[1]),
-Aa=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Ia=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(da.vertexNormalsWorld[2]),Ba=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Pa=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,Ga(Q,S,T,j,L,fa,p.envMap.image,na,xa,Aa,Ia,Ba,Pa)}else p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ka=da.uvs[0],Ga(Q,S,
-T,j,L,fa,p.map.image,ka[m].u,ka[m].v,ka[o].u,ka[o].v,ka[t].u,ka[t].v)),e(THREE.SubtractiveBlending)),ta?!p.wireframe&&p.shading==THREE.SmoothShading&&da.vertexNormalsWorld.length==3?(ma.r=aa.r=ca.r=wa.r,ma.g=aa.g=ca.g=wa.g,ma.b=aa.b=ca.b=wa.b,n(u,da.v1.positionWorld,da.vertexNormalsWorld[0],ma),n(u,da.v2.positionWorld,da.vertexNormalsWorld[1],aa),n(u,da.v3.positionWorld,da.vertexNormalsWorld[2],ca),ja.r=(aa.r+ca.r)*0.5,ja.g=(aa.g+ca.g)*0.5,ja.b=(aa.b+ca.b)*0.5,oa=Sa(ma,aa,ca,ja),Ga(Q,S,T,j,L,fa,oa,
-0,0,1,0,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,n(u,da.centroidWorld,da.normalWorld,ua),M.r=Math.max(0,Math.min(p.color.r*ua.r,1)),M.g=Math.max(0,Math.min(p.color.g*ua.g,1)),M.b=Math.max(0,Math.min(p.color.b*ua.b,1)),M.updateHex(),p.wireframe?Ja(M,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(M)):p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(p.color);else if(p instanceof THREE.MeshDepthMaterial)U=k.near,W=k.far,ma.r=ma.g=ma.b=1-Na(b.positionScreen.z,
-U,W),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,U,W),ca.r=ca.g=ca.b=1-Na(g.positionScreen.z,U,W),ja.r=(aa.r+ca.r)*0.5,ja.g=(aa.g+ca.g)*0.5,ja.b=(aa.b+ca.b)*0.5,oa=Sa(ma,aa,ca,ja),Ga(Q,S,T,j,L,fa,oa,0,0,1,0,0,1);else if(p instanceof THREE.MeshNormalMaterial)M.r=Qa(da.normalWorld.x),M.g=Qa(da.normalWorld.y),M.b=Qa(da.normalWorld.z),M.updateHex(),p.wireframe?Ja(M,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(M)}function y(b,f,g,m,o,t,p,da,u){h.data.vertices+=4;h.data.faces++;c(da.opacity);
-e(da.blending);if(da.map||da.envMap)w(b,f,m,0,1,3,p,da,u),w(o,g,t,1,2,3,p,da,u);else if(Q=b.positionScreen.x,S=b.positionScreen.y,T=f.positionScreen.x,j=f.positionScreen.y,L=g.positionScreen.x,fa=g.positionScreen.y,Y=m.positionScreen.x,ga=m.positionScreen.y,ea=o.positionScreen.x,ia=o.positionScreen.y,qa=t.positionScreen.x,ha=t.positionScreen.y,da instanceof THREE.MeshBasicMaterial)H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(da.color);
-else if(da instanceof THREE.MeshLambertMaterial)ta?!da.wireframe&&da.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(ma.r=aa.r=ca.r=ja.r=wa.r,ma.g=aa.g=ca.g=ja.g=wa.g,ma.b=aa.b=ca.b=ja.b=wa.b,n(u,p.v1.positionWorld,p.vertexNormalsWorld[0],ma),n(u,p.v2.positionWorld,p.vertexNormalsWorld[1],aa),n(u,p.v4.positionWorld,p.vertexNormalsWorld[3],ca),n(u,p.v3.positionWorld,p.vertexNormalsWorld[2],ja),oa=Sa(ma,aa,ca,ja),A(Q,S,T,j,Y,ga),Ga(Q,S,T,j,Y,ga,oa,0,0,1,0,0,1),A(ea,ia,L,fa,qa,ha),Ga(ea,
-ia,L,fa,qa,ha,oa,1,0,1,1,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,n(u,p.centroidWorld,p.normalWorld,ua),M.r=Math.max(0,Math.min(da.color.r*ua.r,1)),M.g=Math.max(0,Math.min(da.color.g*ua.g,1)),M.b=Math.max(0,Math.min(da.color.b*ua.b,1)),M.updateHex(),H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(M,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(M)):(H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(da.color));else if(da instanceof THREE.MeshNormalMaterial)M.r=
-Qa(p.normalWorld.x),M.g=Qa(p.normalWorld.y),M.b=Qa(p.normalWorld.z),M.updateHex(),H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(M,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(M);else if(da instanceof THREE.MeshDepthMaterial)U=k.near,W=k.far,ma.r=ma.g=ma.b=1-Na(b.positionScreen.z,U,W),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,U,W),ca.r=ca.g=ca.b=1-Na(m.positionScreen.z,U,W),ja.r=ja.g=ja.b=1-Na(g.positionScreen.z,U,W),oa=Sa(ma,aa,ca,ja),A(Q,S,T,j,Y,ga),Ga(Q,S,T,j,Y,ga,oa,0,0,1,0,0,1),A(ea,
-ia,L,fa,qa,ha),Ga(ea,ia,L,fa,qa,ha,oa,1,0,1,1,0,1)}function A(b,e,c,f,h,g){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(b,e);x.closePath()}function H(b,e,c,f,h,g,j,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(j,k);x.lineTo(b,e);x.closePath()}function Ja(b,e,c,h){if(G!=e)x.lineWidth=G=e;if(C!=c)x.lineCap=C=c;if(P!=h)x.lineJoin=P=h;f(b);x.stroke();ra.inflate(e*2)}function J(b){g(b);x.fill()}function Ga(b,e,c,f,h,g,j,k,m,o,t,da,p){var n,u;n=j.width-1;u=j.height-
-1;k*=n;m*=u;o*=n;t*=u;da*=n;p*=u;c-=b;f-=e;h-=b;g-=e;o-=k;t-=m;da-=k;p-=m;n=o*p-da*t;if(!((n<0?-n:n)<1))u=1/n,n=(p*c-t*h)*u,t=(p*f-t*g)*u,c=(o*h-da*c)*u,f=(o*g-da*f)*u,b=b-n*k-c*m,e=e-t*k-f*m,x.save(),x.transform(n,t,c,f,b,e),x.clip(),x.drawImage(j,0,0),x.restore()}function Sa(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),da=~~(f.g*255),f=~~(f.b*255);va[0]=h<0?0:h>255?255:h;va[1]=g<0?0:g>255?
-255:g;va[2]=b<0?0:b>255?255:b;va[4]=j<0?0:j>255?255:j;va[5]=k<0?0:k>255?255:k;va[6]=e<0?0:e>255?255:e;va[8]=m<0?0:m>255?255:m;va[9]=o<0?0:o>255?255:o;va[10]=c<0?0:c>255?255:c;va[12]=t<0?0:t>255?255:t;va[13]=da<0?0:da>255?255:da;va[14]=f<0?0:f>255?255:f;X.putImageData(R,0,0);za.drawImage(Ea,0,0);return N}function Na(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 Ka(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 Ta,Va,pa,Ca,La,Ra,Ua,D;this.autoClear?this.clear():x.setTransform(1,0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,k,this.sortElements);(ta=b.lights.length>0)&&t(b);Ta=0;for(Va=m.length;Ta<Va;Ta++){pa=m[Ta];ra.empty();if(pa instanceof THREE.RenderableParticle){F=pa;F.x*=u;F.y*=v;Ca=0;for(La=pa.materials.length;Ca<La;)D=pa.materials[Ca++],D.opacity!=0&&p(F,pa,D,b)}else if(pa instanceof THREE.RenderableLine){if(F=pa.v1,K=pa.v2,F.positionScreen.x*=u,F.positionScreen.y*=
-v,K.positionScreen.x*=u,K.positionScreen.y*=v,ra.addPoint(F.positionScreen.x,F.positionScreen.y),ra.addPoint(K.positionScreen.x,K.positionScreen.y),Z.instersects(ra)){Ca=0;for(La=pa.materials.length;Ca<La;)D=pa.materials[Ca++],D.opacity!=0&&z(F,K,pa,D,b)}}else if(pa instanceof THREE.RenderableFace3){if(F=pa.v1,K=pa.v2,I=pa.v3,F.positionScreen.x*=u,F.positionScreen.y*=v,K.positionScreen.x*=u,K.positionScreen.y*=v,I.positionScreen.x*=u,I.positionScreen.y*=v,pa.overdraw&&(Ka(F.positionScreen,K.positionScreen),
-Ka(K.positionScreen,I.positionScreen),Ka(I.positionScreen,F.positionScreen)),ra.add3Points(F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y,I.positionScreen.x,I.positionScreen.y),Z.instersects(ra)){Ca=0;for(La=pa.meshMaterials.length;Ca<La;)if(D=pa.meshMaterials[Ca++],D instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=pa.faceMaterials.length;Ra<Ua;)(D=pa.faceMaterials[Ra++])&&D.opacity!=0&&w(F,K,I,0,1,2,pa,D,b)}else D.opacity!=0&&w(F,K,I,0,1,2,pa,D,b)}}else if(pa instanceof
-THREE.RenderableFace4&&(F=pa.v1,K=pa.v2,I=pa.v3,V=pa.v4,F.positionScreen.x*=u,F.positionScreen.y*=v,K.positionScreen.x*=u,K.positionScreen.y*=v,I.positionScreen.x*=u,I.positionScreen.y*=v,V.positionScreen.x*=u,V.positionScreen.y*=v,E.positionScreen.copy(K.positionScreen),$.positionScreen.copy(V.positionScreen),pa.overdraw&&(Ka(F.positionScreen,K.positionScreen),Ka(K.positionScreen,V.positionScreen),Ka(V.positionScreen,F.positionScreen),Ka(I.positionScreen,E.positionScreen),Ka(I.positionScreen,$.positionScreen)),
-ra.addPoint(F.positionScreen.x,F.positionScreen.y),ra.addPoint(K.positionScreen.x,K.positionScreen.y),ra.addPoint(I.positionScreen.x,I.positionScreen.y),ra.addPoint(V.positionScreen.x,V.positionScreen.y),Z.instersects(ra))){Ca=0;for(La=pa.meshMaterials.length;Ca<La;)if(D=pa.meshMaterials[Ca++],D instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=pa.faceMaterials.length;Ra<Ua;)(D=pa.faceMaterials[Ra++])&&D.opacity!=0&&y(F,K,I,V,E,$,pa,D,b)}else D.opacity!=0&&y(F,K,I,V,E,$,pa,D,b)}la.addRectangle(ra)}x.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&&(V.sub(g.position,e.centroidWorld),V.normalize(),j=e.normalWorld.dot(V)*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,j,m,o,p){h.data.vertices+=3;h.data.faces++;Q=f(S++);Q.setAttribute("d",
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?G.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?J?(C.r=P.r,C.g=P.g,C.b=P.b,b(p,m,C),G.r=Math.max(0,Math.min(o.color.r*C.r,1)),G.g=Math.max(0,Math.min(o.color.g*C.g,1)),G.b=Math.max(0,Math.min(o.color.b*C.b,1)),G.updateHex()):G.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(I=1-o.__2near/(o.__farPlusNear-
-m.z*o.__farMinusNear),G.setRGB(I,I,I)):o instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));o.wireframe?Q.setAttribute("style","fill: none; stroke: #"+k(G.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):Q.setAttribute("style","fill: #"+k(G.hex.toString(16))+"; fill-opacity: "+o.opacity);t.appendChild(Q)}function e(e,c,j,m,
-o,p,n){h.data.vertices+=4;h.data.faces++;Q=f(S++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?J?(C.r=P.r,C.g=P.g,C.b=P.b,b(n,o,C),G.r=Math.max(0,Math.min(p.color.r*C.r,1)),G.g=Math.max(0,Math.min(p.color.g*C.g,1)),G.b=Math.max(0,Math.min(p.color.b*
-C.b,1)),G.updateHex()):G.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(I=1-p.__2near/(p.__farPlusNear-o.z*p.__farMinusNear),G.setRGB(I,I,I)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(g(o.normalWorld.x),g(o.normalWorld.y),g(o.normalWorld.z));p.wireframe?Q.setAttribute("style","fill: none; stroke: #"+k(G.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):Q.setAttribute("style",
-"fill: #"+k(G.hex.toString(16))+"; fill-opacity: "+p.opacity);t.appendChild(Q)}function f(b){E[b]==null&&(E[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),j==0&&E[b].setAttribute("shape-rendering","crispEdges"));return E[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,o=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,u,v,x,z,y,w,H=new THREE.Rectangle,A=new THREE.Rectangle,J=
-!1,G=new THREE.Color(16777215),C=new THREE.Color(16777215),P=new THREE.Color(0),F=new THREE.Color(0),K=new THREE.Color(0),I,V=new THREE.Vector3,E=[],$=[],Q,S,T,j=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":j=1;break;case "low":j=0}};this.setSize=function(b,e){n=b;p=e;u=n/2;v=p/2;t.setAttribute("viewBox",-u+" "+-v+" "+n+" "+p);t.setAttribute("width",n);t.setAttribute("height",p);H.set(-u,-v,
-u,v)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=function(b,f){var g,p,n,C,G,I,M,E;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,f,this.sortElements);T=S=0;if(J=b.lights.length>0){M=b.lights;P.setRGB(0,0,0);F.setRGB(0,0,0);K.setRGB(0,0,0);g=0;for(p=M.length;g<p;g++)n=M[g],C=n.color,n instanceof THREE.AmbientLight?(P.r+=C.r,P.g+=C.g,P.b+=C.b):n instanceof THREE.DirectionalLight?(F.r+=C.r,F.g+=C.g,F.b+=C.b):n instanceof
-THREE.PointLight&&(K.r+=C.r,K.g+=C.g,K.b+=C.b)}g=0;for(p=m.length;g<p;g++)if(M=m[g],A.empty(),M instanceof THREE.RenderableParticle){x=M;x.x*=u;x.y*=-v;n=0;for(C=M.materials.length;n<C;)n++}else if(M instanceof THREE.RenderableLine){if(x=M.v1,z=M.v2,x.positionScreen.x*=u,x.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),H.instersects(A)){n=0;for(C=M.materials.length;n<C;)if((E=M.materials[n++])&&
-E.opacity!=0){G=x;I=z;var V=T++;$[V]==null&&($[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),j==0&&$[V].setAttribute("shape-rendering","crispEdges"));Q=$[V];Q.setAttribute("x1",G.positionScreen.x);Q.setAttribute("y1",G.positionScreen.y);Q.setAttribute("x2",I.positionScreen.x);Q.setAttribute("y2",I.positionScreen.y);E instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: ##"+k(E.color.hex.toString(16))+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+
-E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin),t.appendChild(Q))}}}else if(M instanceof THREE.RenderableFace3){if(x=M.v1,z=M.v2,y=M.v3,x.positionScreen.x*=u,x.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(z.positionScreen.x,z.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),H.instersects(A)){n=0;for(C=M.meshMaterials.length;n<
-C;)if(E=M.meshMaterials[n++],E instanceof THREE.MeshFaceMaterial){G=0;for(I=M.faceMaterials.length;G<I;)(E=M.faceMaterials[G++])&&E.opacity!=0&&c(x,z,y,M,E,b)}else E&&E.opacity!=0&&c(x,z,y,M,E,b)}}else if(M instanceof THREE.RenderableFace4&&(x=M.v1,z=M.v2,y=M.v3,w=M.v4,x.positionScreen.x*=u,x.positionScreen.y*=-v,z.positionScreen.x*=u,z.positionScreen.y*=-v,y.positionScreen.x*=u,y.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,A.addPoint(x.positionScreen.x,x.positionScreen.y),A.addPoint(z.positionScreen.x,
-z.positionScreen.y),A.addPoint(y.positionScreen.x,y.positionScreen.y),A.addPoint(w.positionScreen.x,w.positionScreen.y),H.instersects(A))){n=0;for(C=M.meshMaterials.length;n<C;)if(E=M.meshMaterials[n++],E instanceof THREE.MeshFaceMaterial){G=0;for(I=M.faceMaterials.length;G<I;)(E=M.faceMaterials[G++])&&E.opacity!=0&&e(x,z,y,w,M,E,b)}else E&&E.opacity!=0&&e(x,z,y,w,M,E,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,j=b.z+b.w,g=e.z+e.w,k=-b.z+b.w,h=-e.z+e.w;return j>=0&&g>=0&&k>=0&&h>=0?!0:j<0&&g<0||k<0&&h<0?!1:(j<0?c=Math.max(c,j/(j-g)):g<0&&(f=Math.min(f,j/(j-g))),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,g=[],j,m,p=[],t,n,o=[],v,u=[],x,z,y=[],w,I,C=[],K=new THREE.Vector4,F=new THREE.Vector4,
+B=new THREE.Matrix4,O=new THREE.Matrix4,E=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(b,e){B.multiply(e.projectionMatrix,e.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,e){B.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));B.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var e=[],m,p,t;h=0;p=
+b.objects;b=0;for(m=p.length;b<m;b++){t=p[b];var k;if(!(k=!t.visible))if(k=t instanceof THREE.Mesh){a:{k=void 0;for(var n=t.matrixWorld,o=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),u=0;u<6;u++)if(k=E[u].x*n.n14+E[u].y*n.n24+E[u].z*n.n34+E[u].w,k<=o){k=!1;break a}k=!0}k=!k}if(!k)k=g[h]=g[h]||new THREE.RenderableObject,h++,f=k,K.copy(t.position),B.multiplyVector3(K),f.object=t,f.z=K.z,e.push(f)}j&&e.sort(c);return e};this.projectScene=function(f,g,h){var K=[],
+S=g.near,T=g.far,k,L,ca,W,X,$,da,ea,fa,J,ia,la,ja,oa,U,ha,ga;I=z=v=n=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);B.multiply(g.projectionMatrix,g.matrixWorldInverse);E[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);E[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);E[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);E[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);E[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);E[5].set(B.n41+B.n31,B.n42+
+B.n32,B.n43+B.n33,B.n44+B.n34);for(k=0;k<6;k++)fa=E[k],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,g,!0);f=0;for(k=fa.length;f<k;f++)if(J=fa[f].object,J.visible)if(ia=J.matrixWorld,la=J.matrixRotationWorld,ja=J.materials,oa=J.overdraw,m=0,J instanceof THREE.Mesh){U=J.geometry;W=U.vertices;ha=U.faces;U=U.faceVertexUvs;L=0;for(ca=W.length;L<ca;L++)j=b(),j.positionWorld.copy(W[L].position),ia.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
+B.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>S&&j.positionScreen.z<T;W=0;for(L=ha.length;W<L;W++){ca=ha[W];if(ca instanceof THREE.Face3)if(X=p[ca.a],$=p[ca.b],da=p[ca.c],X.visible&&$.visible&&da.visible&&(J.doubleSided||J.flipSided!=(da.positionScreen.x-X.positionScreen.x)*($.positionScreen.y-X.positionScreen.y)-(da.positionScreen.y-X.positionScreen.y)*($.positionScreen.x-X.positionScreen.x)<0))ea=o[n]=
+o[n]||new THREE.RenderableFace3,n++,t=ea,t.v1.copy(X),t.v2.copy($),t.v3.copy(da);else continue;else if(ca instanceof THREE.Face4)if(X=p[ca.a],$=p[ca.b],da=p[ca.c],ea=p[ca.d],X.visible&&$.visible&&da.visible&&ea.visible&&(J.doubleSided||J.flipSided!=((ea.positionScreen.x-X.positionScreen.x)*($.positionScreen.y-X.positionScreen.y)-(ea.positionScreen.y-X.positionScreen.y)*($.positionScreen.x-X.positionScreen.x)<0||($.positionScreen.x-da.positionScreen.x)*(ea.positionScreen.y-da.positionScreen.y)-($.positionScreen.y-
+da.positionScreen.y)*(ea.positionScreen.x-da.positionScreen.x)<0)))ga=u[v]=u[v]||new THREE.RenderableFace4,v++,t=ga,t.v1.copy(X),t.v2.copy($),t.v3.copy(da),t.v4.copy(ea);else continue;t.normalWorld.copy(ca.normal);la.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ca.centroid);ia.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);B.multiplyVector3(t.centroidScreen);da=ca.vertexNormals;X=0;for($=da.length;X<$;X++)ea=t.vertexNormalsWorld[X],ea.copy(da[X]),la.multiplyVector3(ea);
+X=0;for($=U.length;X<$;X++)if(ga=U[X][W]){da=0;for(ea=ga.length;da<ea;da++)t.uvs[X][da]=ga[da]}t.meshMaterials=ja;t.faceMaterials=ca.materials;t.overdraw=oa;t.z=t.centroidScreen.z;K.push(t)}}else if(J instanceof THREE.Line){O.multiply(B,ia);W=J.geometry.vertices;X=b();X.positionScreen.copy(W[0].position);O.multiplyVector4(X.positionScreen);L=1;for(ca=W.length;L<ca;L++)if(X=b(),X.positionScreen.copy(W[L].position),O.multiplyVector4(X.positionScreen),$=p[m-2],H.copy(X.positionScreen),P.copy($.positionScreen),
+e(H,P))H.multiplyScalar(1/H.w),P.multiplyScalar(1/P.w),ia=y[z]=y[z]||new THREE.RenderableLine,z++,x=ia,x.v1.positionScreen.copy(H),x.v2.positionScreen.copy(P),x.z=Math.max(H.z,P.z),x.materials=J.materials,K.push(x)}else if(J instanceof THREE.Particle&&(F.set(J.matrixWorld.n14,J.matrixWorld.n24,J.matrixWorld.n34,1),B.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))ia=C[I]=C[I]||new THREE.RenderableParticle,I++,w=ia,w.x=F.x/F.w,w.y=F.y/F.w,w.z=F.z,w.rotation=J.rotation.z,w.scale.x=J.scale.x*Math.abs(w.x-
+(F.x+g.projectionMatrix.n11)/(F.w+g.projectionMatrix.n14)),w.scale.y=J.scale.y*Math.abs(w.y-(F.y+g.projectionMatrix.n22)/(F.w+g.projectionMatrix.n24)),w.materials=J.materials,K.push(w);h&&K.sort(c);return K}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,g;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;g=f/2};this.render=function(e,f){var p,t,n,o,v,u,x,z;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(v=b[p],v instanceof THREE.RenderableParticle){x=v.x*h+h;z=v.y*g+g;n=0;for(o=v.material.length;n<o;n++)if(u=v.material[n],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=x+"px",u.style.top=z+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(w!=b)x.globalAlpha=w=b}function e(b){if(I!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}I=b}}function f(b){if(C!=b.hex)C=b.hex,x.strokeStyle="#"+g(C.toString(16))}function h(b){if(K!=b.hex)K=b.hex,x.fillStyle="#"+g(K.toString(16))}function g(b){for(;b.length<6;)b="0"+b;return b}
+var j=this,m=null,p=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,o,v,u,x=t.getContext("2d"),z=new THREE.Color(0),y=0,w=1,I=0,C=null,K=null,F=null,B=null,O=null,E,H,P,V,G=new THREE.RenderableVertex,aa=new THREE.RenderableVertex,Q,S,T,k,L,ca,W,X,$,da,ea,fa,J=new THREE.Color(0),ia=new THREE.Color(0),la=new THREE.Color(0),ja=new THREE.Color(0),oa=new THREE.Color(0),U,ha,ga,na,za,wa,Aa,Ia,Ba,Pa,Z=new THREE.Rectangle,ka=new THREE.Rectangle,qa=new THREE.Rectangle,
+sa=!1,ta=new THREE.Color,va=new THREE.Color,Da=new THREE.Color,xa=new THREE.Color,ra=new THREE.Vector3,Ea,Y,R,ua,M,ya,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;Y=Ea.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);R=Y.getImageData(0,0,2,2);ua=R.data;M=document.createElement("canvas");M.width=M.height=b;ya=M.getContext("2d");ya.translate(-b/2,-b/2);ya.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};
+this.setSize=function(b,e){n=b;o=e;v=n/2;u=o/2;t.width=n;t.height=o;Z.set(-v,-u,v,u);ka.set(-v,-u,v,u);w=1;I=0;O=B=F=K=C=null};this.setClearColor=function(b,e){z=b;y=e;ka.set(-v,-u,v,u)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;ka.set(-v,-u,v,u)};this.clear=function(){x.setTransform(1,0,0,-1,v,u);if(!ka.isEmpty())ka.inflate(1),ka.minSelf(Z),y==0?x.clearRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight()):(e(THREE.NormalBlending),c(1),K="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+
+","+Math.floor(z.b*255)+","+y+")",x.fillStyle=K,x.fillRect(ka.getX(),ka.getY(),ka.getWidth(),ka.getHeight())),ka.empty()};this.render=function(b,g){function t(b){var e,c,f,j=b.lights;va.setRGB(0,0,0);Da.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=j.length;b<e;b++)c=j[b],f=c.color,c instanceof THREE.AmbientLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):c instanceof THREE.DirectionalLight?(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b)}function n(b,e,c,f){var j,k,
+g,h,m=b.lights,b=0;for(j=m.length;b<j;b++)k=m[b],g=k.color,k instanceof THREE.DirectionalLight?(h=c.dot(k.position),h<=0||(h*=k.intensity,f.r+=g.r*h,f.g+=g.g*h,f.b+=g.b*h)):k instanceof THREE.PointLight&&(h=c.dot(ra.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+=g.r*h,f.g+=g.g*h,f.b+=g.b*h)))}function o(b,j,k){c(k.opacity);e(k.blending);var g,m,p,t,ma,n;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)t=k.map.image,
+ma=t.width>>1,n=t.height>>1,k=j.scale.x*v,p=j.scale.y*u,g=k*ma,m=p*n,qa.set(b.x-g,b.y-m,b.x+g,b.y+m),Z.instersects(qa)&&(x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(k,-p),x.translate(-ma,-n),x.drawImage(t,0,0),x.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(g=j.scale.x*v,m=j.scale.y*u,qa.set(b.x-g,b.y-m,b.x+g,b.y+m),Z.instersects(qa)&&(f(k.color),h(k.color),x.save(),x.translate(b.x,b.y),x.rotate(-j.rotation),x.scale(g,m),k.program(x),x.restore()))}function w(b,j,k,g){c(g.opacity);
+e(g.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(j.positionScreen.x,j.positionScreen.y);x.closePath();if(g instanceof THREE.LineBasicMaterial){b=g.linewidth;if(F!=b)x.lineWidth=F=b;b=g.linecap;if(B!=b)x.lineCap=B=b;b=g.linejoin;if(O!=b)x.lineJoin=O=b;f(g.color);x.stroke();qa.inflate(g.linewidth*2)}}function y(b,f,h,m,p,t,ma,o,u){j.data.vertices+=3;j.data.faces++;c(o.opacity);e(o.blending);Q=b.positionScreen.x;S=b.positionScreen.y;T=f.positionScreen.x;k=f.positionScreen.y;
+L=h.positionScreen.x;ca=h.positionScreen.y;C(Q,S,T,k,L,ca);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(na=ma.uvs[0],Ga(Q,S,T,k,L,ca,o.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[t].u,na[t].v));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,ra.copy(ma.vertexNormalsWorld[0]),za=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,wa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[1]),
+Aa=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Ia=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,ra.copy(ma.vertexNormalsWorld[2]),Ba=(ra.x*b.n11+ra.y*b.n12+ra.z*b.n13)*0.5+0.5,Pa=-(ra.x*b.n21+ra.y*b.n22+ra.z*b.n23)*0.5+0.5,Ga(Q,S,T,k,L,ca,o.envMap.image,za,wa,Aa,Ia,Ba,Pa)}else o.wireframe?Ja(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&(o.map.mapping instanceof THREE.UVMapping&&(na=ma.uvs[0],Ga(Q,S,
+T,k,L,ca,o.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[t].u,na[t].v)),e(THREE.SubtractiveBlending)),sa?!o.wireframe&&o.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==3?(ia.r=la.r=ja.r=va.r,ia.g=la.g=ja.g=va.g,ia.b=la.b=ja.b=va.b,n(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ia),n(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],la),n(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],ja),oa.r=(la.r+ja.r)*0.5,oa.g=(la.g+ja.g)*0.5,oa.b=(la.b+ja.b)*0.5,ga=K(ia,la,ja,oa),Ga(Q,S,T,k,L,ca,ga,
+0,0,1,0,0,1)):(ta.r=va.r,ta.g=va.g,ta.b=va.b,n(u,ma.centroidWorld,ma.normalWorld,ta),J.r=Math.max(0,Math.min(o.color.r*ta.r,1)),J.g=Math.max(0,Math.min(o.color.g*ta.g,1)),J.b=Math.max(0,Math.min(o.color.b*ta.b,1)),J.updateHex(),o.wireframe?Ja(J,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(J)):o.wireframe?Ja(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof THREE.MeshDepthMaterial)U=g.near,ha=g.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,
+U,ha),la.r=la.g=la.b=1-Na(f.positionScreen.z,U,ha),ja.r=ja.g=ja.b=1-Na(h.positionScreen.z,U,ha),oa.r=(la.r+ja.r)*0.5,oa.g=(la.g+ja.g)*0.5,oa.b=(la.b+ja.b)*0.5,ga=K(ia,la,ja,oa),Ga(Q,S,T,k,L,ca,ga,0,0,1,0,0,1);else if(o instanceof THREE.MeshNormalMaterial)J.r=Qa(ma.normalWorld.x),J.g=Qa(ma.normalWorld.y),J.b=Qa(ma.normalWorld.z),J.updateHex(),o.wireframe?Ja(J,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(J)}function z(b,f,h,m,p,t,ma,o,u){j.data.vertices+=4;j.data.faces++;c(o.opacity);
+e(o.blending);if(o.map||o.envMap)y(b,f,m,0,1,3,ma,o,u),y(p,h,t,1,2,3,ma,o,u);else if(Q=b.positionScreen.x,S=b.positionScreen.y,T=f.positionScreen.x,k=f.positionScreen.y,L=h.positionScreen.x,ca=h.positionScreen.y,W=m.positionScreen.x,X=m.positionScreen.y,$=p.positionScreen.x,da=p.positionScreen.y,ea=t.positionScreen.x,fa=t.positionScreen.y,o instanceof THREE.MeshBasicMaterial)Sa(Q,S,T,k,L,ca,W,X),o.wireframe?Ja(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color);else if(o instanceof
+THREE.MeshLambertMaterial)sa?!o.wireframe&&o.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==4?(ia.r=la.r=ja.r=oa.r=va.r,ia.g=la.g=ja.g=oa.g=va.g,ia.b=la.b=ja.b=oa.b=va.b,n(u,ma.v1.positionWorld,ma.vertexNormalsWorld[0],ia),n(u,ma.v2.positionWorld,ma.vertexNormalsWorld[1],la),n(u,ma.v4.positionWorld,ma.vertexNormalsWorld[3],ja),n(u,ma.v3.positionWorld,ma.vertexNormalsWorld[2],oa),ga=K(ia,la,ja,oa),C(Q,S,T,k,W,X),Ga(Q,S,T,k,W,X,ga,0,0,1,0,0,1),C($,da,L,ca,ea,fa),Ga($,da,L,ca,ea,fa,ga,1,
+0,1,1,0,1)):(ta.r=va.r,ta.g=va.g,ta.b=va.b,n(u,ma.centroidWorld,ma.normalWorld,ta),J.r=Math.max(0,Math.min(o.color.r*ta.r,1)),J.g=Math.max(0,Math.min(o.color.g*ta.g,1)),J.b=Math.max(0,Math.min(o.color.b*ta.b,1)),J.updateHex(),Sa(Q,S,T,k,L,ca,W,X),o.wireframe?Ja(J,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(J)):(Sa(Q,S,T,k,L,ca,W,X),o.wireframe?Ja(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(o.color));else if(o instanceof THREE.MeshNormalMaterial)J.r=Qa(ma.normalWorld.x),
+J.g=Qa(ma.normalWorld.y),J.b=Qa(ma.normalWorld.z),J.updateHex(),Sa(Q,S,T,k,L,ca,W,X),o.wireframe?Ja(J,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):I(J);else if(o instanceof THREE.MeshDepthMaterial)U=g.near,ha=g.far,ia.r=ia.g=ia.b=1-Na(b.positionScreen.z,U,ha),la.r=la.g=la.b=1-Na(f.positionScreen.z,U,ha),ja.r=ja.g=ja.b=1-Na(m.positionScreen.z,U,ha),oa.r=oa.g=oa.b=1-Na(h.positionScreen.z,U,ha),ga=K(ia,la,ja,oa),C(Q,S,T,k,W,X),Ga(Q,S,T,k,W,X,ga,0,0,1,0,0,1),C($,da,L,ca,ea,fa),Ga($,da,
+L,ca,ea,fa,ga,1,0,1,1,0,1)}function C(b,e,c,f,j,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(j,k);x.lineTo(b,e);x.closePath()}function Sa(b,e,c,f,j,k,g,h){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(j,k);x.lineTo(g,h);x.lineTo(b,e);x.closePath()}function Ja(b,e,c,j){if(F!=e)x.lineWidth=F=e;if(B!=c)x.lineCap=B=c;if(O!=j)x.lineJoin=O=j;f(b);x.stroke();qa.inflate(e*2)}function I(b){h(b);x.fill()}function Ga(b,e,c,f,j,k,g,h,m,p,ma,o,t){var n,u;n=g.width-1;u=g.height-1;h*=n;m*=u;p*=n;ma*=
+u;o*=n;t*=u;c-=b;f-=e;j-=b;k-=e;p-=h;ma-=m;o-=h;t-=m;n=p*t-o*ma;if(!((n<0?-n:n)<1))u=1/n,n=(t*c-ma*j)*u,ma=(t*f-ma*k)*u,c=(p*j-o*c)*u,f=(p*k-o*f)*u,b=b-n*h-c*m,e=e-ma*h-f*m,x.save(),x.transform(n,ma,c,f,b,e),x.clip(),x.drawImage(g,0,0),x.restore()}function K(b,e,c,f){var j=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),g=~~(e.r*255),h=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),ma=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),o=~~(f.g*255),f=~~(f.b*255);ua[0]=j<0?0:j>255?255:j;ua[1]=k<0?0:k>255?255:k;ua[2]=b<0?0:
+b>255?255:b;ua[4]=g<0?0:g>255?255:g;ua[5]=h<0?0:h>255?255:h;ua[6]=e<0?0:e>255?255:e;ua[8]=m<0?0:m>255?255:m;ua[9]=ma<0?0:ma>255?255:ma;ua[10]=c<0?0:c>255?255:c;ua[12]=p<0?0:p>255?255:p;ua[13]=o<0?0:o>255?255:o;ua[14]=f<0?0:f>255?255:f;Y.putImageData(R,0,0);ya.drawImage(Ea,0,0);return M}function Na(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 Ka(b,e){var c=e.x-b.x,f=e.y-b.y,j=c*c+f*f;j!=0&&(j=1/Math.sqrt(j),c*=j,f*=j,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}
+var Ta,Va,pa,Ca,La,Ra,Ua,D;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,u);j.data.vertices=0;j.data.faces=0;m=p.projectScene(b,g,this.sortElements);(sa=b.lights.length>0)&&t(b);Ta=0;for(Va=m.length;Ta<Va;Ta++){pa=m[Ta];qa.empty();if(pa instanceof THREE.RenderableParticle){E=pa;E.x*=v;E.y*=u;Ca=0;for(La=pa.materials.length;Ca<La;)D=pa.materials[Ca++],D.opacity!=0&&o(E,pa,D,b)}else if(pa instanceof THREE.RenderableLine){if(E=pa.v1,H=pa.v2,E.positionScreen.x*=v,E.positionScreen.y*=u,H.positionScreen.x*=
+v,H.positionScreen.y*=u,qa.addPoint(E.positionScreen.x,E.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),Z.instersects(qa)){Ca=0;for(La=pa.materials.length;Ca<La;)D=pa.materials[Ca++],D.opacity!=0&&w(E,H,pa,D,b)}}else if(pa instanceof THREE.RenderableFace3){if(E=pa.v1,H=pa.v2,P=pa.v3,E.positionScreen.x*=v,E.positionScreen.y*=u,H.positionScreen.x*=v,H.positionScreen.y*=u,P.positionScreen.x*=v,P.positionScreen.y*=u,pa.overdraw&&(Ka(E.positionScreen,H.positionScreen),Ka(H.positionScreen,
+P.positionScreen),Ka(P.positionScreen,E.positionScreen)),qa.add3Points(E.positionScreen.x,E.positionScreen.y,H.positionScreen.x,H.positionScreen.y,P.positionScreen.x,P.positionScreen.y),Z.instersects(qa)){Ca=0;for(La=pa.meshMaterials.length;Ca<La;)if(D=pa.meshMaterials[Ca++],D instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=pa.faceMaterials.length;Ra<Ua;)(D=pa.faceMaterials[Ra++])&&D.opacity!=0&&y(E,H,P,0,1,2,pa,D,b)}else D.opacity!=0&&y(E,H,P,0,1,2,pa,D,b)}}else if(pa instanceof THREE.RenderableFace4&&
+(E=pa.v1,H=pa.v2,P=pa.v3,V=pa.v4,E.positionScreen.x*=v,E.positionScreen.y*=u,H.positionScreen.x*=v,H.positionScreen.y*=u,P.positionScreen.x*=v,P.positionScreen.y*=u,V.positionScreen.x*=v,V.positionScreen.y*=u,G.positionScreen.copy(H.positionScreen),aa.positionScreen.copy(V.positionScreen),pa.overdraw&&(Ka(E.positionScreen,H.positionScreen),Ka(H.positionScreen,V.positionScreen),Ka(V.positionScreen,E.positionScreen),Ka(P.positionScreen,G.positionScreen),Ka(P.positionScreen,aa.positionScreen)),qa.addPoint(E.positionScreen.x,
+E.positionScreen.y),qa.addPoint(H.positionScreen.x,H.positionScreen.y),qa.addPoint(P.positionScreen.x,P.positionScreen.y),qa.addPoint(V.positionScreen.x,V.positionScreen.y),Z.instersects(qa))){Ca=0;for(La=pa.meshMaterials.length;Ca<La;)if(D=pa.meshMaterials[Ca++],D instanceof THREE.MeshFaceMaterial){Ra=0;for(Ua=pa.faceMaterials.length;Ra<Ua;)(D=pa.faceMaterials[Ra++])&&D.opacity!=0&&z(E,H,P,V,G,aa,pa,D,b)}else D.opacity!=0&&z(E,H,P,V,G,aa,pa,D,b)}ka.addRectangle(qa)}x.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,j,k,g;f=0;for(j=b.lights.length;f<j;f++)k=b.lights[f],k instanceof THREE.DirectionalLight?(g=e.normalWorld.dot(k.position)*k.intensity,g>0&&(c.r+=k.color.r*g,c.g+=k.color.g*g,c.b+=k.color.b*g)):k instanceof THREE.PointLight&&(V.sub(k.position,e.centroidWorld),V.normalize(),g=e.normalWorld.dot(V)*k.intensity,g>0&&(c.r+=k.color.r*g,c.g+=k.color.g*g,c.b+=k.color.b*g))}function c(e,c,k,m,p,o){j.data.vertices+=3;j.data.faces++;Q=f(S++);Q.setAttribute("d",
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?K?(B.r=O.r,B.g=O.g,B.b=O.b,b(o,m,B),F.r=Math.max(0,Math.min(p.color.r*B.r,1)),F.g=Math.max(0,Math.min(p.color.g*B.g,1)),F.b=Math.max(0,Math.min(p.color.b*B.b,1)),F.updateHex()):F.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(P=1-p.__2near/(p.__farPlusNear-
+m.z*p.__farMinusNear),F.setRGB(P,P,P)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));p.wireframe?Q.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):Q.setAttribute("style","fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+p.opacity);t.appendChild(Q)}function e(e,c,k,m,
+p,o,n){j.data.vertices+=4;j.data.faces++;Q=f(S++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?F.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?K?(B.r=O.r,B.g=O.g,B.b=O.b,b(n,p,B),F.r=Math.max(0,Math.min(o.color.r*B.r,1)),F.g=Math.max(0,Math.min(o.color.g*B.g,1)),F.b=Math.max(0,Math.min(o.color.b*
+B.b,1)),F.updateHex()):F.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(P=1-o.__2near/(o.__farPlusNear-p.z*o.__farMinusNear),F.setRGB(P,P,P)):o instanceof THREE.MeshNormalMaterial&&F.setRGB(h(p.normalWorld.x),h(p.normalWorld.y),h(p.normalWorld.z));o.wireframe?Q.setAttribute("style","fill: none; stroke: #"+g(F.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):Q.setAttribute("style",
+"fill: #"+g(F.hex.toString(16))+"; fill-opacity: "+o.opacity);t.appendChild(Q)}function f(b){G[b]==null&&(G[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),k==0&&G[b].setAttribute("shape-rendering","crispEdges"));return G[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,m=null,p=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,o,v,u,x,z,y,w,I=new THREE.Rectangle,C=new THREE.Rectangle,K=
+!1,F=new THREE.Color(16777215),B=new THREE.Color(16777215),O=new THREE.Color(0),E=new THREE.Color(0),H=new THREE.Color(0),P,V=new THREE.Vector3,G=[],aa=[],Q,S,T,k=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":k=1;break;case "low":k=0}};this.setSize=function(b,e){n=b;o=e;v=n/2;u=o/2;t.setAttribute("viewBox",-v+" "+-u+" "+n+" "+o);t.setAttribute("width",n);t.setAttribute("height",o);I.set(-v,
+-u,v,u)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=function(b,f){var h,o,n,F,B,P,J,G;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;m=p.projectScene(b,f,this.sortElements);T=S=0;if(K=b.lights.length>0){J=b.lights;O.setRGB(0,0,0);E.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(o=J.length;h<o;h++)n=J[h],F=n.color,n instanceof THREE.AmbientLight?(O.r+=F.r,O.g+=F.g,O.b+=F.b):n instanceof THREE.DirectionalLight?(E.r+=F.r,E.g+=F.g,E.b+=F.b):n instanceof
+THREE.PointLight&&(H.r+=F.r,H.g+=F.g,H.b+=F.b)}h=0;for(o=m.length;h<o;h++)if(J=m[h],C.empty(),J instanceof THREE.RenderableParticle){x=J;x.x*=v;x.y*=-u;n=0;for(F=J.materials.length;n<F;)n++}else if(J instanceof THREE.RenderableLine){if(x=J.v1,z=J.v2,x.positionScreen.x*=v,x.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),I.instersects(C)){n=0;for(F=J.materials.length;n<F;)if((G=J.materials[n++])&&
+G.opacity!=0){B=x;P=z;var V=T++;aa[V]==null&&(aa[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),k==0&&aa[V].setAttribute("shape-rendering","crispEdges"));Q=aa[V];Q.setAttribute("x1",B.positionScreen.x);Q.setAttribute("y1",B.positionScreen.y);Q.setAttribute("x2",P.positionScreen.x);Q.setAttribute("y2",P.positionScreen.y);G instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: ##"+g(G.color.hex.toString(16))+"; stroke-width: "+G.linewidth+"; stroke-opacity: "+
+G.opacity+"; stroke-linecap: "+G.linecap+"; stroke-linejoin: "+G.linejoin),t.appendChild(Q))}}}else if(J instanceof THREE.RenderableFace3){if(x=J.v1,z=J.v2,y=J.v3,x.positionScreen.x*=v,x.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,y.positionScreen.x*=v,y.positionScreen.y*=-u,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),I.instersects(C)){n=0;for(F=J.meshMaterials.length;n<
+F;)if(G=J.meshMaterials[n++],G instanceof THREE.MeshFaceMaterial){B=0;for(P=J.faceMaterials.length;B<P;)(G=J.faceMaterials[B++])&&G.opacity!=0&&c(x,z,y,J,G,b)}else G&&G.opacity!=0&&c(x,z,y,J,G,b)}}else if(J instanceof THREE.RenderableFace4&&(x=J.v1,z=J.v2,y=J.v3,w=J.v4,x.positionScreen.x*=v,x.positionScreen.y*=-u,z.positionScreen.x*=v,z.positionScreen.y*=-u,y.positionScreen.x*=v,y.positionScreen.y*=-u,w.positionScreen.x*=v,w.positionScreen.y*=-u,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(z.positionScreen.x,
+z.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(w.positionScreen.x,w.positionScreen.y),I.instersects(C))){n=0;for(F=J.meshMaterials.length;n<F;)if(G=J.meshMaterials[n++],G instanceof THREE.MeshFaceMaterial){B=0;for(P=J.faceMaterials.length;B<P;)(G=J.faceMaterials[B++])&&G.opacity!=0&&e(x,z,y,w,J,G,b)}else G&&G.opacity!=0&&e(x,z,y,w,J,G,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",
@@ -202,7 +201,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"};
-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.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.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}}};
@@ -225,145 +224,145 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\
 THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
 THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},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,h,g,k=b.vertices,m=k.length,o=b.colors,p=o.length,t=b.__vertexArray,n=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,x=b.__dirtyColors,w=b.__webglCustomAttributes,z,y;if(w)for(z in w)w[z].offset=0;if(c.sortParticles){ka.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)h=k[f].position,Aa.copy(h),ka.multiplyVector3(Aa),u[f]=[Aa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)h=k[u[f][1]].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;
-for(f=0;f<p;f++)g=f*3,color=o[u[f][1]],n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b;if(w)for(z in w){f=w[z];o=f.value.length;for(g=0;g<o;g++){index=u[g][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[p]=y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=
-y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)h=k[f].position,g=f*3,t[g]=h.x,t[g+1]=h.y,t[g+2]=h.z;if(x)for(f=0;f<p;f++)color=o[f],g=f*3,n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b;if(w)for(z in w)if(f=w[z],f.__original.needsUpdate){o=f.value.length;for(g=0;g<o;g++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[g];f.size===2?(f.array[p]=
-y.x,f.array[p+1]=y.y):f.size===3?f.type==="c"?(f.array[p]=y.r,f.array[p+1]=y.g,f.array[p+2]=y.b):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z):(f.array[p]=y.x,f.array[p+1]=y.y,f.array[p+2]=y.z,f.array[p+3]=y.w)}f.offset+=f.size}}}if(v||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,t,e);if(x||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,n,e);if(w)for(z in w)if(f=w[z],f.__original.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
-f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||T.initMaterial(f,e,c,g);if(f.morphTargets&&!g.__webglMorphTargetInfluences){g.__webglMorphTargetInfluences=new Float32Array(T.maxMorphTargets);for(var h=0,k=this.maxMorphTargets;h<k;h++)g.__webglMorphTargetInfluences[h]=0}var h=f.program,k=h.uniforms,m=f.uniforms;h!=fa&&(j.useProgram(h),fa=h);j.uniformMatrix4fv(k.projectionMatrix,!1,na);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 p,o,t,n=0,u=0,v=0,x,w,y,z=Ia,A=z.directional.colors,C=z.directional.positions,H=z.point.colors,G=z.point.positions,J=z.point.distances,
-U=0,D=0,c=o=y=0;for(p=e.length;c<p;c++)if(o=e[c],t=o.color,x=o.position,w=o.intensity,y=o.distance,o instanceof THREE.AmbientLight)n+=t.r,u+=t.g,v+=t.b;else if(o instanceof THREE.DirectionalLight)y=U*3,A[y]=t.r*w,A[y+1]=t.g*w,A[y+2]=t.b*w,C[y]=x.x,C[y+1]=x.y,C[y+2]=x.z,U+=1;else if(o instanceof THREE.SpotLight)y=U*3,A[y]=t.r*w,A[y+1]=t.g*w,A[y+2]=t.b*w,t=1/x.length(),C[y]=x.x*t,C[y+1]=x.y*t,C[y+2]=x.z*t,U+=1;else if(o instanceof THREE.PointLight)o=D*3,H[o]=t.r*w,H[o+1]=t.g*w,H[o+2]=t.b*w,G[o]=x.x,
-G[o+1]=x.y,G[o+2]=x.z,J[D]=y,D+=1;for(c=U*3;c<A.length;c++)A[c]=0;for(c=D*3;c<H.length;c++)H[c]=0;z.point.length=D;z.directional.length=U;z.ambient[0]=n;z.ambient[1]=u;z.ambient[2]=v;c=Ia;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,j,g,h=b.vertices,m=h.length,p=b.colors,o=p.length,t=b.__vertexArray,n=b.__colorArray,u=b.__sortArray,v=b.__dirtyVertices,x=b.__dirtyColors,w=b.__webglCustomAttributes,y,z;if(w)for(y in w)w[y].offset=0;if(c.sortParticles){na.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)j=h[f].position,Aa.copy(j),na.multiplyVector3(Aa),u[f]=[Aa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)j=h[u[f][1]].position,g=f*3,t[g]=j.x,t[g+1]=j.y,t[g+2]=j.z;
+for(f=0;f<o;f++)g=f*3,color=p[u[f][1]],n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b;if(w)for(y in w){f=w[y];p=f.value.length;for(g=0;g<p;g++){index=u[g][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[index];f.size===2?(f.array[o]=z.x,f.array[o+1]=z.y):f.size===3?f.type==="c"?(f.array[o]=z.r,f.array[o+1]=z.g,f.array[o+2]=z.b):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z):(f.array[o]=
+z.x,f.array[o+1]=z.y,f.array[o+2]=z.z,f.array[o+3]=z.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<m;f++)j=h[f].position,g=f*3,t[g]=j.x,t[g+1]=j.y,t[g+2]=j.z;if(x)for(f=0;f<o;f++)color=p[f],g=f*3,n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b;if(w)for(y in w)if(f=w[y],f.__original.needsUpdate){p=f.value.length;for(g=0;g<p;g++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[g];f.size===2?(f.array[o]=
+z.x,f.array[o+1]=z.y):f.size===3?f.type==="c"?(f.array[o]=z.r,f.array[o+1]=z.g,f.array[o+2]=z.b):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z,f.array[o+3]=z.w)}f.offset+=f.size}}}if(v||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,t,e);if(x||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,n,e);if(w)for(y in w)if(f=w[y],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,j){f.program||T.initMaterial(f,e,c,j);if(f.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(T.maxMorphTargets);for(var g=0,h=this.maxMorphTargets;g<h;g++)j.__webglMorphTargetInfluences[g]=0}var g=f.program,h=g.uniforms,m=f.uniforms;g!=ca&&(k.useProgram(g),ca=g);k.uniformMatrix4fv(h.projectionMatrix,!1,za);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 o,p,t,n=0,u=0,v=0,x,w,y,z=Ia,C=z.directional.colors,E=z.directional.positions,F=z.point.colors,I=z.point.positions,B=z.point.distances,
+U=0,D=0,c=p=y=0;for(o=e.length;c<o;c++)if(p=e[c],t=p.color,x=p.position,w=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)n+=t.r,u+=t.g,v+=t.b;else if(p instanceof THREE.DirectionalLight)y=U*3,C[y]=t.r*w,C[y+1]=t.g*w,C[y+2]=t.b*w,E[y]=x.x,E[y+1]=x.y,E[y+2]=x.z,U+=1;else if(p instanceof THREE.SpotLight)y=U*3,C[y]=t.r*w,C[y+1]=t.g*w,C[y+2]=t.b*w,t=1/x.length(),E[y]=x.x*t,E[y+1]=x.y*t,E[y+2]=x.z*t,U+=1;else if(p instanceof THREE.PointLight)p=D*3,F[p]=t.r*w,F[p+1]=t.g*w,F[p+2]=t.b*w,I[p]=x.x,
+I[p+1]=x.y,I[p+2]=x.z,B[D]=y,D+=1;for(c=U*3;c<C.length;c++)C[c]=0;for(c=D*3;c<F.length;c++)F[c]=0;z.point.length=D;z.directional.length=U;z.ambient[0]=n;z.ambient[1]=u;z.ambient[2]=v;c=Ia;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=Ba.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<ua.length;c++)m.shadowMatrix.value[c]=ua[c],m.shadowMap.texture[c]=T.shadowMap[c];m.shadowDarkness.value=T.shadowMapDarkness;m.shadowBias.value=T.shadowMapBias}for(var F in m)if(n=h.uniforms[F])if(p=m[F],u=p.type,c=p.value,u=="i")j.uniform1i(n,c);else if(u=="f")j.uniform1f(n,c);else if(u=="fv1")j.uniform1fv(n,c);else if(u=="fv")j.uniform3fv(n,c);else if(u==
-"v2")j.uniform2f(n,c.x,c.y);else if(u=="v3")j.uniform3f(n,c.x,c.y,c.z);else if(u=="v4")j.uniform4f(n,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!p._array)p._array=new Float32Array(16);c.flattenToArray(p._array);j.uniformMatrix4fv(n,!1,p._array)}else if(u=="m4v"){if(!p._array)p._array=new Float32Array(16*c.length);u=0;for(v=c.length;u<v;u++)c[u].flattenToArrayOffset(p._array,u*16);j.uniformMatrix4fv(n,!1,p._array)}else if(u=="c")j.uniform3f(n,c.r,c.g,c.b);else if(u=="t"){if(j.uniform1i(n,c),n=p.texture)if(n.image instanceof
-Array&&n.image.length==6){if(p=n,p.image.length==6){if(p.needsUpdate){if(p.__webglInit){j.bindTexture(j.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(n=0;n<6;++n)j.texSubImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,j.RGBA,j.UNSIGNED_BYTE,p.image[n])}else{p.image.__webglTextureCube=j.createTexture();j.bindTexture(j.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(n=0;n<6;++n)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,p.image[n]);p.__webglInit=!0}I(j.TEXTURE_CUBE_MAP,
-p,p.image[0]);j.bindTexture(j.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}j.activeTexture(j.TEXTURE0+c);j.bindTexture(j.TEXTURE_CUBE_MAP,p.image.__webglTextureCube)}}else V(n,c)}else if(u=="tv"){if(!p._array){p._array=[];u=0;for(v=p.texture.length;u<v;u++)p._array[u]=c+u}j.uniform1iv(n,p._array);u=0;for(v=p.texture.length;u<v;u++)(n=p.texture[u])&&V(n,p._array[u])}j.uniformMatrix4fv(k.modelViewMatrix,!1,g._modelViewMatrixArray);j.uniformMatrix3fv(k.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
-f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&j.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||g.receiveShadow)&&k.objectMatrix!==null&&j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&j.uniformMatrix4fv(k.viewMatrix,!1,xa);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,j.uniform3fv(k.directionalLightDirection,b),j.uniformMatrix4fv(k.objectMatrix,!1,g._objectMatrixArray),j.uniformMatrix4fv(k.viewMatrix,!1,xa);f.skinning&&(j.uniformMatrix4fv(k.cameraInverseMatrix,!1,xa),j.uniformMatrix4fv(k.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,k){if(g.opacity!=0){var m,b=e(b,c,f,g,k).attributes;if(!g.morphTargets&&
-b.position>=0)j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else if(k.morphTargetBase){c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,p=k.morphTargetForcedOrder,
-o=k.morphTargetInfluences;f<g.numSupportedMorphTargets&&f<p.length;)j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=o[p[f]],f++;else{var p=[],t=-1,n=0,o=k.morphTargetInfluences,u,v=o.length,f=0;for(k.morphTargetBase!==-1&&(p[k.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(u=0;u<v;u++)!p[u]&&o[u]>t&&(n=u,t=o[n]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n]);j.vertexAttribPointer(c["morphTarget"+
-f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=t;p[n]=1;t=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,
-!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer),
-j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount,j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),T.data.vertices+=h.__webglFaceCount,T.data.faces+=h.__webglFaceCount/
-3,T.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),T.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),T.data.drawCalls++):k instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),T.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
-j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,k,m,p,o,t,n,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],h=c[u+1],g=c[u+2],k=c[u+3],p=c[u+4],t=c[u+5],m=c[u+6],o=c[u+7],n=c[u+8],f=(f+k+m)/
-3,h=(h+p+o)/3,g=(g+t+n)/3,c[u]=f,c[u+1]=h,c[u+2]=g,c[u+3]=f,c[u+4]=h,c[u+5]=g,c[u+6]=f,c[u+7]=h,c[u+8]=g}j.bufferData(j.ARRAY_BUFFER,b.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(e.attributes.normal);j.vertexAttribPointer(e.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,b.count);b.count=0}function k(b){if(ea!=b.doubleSided)b.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ea=b.doubleSided;if(ia!=b.flipSided)b.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ia=b.flipSided}
-function h(b){ha!=b&&(b?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ha=b)}function m(b,e,c){M!=b&&(b?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),M=b);if(b&&(ma!=e||aa!=c))j.polygonOffset(e,c),ma=e,aa=c}function o(b){oa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);oa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);oa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);oa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);oa[4].set(b.n41-b.n31,b.n42-
-b.n32,b.n43-b.n33,b.n44-b.n34);oa[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=oa[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function t(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=oa[f].x*e.n14+oa[f].y*e.n24+oa[f].z*e.n34+oa[f].w,b<=c)return!1;return!0}function n(b,e){b.list[b.count]=e;b.count+=1}function p(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=
-h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?n(g,c):n(h,c)}function u(b){var e,c,f,h,g=b.object,k=b.buffer,j=b.opaque,m=b.transparent;m.count=0;b=j.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=k.materials.length;e<c;e++)(h=k.materials[e])&&(h.transparent?n(m,h):n(j,h))}else(h=e)&&(h.transparent?n(m,h):n(j,h))}function v(b,e){return e.z-b.z}function x(b,c){var m,p,n,u=0,v,x,y,w,z=b.lights;ta||(ta=new THREE.Camera(T.shadowCameraFov,
-c.aspect,T.shadowCameraNear,T.shadowCameraFar));m=0;for(p=z.length;m<p;m++)if(n=z[m],n instanceof THREE.SpotLight&&n.castShadow){T.shadowMap[u]||(T.shadowMap[u]=new THREE.WebGLRenderTarget(T.shadowMapWidth,T.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ua[u]||(ua[u]=new THREE.Matrix4);v=T.shadowMap[u];x=ua[u];ta.position.copy(n.position);ta.target.position.copy(n.target.position);ta.update(void 0,!0);b.update(void 0,!1,ta);x.set(0.5,0,0,0.5,
-0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(ta.projectionMatrix);x.multiplySelf(ta.matrixWorldInverse);ta.matrixWorldInverse.flattenToArray(xa);ta.projectionMatrix.flattenToArray(na);ka.multiply(ta.projectionMatrix,ta.matrixWorldInverse);o(ka);T.initWebGLObjects(b);E(v);j.clearColor(1,1,1,1);T.clear();j.clearColor(la.r,la.g,la.b,ra);x=b.__webglObjects.length;n=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],w=y.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||
-t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),H(w,ta,!1),y.render=!0):y.render=!1:y.render=!1;h(!0);K(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)w=y.object,buffer=y.buffer,k(w),y=w.geometry.morphTargets.length?ya:Da,f(ta,z,null,y,buffer,w);for(v=0;v<n;v++)y=b.__webglObjectsImmediate[v],w=y.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),H(w,ta,!1),k(w),program=e(ta,z,null,Da,w),w.render(function(b){g(b,
-program,Da.shading)}));u++}}function z(b){j.enable(j.POLYGON_OFFSET_FILL);j.polygonOffset(0.1,1);j.enable(j.STENCIL_TEST);j.enable(j.DEPTH_TEST);j.depthMask(!1);j.colorMask(!1,!1,!1,!1);j.stencilFunc(j.ALWAYS,1,255);j.stencilOpSeparate(j.BACK,j.KEEP,j.INCR,j.KEEP);j.stencilOpSeparate(j.FRONT,j.KEEP,j.DECR,j.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],k,m,p,o,t,n=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(t=0;t<n;t++)f=b.__webglShadowVolumes[t].object,k=b.__webglShadowVolumes[t].buffer,m=f.materials[0],m.program||T.initMaterial(m,h,void 0,f),m=m.program,p=m.uniforms,o=m.attributes,fa!==m&&(j.useProgram(m),fa=m,j.uniformMatrix4fv(p.projectionMatrix,!1,na),j.uniformMatrix4fv(p.viewMatrix,!1,xa),j.uniform3fv(p.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),j.uniformMatrix4fv(p.objectMatrix,!1,f._objectMatrixArray),j.bindBuffer(j.ARRAY_BUFFER,
-k.__webglVertexBuffer),j.vertexAttribPointer(o.position,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer),j.vertexAttribPointer(o.normal,3,j.FLOAT,!1,0,0),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),j.cullFace(j.FRONT),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0),j.cullFace(j.BACK),j.drawElements(j.TRIANGLES,k.__webglFaceCount,j.UNSIGNED_SHORT,0)}j.disable(j.POLYGON_OFFSET_FILL);j.colorMask(!0,!0,!0,!0);j.stencilFunc(j.NOTEQUAL,0,255);j.stencilOp(j.KEEP,
-j.KEEP,j.KEEP);j.disable(j.DEPTH_TEST);ha=qa=-1;fa=X.program;j.useProgram(X.program);j.uniformMatrix4fv(X.projectionLocation,!1,na);j.uniform1f(X.darknessLocation,X.darkness);j.bindBuffer(j.ARRAY_BUFFER,X.vertexBuffer);j.vertexAttribPointer(X.vertexLocation,3,j.FLOAT,!1,0,0);j.enableVertexAttribArray(X.vertexLocation);j.blendFunc(j.ONE,j.ONE_MINUS_SRC_ALPHA);j.blendEquation(j.FUNC_ADD);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,X.elementBuffer);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.disable(j.STENCIL_TEST);
-j.enable(j.DEPTH_TEST);j.depthMask(ga)}function y(b,e){var c,f,h;c=N.attributes;var g=N.uniforms,k=W/U,m,p=[],o=U*0.5,t=W*0.5,n=!0;j.useProgram(N.program);fa=N.program;ha=qa=-1;za||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),za=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
-N.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,!1,na);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?
-(j.uniform1i(g.useScreenCoordinates,1),j.uniform3f(g.screenPosition,(h.position.x-o)/o,(t-h.position.y)/t,Math.max(0,Math.min(1,h.position.z)))):(j.uniform1i(g.useScreenCoordinates,0),j.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),j.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?W:1),p[0]=m*k*h.scale.x,p[1]=m*h.scale.y,j.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),j.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),j.uniform2f(g.alignment,
-h.alignment.x,h.alignment.y),j.uniform1f(g.opacity,h.opacity),j.uniform1f(g.rotation,h.rotation),j.uniform2fv(g.scale,p),h.mergeWith3D&&!n?(j.enable(j.DEPTH_TEST),n=!0):!h.mergeWith3D&&n&&(j.disable(j.DEPTH_TEST),n=!1),K(h.blending),V(h.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ga)}function w(b,e){var c,f,h=b.__webglLensFlares.length,g,k,m,p=new THREE.Vector3,o=W/U,t=U*0.5,n=W*0.5,u=16/W,v=[u*o,u],x=[1,1,0],w=[1,1],y=R.uniforms;
-c=R.attributes;j.useProgram(R.program);fa=R.program;ha=qa=-1;va||(j.enableVertexAttribArray(R.attributes.vertex),j.enableVertexAttribArray(R.attributes.uv),va=!0);j.uniform1i(y.occlusionMap,0);j.uniform1i(y.map,1);j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.vertexAttribPointer(c.vertex,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,R.elementBuffer);j.disable(j.CULL_FACE);j.depthMask(!1);j.activeTexture(j.TEXTURE0);j.bindTexture(j.TEXTURE_2D,
-R.occlusionTexture);j.activeTexture(j.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,p.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(p),e.projectionMatrix.multiplyVector3(p),x[0]=p.x,x[1]=p.y,x[2]=p.z,w[0]=x[0]*t+t,w[1]=x[1]*n+n,R.hasVertexTexture||w[0]>0&&w[0]<U&&w[1]>0&&w[1]<W){j.bindTexture(j.TEXTURE_2D,R.tempTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGB,w[0]-8,w[1]-8,16,16,0);j.uniform1i(y.renderType,0);j.uniform2fv(y.scale,v);j.uniform3fv(y.screenPosition,
-x);j.disable(j.BLEND);j.enable(j.DEPTH_TEST);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);j.bindTexture(j.TEXTURE_2D,R.occlusionTexture);j.copyTexImage2D(j.TEXTURE_2D,0,j.RGBA,w[0]-8,w[1]-8,16,16,0);j.uniform1i(y.renderType,1);j.disable(j.DEPTH_TEST);j.bindTexture(j.TEXTURE_2D,R.tempTexture);j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();j.uniform1i(y.renderType,
-2);j.enable(j.BLEND);g=0;for(k=c.lensFlares.length;g<k;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,x[2]=m.z,u=m.size*m.scale/W,v[0]=u*o,v[1]=u,j.uniform3fv(y.screenPosition,x),j.uniform2fv(y.scale,v),j.uniform1f(y.rotation,m.rotation),j.uniform1f(y.opacity,m.opacity),K(m.blending),V(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ga)}function H(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
-b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function J(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function G(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=A(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var k=b,m=j.DYNAMIC_DRAW;if(g.__inittedArrays){var p=void 0,o=void 0,t=void 0,n=void 0,u=t=void 0,v=void 0,x=void 0,w=void 0,y=void 0,z=void 0,C=void 0,H=void 0,G=void 0,U=void 0,F=void 0,W=void 0,K=void 0,D=n=w=n=x=v=void 0,E=void 0,B=E=D=v=void 0,L=void 0,oa=B=E=D=t=t=u=w=n=B=E=D=L=B=E=D=L=B=E=D=void 0,I=
-0,M=0,Q=0,ga=0,P=0,R=0,N=0,S=0,ka=0,O=0,V=0,E=D=0,T=g.__vertexArray,fa=g.__uvArray,$=g.__uv2Array,Z=g.__normalArray,Y=g.__tangentArray,X=g.__colorArray,na=g.__skinVertexAArray,ea=g.__skinVertexBArray,aa=g.__skinIndexArray,ca=g.__skinWeightArray,ma=g.__morphTargetsArrays,ja=g.__webglCustomAttributes,B=void 0,ia=g.__faceArray,la=g.__lineArray,qa=g.__needsSmoothNormals,z=g.__vertexColorType,y=g.__uvType,C=g.__normalType,ha=k.geometry,ra=ha.__dirtyVertices,sa=ha.__dirtyElements,xa=ha.__dirtyUvs,ta=ha.__dirtyNormals,
-ua=ha.__dirtyTangents,wa=ha.__dirtyColors,Aa=ha.__dirtyMorphTargets,va=ha.vertices,Ba=g.faces,Da=ha.faces,Ia=ha.faceVertexUvs[0],Ea=ha.faceVertexUvs[1],ya=ha.skinVerticesA,za=ha.skinVerticesB,Oa=ha.skinIndices,Ha=ha.skinWeights,Ma=k instanceof THREE.ShadowVolume?ha.edgeFaces:void 0,Fa=ha.morphTargets;if(ja)for(oa in ja)ja[oa].offset=0,ja[oa].offsetSrc=0;p=0;for(o=Ba.length;p<o;p++)if(t=Ba[p],n=Da[t],Ia&&(H=Ia[t]),Ea&&(G=Ea[t]),t=n.vertexNormals,u=n.normal,v=n.vertexColors,x=n.color,w=n.vertexTangents,
-n instanceof THREE.Face3){if(ra)U=va[n.a].position,F=va[n.b].position,W=va[n.c].position,T[M]=U.x,T[M+1]=U.y,T[M+2]=U.z,T[M+3]=F.x,T[M+4]=F.y,T[M+5]=F.z,T[M+6]=W.x,T[M+7]=W.y,T[M+8]=W.z,M+=9;if(ja)for(oa in ja)if(B=ja[oa],B.__original.needsUpdate)D=B.offset,E=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[D+0]=B.value[n.a],B.array[D+1]=B.value[n.b],B.array[D+2]=B.value[n.c]):B.boundTo==="faces"?(B.array[D+0]=B.value[E],B.array[D+1]=B.value[E],B.array[D+2]=B.value[E],B.offsetSrc++):
-B.boundTo==="faceVertices"&&(B.array[D+0]=B.value[E+0],B.array[D+1]=B.value[E+1],B.array[D+2]=B.value[E+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(U=B.value[n.a],F=B.value[n.b],W=B.value[n.c]):B.boundTo==="faces"?(U=B.value[E],F=B.value[E],W=B.value[E],B.offsetSrc++):B.boundTo==="faceVertices"&&(U=B.value[E+0],F=B.value[E+1],W=B.value[E+2],B.offsetSrc+=3),B.size===2?(B.array[D+0]=U.x,B.array[D+1]=U.y,B.array[D+2]=F.x,B.array[D+3]=F.y,B.array[D+4]=W.x,B.array[D+5]=
-W.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[D+0]=U.r,B.array[D+1]=U.g,B.array[D+2]=U.b,B.array[D+3]=F.r,B.array[D+4]=F.g,B.array[D+5]=F.b,B.array[D+6]=W.r,B.array[D+7]=W.g,B.array[D+8]=W.b):(B.array[D+0]=U.x,B.array[D+1]=U.y,B.array[D+2]=U.z,B.array[D+3]=F.x,B.array[D+4]=F.y,B.array[D+5]=F.z,B.array[D+6]=W.x,B.array[D+7]=W.y,B.array[D+8]=W.z),B.offset+=9):(B.array[D+0]=U.x,B.array[D+1]=U.y,B.array[D+2]=U.z,B.array[D+3]=U.w,B.array[D+4]=F.x,B.array[D+5]=F.y,B.array[D+6]=F.z,B.array[D+7]=F.w,
-B.array[D+8]=W.x,B.array[D+9]=W.y,B.array[D+10]=W.z,B.array[D+11]=W.w,B.offset+=12));if(Aa){D=0;for(E=Fa.length;D<E;D++)U=Fa[D].vertices[n.a].position,F=Fa[D].vertices[n.b].position,W=Fa[D].vertices[n.c].position,B=ma[D],B[V+0]=U.x,B[V+1]=U.y,B[V+2]=U.z,B[V+3]=F.x,B[V+4]=F.y,B[V+5]=F.z,B[V+6]=W.x,B[V+7]=W.y,B[V+8]=W.z;V+=9}if(Ha.length)D=Ha[n.a],E=Ha[n.b],B=Ha[n.c],ca[O]=D.x,ca[O+1]=D.y,ca[O+2]=D.z,ca[O+3]=D.w,ca[O+4]=E.x,ca[O+5]=E.y,ca[O+6]=E.z,ca[O+7]=E.w,ca[O+8]=B.x,ca[O+9]=B.y,ca[O+10]=B.z,ca[O+
-11]=B.w,D=Oa[n.a],E=Oa[n.b],B=Oa[n.c],aa[O]=D.x,aa[O+1]=D.y,aa[O+2]=D.z,aa[O+3]=D.w,aa[O+4]=E.x,aa[O+5]=E.y,aa[O+6]=E.z,aa[O+7]=E.w,aa[O+8]=B.x,aa[O+9]=B.y,aa[O+10]=B.z,aa[O+11]=B.w,D=ya[n.a],E=ya[n.b],B=ya[n.c],na[O]=D.x,na[O+1]=D.y,na[O+2]=D.z,na[O+3]=1,na[O+4]=E.x,na[O+5]=E.y,na[O+6]=E.z,na[O+7]=1,na[O+8]=B.x,na[O+9]=B.y,na[O+10]=B.z,na[O+11]=1,D=za[n.a],E=za[n.b],B=za[n.c],ea[O]=D.x,ea[O+1]=D.y,ea[O+2]=D.z,ea[O+3]=1,ea[O+4]=E.x,ea[O+5]=E.y,ea[O+6]=E.z,ea[O+7]=1,ea[O+8]=B.x,ea[O+9]=B.y,ea[O+10]=
-B.z,ea[O+11]=1,O+=12;if(wa&&z)v.length==3&&z==THREE.VertexColors?(n=v[0],D=v[1],E=v[2]):E=D=n=x,X[ka]=n.r,X[ka+1]=n.g,X[ka+2]=n.b,X[ka+3]=D.r,X[ka+4]=D.g,X[ka+5]=D.b,X[ka+6]=E.r,X[ka+7]=E.g,X[ka+8]=E.b,ka+=9;if(ua&&ha.hasTangents)v=w[0],x=w[1],n=w[2],Y[N]=v.x,Y[N+1]=v.y,Y[N+2]=v.z,Y[N+3]=v.w,Y[N+4]=x.x,Y[N+5]=x.y,Y[N+6]=x.z,Y[N+7]=x.w,Y[N+8]=n.x,Y[N+9]=n.y,Y[N+10]=n.z,Y[N+11]=n.w,N+=12;if(ta&&C)if(t.length==3&&qa)for(w=0;w<3;w++)u=t[w],Z[R]=u.x,Z[R+1]=u.y,Z[R+2]=u.z,R+=3;else for(w=0;w<3;w++)Z[R]=
-u.x,Z[R+1]=u.y,Z[R+2]=u.z,R+=3;if(xa&&H!==void 0&&y)for(w=0;w<3;w++)t=H[w],fa[Q]=t.u,fa[Q+1]=t.v,Q+=2;if(xa&&G!==void 0&&y)for(w=0;w<3;w++)t=G[w],$[ga]=t.u,$[ga+1]=t.v,ga+=2;sa&&(ia[P]=I,ia[P+1]=I+1,ia[P+2]=I+2,P+=3,la[S]=I,la[S+1]=I+1,la[S+2]=I,la[S+3]=I+2,la[S+4]=I+1,la[S+5]=I+2,S+=6,I+=3)}else if(n instanceof THREE.Face4){if(ra)U=va[n.a].position,F=va[n.b].position,W=va[n.c].position,K=va[n.d].position,T[M]=U.x,T[M+1]=U.y,T[M+2]=U.z,T[M+3]=F.x,T[M+4]=F.y,T[M+5]=F.z,T[M+6]=W.x,T[M+7]=W.y,T[M+8]=
-W.z,T[M+9]=K.x,T[M+10]=K.y,T[M+11]=K.z,M+=12;if(ja)for(oa in ja)if(B=ja[oa],B.__original.needsUpdate)D=B.offset,E=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[D+0]=B.value[n.a],B.array[D+1]=B.value[n.b],B.array[D+2]=B.value[n.c],B.array[D+3]=B.value[n.d]):B.boundTo==="faces"?(B.array[D+0]=B.value[E],B.array[D+1]=B.value[E],B.array[D+2]=B.value[E],B.array[D+3]=B.value[E],B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[D+0]=B.value[E+0],B.array[D+1]=B.value[E+1],B.array[D+
-2]=B.value[E+2],B.array[D+3]=B.value[E+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(U=B.value[n.a],F=B.value[n.b],W=B.value[n.c],K=B.value[n.d]):B.boundTo==="faces"?(U=B.value[E],F=B.value[E],W=B.value[E],K=B.value[E],B.offsetSrc++):B.boundTo==="faceVertices"&&(U=B.value[E+0],F=B.value[E+1],W=B.value[E+2],K=B.value[E+3],B.offsetSrc+=4),B.size===2?(B.array[D+0]=U.x,B.array[D+1]=U.y,B.array[D+2]=F.x,B.array[D+3]=F.y,B.array[D+4]=W.x,B.array[D+5]=W.y,B.array[D+6]=K.x,
-B.array[D+7]=K.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[D+0]=U.r,B.array[D+1]=U.g,B.array[D+2]=U.b,B.array[D+3]=F.r,B.array[D+4]=F.g,B.array[D+5]=F.b,B.array[D+6]=W.r,B.array[D+7]=W.g,B.array[D+8]=W.b,B.array[D+9]=K.r,B.array[D+10]=K.g,B.array[D+11]=K.b):(B.array[D+0]=U.x,B.array[D+1]=U.y,B.array[D+2]=U.z,B.array[D+3]=F.x,B.array[D+4]=F.y,B.array[D+5]=F.z,B.array[D+6]=W.x,B.array[D+7]=W.y,B.array[D+8]=W.z,B.array[D+9]=K.x,B.array[D+10]=K.y,B.array[D+11]=K.z),B.offset+=12):(B.array[D+0]=U.x,
-B.array[D+1]=U.y,B.array[D+2]=U.z,B.array[D+3]=U.w,B.array[D+4]=F.x,B.array[D+5]=F.y,B.array[D+6]=F.z,B.array[D+7]=F.w,B.array[D+8]=W.x,B.array[D+9]=W.y,B.array[D+10]=W.z,B.array[D+11]=W.w,B.array[D+12]=K.x,B.array[D+13]=K.y,B.array[D+14]=K.z,B.array[D+15]=K.w,B.offset+=16));if(Aa){D=0;for(E=Fa.length;D<E;D++)U=Fa[D].vertices[n.a].position,F=Fa[D].vertices[n.b].position,W=Fa[D].vertices[n.c].position,K=Fa[D].vertices[n.d].position,B=ma[D],B[V+0]=U.x,B[V+1]=U.y,B[V+2]=U.z,B[V+3]=F.x,B[V+4]=F.y,B[V+
-5]=F.z,B[V+6]=W.x,B[V+7]=W.y,B[V+8]=W.z,B[V+9]=K.x,B[V+10]=K.y,B[V+11]=K.z;V+=12}if(Ha.length)D=Ha[n.a],E=Ha[n.b],B=Ha[n.c],L=Ha[n.d],ca[O]=D.x,ca[O+1]=D.y,ca[O+2]=D.z,ca[O+3]=D.w,ca[O+4]=E.x,ca[O+5]=E.y,ca[O+6]=E.z,ca[O+7]=E.w,ca[O+8]=B.x,ca[O+9]=B.y,ca[O+10]=B.z,ca[O+11]=B.w,ca[O+12]=L.x,ca[O+13]=L.y,ca[O+14]=L.z,ca[O+15]=L.w,D=Oa[n.a],E=Oa[n.b],B=Oa[n.c],L=Oa[n.d],aa[O]=D.x,aa[O+1]=D.y,aa[O+2]=D.z,aa[O+3]=D.w,aa[O+4]=E.x,aa[O+5]=E.y,aa[O+6]=E.z,aa[O+7]=E.w,aa[O+8]=B.x,aa[O+9]=B.y,aa[O+10]=B.z,
-aa[O+11]=B.w,aa[O+12]=L.x,aa[O+13]=L.y,aa[O+14]=L.z,aa[O+15]=L.w,D=ya[n.a],E=ya[n.b],B=ya[n.c],L=ya[n.d],na[O]=D.x,na[O+1]=D.y,na[O+2]=D.z,na[O+3]=1,na[O+4]=E.x,na[O+5]=E.y,na[O+6]=E.z,na[O+7]=1,na[O+8]=B.x,na[O+9]=B.y,na[O+10]=B.z,na[O+11]=1,na[O+12]=L.x,na[O+13]=L.y,na[O+14]=L.z,na[O+15]=1,D=za[n.a],E=za[n.b],B=za[n.c],n=za[n.d],ea[O]=D.x,ea[O+1]=D.y,ea[O+2]=D.z,ea[O+3]=1,ea[O+4]=E.x,ea[O+5]=E.y,ea[O+6]=E.z,ea[O+7]=1,ea[O+8]=B.x,ea[O+9]=B.y,ea[O+10]=B.z,ea[O+11]=1,ea[O+12]=n.x,ea[O+13]=n.y,ea[O+
-14]=n.z,ea[O+15]=1,O+=16;if(wa&&z)v.length==4&&z==THREE.VertexColors?(n=v[0],D=v[1],E=v[2],v=v[3]):v=E=D=n=x,X[ka]=n.r,X[ka+1]=n.g,X[ka+2]=n.b,X[ka+3]=D.r,X[ka+4]=D.g,X[ka+5]=D.b,X[ka+6]=E.r,X[ka+7]=E.g,X[ka+8]=E.b,X[ka+9]=v.r,X[ka+10]=v.g,X[ka+11]=v.b,ka+=12;if(ua&&ha.hasTangents)v=w[0],x=w[1],n=w[2],w=w[3],Y[N]=v.x,Y[N+1]=v.y,Y[N+2]=v.z,Y[N+3]=v.w,Y[N+4]=x.x,Y[N+5]=x.y,Y[N+6]=x.z,Y[N+7]=x.w,Y[N+8]=n.x,Y[N+9]=n.y,Y[N+10]=n.z,Y[N+11]=n.w,Y[N+12]=w.x,Y[N+13]=w.y,Y[N+14]=w.z,Y[N+15]=w.w,N+=16;if(ta&&
-C)if(t.length==4&&qa)for(w=0;w<4;w++)u=t[w],Z[R]=u.x,Z[R+1]=u.y,Z[R+2]=u.z,R+=3;else for(w=0;w<4;w++)Z[R]=u.x,Z[R+1]=u.y,Z[R+2]=u.z,R+=3;if(xa&&H!==void 0&&y)for(w=0;w<4;w++)t=H[w],fa[Q]=t.u,fa[Q+1]=t.v,Q+=2;if(xa&&G!==void 0&&y)for(w=0;w<4;w++)t=G[w],$[ga]=t.u,$[ga+1]=t.v,ga+=2;sa&&(ia[P]=I,ia[P+1]=I+1,ia[P+2]=I+3,ia[P+3]=I+1,ia[P+4]=I+2,ia[P+5]=I+3,P+=6,la[S]=I,la[S+1]=I+1,la[S+2]=I,la[S+3]=I+3,la[S+4]=I+1,la[S+5]=I+2,la[S+6]=I+2,la[S+7]=I+3,S+=8,I+=4)}if(Ma){p=0;for(o=Ma.length;p<o;p++)ia[P]=Ma[p].a,
-ia[P+1]=Ma[p].b,ia[P+2]=Ma[p].c,ia[P+3]=Ma[p].a,ia[P+4]=Ma[p].c,ia[P+5]=Ma[p].d,P+=6}ra&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,T,m));if(ja)for(oa in ja)B=ja[oa],B.__original.needsUpdate&&(j.bindBuffer(j.ARRAY_BUFFER,B.buffer),j.bufferData(j.ARRAY_BUFFER,B.array,m));if(Aa){D=0;for(E=Fa.length;D<E;D++)j.bindBuffer(j.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[D]),j.bufferData(j.ARRAY_BUFFER,ma[D],m)}wa&&ka>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglColorBuffer),
-j.bufferData(j.ARRAY_BUFFER,X,m));ta&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));ua&&ha.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,Y,m));xa&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,fa,m));xa&&ga>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,$,m));sa&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,
-ia,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,la,m));O>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,na,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,aa,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));k.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(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||
-f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;y=b.vertices;g=b.colors;z=y.length;k=g.length;C=b.__vertexArray;m=b.__colorArray;H=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<z;p++)o=y[p].position,h=p*3,C[h]=o.x,C[h+1]=o.y,C[h+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,C,e)}if(H){for(p=0;p<k;p++)color=g[p],h=p*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);j.bufferData(j.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=j.DYNAMIC_DRAW;y=b.vertices;g=b.colors;z=y.length;k=g.length;C=b.__vertexArray;m=b.__colorArray;H=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p<z;p++)o=y[p].position,h=p*3,C[h]=o.x,C[h+1]=o.y,C[h+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,C,e)}if(H){for(p=0;p<k;p++)color=g[p],h=p*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;j.bindBuffer(j.ARRAY_BUFFER,b.__webglColorBuffer);
-j.bufferData(j.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,g=A(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,j.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,J(f)}function C(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function P(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,k,j,m,p,n={},o=b.morphTargets!==
-void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)k=b.faces[h],j=k.materials,m=e(j),n[m]==void 0&&(n[m]={hash:m,counter:0}),p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:j,vertices:0,numMorphTargets:o}),k=k instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+k>65535&&(n[m].counter+=1,p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:j,vertices:0,numMorphTargets:o})),
-b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=k}function F(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=qa){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,
-j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}qa=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,S(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,S(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,S(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,S(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b,
-j.TEXTURE_MAG_FILTER,Q(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function V(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),I(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+
-e);j.bindTexture(j.TEXTURE_2D,b.__webglTexture)}function E(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,S(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,S(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,
-S(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,S(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,
-j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,
-c=U,b=W);e!=Y&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(ca,ja,c,b),Y=e)}function $(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}
-function S(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
-var T=this,j,L=[],fa=null,Y=null,ga=!0,ea=null,ia=null,qa=null,ha=null,M=null,ma=null,aa=null,ca=0,ja=0,U=0,W=0,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,na=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-Pa=b.stencil!==void 0?b.stencil:!0,Z=b.antialias!==void 0?b.antialias:!1,la=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ra=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;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 ta,ua=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(j=Ba.getContext("experimental-webgl",{antialias:Z,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+
-" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(sa){console.error(sa)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(la.r,la.g,la.b,ra);this.context=j;var Ea=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0;if(Pa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=-1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=j.createBuffer();X.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,X.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,
-X.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,X.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,X.faces,j.STATIC_DRAW);X.program=j.createProgram();j.attachShader(X.program,$("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(X.program,$("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(X.program);X.vertexLocation=j.getAttribLocation(X.program,"position");X.projectionLocation=j.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation=
-j.getUniformLocation(X.program,"darkness")}var R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);Z=0;R.vertices[Z++]=-1;R.vertices[Z++]=-1;R.vertices[Z++]=0;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;Z=0;R.faces[Z++]=0;R.faces[Z++]=1;R.faces[Z++]=2;R.faces[Z++]=0;R.faces[Z++]=2;R.faces[Z++]=3;
-R.vertexBuffer=j.createBuffer();R.elementBuffer=j.createBuffer();R.tempTexture=j.createTexture();R.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,R.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,R.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,R.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,R.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,
-j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,R.occlusionTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);
-j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(R.hasVertexTexture=!1,R.program=j.createProgram(),j.attachShader(R.program,$("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(R.program,$("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(R.hasVertexTexture=!0,R.program=j.createProgram(),j.attachShader(R.program,$("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(R.program,$("vertex",
-THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));j.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.vertex=j.getAttribLocation(R.program,"position");R.attributes.uv=j.getAttribLocation(R.program,"UV");R.uniforms.renderType=j.getUniformLocation(R.program,"renderType");R.uniforms.map=j.getUniformLocation(R.program,"map");R.uniforms.occlusionMap=j.getUniformLocation(R.program,"occlusionMap");R.uniforms.opacity=j.getUniformLocation(R.program,"opacity");R.uniforms.scale=j.getUniformLocation(R.program,
-"scale");R.uniforms.rotation=j.getUniformLocation(R.program,"rotation");R.uniforms.screenPosition=j.getUniformLocation(R.program,"screenPosition");var va=!1,N={};N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);Z=0;N.vertices[Z++]=-1;N.vertices[Z++]=-1;N.vertices[Z++]=0;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=-1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=0;N.vertices[Z++]=-1;N.vertices[Z++]=1;N.vertices[Z++]=0;Z=
-N.vertices[Z++]=0;N.faces[Z++]=0;N.faces[Z++]=1;N.faces[Z++]=2;N.faces[Z++]=0;N.faces[Z++]=2;N.faces[Z++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);N.program=j.createProgram();j.attachShader(N.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,
-$("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,"rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,
-"alignment");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,
-"projectionMatrix");var za=!1;this.setSize=function(b,e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ca=b;ja=e;U=c;W=f;j.viewport(ca,ja,U,W)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ga=b;j.depthMask(b)};this.setClearColorHex=function(b,e){la.setHex(b);ra=e;j.clearColor(la.r,la.g,la.b,ra)};this.setClearColor=
-function(b,e){la.copy(b);ra=e;j.clearColor(la.r,la.g,la.b,ra)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){X.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var h,g,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":
-b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var p,n,o;p=o=m=0;for(n=e.length;p<n;p++)g=e[p],g instanceof THREE.SpotLight&&o++,g instanceof THREE.DirectionalLight&&o++,g instanceof THREE.PointLight&&
-m++;m+o<=4?p=o:(p=Math.ceil(4*o/(m+o)),m=4-p);g={directional:p,point:m};m=o=0;for(p=e.length;m<p;m++)n=e[m],n instanceof THREE.SpotLight&&n.castShadow&&o++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{p=b.fragmentShader;n=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:g.directional,maxPointLights:g.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o},v,f=[];k?f.push(k):(f.push(p),f.push(n));for(v in c)f.push(v),f.push(c[v]);k=f.join();v=0;for(f=L.length;v<f;v++)if(L[v].code==k){u=L[v].program;break a}v=j.createProgram();f=[Ea?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(j.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(c=0;c<ta.length;c++)m.shadowMatrix.value[c]=ta[c],m.shadowMap.texture[c]=T.shadowMap[c];m.shadowDarkness.value=T.shadowMapDarkness;m.shadowBias.value=T.shadowMapBias}for(var K in m)if(n=g.uniforms[K])if(o=m[K],u=o.type,c=o.value,u=="i")k.uniform1i(n,c);else if(u=="f")k.uniform1f(n,c);else if(u=="fv1")k.uniform1fv(n,c);else if(u=="fv")k.uniform3fv(n,c);else if(u==
+"v2")k.uniform2f(n,c.x,c.y);else if(u=="v3")k.uniform3f(n,c.x,c.y,c.z);else if(u=="v4")k.uniform4f(n,c.x,c.y,c.z,c.w);else if(u=="m4"){if(!o._array)o._array=new Float32Array(16);c.flattenToArray(o._array);k.uniformMatrix4fv(n,!1,o._array)}else if(u=="m4v"){if(!o._array)o._array=new Float32Array(16*c.length);u=0;for(v=c.length;u<v;u++)c[u].flattenToArrayOffset(o._array,u*16);k.uniformMatrix4fv(n,!1,o._array)}else if(u=="c")k.uniform3f(n,c.r,c.g,c.b);else if(u=="t"){if(k.uniform1i(n,c),n=o.texture)if(n.image instanceof
+Array&&n.image.length==6){if(o=n,o.image.length==6){if(o.needsUpdate){if(o.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(n=0;n<6;++n)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,k.RGBA,k.UNSIGNED_BYTE,o.image[n])}else{o.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(n=0;n<6;++n)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,o.image[n]);o.__webglInit=!0}P(k.TEXTURE_CUBE_MAP,
+o,o.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}}else V(n,c)}else if(u=="tv"){if(!o._array){o._array=[];u=0;for(v=o.texture.length;u<v;u++)o._array[u]=c+u}k.uniform1iv(n,o._array);u=0;for(v=o.texture.length;u<v;u++)(n=o.texture[u])&&V(n,o._array[u])}k.uniformMatrix4fv(h.modelViewMatrix,!1,j._modelViewMatrixArray);k.uniformMatrix3fv(h.normalMatrix,!1,j._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||j.receiveShadow)&&h.objectMatrix!==null&&k.uniformMatrix4fv(h.objectMatrix,!1,j._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&h.viewMatrix!==null&&k.uniformMatrix4fv(h.viewMatrix,!1,wa);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,j._objectMatrixArray),k.uniformMatrix4fv(h.viewMatrix,!1,wa);f.skinning&&(k.uniformMatrix4fv(h.cameraInverseMatrix,!1,wa),k.uniformMatrix4fv(h.boneGlobalMatrices,!1,j.boneMatrices));return g}function f(b,c,f,j,g,h){if(j.opacity!=0){var m,b=e(b,c,f,j,h).attributes;if(!j.morphTargets&&
+b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(h.morphTargetBase){c=j.program.attributes;h.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[h.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length)for(var f=0,o=h.morphTargetForcedOrder,
+p=h.morphTargetInfluences;f<j.numSupportedMorphTargets&&f<o.length;)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[o[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[f]=p[o[f]],f++;else{var o=[],t=-1,n=0,p=h.morphTargetInfluences,u,v=p.length,f=0;for(h.morphTargetBase!==-1&&(o[h.morphTargetBase]=!0);f<j.numSupportedMorphTargets;){for(u=0;u<v;u++)!o[u]&&p[u]>t&&(n=u,t=p[n]);k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n]);k.vertexAttribPointer(c["morphTarget"+
+f],3,k.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[f]=t;o[n]=1;t=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(j.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(m in g.__webglCustomAttributes)b[m]>=0&&(c=g.__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,g.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,
+!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),
+k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,
+4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));h instanceof THREE.Mesh?(j.wireframe?(k.lineWidth(j.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.drawElements(k.LINES,g.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.drawElements(k.TRIANGLES,g.__webglFaceCount,k.UNSIGNED_SHORT,0)),T.data.vertices+=g.__webglFaceCount,T.data.faces+=g.__webglFaceCount/
+3,T.data.drawCalls++):h instanceof THREE.Line?(h=h.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(j.linewidth),k.drawArrays(h,0,g.__webglLineCount),T.data.drawCalls++):h instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,g.__webglParticleCount),T.data.drawCalls++):h instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,g.__webglVertexCount),T.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,g,j,h,m,o,p,t,n,u,v=b.count*3;for(u=0;u<v;u+=9)c=b.normalArray,f=c[u],g=c[u+1],j=c[u+2],h=c[u+3],o=c[u+4],t=c[u+5],m=c[u+6],p=c[u+7],n=c[u+8],f=(f+h+m)/
+3,g=(g+o+p)/3,j=(j+t+n)/3,c[u]=f,c[u+1]=g,c[u+2]=j,c[u+3]=f,c[u+4]=g,c[u+5]=j,c[u+6]=f,c[u+7]=g,c[u+8]=j}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 g(b){if($!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),$=b.doubleSided;if(da!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),da=b.flipSided}
+function j(b){fa!=b&&(b?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),fa=b)}function m(b,e,c){J!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),J=b);if(b&&(ia!=e||la!=c))k.polygonOffset(e,c),ia=e,la=c}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 e,b=0;b<6;b++)e=ga[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function t(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=ga[f].x*e.n14+ga[f].y*e.n24+ga[f].z*e.n34+ga[f].w,b<=c)return!1;return!0}function n(b,e){b.list[b.count]=e;b.count+=1}function o(b){var e,c,f=b.object,g=b.opaque,j=b.transparent;j.count=0;b=
+g.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?n(j,c):n(g,c)}function v(b){var e,c,f,g,j=b.object,h=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=j.materials.length;b<f;b++)if(e=j.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=h.materials.length;e<c;e++)(g=h.materials[e])&&(g.transparent?n(m,g):n(k,g))}else(g=e)&&(g.transparent?n(m,g):n(k,g))}function u(b,e){return e.z-b.z}function x(b,c){var m,o,n,u=0,v,x,w,y,z=b.lights;sa||(sa=new THREE.Camera(T.shadowCameraFov,
+c.aspect,T.shadowCameraNear,T.shadowCameraFar));m=0;for(o=z.length;m<o;m++)if(n=z[m],n instanceof THREE.SpotLight&&n.castShadow){T.shadowMap[u]||(T.shadowMap[u]=new THREE.WebGLRenderTarget(T.shadowMapWidth,T.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ta[u]||(ta[u]=new THREE.Matrix4);v=T.shadowMap[u];x=ta[u];sa.position.copy(n.position);sa.target.position.copy(n.target.position);sa.update(void 0,!0);b.update(void 0,!1,sa);x.set(0.5,0,0,0.5,
+0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(sa.projectionMatrix);x.multiplySelf(sa.matrixWorldInverse);sa.matrixWorldInverse.flattenToArray(wa);sa.projectionMatrix.flattenToArray(za);na.multiply(sa.projectionMatrix,sa.matrixWorldInverse);p(na);T.initWebGLObjects(b);G(v);k.clearColor(1,1,1,1);T.clear();k.clearColor(ka.r,ka.g,ka.b,qa);x=b.__webglObjects.length;n=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)w=b.__webglObjects[v],y=w.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||
+t(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),I(y,sa,!1),w.render=!0):w.render=!1:w.render=!1;j(!0);H(THREE.NormalBlending);for(v=0;v<x;v++)if(w=b.__webglObjects[v],w.render)y=w.object,buffer=w.buffer,g(y),w=y.geometry.morphTargets.length?xa:Da,f(sa,z,null,w,buffer,y);for(v=0;v<n;v++)w=b.__webglObjectsImmediate[v],y=w.object,y.visible&&y.castShadow&&(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),I(y,sa,!1),g(y),program=e(sa,z,null,Da,y),y.render(function(b){h(b,
+program,Da.shading)}));u++}}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,g=b.lights,j=[],h,m,o,p,t,n=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){j[0]=-f.position.x;
+j[1]=-f.position.y;j[2]=-f.position.z;for(t=0;t<n;t++)f=b.__webglShadowVolumes[t].object,h=b.__webglShadowVolumes[t].buffer,m=f.materials[0],m.program||T.initMaterial(m,g,void 0,f),m=m.program,o=m.uniforms,p=m.attributes,ca!==m&&(k.useProgram(m),ca=m,k.uniformMatrix4fv(o.projectionMatrix,!1,za),k.uniformMatrix4fv(o.viewMatrix,!1,wa),k.uniform3fv(o.directionalLightDirection,j)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(o.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);fa=ea=-1;ca=Y.program;k.useProgram(Y.program);k.uniformMatrix4fv(Y.projectionLocation,!1,za);k.uniform1f(Y.darknessLocation,Y.darkness);k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.vertexAttribPointer(Y.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(Y.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);
+k.enable(k.DEPTH_TEST);k.depthMask(X)}function y(b,e){var c,f,g;c=M.attributes;var j=M.uniforms,h=ha/U,m,o=[],p=U*0.5,t=ha*0.5,n=!0;k.useProgram(M.program);ca=M.program;fa=ea=-1;ya||(k.enableVertexAttribArray(M.attributes.position),k.enableVertexAttribArray(M.attributes.uv),ya=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,M.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,
+M.elementBuffer);k.uniformMatrix4fv(j.projectionMatrix,!1,za);k.activeTexture(k.TEXTURE0);k.uniform1i(j.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)g=b.__webglSprites[c],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?
+(k.uniform1i(j.useScreenCoordinates,1),k.uniform3f(j.screenPosition,(g.position.x-p)/p,(t-g.position.y)/t,Math.max(0,Math.min(1,g.position.z)))):(k.uniform1i(j.useScreenCoordinates,0),k.uniform1i(j.affectedByDistance,g.affectedByDistance?1:0),k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray)),m=g.map.image.width/(g.scaleByViewport?ha:1),o[0]=m*h*g.scale.x,o[1]=m*g.scale.y,k.uniform2f(j.uvScale,g.uvScale.x,g.uvScale.y),k.uniform2f(j.uvOffset,g.uvOffset.x,g.uvOffset.y),k.uniform2f(j.alignment,
+g.alignment.x,g.alignment.y),k.uniform1f(j.opacity,g.opacity),k.uniform1f(j.rotation,g.rotation),k.uniform2fv(j.scale,o),g.mergeWith3D&&!n?(k.enable(k.DEPTH_TEST),n=!0):!g.mergeWith3D&&n&&(k.disable(k.DEPTH_TEST),n=!1),H(g.blending),V(g.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(X)}function w(b,e){var c,f,g=b.__webglLensFlares.length,j,h,m,o=new THREE.Vector3,p=ha/U,t=U*0.5,n=ha*0.5,u=16/ha,v=[u*p,u],x=[1,1,0],w=[1,1],y=R.uniforms;
+c=R.attributes;k.useProgram(R.program);ca=R.program;fa=ea=-1;ua||(k.enableVertexAttribArray(R.attributes.vertex),k.enableVertexAttribArray(R.attributes.uv),ua=!0);k.uniform1i(y.occlusionMap,0);k.uniform1i(y.map,1);k.bindBuffer(k.ARRAY_BUFFER,R.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,R.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,
+R.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<g;f++)if(c=b.__webglLensFlares[f].object,o.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),e.matrixWorldInverse.multiplyVector3(o),e.projectionMatrix.multiplyVector3(o),x[0]=o.x,x[1]=o.y,x[2]=o.z,w[0]=x[0]*t+t,w[1]=x[1]*n+n,R.hasVertexTexture||w[0]>0&&w[0]<U&&w[1]>0&&w[1]<ha){k.bindTexture(k.TEXTURE_2D,R.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,w[0]-8,w[1]-8,16,16,0);k.uniform1i(y.renderType,0);k.uniform2fv(y.scale,v);
+k.uniform3fv(y.screenPosition,x);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,R.occlusionTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,w[0]-8,w[1]-8,16,16,0);k.uniform1i(y.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,R.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();
+k.uniform1i(y.renderType,2);k.enable(k.BLEND);j=0;for(h=c.lensFlares.length;j<h;j++)if(m=c.lensFlares[j],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,x[2]=m.z,u=m.size*m.scale/ha,v[0]=u*p,v[1]=u,k.uniform3fv(y.screenPosition,x),k.uniform2fv(y.scale,v),k.uniform1f(y.rotation,m.rotation),k.uniform1f(y.opacity,m.opacity),H(m.blending),V(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(X)}function I(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,
+b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function C(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function K(b){var e,c,f,g;g=b.__materials;b=0;for(c=g.length;b<c;b++)if(f=g[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function F(b){var e,f,g,j;if(b instanceof THREE.Mesh){f=b.geometry;
+for(e in f.geometryGroups)if(g=f.geometryGroups[e],j=C(g),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||j){j=g;var h=b,m=k.DYNAMIC_DRAW;if(j.__inittedArrays){var o=void 0,p=void 0,t=void 0,n=void 0,u=t=void 0,v=void 0,x=void 0,w=void 0,y=void 0,z=void 0,E=void 0,F=void 0,I=void 0,B=void 0,U=void 0,H=void 0,ha=void 0,D=n=w=n=x=v=void 0,G=void 0,A=G=D=v=void 0,L=void 0,P=A=G=D=t=t=u=w=n=A=G=D=L=A=G=D=L=A=G=D=void 0,J=
+0,ga=0,Q=0,X=0,O=0,R=0,M=0,S=0,na=0,N=0,V=0,G=D=0,T=j.__vertexArray,aa=j.__uvArray,ca=j.__uv2Array,Z=j.__normalArray,W=j.__tangentArray,Y=j.__colorArray,da=j.__skinVertexAArray,ea=j.__skinVertexBArray,$=j.__skinIndexArray,fa=j.__skinWeightArray,za=j.__morphTargetsArrays,la=j.__webglCustomAttributes,A=void 0,ia=j.__faceArray,ja=j.__lineArray,oa=j.__needsSmoothNormals,z=j.__vertexColorType,y=j.__uvType,E=j.__normalType,ka=h.geometry,qa=ka.__dirtyVertices,ra=ka.__dirtyElements,wa=ka.__dirtyUvs,sa=ka.__dirtyNormals,
+ta=ka.__dirtyTangents,va=ka.__dirtyColors,Aa=ka.__dirtyMorphTargets,ua=ka.vertices,Ba=j.faces,Da=ka.faces,Ia=ka.faceVertexUvs[0],Ea=ka.faceVertexUvs[1],xa=ka.skinVerticesA,ya=ka.skinVerticesB,Oa=ka.skinIndices,Ha=ka.skinWeights,Ma=h instanceof THREE.ShadowVolume?ka.edgeFaces:void 0,Fa=ka.morphTargets;if(la)for(P in la)la[P].offset=0,la[P].offsetSrc=0;o=0;for(p=Ba.length;o<p;o++)if(t=Ba[o],n=Da[t],Ia&&(F=Ia[t]),Ea&&(I=Ea[t]),t=n.vertexNormals,u=n.normal,v=n.vertexColors,x=n.color,w=n.vertexTangents,
+n instanceof THREE.Face3){if(qa)B=ua[n.a].position,U=ua[n.b].position,H=ua[n.c].position,T[ga]=B.x,T[ga+1]=B.y,T[ga+2]=B.z,T[ga+3]=U.x,T[ga+4]=U.y,T[ga+5]=U.z,T[ga+6]=H.x,T[ga+7]=H.y,T[ga+8]=H.z,ga+=9;if(la)for(P in la)if(A=la[P],A.__original.needsUpdate)D=A.offset,G=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[D+0]=A.value[n.a],A.array[D+1]=A.value[n.b],A.array[D+2]=A.value[n.c]):A.boundTo==="faces"?(A.array[D+0]=A.value[G],A.array[D+1]=A.value[G],A.array[D+2]=A.value[G],
+A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[D+0]=A.value[G+0],A.array[D+1]=A.value[G+1],A.array[D+2]=A.value[G+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(B=A.value[n.a],U=A.value[n.b],H=A.value[n.c]):A.boundTo==="faces"?(B=A.value[G],U=A.value[G],H=A.value[G],A.offsetSrc++):A.boundTo==="faceVertices"&&(B=A.value[G+0],U=A.value[G+1],H=A.value[G+2],A.offsetSrc+=3),A.size===2?(A.array[D+0]=B.x,A.array[D+1]=B.y,A.array[D+2]=U.x,A.array[D+3]=U.y,A.array[D+4]=H.x,
+A.array[D+5]=H.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[D+0]=B.r,A.array[D+1]=B.g,A.array[D+2]=B.b,A.array[D+3]=U.r,A.array[D+4]=U.g,A.array[D+5]=U.b,A.array[D+6]=H.r,A.array[D+7]=H.g,A.array[D+8]=H.b):(A.array[D+0]=B.x,A.array[D+1]=B.y,A.array[D+2]=B.z,A.array[D+3]=U.x,A.array[D+4]=U.y,A.array[D+5]=U.z,A.array[D+6]=H.x,A.array[D+7]=H.y,A.array[D+8]=H.z),A.offset+=9):(A.array[D+0]=B.x,A.array[D+1]=B.y,A.array[D+2]=B.z,A.array[D+3]=B.w,A.array[D+4]=U.x,A.array[D+5]=U.y,A.array[D+6]=U.z,A.array[D+
+7]=U.w,A.array[D+8]=H.x,A.array[D+9]=H.y,A.array[D+10]=H.z,A.array[D+11]=H.w,A.offset+=12));if(Aa){D=0;for(G=Fa.length;D<G;D++)B=Fa[D].vertices[n.a].position,U=Fa[D].vertices[n.b].position,H=Fa[D].vertices[n.c].position,A=za[D],A[V+0]=B.x,A[V+1]=B.y,A[V+2]=B.z,A[V+3]=U.x,A[V+4]=U.y,A[V+5]=U.z,A[V+6]=H.x,A[V+7]=H.y,A[V+8]=H.z;V+=9}if(Ha.length)D=Ha[n.a],G=Ha[n.b],A=Ha[n.c],fa[N]=D.x,fa[N+1]=D.y,fa[N+2]=D.z,fa[N+3]=D.w,fa[N+4]=G.x,fa[N+5]=G.y,fa[N+6]=G.z,fa[N+7]=G.w,fa[N+8]=A.x,fa[N+9]=A.y,fa[N+10]=
+A.z,fa[N+11]=A.w,D=Oa[n.a],G=Oa[n.b],A=Oa[n.c],$[N]=D.x,$[N+1]=D.y,$[N+2]=D.z,$[N+3]=D.w,$[N+4]=G.x,$[N+5]=G.y,$[N+6]=G.z,$[N+7]=G.w,$[N+8]=A.x,$[N+9]=A.y,$[N+10]=A.z,$[N+11]=A.w,D=xa[n.a],G=xa[n.b],A=xa[n.c],da[N]=D.x,da[N+1]=D.y,da[N+2]=D.z,da[N+3]=1,da[N+4]=G.x,da[N+5]=G.y,da[N+6]=G.z,da[N+7]=1,da[N+8]=A.x,da[N+9]=A.y,da[N+10]=A.z,da[N+11]=1,D=ya[n.a],G=ya[n.b],A=ya[n.c],ea[N]=D.x,ea[N+1]=D.y,ea[N+2]=D.z,ea[N+3]=1,ea[N+4]=G.x,ea[N+5]=G.y,ea[N+6]=G.z,ea[N+7]=1,ea[N+8]=A.x,ea[N+9]=A.y,ea[N+10]=A.z,
+ea[N+11]=1,N+=12;if(va&&z)v.length==3&&z==THREE.VertexColors?(n=v[0],D=v[1],G=v[2]):G=D=n=x,Y[na]=n.r,Y[na+1]=n.g,Y[na+2]=n.b,Y[na+3]=D.r,Y[na+4]=D.g,Y[na+5]=D.b,Y[na+6]=G.r,Y[na+7]=G.g,Y[na+8]=G.b,na+=9;if(ta&&ka.hasTangents)v=w[0],x=w[1],n=w[2],W[M]=v.x,W[M+1]=v.y,W[M+2]=v.z,W[M+3]=v.w,W[M+4]=x.x,W[M+5]=x.y,W[M+6]=x.z,W[M+7]=x.w,W[M+8]=n.x,W[M+9]=n.y,W[M+10]=n.z,W[M+11]=n.w,M+=12;if(sa&&E)if(t.length==3&&oa)for(w=0;w<3;w++)u=t[w],Z[R]=u.x,Z[R+1]=u.y,Z[R+2]=u.z,R+=3;else for(w=0;w<3;w++)Z[R]=u.x,
+Z[R+1]=u.y,Z[R+2]=u.z,R+=3;if(wa&&F!==void 0&&y)for(w=0;w<3;w++)t=F[w],aa[Q]=t.u,aa[Q+1]=t.v,Q+=2;if(wa&&I!==void 0&&y)for(w=0;w<3;w++)t=I[w],ca[X]=t.u,ca[X+1]=t.v,X+=2;ra&&(ia[O]=J,ia[O+1]=J+1,ia[O+2]=J+2,O+=3,ja[S]=J,ja[S+1]=J+1,ja[S+2]=J,ja[S+3]=J+2,ja[S+4]=J+1,ja[S+5]=J+2,S+=6,J+=3)}else if(n instanceof THREE.Face4){if(qa)B=ua[n.a].position,U=ua[n.b].position,H=ua[n.c].position,ha=ua[n.d].position,T[ga]=B.x,T[ga+1]=B.y,T[ga+2]=B.z,T[ga+3]=U.x,T[ga+4]=U.y,T[ga+5]=U.z,T[ga+6]=H.x,T[ga+7]=H.y,T[ga+
+8]=H.z,T[ga+9]=ha.x,T[ga+10]=ha.y,T[ga+11]=ha.z,ga+=12;if(la)for(P in la)if(A=la[P],A.__original.needsUpdate)D=A.offset,G=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[D+0]=A.value[n.a],A.array[D+1]=A.value[n.b],A.array[D+2]=A.value[n.c],A.array[D+3]=A.value[n.d]):A.boundTo==="faces"?(A.array[D+0]=A.value[G],A.array[D+1]=A.value[G],A.array[D+2]=A.value[G],A.array[D+3]=A.value[G],A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[D+0]=A.value[G+0],A.array[D+1]=A.value[G+
+1],A.array[D+2]=A.value[G+2],A.array[D+3]=A.value[G+3],A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo==="vertices"?(B=A.value[n.a],U=A.value[n.b],H=A.value[n.c],ha=A.value[n.d]):A.boundTo==="faces"?(B=A.value[G],U=A.value[G],H=A.value[G],ha=A.value[G],A.offsetSrc++):A.boundTo==="faceVertices"&&(B=A.value[G+0],U=A.value[G+1],H=A.value[G+2],ha=A.value[G+3],A.offsetSrc+=4),A.size===2?(A.array[D+0]=B.x,A.array[D+1]=B.y,A.array[D+2]=U.x,A.array[D+3]=U.y,A.array[D+4]=H.x,A.array[D+5]=H.y,A.array[D+
+6]=ha.x,A.array[D+7]=ha.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[D+0]=B.r,A.array[D+1]=B.g,A.array[D+2]=B.b,A.array[D+3]=U.r,A.array[D+4]=U.g,A.array[D+5]=U.b,A.array[D+6]=H.r,A.array[D+7]=H.g,A.array[D+8]=H.b,A.array[D+9]=ha.r,A.array[D+10]=ha.g,A.array[D+11]=ha.b):(A.array[D+0]=B.x,A.array[D+1]=B.y,A.array[D+2]=B.z,A.array[D+3]=U.x,A.array[D+4]=U.y,A.array[D+5]=U.z,A.array[D+6]=H.x,A.array[D+7]=H.y,A.array[D+8]=H.z,A.array[D+9]=ha.x,A.array[D+10]=ha.y,A.array[D+11]=ha.z),A.offset+=12):(A.array[D+
+0]=B.x,A.array[D+1]=B.y,A.array[D+2]=B.z,A.array[D+3]=B.w,A.array[D+4]=U.x,A.array[D+5]=U.y,A.array[D+6]=U.z,A.array[D+7]=U.w,A.array[D+8]=H.x,A.array[D+9]=H.y,A.array[D+10]=H.z,A.array[D+11]=H.w,A.array[D+12]=ha.x,A.array[D+13]=ha.y,A.array[D+14]=ha.z,A.array[D+15]=ha.w,A.offset+=16));if(Aa){D=0;for(G=Fa.length;D<G;D++)B=Fa[D].vertices[n.a].position,U=Fa[D].vertices[n.b].position,H=Fa[D].vertices[n.c].position,ha=Fa[D].vertices[n.d].position,A=za[D],A[V+0]=B.x,A[V+1]=B.y,A[V+2]=B.z,A[V+3]=U.x,A[V+
+4]=U.y,A[V+5]=U.z,A[V+6]=H.x,A[V+7]=H.y,A[V+8]=H.z,A[V+9]=ha.x,A[V+10]=ha.y,A[V+11]=ha.z;V+=12}if(Ha.length)D=Ha[n.a],G=Ha[n.b],A=Ha[n.c],L=Ha[n.d],fa[N]=D.x,fa[N+1]=D.y,fa[N+2]=D.z,fa[N+3]=D.w,fa[N+4]=G.x,fa[N+5]=G.y,fa[N+6]=G.z,fa[N+7]=G.w,fa[N+8]=A.x,fa[N+9]=A.y,fa[N+10]=A.z,fa[N+11]=A.w,fa[N+12]=L.x,fa[N+13]=L.y,fa[N+14]=L.z,fa[N+15]=L.w,D=Oa[n.a],G=Oa[n.b],A=Oa[n.c],L=Oa[n.d],$[N]=D.x,$[N+1]=D.y,$[N+2]=D.z,$[N+3]=D.w,$[N+4]=G.x,$[N+5]=G.y,$[N+6]=G.z,$[N+7]=G.w,$[N+8]=A.x,$[N+9]=A.y,$[N+10]=A.z,
+$[N+11]=A.w,$[N+12]=L.x,$[N+13]=L.y,$[N+14]=L.z,$[N+15]=L.w,D=xa[n.a],G=xa[n.b],A=xa[n.c],L=xa[n.d],da[N]=D.x,da[N+1]=D.y,da[N+2]=D.z,da[N+3]=1,da[N+4]=G.x,da[N+5]=G.y,da[N+6]=G.z,da[N+7]=1,da[N+8]=A.x,da[N+9]=A.y,da[N+10]=A.z,da[N+11]=1,da[N+12]=L.x,da[N+13]=L.y,da[N+14]=L.z,da[N+15]=1,D=ya[n.a],G=ya[n.b],A=ya[n.c],n=ya[n.d],ea[N]=D.x,ea[N+1]=D.y,ea[N+2]=D.z,ea[N+3]=1,ea[N+4]=G.x,ea[N+5]=G.y,ea[N+6]=G.z,ea[N+7]=1,ea[N+8]=A.x,ea[N+9]=A.y,ea[N+10]=A.z,ea[N+11]=1,ea[N+12]=n.x,ea[N+13]=n.y,ea[N+14]=
+n.z,ea[N+15]=1,N+=16;if(va&&z)v.length==4&&z==THREE.VertexColors?(n=v[0],D=v[1],G=v[2],v=v[3]):v=G=D=n=x,Y[na]=n.r,Y[na+1]=n.g,Y[na+2]=n.b,Y[na+3]=D.r,Y[na+4]=D.g,Y[na+5]=D.b,Y[na+6]=G.r,Y[na+7]=G.g,Y[na+8]=G.b,Y[na+9]=v.r,Y[na+10]=v.g,Y[na+11]=v.b,na+=12;if(ta&&ka.hasTangents)v=w[0],x=w[1],n=w[2],w=w[3],W[M]=v.x,W[M+1]=v.y,W[M+2]=v.z,W[M+3]=v.w,W[M+4]=x.x,W[M+5]=x.y,W[M+6]=x.z,W[M+7]=x.w,W[M+8]=n.x,W[M+9]=n.y,W[M+10]=n.z,W[M+11]=n.w,W[M+12]=w.x,W[M+13]=w.y,W[M+14]=w.z,W[M+15]=w.w,M+=16;if(sa&&E)if(t.length==
+4&&oa)for(w=0;w<4;w++)u=t[w],Z[R]=u.x,Z[R+1]=u.y,Z[R+2]=u.z,R+=3;else for(w=0;w<4;w++)Z[R]=u.x,Z[R+1]=u.y,Z[R+2]=u.z,R+=3;if(wa&&F!==void 0&&y)for(w=0;w<4;w++)t=F[w],aa[Q]=t.u,aa[Q+1]=t.v,Q+=2;if(wa&&I!==void 0&&y)for(w=0;w<4;w++)t=I[w],ca[X]=t.u,ca[X+1]=t.v,X+=2;ra&&(ia[O]=J,ia[O+1]=J+1,ia[O+2]=J+3,ia[O+3]=J+1,ia[O+4]=J+2,ia[O+5]=J+3,O+=6,ja[S]=J,ja[S+1]=J+1,ja[S+2]=J,ja[S+3]=J+3,ja[S+4]=J+1,ja[S+5]=J+2,ja[S+6]=J+2,ja[S+7]=J+3,S+=8,J+=4)}if(Ma){o=0;for(p=Ma.length;o<p;o++)ia[O]=Ma[o].a,ia[O+1]=Ma[o].b,
+ia[O+2]=Ma[o].c,ia[O+3]=Ma[o].a,ia[O+4]=Ma[o].c,ia[O+5]=Ma[o].d,O+=6}qa&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,T,m));if(la)for(P in la)A=la[P],A.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,m));if(Aa){D=0;for(G=Fa.length;D<G;D++)k.bindBuffer(k.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[D]),k.bufferData(k.ARRAY_BUFFER,za[D],m)}va&&na>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,
+Y,m));sa&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,Z,m));ta&&ka.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,W,m));wa&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m));wa&&X>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ca,m));ra&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ia,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,
+j.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ja,m));N>0&&(k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,da,m),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,$,m),k.bindBuffer(k.ARRAY_BUFFER,j.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));h.dynamic||(delete j.__inittedArrays,delete j.__colorArray,delete j.__normalArray,
+delete j.__tangentArray,delete j.__uvArray,delete j.__uv2Array,delete j.__faceArray,delete j.__vertexArray,delete j.__lineArray,delete j.__skinVertexAArray,delete j.__skinVertexBArray,delete j.__skinIndexArray,delete j.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;K(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;
+j=b.colors;z=y.length;h=j.length;E=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(o=0;o<z;o++)p=y[o].position,g=o*3,E[g]=p.x,E[g+1]=p.y,E[g+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,E,e)}if(F){for(o=0;o<h;o++)color=j[o],g=o*3,m[g]=color.r,m[g+1]=color.g,m[g+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;y=b.vertices;j=b.colors;z=y.length;h=j.length;E=b.__vertexArray;m=b.__colorArray;F=b.__dirtyColors;if(b.__dirtyVertices){for(o=0;o<z;o++)p=y[o].position,g=o*3,E[g]=p.x,E[g+1]=p.y,E[g+2]=p.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,E,e)}if(F){for(o=0;o<h;o++)color=j[o],g=o*3,m[g]=color.r,m[g+1]=color.g,m[g+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,j=C(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||j)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,K(f)}function B(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,o,n={},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),n[m]==void 0&&(n[m]={hash:m,counter:0}),o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:p}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+h>65535&&(n[m].counter+=1,o=n[m].hash+"_"+n[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(g),
+b.geometryGroups[o].vertices+=h}function E(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(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 P(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,Q(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function V(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),P(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 G(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=U,b=ha);e!=W&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ja,oa,c,b),W=e)}function aa(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 Q(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 T=this,k,L=[],ca=null,W=null,X=!0,$=null,da=null,ea=null,fa=null,J=null,ia=null,la=null,ja=0,oa=0,U=0,ha=0,ga=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],na=new THREE.Matrix4,za=new Float32Array(16),wa=new Float32Array(16),Aa=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+Pa=b.stencil!==void 0?b.stencil:!0,Z=b.antialias!==void 0?b.antialias:!1,ka=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),qa=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;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 sa,ta=[],b=THREE.ShaderLib.depthRGBA,va=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:va}),xa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:va,morphTargets:!0});Da._shadowPass=!0;xa._shadowPass=!0;try{if(!(k=Ba.getContext("experimental-webgl",{antialias:Z,stencil:Pa})))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(ra){console.error(ra)}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(ka.r,ka.g,ka.b,qa);this.context=k;var Ea=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+0;if(Pa){var Y={};Y.vertices=new Float32Array(12);Y.faces=new Uint16Array(6);Y.darkness=0.5;Y.vertices[0]=-20;Y.vertices[1]=-20;Y.vertices[2]=-1;Y.vertices[3]=20;Y.vertices[4]=-20;Y.vertices[5]=-1;Y.vertices[6]=20;Y.vertices[7]=20;Y.vertices[8]=-1;Y.vertices[9]=-20;Y.vertices[10]=20;Y.vertices[11]=-1;Y.faces[0]=0;Y.faces[1]=1;Y.faces[2]=2;Y.faces[3]=0;Y.faces[4]=2;Y.faces[5]=3;Y.vertexBuffer=k.createBuffer();Y.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,Y.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
+Y.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Y.faces,k.STATIC_DRAW);Y.program=k.createProgram();k.attachShader(Y.program,aa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(Y.program,aa("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(Y.program);Y.vertexLocation=k.getAttribLocation(Y.program,"position");Y.projectionLocation=k.getUniformLocation(Y.program,"projectionMatrix");Y.darknessLocation=
+k.getUniformLocation(Y.program,"darkness")}var R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);Z=0;R.vertices[Z++]=-1;R.vertices[Z++]=-1;R.vertices[Z++]=0;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;Z=0;R.faces[Z++]=0;R.faces[Z++]=1;R.faces[Z++]=2;R.faces[Z++]=0;R.faces[Z++]=2;R.faces[Z++]=3;
+R.vertexBuffer=k.createBuffer();R.elementBuffer=k.createBuffer();R.tempTexture=k.createTexture();R.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,R.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,R.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,R.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,R.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,R.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,R.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?(R.hasVertexTexture=!1,R.program=k.createProgram(),k.attachShader(R.program,aa("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(R.program,aa("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(R.hasVertexTexture=!0,R.program=k.createProgram(),k.attachShader(R.program,aa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(R.program,aa("vertex",
+THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.vertex=k.getAttribLocation(R.program,"position");R.attributes.uv=k.getAttribLocation(R.program,"UV");R.uniforms.renderType=k.getUniformLocation(R.program,"renderType");R.uniforms.map=k.getUniformLocation(R.program,"map");R.uniforms.occlusionMap=k.getUniformLocation(R.program,"occlusionMap");R.uniforms.opacity=k.getUniformLocation(R.program,"opacity");R.uniforms.scale=k.getUniformLocation(R.program,
+"scale");R.uniforms.rotation=k.getUniformLocation(R.program,"rotation");R.uniforms.screenPosition=k.getUniformLocation(R.program,"screenPosition");var ua=!1,M={};M.vertices=new Float32Array(16);M.faces=new Uint16Array(6);Z=0;M.vertices[Z++]=-1;M.vertices[Z++]=-1;M.vertices[Z++]=0;M.vertices[Z++]=1;M.vertices[Z++]=1;M.vertices[Z++]=-1;M.vertices[Z++]=1;M.vertices[Z++]=1;M.vertices[Z++]=1;M.vertices[Z++]=1;M.vertices[Z++]=1;M.vertices[Z++]=0;M.vertices[Z++]=-1;M.vertices[Z++]=1;M.vertices[Z++]=0;Z=
+M.vertices[Z++]=0;M.faces[Z++]=0;M.faces[Z++]=1;M.faces[Z++]=2;M.faces[Z++]=0;M.faces[Z++]=2;M.faces[Z++]=3;M.vertexBuffer=k.createBuffer();M.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,M.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,M.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,M.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,M.faces,k.STATIC_DRAW);M.program=k.createProgram();k.attachShader(M.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(M.program,
+aa("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(M.program);M.attributes={};M.uniforms={};M.attributes.position=k.getAttribLocation(M.program,"position");M.attributes.uv=k.getAttribLocation(M.program,"uv");M.uniforms.uvOffset=k.getUniformLocation(M.program,"uvOffset");M.uniforms.uvScale=k.getUniformLocation(M.program,"uvScale");M.uniforms.rotation=k.getUniformLocation(M.program,"rotation");M.uniforms.scale=k.getUniformLocation(M.program,"scale");M.uniforms.alignment=k.getUniformLocation(M.program,
+"alignment");M.uniforms.map=k.getUniformLocation(M.program,"map");M.uniforms.opacity=k.getUniformLocation(M.program,"opacity");M.uniforms.useScreenCoordinates=k.getUniformLocation(M.program,"useScreenCoordinates");M.uniforms.affectedByDistance=k.getUniformLocation(M.program,"affectedByDistance");M.uniforms.screenPosition=k.getUniformLocation(M.program,"screenPosition");M.uniforms.modelViewMatrix=k.getUniformLocation(M.program,"modelViewMatrix");M.uniforms.projectionMatrix=k.getUniformLocation(M.program,
+"projectionMatrix");var ya=!1;this.setSize=function(b,e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ja=b;oa=e;U=c;ha=f;k.viewport(ja,oa,U,ha)};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){X=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ka.setHex(b);qa=e;k.clearColor(ka.r,ka.g,ka.b,qa)};this.setClearColor=
+function(b,e){ka.copy(b);qa=e;k.clearColor(ka.r,ka.g,ka.b,qa)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){Y.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 o,n,p;o=p=m=0;for(n=e.length;o<n;o++)j=e[o],j instanceof THREE.SpotLight&&p++,j instanceof THREE.DirectionalLight&&p++,j instanceof THREE.PointLight&&
+m++;m+p<=4?o=p:(o=Math.ceil(4*p/(m+p)),m=4-o);j={directional:o,point:m};m=p=0;for(o=e.length;m<o;m++)n=e[m],n instanceof THREE.SpotLight&&n.castShadow&&p++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{o=b.fragmentShader;n=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:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p},v,f=[];h?f.push(h):(f.push(o),f.push(n));for(v in c)f.push(v),f.push(c[v]);h=f.join();v=0;for(f=L.length;v<f;v++)if(L[v].code==h){u=L[v].program;break a}v=k.createProgram();f=[Ea?"#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");
-g=["#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.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");j.attachShader(v,$("fragment",g+p));j.attachShader(v,$("vertex",f+n));j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,j.VALIDATE_STATUS)+", gl error ["+j.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++)p=w[f],v.uniforms[p]=j.getUniformLocation(v,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)f.push("morphTarget"+w);for(u in e)f.push(u);u=f;w=0;for(e=u.length;w<e;w++)c=u[w],v.attributes[c]=j.getAttribLocation(v,c);L.push({program:v,
-code:k});u=v}b.program=u;u=b.program.attributes;u.position>=0&&j.enableVertexAttribArray(u.position);u.color>=0&&j.enableVertexAttribArray(u.color);u.normal>=0&&j.enableVertexAttribArray(u.normal);u.tangent>=0&&j.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(j.enableVertexAttribArray(u.skinVertexA),j.enableVertexAttribArray(u.skinVertexB),j.enableVertexAttribArray(u.skinIndex),j.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(h in b.attributes)u[h]!==
-void 0&&u[h]>=0&&j.enableVertexAttribArray(u[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,u.morphTarget0>=0&&(j.enableVertexAttribArray(u.morphTarget0),b.numSupportedMorphTargets++),u.morphTarget1>=0&&(j.enableVertexAttribArray(u.morphTarget1),b.numSupportedMorphTargets++),u.morphTarget2>=0&&(j.enableVertexAttribArray(u.morphTarget2),b.numSupportedMorphTargets++),u.morphTarget3>=0&&(j.enableVertexAttribArray(u.morphTarget3),b.numSupportedMorphTargets++),u.morphTarget4>=0&&(j.enableVertexAttribArray(u.morphTarget4),
-b.numSupportedMorphTargets++),u.morphTarget5>=0&&(j.enableVertexAttribArray(u.morphTarget5),b.numSupportedMorphTargets++),u.morphTarget6>=0&&(j.enableVertexAttribArray(u.morphTarget6),b.numSupportedMorphTargets++),u.morphTarget7>=0&&(j.enableVertexAttribArray(u.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,n,C){var A,U,G,F,W,J,I,L,M=b.lights,N=b.fog;this.shadowMapEnabled&&x(b,c);T.data.vertices=0;T.data.faces=0;T.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
-!1,c);c.matrixWorldInverse.flattenToArray(xa);c.projectionMatrix.flattenToArray(na);ka.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ka);this.initWebGLObjects(b);E(n);(this.autoClear||C)&&this.clear();W=b.__webglObjects.length;for(C=0;C<W;C++)if(A=b.__webglObjects[C],I=A.object,I.visible)if(!(I instanceof THREE.Mesh)||t(I)){if(I.matrixWorld.flattenToArray(I._objectMatrixArray),H(I,c,!0),u(A),A.render=!0,this.sortObjects)A.object.renderDepth?A.z=A.object.renderDepth:(Aa.copy(I.position),ka.multiplyVector3(Aa),
-A.z=Aa.z)}else A.render=!1;else A.render=!1;this.sortObjects&&b.__webglObjects.sort(v);J=b.__webglObjectsImmediate.length;for(C=0;C<J;C++)A=b.__webglObjectsImmediate[C],I=A.object,I.visible&&(I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray),H(I,c,!0),p(A));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(C=0;C<W;C++)if(A=b.__webglObjects[C],A.render)I=A.object,L=A.buffer,k(I),f(c,M,N,b.overrideMaterial,L,I);for(C=0;C<J;C++)A=b.__webglObjectsImmediate[C],
-I=A.object,I.visible&&(k(I),U=e(c,M,N,b.overrideMaterial,I),I.render(function(e){g(e,U,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(C=0;C<W;C++)if(A=b.__webglObjects[C],A.render){I=A.object;L=A.buffer;G=A.opaque;k(I);for(A=0;A<G.count;A++)F=G.list[A],h(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,M,N,F,L,I)}for(C=0;C<J;C++)if(A=b.__webglObjectsImmediate[C],I=A.object,I.visible){G=A.opaque;k(I);for(A=0;A<G.count;A++)F=G.list[A],h(F.depthTest),m(F.polygonOffset,
-F.polygonOffsetFactor,F.polygonOffsetUnits),U=e(c,M,N,F,I),I.render(function(b){g(b,U,F.shading)})}for(C=0;C<W;C++)if(A=b.__webglObjects[C],A.render){I=A.object;L=A.buffer;G=A.transparent;k(I);for(A=0;A<G.count;A++)F=G.list[A],K(F.blending),h(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,M,N,F,L,I)}for(C=0;C<J;C++)if(A=b.__webglObjectsImmediate[C],I=A.object,I.visible){G=A.transparent;k(I);for(A=0;A<G.count;A++)F=G.list[A],K(F.blending),h(F.depthTest),m(F.polygonOffset,
-F.polygonOffsetFactor,F.polygonOffsetUnits),U=e(c,M,N,F,I),I.render(function(b){g(b,U,F.shading)})}}b.__webglSprites.length&&y(b,c);Pa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&w(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(j.bindTexture(j.TEXTURE_2D,n.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.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&&P(h),h.geometryGroups){g=
-h.geometryGroups[f];if(!g.__webglVertexBuffer){var k=g;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=
-j.createBuffer();if(k.numMorphTargets){var m=void 0,p=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(p=k.numMorphTargets;m<p;m++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}for(var k=g,m=e,n=void 0,o=void 0,t=void 0,u=t=void 0,v=void 0,w=void 0,x=w=p=0,y=t=o=void 0,z=y=o=n=void 0,t=void 0,u=m.geometry,v=u.faces,y=k.faces,n=0,o=y.length;n<o;n++)t=y[n],t=v[t],t instanceof THREE.Face3?(p+=3,w+=1,x+=3):t instanceof THREE.Face4&&(p+=4,w+=2,x+=4);for(var n=k,o=m,A=y=v=void 0,U=void 0,A=void 0,t=
-[],v=0,y=o.materials.length;v<y;v++)if(A=o.materials[v],A instanceof THREE.MeshFaceMaterial){A=0;for(l=n.materials.length;A<l;A++)(U=n.materials[A])&&t.push(U)}else(U=A)&&t.push(U);n=t;k.__materials=n;a:{v=o=void 0;y=n.length;for(o=0;o<y;o++)if(v=n[o],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){o=!0;break a}o=!1}a:{y=v=void 0;t=n.length;for(v=0;v<t;v++)if(y=n[v],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==
-THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{t=v=void 0;A=n.length;for(v=0;v<A;v++)if(t=n[v],t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(p*3);if(y)k.__normalArray=new Float32Array(p*3);if(u.hasTangents)k.__tangentArray=new Float32Array(p*4);if(t)k.__colorArray=new Float32Array(p*3);if(o){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(p*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(p*
-2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(p*4),k.__skinVertexBArray=new Float32Array(p*4),k.__skinIndexArray=new Float32Array(p*4),k.__skinWeightArray=new Float32Array(p*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(x*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;u++)k.__morphTargetsArrays.push(new Float32Array(p*3))}k.__needsSmoothNormals=
-y==THREE.SmoothShading;k.__uvType=o;k.__vertexColorType=t;k.__normalType=y;k.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=x*2;u=0;for(v=n.length;u<v;u++)if(o=n[u],o.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in o.attributes){t=o.attributes[a];y={};for(z in t)y[z]=t[z];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type==="v4"?w=4:y.type==="c"&&
-(w=3),y.size=w,y.array=new Float32Array(p*w),y.buffer=j.createBuffer(),y.buffer.belongsToAttribute=a,t.needsUpdate=!0,y.__original=t;k.__webglCustomAttributes[a]=y}}k.__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?F(c.__webglShadowVolumes,g,e):F(c.__webglObjects,g,e)}else if(e instanceof THREE.LensFlare)F(c.__webglLensFlares,void 0,e);else if(e instanceof
-THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.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;F(c.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)f=h,f.__webglVertexBuffer=j.createBuffer(),f.__webglColorBuffer=j.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;F(c.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){f=h;f.__webglVertexBuffer=j.createBuffer();f.__webglColorBuffer=j.createBuffer();f=h;g=e;k=f.vertices.length;f.__vertexArray=new Float32Array(k*3);f.__colorArray=new Float32Array(k*3);f.__sortArray=[];f.__webglParticleCount=k;f.__materials=g.materials;z=p=m=void 0;m=0;for(p=
-g.materials.length;m<p;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(k*size),attribute.buffer=j.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}F(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)C(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)C(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?C(e.__webglLensFlares,c):c instanceof
-THREE.MarchingCubes&&C(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)G(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)G(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)G(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),b=="back"?j.cullFace(j.BACK):b=="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):
-j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return Ea}};
+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.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,aa("fragment",j+o));k.attachShader(v,aa("vertex",f+n));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++)o=w[f],v.uniforms[o]=k.getUniformLocation(v,o);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)f.push("morphTarget"+w);for(u in e)f.push(u);u=f;w=0;for(e=u.length;w<e;w++)c=u[w],v.attributes[c]=k.getAttribLocation(v,c);L.push({program:v,
+code:h});u=v}b.program=u;u=b.program.attributes;u.position>=0&&k.enableVertexAttribArray(u.position);u.color>=0&&k.enableVertexAttribArray(u.color);u.normal>=0&&k.enableVertexAttribArray(u.normal);u.tangent>=0&&k.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(k.enableVertexAttribArray(u.skinVertexA),k.enableVertexAttribArray(u.skinVertexB),k.enableVertexAttribArray(u.skinIndex),k.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(g in b.attributes)u[g]!==
+void 0&&u[g]>=0&&k.enableVertexAttribArray(u[g]);if(b.morphTargets)b.numSupportedMorphTargets=0,u.morphTarget0>=0&&(k.enableVertexAttribArray(u.morphTarget0),b.numSupportedMorphTargets++),u.morphTarget1>=0&&(k.enableVertexAttribArray(u.morphTarget1),b.numSupportedMorphTargets++),u.morphTarget2>=0&&(k.enableVertexAttribArray(u.morphTarget2),b.numSupportedMorphTargets++),u.morphTarget3>=0&&(k.enableVertexAttribArray(u.morphTarget3),b.numSupportedMorphTargets++),u.morphTarget4>=0&&(k.enableVertexAttribArray(u.morphTarget4),
+b.numSupportedMorphTargets++),u.morphTarget5>=0&&(k.enableVertexAttribArray(u.morphTarget5),b.numSupportedMorphTargets++),u.morphTarget6>=0&&(k.enableVertexAttribArray(u.morphTarget6),b.numSupportedMorphTargets++),u.morphTarget7>=0&&(k.enableVertexAttribArray(u.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,n,C){var B,U,E,F,K,ha,J,L,ga=b.lights,M=b.fog;this.shadowMapEnabled&&x(b,c);T.data.vertices=0;T.data.faces=0;T.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
+!1,c);c.matrixWorldInverse.flattenToArray(wa);c.projectionMatrix.flattenToArray(za);na.multiply(c.projectionMatrix,c.matrixWorldInverse);p(na);this.initWebGLObjects(b);G(n);(this.autoClear||C)&&this.clear();K=b.__webglObjects.length;for(C=0;C<K;C++)if(B=b.__webglObjects[C],J=B.object,J.visible)if(!(J instanceof THREE.Mesh)||t(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),I(J,c,!0),v(B),B.render=!0,this.sortObjects)B.object.renderDepth?B.z=B.object.renderDepth:(Aa.copy(J.position),na.multiplyVector3(Aa),
+B.z=Aa.z)}else B.render=!1;else B.render=!1;this.sortObjects&&b.__webglObjects.sort(u);ha=b.__webglObjectsImmediate.length;for(C=0;C<ha;C++)B=b.__webglObjectsImmediate[C],J=B.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),I(J,c,!0),o(B));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);H(b.overrideMaterial.blending);for(C=0;C<K;C++)if(B=b.__webglObjects[C],B.render)J=B.object,L=B.buffer,g(J),f(c,ga,M,b.overrideMaterial,L,J);for(C=0;C<ha;C++)B=b.__webglObjectsImmediate[C],
+J=B.object,J.visible&&(g(J),U=e(c,ga,M,b.overrideMaterial,J),J.render(function(e){h(e,U,b.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(C=0;C<K;C++)if(B=b.__webglObjects[C],B.render){J=B.object;L=B.buffer;E=B.opaque;g(J);for(B=0;B<E.count;B++)F=E.list[B],j(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,ga,M,F,L,J)}for(C=0;C<ha;C++)if(B=b.__webglObjectsImmediate[C],J=B.object,J.visible){E=B.opaque;g(J);for(B=0;B<E.count;B++)F=E.list[B],j(F.depthTest),
+m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),U=e(c,ga,M,F,J),J.render(function(b){h(b,U,F.shading)})}for(C=0;C<K;C++)if(B=b.__webglObjects[C],B.render){J=B.object;L=B.buffer;E=B.transparent;g(J);for(B=0;B<E.count;B++)F=E.list[B],H(F.blending),j(F.depthTest),m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),f(c,ga,M,F,L,J)}for(C=0;C<ha;C++)if(B=b.__webglObjectsImmediate[C],J=B.object,J.visible){E=B.transparent;g(J);for(B=0;B<E.count;B++)F=E.list[B],H(F.blending),j(F.depthTest),
+m(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),U=e(c,ga,M,F,J),J.render(function(b){h(b,U,F.shading)})}}b.__webglSprites.length&&y(b,c);Pa&&b.__webglShadowVolumes.length&&b.lights.length&&z(b);b.__webglLensFlares.length&&w(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,n.__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,g=void 0,j=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 g=e.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,o=void 0;h.__webglMorphTargetsBuffers=[];m=0;for(o=h.numMorphTargets;m<o;m++)h.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var h=j,m=e,n=void 0,p=void 0,t=void 0,u=t=void 0,v=void 0,w=void 0,x=w=o=0,y=t=p=void 0,z=y=p=n=void 0,t=void 0,u=m.geometry,v=u.faces,y=h.faces,n=0,p=y.length;n<p;n++)t=y[n],t=v[t],t instanceof THREE.Face3?(o+=3,w+=1,x+=3):t instanceof THREE.Face4&&(o+=4,w+=2,x+=4);for(var n=h,
+p=m,C=y=v=void 0,U=void 0,C=void 0,t=[],v=0,y=p.materials.length;v<y;v++)if(C=p.materials[v],C instanceof THREE.MeshFaceMaterial){C=0;for(l=n.materials.length;C<l;C++)(U=n.materials[C])&&t.push(U)}else(U=C)&&t.push(U);n=t;h.__materials=n;a:{v=p=void 0;y=n.length;for(p=0;p<y;p++)if(v=n[p],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{y=v=void 0;t=n.length;for(v=0;v<t;v++)if(y=n[v],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=
+y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{t=v=void 0;C=n.length;for(v=0;v<C;v++)if(t=n[v],t.vertexColors){t=t.vertexColors;break a}t=!1}h.__vertexArray=new Float32Array(o*3);if(y)h.__normalArray=new Float32Array(o*3);if(u.hasTangents)h.__tangentArray=new Float32Array(o*4);if(t)h.__colorArray=new Float32Array(o*3);if(p){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)h.__uvArray=new Float32Array(o*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>
+1)h.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)h.__skinVertexAArray=new Float32Array(o*4),h.__skinVertexBArray=new Float32Array(o*4),h.__skinIndexArray=new Float32Array(o*4),h.__skinWeightArray=new Float32Array(o*4);h.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));h.__lineArray=new Uint16Array(x*2);if(h.numMorphTargets){h.__morphTargetsArrays=[];u=0;for(v=h.numMorphTargets;u<v;u++)h.__morphTargetsArrays.push(new Float32Array(o*
+3))}h.__needsSmoothNormals=y==THREE.SmoothShading;h.__uvType=p;h.__vertexColorType=t;h.__normalType=y;h.__webglFaceCount=w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);h.__webglLineCount=x*2;u=0;for(v=n.length;u<v;u++)if(p=n[u],p.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];y={};for(z in t)y[z]=t[z];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type===
+"v4"?w=4:y.type==="c"&&(w=3),y.size=w,y.array=new Float32Array(o*w),y.buffer=k.createBuffer(),y.buffer.belongsToAttribute=a,t.needsUpdate=!0,y.__original=t;h.__webglCustomAttributes[a]=y}}h.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?E(c.__webglShadowVolumes,j,e):E(c.__webglObjects,j,e)}else if(e instanceof THREE.LensFlare)E(c.__webglLensFlares,void 0,
+e);else if(e instanceof THREE.Ribbon){g=e.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;E(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.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;E(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;j=e;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=o=m=void 0;m=0;for(o=j.materials.length;m<o;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}E(c.__webglObjects,g,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)B(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)B(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?B(e.__webglLensFlares,
+c):c instanceof THREE.MarchingCubes&&B(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)F(b.__webglObjects[e].object,b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)F(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)F(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 Ea}};
 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 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,k=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==k)h=e=0;else{var m=k-h,h=m/k,e=e==k?(f-g)/m:f==k?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=k;return c},
+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,g=Math.max(Math.max(e,f),h),j=Math.min(Math.min(e,f),h);if(j==g)j=e=0;else{var m=g-j,j=m/g,e=e==g?(f-h)/m:f==g?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=j;c.v=g;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,g=e?c.geometry:c,k=b.vertices,h=g.vertices,m=b.faces,o=g.faces,t=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,p=h.length;n<p;n++){var u=new THREE.Vertex(h[n].position.clone());e&&c.matrix.multiplyVector3(u.position);k.push(u)}n=0;for(p=o.length;n<p;n++){var h=o[n],v,x,z=h.vertexNormals,u=h.vertexColors;h instanceof THREE.Face3?v=new THREE.Face3(h.a+f,h.b+f,h.c+
-f):h instanceof THREE.Face4&&(v=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));v.normal.copy(h.normal);e=0;for(k=z.length;e<k;e++)x=z[e],v.vertexNormals.push(x.clone());v.color.copy(h.color);e=0;for(k=u.length;e<k;e++)x=u[e],v.vertexColors.push(x.clone());v.materials=h.materials.slice();v.centroid.copy(h.centroid);m.push(v)}n=0;for(p=g.length;n<p;n++){f=g[n];m=[];e=0;for(k=f.length;e<k;e++)m.push(new THREE.UV(f[e].u,f[e].v));t.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,g=b.faces,
-k=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],o,t,n=m.vertexNormals,p=m.vertexColors;m instanceof THREE.Face3?o=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(o=new THREE.Face4(m.a,m.b,m.c,m.d));o.normal.copy(m.normal);f=0;for(h=n.length;f<h;f++)t=n[f],o.vertexNormals.push(t.clone());o.color.copy(m.color);f=0;for(h=p.length;f<h;f++)t=p[f],o.vertexColors.push(t.clone());o.materials=m.materials.slice();
-o.centroid.copy(m.centroid);c.faces.push(o)}b=0;for(e=k.length;b<e;b++){g=k[b];o=[];f=0;for(h=g.length;f<h;f++)o.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(o)}return c}};
-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=[],k=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)k.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return k}};
-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)}};
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,g=b.vertices,j=h.vertices,m=b.faces,p=h.faces,t=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,o=j.length;n<o;n++){var v=new THREE.Vertex(j[n].position.clone());e&&c.matrix.multiplyVector3(v.position);g.push(v)}n=0;for(o=p.length;n<o;n++){var j=p[n],u,x,z=j.vertexNormals,v=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+f,j.b+f,j.c+
+f):j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);e=0;for(g=z.length;e<g;e++)x=z[e],u.vertexNormals.push(x.clone());u.color.copy(j.color);e=0;for(g=v.length;e<g;e++)x=v[e],u.vertexColors.push(x.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);m.push(u)}n=0;for(o=h.length;n<o;n++){f=h[n];m=[];e=0;for(g=f.length;e<g;e++)m.push(new THREE.UV(f[e].u,f[e].v));t.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,
+g=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var j=new THREE.Vertex(f[b].position.clone());c.vertices.push(j)}b=0;for(e=h.length;b<e;b++){var m=h[b],p,t,n=m.vertexNormals,o=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(j=n.length;f<j;f++)t=n[f],p.vertexNormals.push(t.clone());p.color.copy(m.color);f=0;for(j=o.length;f<j;f++)t=o[f],p.vertexColors.push(t.clone());p.materials=m.materials.slice();
+p.centroid.copy(m.centroid);c.faces.push(p)}b=0;for(e=g.length;b<e;b++){h=g[b];p=[];f=0;for(j=h.length;f<j;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c}};
+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=[],g=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)g.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return g}};
+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)}};
 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;",
@@ -373,23 +372,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,g,k=2*Math.ceil(b*3)+1;k>25&&(k=25);g=(k-1)*0.5;e=Array(k);for(c=f=0;c<k;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<k;++c)e[c]/=f;return e}};
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,h,g=2*Math.ceil(b*3)+1;g>25&&(g=25);h=(g-1)*0.5;e=Array(g);for(c=f=0;c<g;++c)e[c]=Math.exp(-((c-h)*(c-h))/(2*b*b)),f+=e[c];for(c=0;c<g;++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 o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++){var t=b.hierarchy[e].keys[f].morphTargets[o];m[t]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var n=
-{};for(t in m){for(o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++)if(b.hierarchy[e].keys[f].morphTargets[o]===t){n[t]=b.hierarchy[e].keys[f].morphTargetsInfluences[o];break}o===b.hierarchy[e].keys[f].morphTargets.length&&(n[t]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=n}}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*
+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 t=b.hierarchy[e].keys[f].morphTargets[p];m[t]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var n=
+{};for(t in m){for(p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++)if(b.hierarchy[e].keys[f].morphTargets[p]===t){n[t]=b.hierarchy[e].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[e].keys[f].morphTargets.length&&(n[t]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=n}}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,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 k=g.animationCache.prevKey;g=g.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.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.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 g=h.animationCache.prevKey;h=h.animationCache.nextKey;g.pos=this.data.hierarchy[e].keys[0];g.rot=this.data.hierarchy[e].keys[0];g.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.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,g,k,h,m,o,t,n=this.data.JIT.hierarchy,p,u;this.currentTime+=b*this.timeScale;u=this.currentTime;p=this.currentTime%=this.data.length;t=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,x=this.hierarchy.length;v<x;v++)if(b=this.hierarchy[v],o=b.animationCache,this.JITCompile&&n[v][t]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[v][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=n[v][t],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=o.prevKey[e];m=o.nextKey[e];if(m.time<=u){if(p<u)if(this.loop){h=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<p;)h=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do h=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
-p)}o.prevKey[e]=h;o.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(p-h.time)/(m.time-h.time);g=h[e];k=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=g,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,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,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f}}if(this.JITCompile&&n[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)n[v][t]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,k,h,m,o,t;g=(b.length-1)*c;k=Math.floor(g);g-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];o=b[e[2]];t=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],o[0],t[0],g,e,h);f[1]=this.interpolate(k[1],m[1],o[1],t[1],g,e,h);f[2]=this.interpolate(k[2],m[2],o[2],t[2],g,e,h);return f};
-THREE.Animation.prototype.interpolate=function(b,c,e,f,g,k,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*k+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.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,g,j,m,p,t,n=this.data.JIT.hierarchy,o,v;this.currentTime+=b*this.timeScale;v=this.currentTime;o=this.currentTime%=this.data.length;t=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,x=this.hierarchy.length;u<x;u++)if(b=this.hierarchy[u],p=b.animationCache,this.JITCompile&&n[u][t]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[u][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=n[u][t],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];j=p.prevKey[e];m=p.nextKey[e];if(m.time<=v){if(o<v)if(this.loop){j=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<o;)j=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do j=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
+o)}p.prevKey[e]=j;p.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(o-j.time)/(m.time-j.time);h=j[e];g=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]+(g[0]-h[0])*f,e.y=h[1]+(g[1]-h[1])*f,e.z=h[2]+(g[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,j.index-1).pos,this.points[1]=h,this.points[2]=g,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,g,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(g[0]-h[0])*f,e.y=h[1]+(g[1]-h[1])*f,e.z=h[2]+(g[2]-h[2])*f}}if(this.JITCompile&&n[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)n[u][t]=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,g,j,m,p,t;h=(b.length-1)*c;g=Math.floor(h);h-=g;e[0]=g==0?g:g-1;e[1]=g;e[2]=g>b.length-2?g:g+1;e[3]=g>b.length-3?g:g+2;g=b[e[0]];m=b[e[1]];p=b[e[2]];t=b[e[3]];e=h*h;j=h*e;f[0]=this.interpolate(g[0],m[0],p[0],t[0],h,e,j);f[1]=this.interpolate(g[1],m[1],p[1],t[1],h,e,j);f[2]=this.interpolate(g[2],m[2],p[2],t[2],h,e,j);return f};
+THREE.Animation.prototype.interpolate=function(b,c,e,f,h,g,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*g+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.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!==
@@ -397,182 +396,181 @@ 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,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)*
+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)*
 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,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},g,k=e.getControlPointsArray(),m=e.getLength(),o=k.length,H=0;g=o-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[g]={time:f,pos:k[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<o-1;g++)H=f*m.chunks[g]/m.total,e.keys[g]={time:H,pos:k[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=
+THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},j,h=e.getControlPointsArray(),m=e.getLength(),p=h.length,I=0;j=p-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:h[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[j]={time:f,pos:h[j],rot:[0,0,0,1],scl:[1,1,1]};for(j=1;j<p-1;j++)I=f*m.chunks[j]/m.total,e.keys[j]={time:I,pos:h[j]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
+f,g=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),g.vertices[c]=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=
 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 g=Math.PI*2,k=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)*k;this.theta=this.lon*k;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),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(o,h);b.position.set(0,10,0);this.animation=
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,g=Math.PI/180;this.update=function(b,e,c){var f,j;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var m=j[1]-j[0];this.phi=
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[0];f=this.horizontalAngleMap.srcRange;j=this.horizontalAngleMap.dstRange;m=j[1]-j[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[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}),j=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,j);b.position.set(0,10,0);this.animation=
 c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(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(),g=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
-c.offset[1]-k)/k;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*
+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,g=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-h)/h;this.moveState.pitchDown=(b.clientY-
+c.offset[1]-g)/g;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 g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,o=!1,t=1,n=0,p=0,u=0,v=0,x=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*v),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*p);this.translateY(b*u);o&&(this.roll+=this.rollSpeed*this.delta*t);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);k.set(0,1,0);g.cross(k,h).normalize();k.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=k.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=k.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=k.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);
+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,g=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,p=!1,t=1,n=0,o=0,v=0,u=0,x=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*x));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*o);this.translateY(b*v);p&&(this.roll+=this.rollSpeed*this.delta*t);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();j.copy(this.forward);g.set(0,1,0);h.cross(g,j).normalize();g.cross(j,h).normalize();this.matrix.n11=h.x;this.matrix.n12=g.x;this.matrix.n13=j.x;this.matrix.n21=h.y;this.matrix.n22=g.y;this.matrix.n23=j.y;this.matrix.n31=h.z;this.matrix.n32=g.z;this.matrix.n33=j.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){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){k.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);k.multiplyScalar(b);this.forward.addSelf(k);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){v=(b.clientX-z)/window.innerWidth;x=(b.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;
-case 40:case 83:n=-1;break;case 39:case 68:p=1;break;case 81:o=!0;t=1;break;case 69:o=!0;t=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:p=0;break;case 40:case 83:n=0;break;case 39:case 68:p=0;break;case 81:o=!1;break;case 69:o=!1;break;case 82:u=0;break;case 70:u=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){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){g.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);g.multiplyScalar(b);this.forward.addSelf(g);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+function(b){u=(b.clientX-z)/window.innerWidth;x=(b.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:o=-1;break;
+case 40:case 83:n=-1;break;case 39:case 68:o=1;break;case 81:p=!0;t=1;break;case 69:p=!0;t=-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:n=0;break;case 37:case 65:o=0;break;case 40:case 83:n=0;break;case 39:case 68:o=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,e){return function(){e.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,g=new THREE.Vector3,k=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Vector2,o=new THREE.Vector2,t=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
-this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(g).setLength(c.x));f.addSelf(g.setLength(c.z));return f};
-this.rotateCamera=function(){var b=Math.acos(k.dot(h)/k.length()/h.length());if(b){var e=(new THREE.Vector3).cross(k,h).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(h);this.staticMoving?k=h:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(o.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=o:m.y+=(o.y-m.y)*this.dynamicDampingFactor)};
-this.panCamera=function(){var b=n.clone().subSelf(t);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?t=n:t.addSelf(b.sub(n,t).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,e,c){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,e,c)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(b){e&&(k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=o=this.getMouseOnScreen(b.clientX,b.clientY),t=n=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?o=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(n=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?k=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=o=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(t=n=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=
+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,g=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector2,p=new THREE.Vector2,t=new THREE.Vector2,n=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(g.dot(j)/g.length()/j.length());if(b){var c=(new THREE.Vector3).cross(g,j).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(j);this.staticMoving?g=j:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(g))}};this.zoomCamera=function(){var b=1+(p.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?m=p:m.y+=(p.y-m.y)*this.dynamicDampingFactor)};
+this.panCamera=function(){var b=n.clone().subSelf(t);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?t=n:t.addSelf(b.sub(n,t).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&&(g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=p=this.getMouseOnScreen(b.clientX,b.clientY),t=n=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?j=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&&(n=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?g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=p=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(t=n=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),g,k=0;for(g=1;g<=b;g++)e=this.getPoint(g/b),k+=e.distanceTo(f),c.push(k),f=e;return this.cacheLengths=c};
-THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,k;for(k=c?c:b*e[g-1];f<g;){if(e[f]>k)break;f++}return f/g};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,g,k){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=k};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b2(b,this.x0,this.x1,this.x2);b=THREE.FontUtils.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,g,k,h,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=k;this.x3=h;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.FontUtils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.FontUtils.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,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,k){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=k};
+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,g=0;for(h=1;h<=b;h++)e=this.getPoint(h/b),g+=e.distanceTo(f),c.push(g),f=e;return this.cacheLengths=c};
+THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,g;for(g=c?c:b*e[h-1];f<h;){if(e[f]>g)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,g){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=h;this.y2=g};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,g,j,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=h;this.y2=g;this.x3=j;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,g){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=h;this.aClockwise=g};
 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,g){var b=(e-b)*0.5,f=(f-c)*0.5,k=g*g;return(2*c-2*e+b+f)*g*k+(-3*c+3*e-2*b-f)*k+b*g+c}};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.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,g=h*h;return(2*c-2*e+b+f)*h*g+(-3*c+3*e-2*b-f)*g+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,e,f,h,g){this.x1=b;this.y1=c;this.z1=e;this.x2=f;this.y2=h;this.z2=g},function(b){return new THREE.Vector3(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b,this.z1+(this.z2-this.z1)*b)});
+THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e,f,h,g,j,m,p){this.x0=b;this.y0=c;this.z0=e;this.x1=f;this.y1=h;this.z1=g;this.x2=j;this.y2=m;this.z2=p},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.x0,this.x1,this.x2);e=THREE.Shape.Utils.b2(b,this.y0,this.y1,this.y2);b=THREE.Shape.Utils.b2(b,this.z0,this.z1,this.z2);return new THREE.Vector2(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 g=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args,k=new THREE.QuadraticBezierCurve(k[k.length-2],k[k.length-1],b,c,e,f);this.curves.push(k);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:k})};
-THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,k){var h=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,g,k);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h,curve:m})};
+THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args,g=new THREE.QuadraticBezierCurve(g[g.length-2],g[g.length-1],b,c,e,f);this.curves.push(g);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:h,curve:g})};
+THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,g){var j=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,g);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:j,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,g,k){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,k));this.actions.push({action:THREE.PathActions.ARC,args:h})};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,g,k,h,m,o,t,n,p,u,v,x,z;f=0;for(g=this.actions.length;f<g;f++)switch(k=this.actions[f],h=k.action,k=k.args,h){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=k[2];o=k[3];p=k[0];u=k[1];e.length>0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)z=h/b,k=THREE.FontUtils.b2(z,v,p,m),z=THREE.FontUtils.b2(z,x,u,o),
-e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:m=k[4];o=k[5];p=k[0];u=k[1];t=k[2];n=k[3];e.length>0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)z=h/b,k=THREE.FontUtils.b3(z,v,p,t,m),z=THREE.FontUtils.b3(z,x,u,n,o),e.push(new THREE.Vector2(k,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*k[0].length;h=h.concat(k[0]);k=new THREE.SplineCurve(h);
-for(h=1;h<=z;h++)e.push(k.getPointAt(h/z));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;m=k[0];o=k[1];t=k[2];p=k[3];z=k[4];u=!!k[5];n=h[h.length-2];v=h[h.length-1];h.length==0&&(n=v=0);x=z-p;var y=b*2;for(h=1;h<=y;h++)z=h/y,u||(z=1-z),z=p+z*x,k=n+m+t*Math.cos(z),z=v+o+t*Math.sin(z),e.push(new THREE.Vector2(k,z))}c&&e.push(e[0]);return e};
-THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var k,h,m;h=0;for(m=b.length;h<m;h++){k=b[h];if(k.x>c)c=k.x;else if(k.x<f)f=k.x;if(k.y>e)e=k.y;else if(k.y<e)g=k.y}return{minX:f,minY:g,maxX:c,maxY:e}};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.arc=function(b,c,e,f,h,g){var j=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,g));this.actions.push({action:THREE.PathActions.ARC,args:j})};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,g,j,m,p,t,n,o,v,u,x,z;f=0;for(h=this.actions.length;f<h;f++)switch(g=this.actions[f],j=g.action,g=g.args,j){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=g[2];p=g[3];o=g[0];v=g[1];e.length>0?(j=e[e.length-1],u=j.x,x=j.y):(j=this.actions[f-1].args,u=j[j.length-2],x=j[j.length-1]);for(j=1;j<=b;j++)z=j/b,g=THREE.Shape.Utils.b2(z,u,o,m),z=THREE.Shape.Utils.b2(z,x,v,
+p),e.push(new THREE.Vector2(g,z));break;case THREE.PathActions.BEZIER_CURVE_TO:m=g[4];p=g[5];o=g[0];v=g[1];t=g[2];n=g[3];e.length>0?(j=e[e.length-1],u=j.x,x=j.y):(j=this.actions[f-1].args,u=j[j.length-2],x=j[j.length-1]);for(j=1;j<=b;j++)z=j/b,g=THREE.Shape.Utils.b3(z,u,o,t,m),z=THREE.Shape.Utils.b3(z,x,v,n,p),e.push(new THREE.Vector2(g,z));break;case THREE.PathActions.CSPLINE_THRU:j=this.actions[f-1].args;j=[new THREE.Vector2(j[j.length-2],j[j.length-1])];z=b*g[0].length;j=j.concat(g[0]);g=new THREE.SplineCurve(j);
+for(j=1;j<=z;j++)e.push(g.getPointAt(j/z));break;case THREE.PathActions.ARC:j=this.actions[f-1].args;m=g[0];p=g[1];t=g[2];o=g[3];z=g[4];v=!!g[5];n=j[j.length-2];u=j[j.length-1];j.length==0&&(n=u=0);x=z-o;var y=b*2;for(j=1;j<=y;j++)z=j/y,v||(z=1-z),z=o+z*x,g=n+m+t*Math.cos(z),z=u+p+t*Math.sin(z),e.push(new THREE.Vector2(g,z))}c&&e.push(e[0]);return e};
+THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,h;c=e=Number.NEGATIVE_INFINITY;f=h=Number.POSITIVE_INFINITY;var g,j,m;j=0;for(m=b.length;j<m;j++){g=b[j];if(g.x>c)c=g.x;else if(g.x<f)f=g.x;if(g.y>e)e=g.y;else if(g.y<e)h=g.y}return{minX:f,minY:h,maxX:c,maxY:e}};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.getMinAndMax(),e=this.getPoints(),f,g,k,h,m,o;f=0;for(g=e.length;f<g;f++)k=e[f],h=k.x,m=k.y,o=h/c.maxX,h=b.getPoint(o),m=b.getNormalVector(o).multiplyScalar(m),k.x=h.x+m.x,k.y=h.y+m.y;return e};
-THREE.Path.prototype.nltransform=function(b,c,e,f,g,k){var h=this.getPoints(),m,o,t,n,p;m=0;for(o=h.length;m<o;m++)t=h[m],n=t.x,p=t.y,t.x=b*n+c*p+e,t.y=f*p+g*n+k;return h};
-THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();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.transform(0.866,
--0.866,0,0.5,0.5,-50);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.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(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};
-THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,k,h,m,o,t,n,p,u,v,x=[];for(o=0;o<c.length;o++){t=c[o];f=f.concat(t);k=Number.POSITIVE_INFINITY;for(g=0;g<t.length;g++){u=t[g];v=[];for(p=0;p<e.length;p++)n=e[p],n=u.distanceTo(n),v.push(n),n<k&&(k=n,h=g,m=p)}g=m-1>=0?m-1:e.length-1;k=h-1>=0?h-1:t.length-1;var z=[t[h],e[m],e[g]];p=THREE.FontUtils.Triangulate.area(z);var y=[t[h],t[k],e[m]];u=THREE.FontUtils.Triangulate.area(y);v=m;n=h;m+=1;h+=-1;m<0&&(m+=e.length);m%=e.length;
-h<0&&(h+=t.length);h%=t.length;g=m-1>=0?m-1:e.length-1;k=h-1>=0?h-1:t.length-1;z=[t[h],e[m],e[g]];z=THREE.FontUtils.Triangulate.area(z);y=[t[h],t[k],e[m]];y=THREE.FontUtils.Triangulate.area(y);p+u>z+y&&(m=v,h=n,m<0&&(m+=e.length),m%=e.length,h<0&&(h+=t.length),h%=t.length,g=m-1>=0?m-1:e.length-1,k=h-1>=0?h-1:t.length-1);p=e.slice(0,m);u=e.slice(m);v=t.slice(h);n=t.slice(0,h);k=[t[h],t[k],e[m]];x.push([t[h],e[m],e[g]]);x.push(k);e=p.concat(v).concat(n).concat(u)}return{shape:e,isolatedPts:x,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),k,h,m,o;for(k=0;k<e.length;k++){o=e[k];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(o[h])&&(o[h]=m)}for(k=0;k<g.length;k++){o=g[k];for(h=0;h<3;h++)for(m=0;m<f.length;m++)f[m].equals(o[h])&&(o[h]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0}};
-THREE.CubeGeometry=function(b,c,e,f,g,k,h,m,o){function t(b,e,c,h,m,o,p,t){var u,v,x=f||1,z=g||1,E=m/2,$=o/2,Q=n.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")u="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")u="y",z=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")u="x",x=k||1;var S=x+1,T=z+1;m/=x;var j=o/z;for(v=0;v<T;v++)for(o=0;o<S;o++){var L=new THREE.Vector3;L[b]=(o*m-E)*c;L[e]=(v*j-$)*h;L[u]=p;n.vertices.push(new THREE.Vertex(L))}for(v=0;v<z;v++)for(o=0;o<x;o++)n.faces.push(new THREE.Face4(o+S*v+
-Q,o+S*(v+1)+Q,o+1+S*(v+1)+Q,o+1+S*v+Q,null,null,t)),n.faceVertexUvs[0].push([new THREE.UV(o/x,v/z),new THREE.UV(o/x,(v+1)/z),new THREE.UV((o+1)/x,(v+1)/z),new THREE.UV((o+1)/x,v/z)])}THREE.Geometry.call(this);var n=this,p=b/2,u=c/2,v=e/2,m=m?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var z in o)this.sides[z]!=void 0&&(this.sides[z]=
-o[z]);this.sides.px&&t("z","y",1*m,-1,e,c,-p,this.materials[0]);this.sides.nx&&t("z","y",-1*m,-1,e,c,p,this.materials[1]);this.sides.py&&t("x","z",1*m,1,b,e,u,this.materials[2]);this.sides.ny&&t("x","z",1*m,-1,b,e,-u,this.materials[3]);this.sides.pz&&t("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&t("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=n.vertices.length;c<f;c++){for(var h=n.vertices[c],g=!1,k=0,m=b.length;k<m;k++){var o=b[k];if(h.position.x==o.position.x&&
-h.position.y==o.position.y&&h.position.z==o.position.z){e[c]=k;g=!0;break}}if(!g)e[c]=b.length,b.push(new THREE.Vertex(h.position.clone()))}c=0;for(f=n.faces.length;c<f;c++)h=n.faces[c],h.a=e[h.a],h.b=e[h.b],h.c=e[h.c],h.d=e[h.d];n.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,k){function h(b,e,c){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}THREE.Geometry.call(this);var m=this,o,t=Math.PI*2,n=f/2;for(o=0;o<b;o++)h(Math.sin(t*o/b)*c,Math.cos(t*o/b)*c,-n);for(o=0;o<b;o++)h(Math.sin(t*o/b)*e,Math.cos(t*o/b)*e,n);for(o=0;o<b;o++)m.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(e>0){h(0,0,-n-(k||0));for(o=b;o<b+b/2;o++)m.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){h(0,0,n+
-(g||0));for(o=b+b/2;o<2*b;o++)m.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],e=this.faces[o],g=this.vertices[e.a],k=this.vertices[e.b],n=this.vertices[e.c],p=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/t,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/t,0.5+k.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/t,0.5+n.position.z/
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/t,0.5+p.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){function e(b,e,c,f){b=b.clone().subSelf(e);c/=b.length();return b.multiplyScalar(f?1+c:1-c).addSelf(e)}function f(b){for(C=b.length;--C>=0;){T=C;j=C-1;j<0&&(j=b.length-1);for(var e=0,e=0;e<p+n*2;e++){var c=S*e,f=S*(e+1);H.faces.push(new THREE.Face4(L+T+c,L+j+c,L+j+f,L+T+f))}}}function g(b,e,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function k(b,e,c){H.faces.push(new THREE.Face3(b,e,c))}var h=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==
-void 0?c.bevelThickness:8,o=c.bevelSize!==void 0?c.bevelSize:m,t=c.bevelEnabled!==void 0?c.bevelEnabled:!0,n=c.bevelSegments!==void 0?c.bevelSegments:3;t||(n=0);var p=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,v,x=!1;if(u)v=u.getPoints(),p=v.length,x=!0;THREE.Geometry.call(this);var z,y,w,H=this,u=b.extractAllPoints(),A=u.shape,u=u.holes,J=!THREE.Shape.Utils.isClockWise(A);if(J){A=A.reverse();y=0;for(w=u.length;y<w;y++)z=u[y],THREE.Shape.Utils.isClockWise(z)&&(u[y]=z.reverse());J=!1}var J=
-THREE.Shape.Utils.triangulateShape(A,u),G=A;y=0;for(w=u.length;y<w;y++)z=u[y],A=A.concat(z);var C,P,F=new THREE.Vector2;C=0;for(P=G.length;C<P;C++)F.addSelf(G[C]);var K=F.divideScalar(G.length),I=[];y=0;for(w=u.length;y<w;y++){F=new THREE.Vector2;z=u[y];C=0;for(P=z.length;C<P;C++)F.addSelf(z[C]);I[y]=F.divideScalar(z.length)}var V,E,$,Q,S=A.length,F=J.length;for(V=n;V>0;V--){z=V/n;$=m*z;E=o*(1-Math.sin((1-z)*Math.PI/2));C=0;for(P=G.length;C<P;C++)Q=e(G[C],K,E,!1),g(Q.x,Q.y,-$);y=0;for(w=u.length;y<
-w;y++){z=u[y];C=0;for(P=z.length;C<P;C++)Q=e(z[C],I[y],E,!0),g(Q.x,Q.y,-$)}}for(C=0;C<S;C++)Q=A[C],x?g(Q.x,Q.y+v[0].y,v[0].x):g(Q.x,Q.y,0);for(z=1;z<=p;z++)for(C=0;C<S;C++)Q=A[C],x?g(Q.x,Q.y+v[z-1].y,v[z-1].x):g(Q.x,Q.y,h/p*z);for(V=1;V<=n;V++){z=V/n;$=m*z;E=o*(1-Math.sin((1-z)*Math.PI/2));C=0;for(P=G.length;C<P;C++)Q=e(G[C],K,E,!1),g(Q.x,Q.y,h+$);y=0;for(w=u.length;y<w;y++){z=u[y];C=0;for(P=z.length;C<P;C++)Q=e(z[C],I[y],E,!0),x?g(Q.x,Q.y+v[p-1].y,v[p-1].x+$):g(Q.x,Q.y,h+$)}}if(t){m=S*0;for(C=0;C<
-F;C++)h=J[C],k(h[2]+m,h[1]+m,h[0]+m);m=S*(p+n*2);for(C=0;C<F;C++)h=J[C],k(h[0]+m,h[1]+m,h[2]+m)}else{for(C=0;C<F;C++)h=J[C],k(h[2],h[1],h[0]);for(C=0;C<F;C++)h=J[C],k(h[0]+S*p,h[1]+S*p,h[2]+S*p)}var T,j,L=0;f(G);L+=G.length;y=0;for(w=u.length;y<w;y++)z=u[y],f(z),L+=z.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}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,k=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,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(b=0;b<this.subdivisions;b++){h=new THREE.Geometry;for(var m in k.faces){var o=f(k.faces[m].a,k.faces[m].b),t=f(k.faces[m].b,k.faces[m].c),n=f(k.faces[m].c,k.faces[m].a);e(k.faces[m].a,o,n,h);e(k.faces[m].b,t,o,h);
-e(k.faces[m].c,n,t,h);e(o,t,n,h)}k.faces=h.faces}g.faces=k.faces;delete k;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=[],k=[],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 o=0;o<=this.angle+0.0010;o+=c){for(m=0;m<e.length;m++)o<this.angle?(e[m]=h.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=k;o==0&&(k=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-o/this.angle,m/b.length),new THREE.UV(1-o/this.angle,(m+1)/b.length),new THREE.UV(1-(o-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(o-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,k=b/2,h=c/2,e=e||1,f=f||1,m=e+1,o=f+1;b/=e;var t=c/f;for(g=0;g<o;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(g*t-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.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.getMinAndMax(),e=this.getPoints(),f,h,g,j,m,p;f=0;for(h=e.length;f<h;f++)g=e[f],j=g.x,m=g.y,p=j/c.maxX,j=b.getPoint(p),m=b.getNormalVector(p).multiplyScalar(m),g.x=j.x+m.x,g.y=j.y+m.y;return e};
+THREE.Path.prototype.nltransform=function(b,c,e,f,h,g){var j=this.getPoints(),m,p,t,n,o;m=0;for(p=j.length;m<p;m++)t=j[m],n=t.x,o=t.y,t.x=b*n+c*o+e,t.y=f*o+h*n+g;return j};
+THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();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=[],g=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&&g.actions.length!=0&&(h.push(g),g=new THREE.Path),g[e].apply(g,f);g.actions.length!=0&&h.push(g);if(h.length==0)return[];var j,g=[];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())?(j&&g.push(j),j=new THREE.Shape,j.actions=f.actions,j.curves=
+f.curves):j.holes.push(f);g.push(j)}else{j=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(j.actions=f.actions,j.curves=f.curves,g.push(j),j=new THREE.Shape):j.holes.push(f)}return g};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(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,g,j,m,p,t,n,o,v,u,x=[];for(p=0;p<c.length;p++){t=c[p];f=f.concat(t);g=Number.POSITIVE_INFINITY;for(h=0;h<t.length;h++){v=t[h];u=[];for(o=0;o<e.length;o++)n=e[o],n=v.distanceTo(n),u.push(n),n<g&&(g=n,j=h,m=o)}h=m-1>=0?m-1:e.length-1;g=j-1>=0?j-1:t.length-1;var z=[t[j],e[m],e[h]];o=THREE.FontUtils.Triangulate.area(z);var y=[t[j],t[g],e[m]];v=THREE.FontUtils.Triangulate.area(y);u=m;n=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=e.length;
+j<0&&(j+=t.length);j%=t.length;h=m-1>=0?m-1:e.length-1;g=j-1>=0?j-1:t.length-1;z=[t[j],e[m],e[h]];z=THREE.FontUtils.Triangulate.area(z);y=[t[j],t[g],e[m]];y=THREE.FontUtils.Triangulate.area(y);o+v>z+y&&(m=u,j=n,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=t.length),j%=t.length,h=m-1>=0?m-1:e.length-1,g=j-1>=0?j-1:t.length-1);o=e.slice(0,m);v=e.slice(m);u=t.slice(j);n=t.slice(0,j);g=[t[j],t[g],e[m]];x.push([t[j],e[m],e[h]]);x.push(g);e=o.concat(u).concat(n).concat(v)}return{shape:e,isolatedPts:x,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),g,j,m,p;for(g=0;g<e.length;g++){p=e[g];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(p[j])&&(p[j]=m)}for(g=0;g<h.length;g++){p=h[g];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(p[j])&&(p[j]=m)}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",g=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=g};
+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,g,j,m,p){function t(b,c,e,j,m,o,p,t){var u,v,x=f||1,z=h||1,G=m/2,aa=o/2,Q=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",z=g||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",x=g||1;var S=x+1,T=z+1;m/=x;var k=o/z;for(v=0;v<T;v++)for(o=0;o<S;o++){var L=new THREE.Vector3;L[b]=(o*m-G)*e;L[c]=(v*k-aa)*j;L[u]=p;n.vertices.push(new THREE.Vertex(L))}for(v=0;v<z;v++)for(o=0;o<x;o++)n.faces.push(new THREE.Face4(o+S*
+v+Q,o+S*(v+1)+Q,o+1+S*(v+1)+Q,o+1+S*v+Q,null,null,t)),n.faceVertexUvs[0].push([new THREE.UV(o/x,v/z),new THREE.UV(o/x,(v+1)/z),new THREE.UV((o+1)/x,(v+1)/z),new THREE.UV((o+1)/x,v/z)])}THREE.Geometry.call(this);var n=this,o=b/2,v=c/2,u=e/2,m=m?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([j])}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&&t("z","y",1*m,-1,e,c,-o,this.materials[0]);this.sides.nx&&t("z","y",-1*m,-1,e,c,o,this.materials[1]);this.sides.py&&t("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&t("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&t("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&t("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=n.vertices.length;e<f;e++){for(var g=n.vertices[e],j=!1,h=0,m=b.length;h<m;h++){var o=b[h];if(g.position.x==o.position.x&&
+g.position.y==o.position.y&&g.position.z==o.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=n.faces.length;e<f;e++)g=n.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];n.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,g){function j(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,p,t=Math.PI*2,n=f/2;for(p=0;p<b;p++)j(Math.sin(t*p/b)*c,Math.cos(t*p/b)*c,-n);for(p=0;p<b;p++)j(Math.sin(t*p/b)*e,Math.cos(t*p/b)*e,n);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){j(0,0,-n-(g||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){j(0,0,n+
+(h||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],h=this.vertices[e.a],g=this.vertices[e.b],n=this.vertices[e.c],o=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/t,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/t,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/t,0.5+n.position.z/
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/t,0.5+o.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.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){return b.clone().addSelf(c.clone().multiplyScalar(e))}function f(b,c,e){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;return(new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec))).normalize()}function h(b){for(E=b.length;--E>=0;){W=E;X=E-1;X<0&&(X=b.length-1);for(var c=0,c=0;c<v+n*2;c++){var e=S*c,f=S*(c+1),g=$+W+e,e=$+X+e,j=$+X+f,f=$+W+f;g+=K;e+=K;j+=K;f+=K;C.faces.push(new THREE.Face4(g,
+e,j,f))}}}function g(b,c,e){C.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function j(b,c,e){b+=K;c+=K;e+=K;C.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,t=c.bevelSize!==void 0?c.bevelSize:p-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0;o||(t=p=n=0);var v=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,x,z=!1;if(u)x=u.getPoints(),v=x.length,z=!0;var y,w,I,C=
+this,K=this.vertices.length,u=b.extractAllPoints(),F=u.shape,u=u.holes,B=!THREE.Shape.Utils.isClockWise(F);if(B){F=F.reverse();w=0;for(I=u.length;w<I;w++)y=u[w],THREE.Shape.Utils.isClockWise(y)&&(u[w]=y.reverse());B=!1}var B=THREE.Shape.Utils.triangulateShape(F,u),O=F;w=0;for(I=u.length;w<I;w++)y=u[w],F=F.concat(y);var E,H,P=new THREE.Vector2;E=0;for(H=O.length;E<H;E++)P.addSelf(O[E]);P.divideScalar(O.length);w=0;for(I=u.length;w<I;w++){P=new THREE.Vector2;y=u[w];E=0;for(H=y.length;E<H;E++)P.addSelf(y[E]);
+P.divideScalar(y.length)}var V,G,aa,Q,S=F.length,P=B.length,T=[];E=0;H=O.length;W=H-1;for(X=E+1;E<H;E++,W++,X++)W==H&&(W=0),X==H&&(X=0),T[E]=f(O[E],O[W],O[X]);var k=[],L,ca=T.concat();w=0;for(I=u.length;w<I;w++){y=u[w];L=[];E=0;H=y.length;W=H-1;for(X=E+1;E<H;E++,W++,X++)W==H&&(W=0),X==H&&(X=0),L[E]=f(y[E],y[W],y[X]);k.push(L);ca=ca.concat(L)}for(V=0;V<n;V++){y=V/n;aa=p*(1-y);G=t*Math.sin(y*Math.PI/2);E=0;for(H=O.length;E<H;E++)Q=e(O[E],T[E],G),g(Q.x,Q.y,-aa);w=0;for(I=u.length;w<I;w++){y=u[w];L=k[w];
+E=0;for(H=y.length;E<H;E++)Q=e(y[E],L[E],G),g(Q.x,Q.y,-aa)}}G=t;for(E=0;E<S;E++)Q=e(F[E],ca[E],G),z?g(Q.x,Q.y+x[0].y,x[0].x):g(Q.x,Q.y,0);for(y=1;y<=v;y++)for(E=0;E<S;E++)Q=e(F[E],ca[E],G),z?g(Q.x,Q.y+x[y-1].y,x[y-1].x):g(Q.x,Q.y,m/v*y);for(V=n-1;V>=0;V--){y=V/n;aa=p*(1-y);G=t*Math.sin(y*Math.PI/2);E=0;for(H=O.length;E<H;E++)Q=e(O[E],T[E],G),g(Q.x,Q.y,m+aa);w=0;for(I=u.length;w<I;w++){y=u[w];L=k[w];E=0;for(H=y.length;E<H;E++)Q=e(y[E],L[E],G),z?g(Q.x,Q.y+x[v-1].y,x[v-1].x+aa):g(Q.x,Q.y,m+aa)}}if(o){p=
+S*0;for(E=0;E<P;E++)m=B[E],j(m[2]+p,m[1]+p,m[0]+p);p=S*(v+n*2);for(E=0;E<P;E++)m=B[E],j(m[0]+p,m[1]+p,m[2]+p)}else{for(E=0;E<P;E++)m=B[E],j(m[2],m[1],m[0]);for(E=0;E<P;E++)m=B[E],j(m[0]+S*v,m[1]+S*v,m[2]+S*v)}var W,X,$=0;h(O);$+=O.length;w=0;for(I=u.length;w<I;w++)y=u[w],h(y),$+=y.length;this.computeCentroids();this.computeFaceNormals()};
+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,g=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,g);e(0,5,1,g);e(0,1,7,g);e(0,7,10,g);e(0,10,11,g);e(1,5,9,g);e(5,11,4,g);e(11,10,2,g);e(10,7,6,g);e(7,1,8,g);e(3,9,4,g);e(3,4,2,g);e(3,2,6,g);e(3,6,8,g);e(3,8,9,g);e(4,9,5,g);e(2,4,11,g);e(6,2,10,g);e(8,6,7,g);e(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var m in g.faces){var p=f(g.faces[m].a,g.faces[m].b),t=f(g.faces[m].b,g.faces[m].c),n=f(g.faces[m].c,g.faces[m].a);e(g.faces[m].a,p,n,j);e(g.faces[m].b,t,p,j);
+e(g.faces[m].c,n,t,j);e(p,t,n,j)}g.faces=j.faces}h.faces=g.faces;delete g;delete j;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=[],g=[],j=(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]=j.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),h[m]=this.vertices.length-1):h=g;p==0&&(g=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-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=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,g=b/2,j=c/2,e=e||1,f=f||1,m=e+1,p=f+1;b/=e;var t=c/f;for(h=0;h<p;h++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-g,-(h*t-j),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.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,g=Math.PI,k=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),o=b*Math.sin(f*g),t=[],n=0;for(f=0;f<k;f++){var p=2*f/k,u=o*Math.sin(p*g),p=o*Math.cos(p*g);(e==0||e==h)&&f>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,m,u)))-1);t.push(n)}c.push(t)}for(var v,x,z,g=c.length,e=0;e<g;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){t=f==k-1;h=c[e][t?0:f+1];m=c[e][t?k-1:f];o=c[e-1][t?
-k-1:f];t=c[e-1][t?0:f+1];u=e/(g-1);v=(e-1)/(g-1);x=(f+1)/k;var p=f/k,n=new THREE.UV(1-x,u),u=new THREE.UV(1-p,u),p=new THREE.UV(1-p,v),y=new THREE.UV(1-x,v);e<c.length-1&&(v=this.vertices[h].position.clone(),x=this.vertices[m].position.clone(),z=this.vertices[o].position.clone(),v.normalize(),x.normalize(),z.normalize(),this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,u,p]));e>1&&(v=
-this.vertices[h].position.clone(),x=this.vertices[o].position.clone(),z=this.vertices[t].position.clone(),v.normalize(),x.normalize(),z.normalize(),this.faces.push(new THREE.Face3(h,o,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,p,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){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){x.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,k=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",o=c.style!==void 0?c.style:"normal",t=c.bevelThickness!==void 0?c.bevelThickness:10,n=c.bevelSize!==void 0?c.bevelSize:8,p=c.bevelEnabled!==
-void 0?c.bevelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=k;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=o;THREE.FontUtils.bevelSize=n;var m=THREE.FontUtils.drawText(b),k=m.points,u=m.faces,h=m.contour,v=m.bevel,x=this;x.vertices=[];x.faces=[];for(var z,o=k.length,y=u.length,n=v.length,m=0;m<o;m++)z=k[m],e(z.x,z.y,0);for(m=0;m<o;m++)z=k[m],e(z.x,z.y,g);if(p){for(m=0;m<n;m++)z=v[m],e(z.x,z.y,t);for(m=0;m<n;m++)z=v[m],e(z.x,z.y,g-t)}for(m=
-0;m<y;m++)g=u[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<y;m++)g=u[m],x.faces.push(new THREE.Face3(g[0]+o,g[1]+o,g[2]+o));var w;if(p)for(m=v.length;--m>0;){if(w){if(w.equals(h[m])){w=null;continue}}else w=h[m];t=o*2+m;u=t-1;f(t,u,u+n,t+n);for(p=0;p<o;p++)if(k[p].equals(h[m]))break;for(g=0;g<o;g++)if(k[g].equals(h[m-1]))break;f(p,g,u,t);f(t+n,u+n,g+o,p+o)}else for(m=h.length;--m>0;){if(w){if(w.equals(h[m])){w=null;continue}}else w=h[m];for(p=0;p<o;p++)if(k[p].equals(h[m]))break;for(g=
-0;g<o;g++)if(k[g].equals(h[m-1]))break;f(p,g,g+o,p+o)}this.computeCentroids();this.computeFaceNormals()};
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},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},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
-{points:b,faces:[]};for(var e,f,g,k,h,m=[],o=0;o<c.length;o++){h=c[o];k=[];for(e=0;e<h.length;e++)f=h[e],k.push(f.x+","+f.y);var t;e=k.slice(1).indexOf(k[0]);var n=this.Triangulate.area(h.slice(0,e+1))<0;f=[];for(e=-1;e<k.length;){t=e+1;e=k[t];e=k.slice(t+1).indexOf(e)+t;if(e<=t)break;var p=h.slice(t,e+1);n?this.Triangulate.area(p)<0?(t>0&&m.push({shape:g,holes:f}),g=p,f=[]):f.push(p):this.Triangulate.area(p)<0?(m.push({shape:p,holes:f}),f=[]):f.push(p);e++}n&&m.push({shape:g,holes:f})}var u,v,x,
-z,y,w;k=[];for(h=0;h<m.length;h++){o=m[h];g=o.shape;f=o.holes;for(t=0;t<f.length;t++){n=f[t];x=Number.POSITIVE_INFINITY;for(p=0;p<n.length;p++){y=n[p];for(e=0;e<g.length;e++)z=g[e],z=y.distanceTo(z),z<x&&(x=z,u=p,v=e)}e=v-1>=0?v-1:g.length-1;var p=u-1>=0?u-1:n.length-1,H=[];H.push(n[u]);H.push(g[v]);H.push(g[e]);x=this.Triangulate.area(H);var A=[];A.push(n[u]);A.push(n[p]);A.push(g[v]);y=this.Triangulate.area(A);z=v;w=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=n.length);u%=g.length;e=v-
-1>=0?v-1:g.length-1;p=u-1>=0?u-1:n.length-1;H=[];H.push(n[u]);H.push(g[v]);H.push(g[e]);H=this.Triangulate.area(H);A=[];A.push(n[u]);A.push(n[p]);A.push(g[v]);A=this.Triangulate.area(A);x+y>H+A&&(v=z,u=w,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=n.length),u%=g.length,e=v-1>=0?v-1:g.length-1,p=u-1>=0?u-1:n.length-1);x=g.slice(0,v);y=g.slice(v);z=n.slice(u);w=n.slice(0,u);k.push(n[u]);k.push(g[v]);k.push(g[e]);k.push(n[u]);k.push(n[p]);k.push(g[v]);g=x.concat(z).concat(w).concat(y)}o.shape=g}u=[];v=[];
-for(h=t=0;h<m.length;h++){o=m[h];g=o.shape;u=u.concat(g);n=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<n.length;f++)o=n[f],o[0]+=t,o[1]+=t,o[2]+=t;v=v.concat(n);t+=g.length}var J;for(f=0;f<k.length/3;f++){o=[];for(m=0;m<3;m++){h=!1;for(g=0;g<u.length&&!h;g++)J=f*3+m,u[g].equals(k[J])&&(o.push(g),h=!0);h||(u.push(k[J]),o.push(u.length-1),console.log("not found"))}v.push(o)}return{points:u,faces:v}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),k=this.size/g.resolution,h=0;f=String(b).split("");
-for(var m=f.length,o=new THREE.Path,b=0;b<m;b++){var t=this.extractGlyphPoints(f[b],g,k,h,o);h+=t.offset;c.push(t.points);e=e.concat(t.points)}b=h/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];k=[];f=[];for(var h=[],m=new THREE.Vector2,n,b=e.length;--b>=0;){if(n){if(n.equals(e[b])){n=null;o=this.Triangulate.area(f)>0;h.push(o);k.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else n=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=0;--b>=0;)o=e[b],
-m=k[f],o=o.clone().subSelf(m),t=this.bevelSize/o.length(),h[f]?t+=1:t=1-t,t=o.multiplyScalar(t).addSelf(m),g.unshift(t),n?n.equals(e[b])&&(n=null,f++):n=e[b];c.bevel=g;return c},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)},extractGlyphPoints:function(b,c,e,f,g){var k=[],h,m,o,t,n,p,u,v,x,z,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));o=c.length;for(b=0;b<o;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(m,t));g.moveTo(m,t);break;case "l":m=c[b++]*e+f;t=c[b++]*e;k.push(new THREE.Vector2(m,t));g.lineTo(m,
-t);break;case "q":m=c[b++]*e+f;t=c[b++]*e;u=c[b++]*e+f;v=c[b++]*e;g.quadraticCurveTo(u,v,m,t);if(h=k[k.length-1]){n=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var w=h/divisions,H=THREE.FontUtils.b2(w,n,u,m),w=THREE.FontUtils.b2(w,p,v,t);k.push(new THREE.Vector2(H,w))}}break;case "b":if(m=c[b++]*e+f,t=c[b++]*e,u=c[b++]*e+f,v=c[b++]*-e,x=c[b++]*e+f,z=c[b++]*-e,g.bezierCurveTo(m,t,u,v,x,z),h=k[k.length-1]){n=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)w=h/divisions,
-H=THREE.FontUtils.b3(w,n,u,x,m),w=THREE.FontUtils.b3(w,p,v,z,t),k.push(new THREE.Vector2(H,w))}}}return{offset:y.ha*e,points:k,path:g}}}};
-(function(b){var c=function(b){for(var c=b.length,g=0,k=c-1,h=0;h<c;k=h++)g+=b[k].x*b[h].y-b[h].x*b[k].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var k=[],h=[],m=[],o,t,n;if(c(b)>0)for(t=0;t<g;t++)h[t]=t;else for(t=0;t<g;t++)h[t]=g-1-t;var p=2*g;for(t=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}o=t;g<=o&&(o=0);t=o+1;g<=t&&(t=0);n=t+1;g<=n&&(n=0);var u;a:{u=b;var v=o,x=t,z=n,y=g,w=h,H=void 0,A=void 0,J=void 0,
-G=void 0,C=void 0,P=void 0,F=void 0,K=void 0,I=void 0,A=u[w[v]].x,J=u[w[v]].y,G=u[w[x]].x,C=u[w[x]].y,P=u[w[z]].x,F=u[w[z]].y;if(1.0E-10>(G-A)*(F-J)-(C-J)*(P-A))u=!1;else{for(H=0;H<y;H++)if(!(H==v||H==x||H==z)){var K=u[w[H]].x,I=u[w[H]].y,V=void 0,E=void 0,$=void 0,Q=void 0,S=void 0,T=void 0,j=void 0,L=void 0,fa=void 0,Y=void 0,ga=void 0,ea=void 0,V=$=S=void 0,V=P-G,E=F-C,$=A-P,Q=J-F,S=G-A,T=C-J,j=K-A,L=I-J,fa=K-G,Y=I-C,ga=K-P,ea=I-F,V=V*Y-E*fa,S=S*L-T*j,$=$*ea-Q*ga;if(V>=0&&$>=0&&S>=0){u=!1;break a}}u=
-!0}}if(u){k.push([b[h[o]],b[h[t]],b[h[n]]]);m.push([h[o],h[t],h[n]]);o=t;for(n=t+1;n<g;o++,n++)h[o]=h[n];g--;p=2*g}}if(f)return m;return k};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,k=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,k,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[k][0],b[k][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.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,g=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e<j+1;e++){f=e/j;var m=b*Math.cos(f*h),p=b*Math.sin(f*h),t=[],n=0;for(f=0;f<g;f++){var o=2*f/g,v=p*Math.sin(o*h),o=p*Math.cos(o*h);(e==0||e==j)&&f>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,m,v)))-1);t.push(n)}c.push(t)}for(var u,x,z,h=c.length,e=0;e<h;e++)if(g=c[e].length,e>0)for(f=0;f<g;f++){t=f==g-1;j=c[e][t?0:f+1];m=c[e][t?g-1:f];p=c[e-1][t?
+g-1:f];t=c[e-1][t?0:f+1];v=e/(h-1);u=(e-1)/(h-1);x=(f+1)/g;var o=f/g,n=new THREE.UV(1-x,v),v=new THREE.UV(1-o,v),o=new THREE.UV(1-o,u),y=new THREE.UV(1-x,u);e<c.length-1&&(u=this.vertices[j].position.clone(),x=this.vertices[m].position.clone(),z=this.vertices[p].position.clone(),u.normalize(),x.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,v,o]));e>1&&(u=
+this.vertices[j].position.clone(),x=this.vertices[p].position.clone(),z=this.vertices[t].position.clone(),u.normalize(),x.normalize(),z.normalize(),this.faces.push(new THREE.Face3(j,p,t,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,o,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;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(""),g=h.length,j=[],b=0;b<g;b++){var m=new THREE.Path,m=this.extractGlyphPoints(h[b],c,e,f,m);f+=m.offset;j.push(m.path)}return{paths:j,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var g=[],j,m,p,t,n,o,v,u,x,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;t=c[b++]*e;g.push(new THREE.Vector2(m,
+t));h.moveTo(m,t);break;case "l":m=c[b++]*e+f;t=c[b++]*e;g.push(new THREE.Vector2(m,t));h.lineTo(m,t);break;case "q":m=c[b++]*e+f;t=c[b++]*e;v=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(v,u,m,t);if(j=g[g.length-1]){n=j.x;o=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var w=j/divisions,I=THREE.Shape.Utils.b2(w,n,v,m),w=THREE.Shape.Utils.b2(w,o,u,t);g.push(new THREE.Vector2(I,w))}}break;case "b":if(m=c[b++]*e+f,t=c[b++]*e,v=c[b++]*e+f,u=c[b++]*-e,x=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(m,t,
+v,u,x,z),j=g[g.length-1]){n=j.x;o=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)w=j/divisions,I=THREE.Shape.Utils.b3(w,n,v,x,m),w=THREE.Shape.Utils.b3(w,o,u,z,t),g.push(new THREE.Vector2(I,w))}}}return{offset:y.ha*e,points:g,path:h}}}};
+(function(b){var c=function(b){for(var c=b.length,h=0,g=c-1,j=0;j<c;g=j++)h+=b[g].x*b[j].y-b[j].x*b[g].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var g=[],j=[],m=[],p,t,n;if(c(b)>0)for(t=0;t<h;t++)j[t]=t;else for(t=0;t<h;t++)j[t]=h-1-t;var o=2*h;for(t=h-1;h>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return g}p=t;h<=p&&(p=0);t=p+1;h<=t&&(t=0);n=t+1;h<=n&&(n=0);var v;a:{v=b;var u=p,x=t,z=n,y=h,w=j,I=void 0,C=void 0,K=void 0,
+F=void 0,B=void 0,O=void 0,E=void 0,H=void 0,P=void 0,C=v[w[u]].x,K=v[w[u]].y,F=v[w[x]].x,B=v[w[x]].y,O=v[w[z]].x,E=v[w[z]].y;if(1.0E-10>(F-C)*(E-K)-(B-K)*(O-C))v=!1;else{for(I=0;I<y;I++)if(!(I==u||I==x||I==z)){var H=v[w[I]].x,P=v[w[I]].y,V=void 0,G=void 0,aa=void 0,Q=void 0,S=void 0,T=void 0,k=void 0,L=void 0,ca=void 0,W=void 0,X=void 0,$=void 0,V=aa=S=void 0,V=O-F,G=E-B,aa=C-O,Q=K-E,S=F-C,T=B-K,k=H-C,L=P-K,ca=H-F,W=P-B,X=H-O,$=P-E,V=V*W-G*ca,S=S*L-T*k,aa=aa*$-Q*X;if(V>=0&&aa>=0&&S>=0){v=!1;break a}}v=
+!0}}if(v){g.push([b[j[p]],b[j[t]],b[j[n]]]);m.push([j[p],j[t],j[n]]);p=t;for(n=t+1;n<h;p++,n++)j[p]=j[n];h--;o=2*h}}if(f)return m;return g};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,g=(this.segmentsT+1)*(c-1)+e-1,j=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,h,g,j));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[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][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,g,k,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=k||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var o=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=m(o,h,this.q,this.p,this.radius,this.heightScale),o=m(o+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=o.x-g.x;e.y=o.y-g.y;e.z=o.z-g.z;f.x=o.x+g.x;f.y=o.y+g.y;f.z=o.z+g.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();o=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=o*f.x+h*k.x;g.y+=o*f.y+h*k.y;g.z+=o*f.z+h*k.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,k=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,k));this.faceVertexUvs[0].push([h,o,t,n])}this.computeCentroids();
+THREE.TorusKnotGeometry=function(b,c,e,f,h,g,j){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=g||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;g=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,j=c/this.segmentsT*2*Math.PI,h=m(p,j,this.q,this.p,this.radius,this.heightScale),p=m(p+0.01,j,this.q,this.p,this.radius,this.heightScale);e.x=p.x-h.x;e.y=p.y-h.y;e.z=p.z-h.z;f.x=p.x+h.x;f.y=p.y+h.y;f.z=p.z+h.z;g.cross(e,f);f.cross(g,e);g.normalize();f.normalize();p=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);h.x+=p*f.x+j*g.x;h.y+=p*f.y+j*g.y;h.z+=p*f.z+j*g.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,g=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][g],g=this.grid[b][g],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,g));this.faceVertexUvs[0].push([j,p,t,n])}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 g(b,e,h,g,k,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}k&&b[e].offset.set(k[0],k[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 k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,m,o;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=k(b.colorDiffuse);
-else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=k(b.colorSpecular);if(b.colorAmbient)h.ambient=k(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 t=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(t.uniforms),p=h.color;m=h.specular;o=h.ambient;var u=h.shininess;n.tNormal.texture=h.normalMap;if(b.mapNormalFactor)n.uNormalScale.value=b.mapNormalFactor;if(h.map)n.tDiffuse.texture=h.map,n.enableDiffuse.value=!0;if(h.specularMap)n.tSpecular.texture=h.specularMap,n.enableSpecular.value=!0;if(h.lightMap)n.tAO.texture=
-h.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(p);n.uSpecularColor.value.setHex(m);n.uAmbientColor.value.setHex(o);n.uShininess.value=u;if(h.opacity)n.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:n,lights:!0,fog:!0})}else h=new THREE[m](h);return h}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
-THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,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(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,o,t,n,p,u,v,x,z,y,w,H,A,J=b.faces;p=b.vertices;var G=b.normals,C=b.colors,P=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&P++;for(c=0;c<P;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];t=0;for(n=p.length;t<n;)u=new THREE.Vertex,u.position.x=p[t++]*e,u.position.y=
-p[t++]*e,u.position.z=p[t++]*e,f.vertices.push(u);t=0;for(n=J.length;t<n;){e=J[t++];p=e&1;o=e&2;c=e&4;g=e&8;v=e&16;u=e&32;z=e&64;e&=128;p?(y=new THREE.Face4,y.a=J[t++],y.b=J[t++],y.c=J[t++],y.d=J[t++],p=4):(y=new THREE.Face3,y.a=J[t++],y.b=J[t++],y.c=J[t++],p=3);if(o)o=J[t++],y.materials=f.materials[o];o=f.faces.length;if(c)for(c=0;c<P;c++)w=b.uvs[c],x=J[t++],A=w[x*2],x=w[x*2+1],f.faceUvs[c][o]=new THREE.UV(A,x);if(g)for(c=0;c<P;c++){w=b.uvs[c];H=[];for(g=0;g<p;g++)x=J[t++],A=w[x*2],x=w[x*2+1],H[g]=
-new THREE.UV(A,x);f.faceVertexUvs[c][o]=H}if(v)v=J[t++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],y.normal=g;if(u)for(c=0;c<p;c++)v=J[t++]*3,g=new THREE.Vector3,g.x=G[v++],g.y=G[v++],g.z=G[v],y.vertexNormals.push(g);if(z)u=J[t++],u=new THREE.Color(C[u]),y.color=u;if(e)for(c=0;c<p;c++)u=J[t++],u=new THREE.Color(C[u]),y.vertexColors.push(u);f.faces.push(y)}}})(g);(function(){var c,e,g,o;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],o=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
-o,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],o=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,o,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,o,t,n,p,u,v,x;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=[];v=f.morphTargets[e].vertices;x=b.morphTargets[e].vertices;o=0;for(t=x.length;o<t;o+=3)n=x[o]*c,p=x[o+1]*
-c,u=x[o+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(n,p,u)))}}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=[];t=f.morphColors[e].colors;n=b.morphColors[e].colors;c=0;for(o=n.length;c<o;c+=3)p=new THREE.Color(16755200),p.setRGB(n[c],n[c+1],n[c+2]),t.push(p)}}})(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),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,k)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,k){var h=new XMLHttpRequest,m=f+"/"+b,o=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?k&&(o==0&&(o=h.getResponseHeader("Content-Length")),k({total:o,loaded:h.responseText.length})):h.readyState==2&&(o=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=n(b,c),g=n(b,c+1),h=n(b,c+2),k=n(b,c+3),j=(k<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&j==-127)return 0;return(1-2*(k>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,j)}function g(b,c){var e=n(b,c),f=n(b,c+1),h=n(b,c+2);return(n(b,c+3)<<24)+(h<<16)+(f<<8)+e}function o(b,c){var e=n(b,c);return(n(b,c+1)<<8)+e}function t(b,c){var e=n(b,c);return e>127?e-256:e}function n(b,
-c){return b.charCodeAt(c)&255}function p(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+P);c=o(b,c+F);THREE.BinaryLoader.prototype.f3(w,e,f,h,c)}function u(c){var e,f,h,k,j,n;e=g(b,c);f=g(b,c+C);h=g(b,c+P);k=o(b,c+F);j=g(b,c+K);n=g(b,c+I);c=g(b,c+V);THREE.BinaryLoader.prototype.f3n(w,J,e,f,h,k,j,n,c)}function v(c){var e,f,h,k;e=g(b,c);f=g(b,c+E);h=g(b,c+$);k=g(b,c+Q);c=o(b,c+S);THREE.BinaryLoader.prototype.f4(w,e,f,h,k,c)}function x(c){var e,f,h,k,n,p,t,u;e=g(b,c);f=g(b,c+E);h=g(b,c+$);k=g(b,c+Q);n=o(b,
-c+S);p=g(b,c+T);t=g(b,c+j);u=g(b,c+L);c=g(b,c+fa);THREE.BinaryLoader.prototype.f4n(w,J,e,f,h,k,n,p,t,u,c)}function z(c){var e,f;e=g(b,c);f=g(b,c+Y);c=g(b,c+ga);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function y(c){var e,f,h;e=g(b,c);f=g(b,c+ea);h=g(b,c+ia);c=g(b,c+qa);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var w=this,H=0,A,J=[],G=[],C,P,F,K,I,V,E,$,Q,S,T,j,L,fa,
-Y,ga,ea,ia,qa,ha,M,ma,aa,ca,ja;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);A={signature:b.substr(H,8),header_bytes:n(b,H+8),vertex_coordinate_bytes:n(b,H+9),normal_coordinate_bytes:n(b,H+10),uv_coordinate_bytes:n(b,H+11),vertex_index_bytes:n(b,H+12),normal_index_bytes:n(b,H+13),uv_index_bytes:n(b,H+14),material_index_bytes:n(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+=A.header_bytes;C=A.vertex_index_bytes;P=A.vertex_index_bytes*2;F=A.vertex_index_bytes*3;K=A.vertex_index_bytes*3+A.material_index_bytes;I=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;V=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;E=A.vertex_index_bytes;$=A.vertex_index_bytes*2;Q=A.vertex_index_bytes*3;S=A.vertex_index_bytes*4;T=A.vertex_index_bytes*
-4+A.material_index_bytes;j=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;L=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;fa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;Y=A.uv_index_bytes;ga=A.uv_index_bytes*2;ea=A.uv_index_bytes;ia=A.uv_index_bytes*2;qa=A.uv_index_bytes*3;c=A.vertex_index_bytes*3+A.material_index_bytes;ja=A.vertex_index_bytes*4+A.material_index_bytes;ha=A.ntri_flat*c;M=A.ntri_smooth*(c+A.normal_index_bytes*3);ma=
-A.ntri_flat_uv*(c+A.uv_index_bytes*3);aa=A.ntri_smooth_uv*(c+A.normal_index_bytes*3+A.uv_index_bytes*3);ca=A.nquad_flat*ja;c=A.nquad_smooth*(ja+A.normal_index_bytes*4);ja=A.nquad_flat_uv*(ja+A.uv_index_bytes*4);H+=function(c){for(var f,g,k,j=A.vertex_coordinate_bytes*3,m=c+A.nvertices*j;c<m;c+=j)f=e(b,c),g=e(b,c+A.vertex_coordinate_bytes),k=e(b,c+A.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(w,f,g,k);return A.nvertices*j}(H);H+=function(c){for(var e,f,g,h=A.normal_coordinate_bytes*3,
-k=c+A.nnormals*h;c<k;c+=h)e=t(b,c),f=t(b,c+A.normal_coordinate_bytes),g=t(b,c+A.normal_coordinate_bytes*2),J.push(e/127,f/127,g/127);return A.nnormals*h}(H);H+=function(c){for(var f,g,k=A.uv_coordinate_bytes*2,j=c+A.nuvs*k;c<j;c+=k)f=e(b,c),g=e(b,c+A.uv_coordinate_bytes),G.push(f,g);return A.nuvs*k}(H);ha=H+ha;M=ha+M;ma=M+ma;aa=ma+aa;ca=aa+ca;c=ca+c;ja=c+ja;(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=e+A.uv_index_bytes*3,g=b+A.ntri_flat_uv*f;for(c=b;c<g;c+=f)p(c),z(c+e);return g-
-b})(M);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=e+A.uv_index_bytes*3,g=b+A.ntri_smooth_uv*f;for(c=b;c<g;c+=f)u(c),z(c+e);return g-b})(ma);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=e+A.uv_index_bytes*4,g=b+A.nquad_flat_uv*f;for(c=b;c<g;c+=f)v(c),y(c+e);return g-b})(c);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,f=e+A.uv_index_bytes*4,g=b+A.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),
-y(c+e);return g-b})(ja);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes,f=b+A.ntri_flat*e;for(c=b;c<f;c+=e)p(c);return f-b})(H);(function(b){var c,e=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,f=b+A.ntri_smooth*e;for(c=b;c<f;c+=e)u(c);return f-b})(ha);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes,f=b+A.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(aa);(function(b){var c,e=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*
-4,f=b+A.nquad_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(ca);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,k){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[k]))},
-f3n:function(b,c,e,f,g,k,h,m,o){var k=b.materials[k],t=c[m*3],n=c[m*3+1],m=c[m*3+2],p=c[o*3],u=c[o*3+1],o=c[o*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(t,n,m),new THREE.Vector3(p,u,o)],null,k))},f4n:function(b,c,e,f,g,k,h,m,o,t,n){var h=b.materials[h],p=c[o*3],u=c[o*3+1],o=c[o*3+2],v=c[t*3],x=c[t*3+1],t=c[t*3+2],z=c[n*3],y=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(e,f,g,k,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(p,
-u,o),new THREE.Vector3(v,x,t),new THREE.Vector3(z,y,n)],null,h))},uv3:function(b,c,e,f,g,k,h){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(k,h));b.push(m)},uv4:function(b,c,e,f,g,k,h,m,o){var t=[];t.push(new THREE.UV(c,e));t.push(new THREE.UV(f,g));t.push(new THREE.UV(k,h));t.push(new THREE.UV(m,o));b.push(t)}};
+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 g(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var j,m,p;m="MeshLambertMaterial";j={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")j.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")j.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)j.transparent=b.transparent;if(b.depthTest!==void 0)j.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(b.vertexColors)j.vertexColors=THREE.VertexColors;if(b.colorDiffuse)j.color=g(b.colorDiffuse);
+else if(b.DbgColor)j.color=b.DbgColor;if(b.colorSpecular)j.specular=g(b.colorSpecular);if(b.colorAmbient)j.ambient=g(b.colorAmbient);if(b.transparency)j.opacity=b.transparency;if(b.specularCoef)j.shininess=b.specularCoef;b.mapDiffuse&&c&&h(j,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(j,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(j,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
+b.mapSpecular&&c&&h(j,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var t=THREE.ShaderUtils.lib.normal,n=THREE.UniformsUtils.clone(t.uniforms),o=j.color;m=j.specular;p=j.ambient;var v=j.shininess;n.tNormal.texture=j.normalMap;if(b.mapNormalFactor)n.uNormalScale.value=b.mapNormalFactor;if(j.map)n.tDiffuse.texture=j.map,n.enableDiffuse.value=!0;if(j.specularMap)n.tSpecular.texture=j.specularMap,n.enableSpecular.value=!0;if(j.lightMap)n.tAO.texture=
+j.lightMap,n.enableAO.value=!0;n.uDiffuseColor.value.setHex(o);n.uSpecularColor.value.setHex(m);n.uAmbientColor.value.setHex(p);n.uShininess.value=v;if(j.opacity)n.uOpacity.value=j.opacity;j=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:n,lights:!0,fog:!0})}else j=new THREE[m](j);return j}};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,p,t,n,o,v,u,x,z,y,w,I,C,K=b.faces;o=b.vertices;var F=b.normals,B=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]=[];t=0;for(n=o.length;t<n;)v=new THREE.Vertex,v.position.x=o[t++]*c,v.position.y=
+o[t++]*c,v.position.z=o[t++]*c,f.vertices.push(v);t=0;for(n=K.length;t<n;){c=K[t++];o=c&1;p=c&2;e=c&4;h=c&8;u=c&16;v=c&32;z=c&64;c&=128;o?(y=new THREE.Face4,y.a=K[t++],y.b=K[t++],y.c=K[t++],y.d=K[t++],o=4):(y=new THREE.Face3,y.a=K[t++],y.b=K[t++],y.c=K[t++],o=3);if(p)p=K[t++],y.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<O;e++)w=b.uvs[e],x=K[t++],C=w[x*2],x=w[x*2+1],f.faceUvs[e][p]=new THREE.UV(C,x);if(h)for(e=0;e<O;e++){w=b.uvs[e];I=[];for(h=0;h<o;h++)x=K[t++],C=w[x*2],x=w[x*2+1],I[h]=
+new THREE.UV(C,x);f.faceVertexUvs[e][p]=I}if(u)u=K[t++]*3,h=new THREE.Vector3,h.x=F[u++],h.y=F[u++],h.z=F[u],y.normal=h;if(v)for(e=0;e<o;e++)u=K[t++]*3,h=new THREE.Vector3,h.x=F[u++],h.y=F[u++],h.z=F[u],y.vertexNormals.push(h);if(z)v=K[t++],v=new THREE.Color(B[v]),y.color=v;if(c)for(e=0;e<o;e++)v=K[t++],v=new THREE.Color(B[v]),y.vertexColors.push(v);f.faces.push(y)}}})(h);(function(){var c,e,h,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,p,t,n,o,v,u,x;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;x=b.morphTargets[e].vertices;p=0;for(t=x.length;p<t;p+=3)n=x[p]*c,o=x[p+1]*
+c,v=x[p+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,o,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=[];t=f.morphColors[e].colors;n=b.morphColors[e].colors;c=0;for(p=n.length;c<p;c+=3)o=new THREE.Color(16755200),o.setRGB(n[c],n[c+1],n[c+2]),t.push(o)}}})(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),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,g)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,h,g){var j=new XMLHttpRequest,m=f+"/"+b,p=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,e,h,c):alert("Couldn't load ["+m+"] ["+j.status+"]"):j.readyState==3?g&&(p==0&&(p=j.getResponseHeader("Content-Length")),g({total:p,loaded:j.responseText.length})):j.readyState==2&&(p=j.getResponseHeader("Content-Length"))};j.open("GET",m,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
+j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,e,f){var h=function(c){function e(b,c){var f=n(b,c),g=n(b,c+1),h=n(b,c+2),j=n(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=n(b,c),f=n(b,c+1),g=n(b,c+2);return(n(b,c+3)<<24)+(g<<16)+(f<<8)+e}function p(b,c){var e=n(b,c);return(n(b,c+1)<<8)+e}function t(b,c){var e=n(b,c);return e>127?e-256:e}function n(b,
+c){return b.charCodeAt(c)&255}function o(c){var e,f,g;e=h(b,c);f=h(b,c+B);g=h(b,c+O);c=p(b,c+E);THREE.BinaryLoader.prototype.f3(w,e,f,g,c)}function v(c){var e,f,g,j,k,n;e=h(b,c);f=h(b,c+B);g=h(b,c+O);j=p(b,c+E);k=h(b,c+H);n=h(b,c+P);c=h(b,c+V);THREE.BinaryLoader.prototype.f3n(w,K,e,f,g,j,k,n,c)}function u(c){var e,f,g,j;e=h(b,c);f=h(b,c+G);g=h(b,c+aa);j=h(b,c+Q);c=p(b,c+S);THREE.BinaryLoader.prototype.f4(w,e,f,g,j,c)}function x(c){var e,f,g,j,n,o,t,u;e=h(b,c);f=h(b,c+G);g=h(b,c+aa);j=h(b,c+Q);n=p(b,
+c+S);o=h(b,c+T);t=h(b,c+k);u=h(b,c+L);c=h(b,c+ca);THREE.BinaryLoader.prototype.f4n(w,K,e,f,g,j,n,o,t,u,c)}function z(c){var e,f;e=h(b,c);f=h(b,c+W);c=h(b,c+X);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[c*2],F[c*2+1])}function y(c){var e,f,g;e=h(b,c);f=h(b,c+$);g=h(b,c+da);c=h(b,c+ea);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],F[e*2],F[e*2+1],F[f*2],F[f*2+1],F[g*2],F[g*2+1],F[c*2],F[c*2+1])}var w=this,I=0,C,K=[],F=[],B,O,E,H,P,V,G,aa,Q,S,T,k,L,ca,
+W,X,$,da,ea,fa,J,ia,la,ja,oa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);C={signature:b.substr(I,8),header_bytes:n(b,I+8),vertex_coordinate_bytes:n(b,I+9),normal_coordinate_bytes:n(b,I+10),uv_coordinate_bytes:n(b,I+11),vertex_index_bytes:n(b,I+12),normal_index_bytes:n(b,I+13),uv_index_bytes:n(b,I+14),material_index_bytes:n(b,I+15),nvertices:h(b,I+16),nnormals:h(b,I+16+4),nuvs:h(b,I+16+8),ntri_flat:h(b,I+16+12),ntri_smooth:h(b,I+16+16),ntri_flat_uv:h(b,I+16+20),ntri_smooth_uv:h(b,
+I+16+24),nquad_flat:h(b,I+16+28),nquad_smooth:h(b,I+16+32),nquad_flat_uv:h(b,I+16+36),nquad_smooth_uv:h(b,I+16+40)};I+=C.header_bytes;B=C.vertex_index_bytes;O=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;H=C.vertex_index_bytes*3+C.material_index_bytes;P=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;G=C.vertex_index_bytes;aa=C.vertex_index_bytes*2;Q=C.vertex_index_bytes*3;S=C.vertex_index_bytes*4;T=C.vertex_index_bytes*
+4+C.material_index_bytes;k=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;L=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ca=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;W=C.uv_index_bytes;X=C.uv_index_bytes*2;$=C.uv_index_bytes;da=C.uv_index_bytes*2;ea=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes;fa=C.ntri_flat*c;J=C.ntri_smooth*(c+C.normal_index_bytes*3);ia=C.ntri_flat_uv*
+(c+C.uv_index_bytes*3);la=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ja=C.nquad_flat*oa;c=C.nquad_smooth*(oa+C.normal_index_bytes*4);oa=C.nquad_flat_uv*(oa+C.uv_index_bytes*4);I+=function(c){for(var f,g,h,k=C.vertex_coordinate_bytes*3,m=c+C.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+C.vertex_coordinate_bytes),h=e(b,c+C.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(w,f,g,h);return C.nvertices*k}(I);I+=function(c){for(var e,f,g,h=C.normal_coordinate_bytes*3,j=c+C.nnormals*
+h;c<j;c+=h)e=t(b,c),f=t(b,c+C.normal_coordinate_bytes),g=t(b,c+C.normal_coordinate_bytes*2),K.push(e/127,f/127,g/127);return C.nnormals*h}(I);I+=function(c){for(var f,g,h=C.uv_coordinate_bytes*2,k=c+C.nuvs*h;c<k;c+=h)f=e(b,c),g=e(b,c+C.uv_coordinate_bytes),F.push(f,g);return C.nuvs*h}(I);fa=I+fa;J=fa+J;ia=J+ia;la=ia+la;ja=la+ja;c=ja+c;oa=c+oa;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=e+C.uv_index_bytes*3,g=b+C.ntri_flat_uv*f;for(c=b;c<g;c+=f)o(c),z(c+e);return g-b})(J);
+(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,g=b+C.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),z(c+e);return g-b})(ia);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,g=b+C.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=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=e+C.uv_index_bytes*4,g=b+C.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),y(c+
+e);return g-b})(oa);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)o(c);return f-b})(I);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(fa);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(la);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
+4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(ja);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,g){b.faces.push(new THREE.Face4(c,e,f,h,null,null,b.materials[g]))},
+f3n:function(b,c,e,f,h,g,j,m,p){var g=b.materials[g],t=c[m*3],n=c[m*3+1],m=c[m*3+2],o=c[p*3],v=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(t,n,m),new THREE.Vector3(o,v,p)],null,g))},f4n:function(b,c,e,f,h,g,j,m,p,t,n){var j=b.materials[j],o=c[p*3],v=c[p*3+1],p=c[p*3+2],u=c[t*3],x=c[t*3+1],t=c[t*3+2],z=c[n*3],y=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(e,f,h,g,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(o,
+v,p),new THREE.Vector3(u,x,t),new THREE.Vector3(z,y,n)],null,j))},uv3:function(b,c,e,f,h,g,j){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,h));m.push(new THREE.UV(g,j));b.push(m)},uv4:function(b,c,e,f,h,g,j,m,p){var t=[];t.push(new THREE.UV(c,e));t.push(new THREE.UV(f,h));t.push(new THREE.UV(g,j));t.push(new THREE.UV(m,p));b.push(t)}};
 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 g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(v in E.objects)if(!L.objects[v])if(H=E.objects[v],H.geometry!==void 0){if(C=L.geometries[H.geometry]){var b=!1;I=[];for(Y=0;Y<H.materials.length;Y++)I[Y]=L.materials[H.materials[Y]],b=I[Y]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();A=H.position;r=H.rotation;
-q=H.quaternion;s=H.scale;q=0;I.length==0&&(I[0]=new THREE.MeshFaceMaterial);I.length>1&&(I=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,I);object.name=v;object.position.set(A[0],A[1],A[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;L.scene.addObject(object);L.objects[v]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b));
-if(H.castsShadow)b=new THREE.ShadowVolume(C),L.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},L.triggers[object.name]=b)}}else A=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(A[0],A[1],A[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,L.scene.addObject(object),L.objects[v]=object,L.empties[v]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}function o(b){return function(c){L.geometries[b]=c;m();Q-=1;e.onLoadComplete();n()}}function t(b){return function(c){L.geometries[b]=c}}function n(){e.callbackProgress({totalModels:T,totalTextures:j,loadedModels:T-Q,loadedTextures:j-S},L);e.onLoadProgress();Q==0&&S==0&&c(L)}var p,
-u,v,x,z,y,w,H,A,J,G,C,P,F,K,I,V,E,$,Q,S,T,j,L;E=b.data;K=new THREE.BinaryLoader;$=new THREE.JSONLoader;S=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in E.objects)if(H=E.objects[v],H.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(E.transform){b=E.transform.position;J=E.transform.rotation;var fa=E.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);J&&L.scene.rotation.set(J[0],
-J[1],J[2]);fa&&L.scene.scale.set(fa[0],fa[1],fa[2]);(b||J||fa)&&L.scene.updateMatrix()}b=function(){S-=1;n();e.onLoadComplete()};for(z in E.cameras){J=E.cameras[z];if(J.type=="perspective")P=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);A=J.position;J=J.target;P.position.set(A[0],A[1],A[2]);P.target.position.set(J[0],J[1],J[2]);L.cameras[z]=P}for(x in E.lights)z=E.lights[x],
-P=z.color!==void 0?z.color:16777215,J=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(A=z.direction,V=new THREE.DirectionalLight(P,J),V.position.set(A[0],A[1],A[2]),V.position.normalize()):z.type=="point"?(A=z.position,d=z.distance,V=new THREE.PointLight(P,J,d),V.position.set(A[0],A[1],A[2])):z.type=="ambient"&&(V=new THREE.AmbientLight(P)),L.scene.addLight(V),L.lights[x]=V;for(y in E.fogs)x=E.fogs[y],x.type=="linear"?F=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(F=new THREE.FogExp2(0,
-x.density)),J=x.color,F.color.setRGB(J[0],J[1],J[2]),L.fogs[y]=F;if(L.cameras&&E.defaults.camera)L.currentCamera=L.cameras[E.defaults.camera];if(L.fogs&&E.defaults.fog)L.scene.fog=L.fogs[E.defaults.fog];J=E.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(J[0],J[1],J[2]);L.bgColorAlpha=E.defaults.bgalpha;for(p in E.geometries)if(y=E.geometries[p],y.type=="bin_mesh"||y.type=="ascii_mesh")Q+=1,e.onLoadStart();T=Q;for(p in E.geometries)y=E.geometries[p],y.type=="cube"?(C=new THREE.CubeGeometry(y.width,
-y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),L.geometries[p]=C):y.type=="plane"?(C=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),L.geometries[p]=C):y.type=="sphere"?(C=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),L.geometries[p]=C):y.type=="cylinder"?(C=new THREE.CylinderGeometry(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset),L.geometries[p]=C):y.type=="torus"?(C=new THREE.TorusGeometry(y.radius,
-y.tube,y.segmentsR,y.segmentsT),L.geometries[p]=C):y.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(y.subdivisions),L.geometries[p]=C):y.type=="bin_mesh"?K.load({model:f(y.url,E.urlBaseType),callback:o(p)}):y.type=="ascii_mesh"?$.load({model:f(y.url,E.urlBaseType),callback:o(p)}):y.type=="embedded_mesh"&&(y=E.embeds[y.id])&&$.createModel(y,t(p),"");for(w in E.textures)if(p=E.textures[w],p.url instanceof Array){S+=p.url.length;for(K=0;K<p.url.length;K++)e.onLoadStart()}else S+=1,e.onLoadStart();
-j=S;for(w in E.textures){p=E.textures[w];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){K=[];for(var Y=0;Y<p.url.length;Y++)K[Y]=f(p.url[Y],E.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,p.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(p.url,E.urlBaseType),p.mapping,b);if(THREE[p.minFilter]!=void 0)K.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)K.magFilter=THREE[p.magFilter];if(p.repeat){K.repeat.set(p.repeat[0],p.repeat[1]);
-if(p.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}p.offset&&K.offset.set(p.offset[0],p.offset[1]);if(p.wrap){$={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if($[p.wrap[0]]!==void 0)K.wrapS=$[p.wrap[0]];if($[p.wrap[1]]!==void 0)K.wrapT=$[p.wrap[1]]}}L.textures[w]=K}for(u in E.materials){w=E.materials[u];for(G in w.parameters)if(G=="envMap"||G=="map"||G=="lightMap")w.parameters[G]=L.textures[w.parameters[G]];else if(G=="shading")w.parameters[G]=
-w.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")w.parameters[G]=THREE[w.parameters[G]]?THREE[w.parameters[G]]:THREE.NormalBlending;else if(G=="combine")w.parameters[G]=w.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(w.parameters[G]=="face")w.parameters[G]=THREE.FaceColors;else if(w.parameters[G])w.parameters[G]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=
-!0;if(w.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(p.uniforms);K=w.parameters.color;$=w.parameters.specular;y=w.parameters.ambient;F=w.parameters.shininess;b.tNormal.texture=L.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=
-L.textures[w.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex($);b.uAmbientColor.value.setHex(y);b.uShininess.value=F;if(w.parameters.opacity)b.uOpacity.value=w.parameters.opacity;w=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:b,lights:!0,fog:!0})}else w=new THREE[w.type](w.parameters);L.materials[u]=w}m();e.callbackSync(L)}}};
+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 G.objects)if(!L.objects[u])if(I=G.objects[u],I.geometry!==void 0){if(B=L.geometries[I.geometry]){var b=!1;P=[];for(W=0;W<I.materials.length;W++)P[W]=L.materials[I.materials[W]],b=P[W]instanceof THREE.MeshShaderMaterial;b&&B.computeTangents();C=I.position;r=I.rotation;
+q=I.quaternion;s=I.scale;q=0;P.length==0&&(P[0]=new THREE.MeshFaceMaterial);P.length>1&&(P=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(B,P);object.name=u;object.position.set(C[0],C[1],C[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=I.visible;L.scene.addObject(object);L.objects[u]=object;I.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b));
+if(I.castsShadow)b=new THREE.ShadowVolume(B),L.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},L.triggers[object.name]=b)}}else C=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(C[0],C[1],C[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=I.visible!==void 0?I.visible:!1,L.scene.addObject(object),L.objects[u]=object,L.empties[u]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},L.triggers[object.name]=b)}function p(b){return function(c){L.geometries[b]=c;m();Q-=1;e.onLoadComplete();n()}}function t(b){return function(c){L.geometries[b]=c}}function n(){e.callbackProgress({totalModels:T,totalTextures:k,loadedModels:T-Q,loadedTextures:k-S},L);e.onLoadProgress();Q==0&&S==0&&c(L)}var o,
+v,u,x,z,y,w,I,C,K,F,B,O,E,H,P,V,G,aa,Q,S,T,k,L;G=b.data;H=new THREE.BinaryLoader;aa=new THREE.JSONLoader;S=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in G.objects)if(I=G.objects[u],I.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(G.transform){b=G.transform.position;K=G.transform.rotation;var ca=G.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);K&&L.scene.rotation.set(K[0],
+K[1],K[2]);ca&&L.scene.scale.set(ca[0],ca[1],ca[2]);(b||K||ca)&&L.scene.updateMatrix()}b=function(){S-=1;n();e.onLoadComplete()};for(z in G.cameras){K=G.cameras[z];if(K.type=="perspective")O=new THREE.Camera(K.fov,K.aspect,K.near,K.far);else if(K.type=="ortho")O=new THREE.Camera,O.projectionMatrix=THREE.Matrix4.makeOrtho(K.left,K.right,K.top,K.bottom,K.near,K.far);C=K.position;K=K.target;O.position.set(C[0],C[1],C[2]);O.target.position.set(K[0],K[1],K[2]);L.cameras[z]=O}for(x in G.lights)z=G.lights[x],
+O=z.color!==void 0?z.color:16777215,K=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(C=z.direction,V=new THREE.DirectionalLight(O,K),V.position.set(C[0],C[1],C[2]),V.position.normalize()):z.type=="point"?(C=z.position,d=z.distance,V=new THREE.PointLight(O,K,d),V.position.set(C[0],C[1],C[2])):z.type=="ambient"&&(V=new THREE.AmbientLight(O)),L.scene.addLight(V),L.lights[x]=V;for(y in G.fogs)x=G.fogs[y],x.type=="linear"?E=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(E=new THREE.FogExp2(0,
+x.density)),K=x.color,E.color.setRGB(K[0],K[1],K[2]),L.fogs[y]=E;if(L.cameras&&G.defaults.camera)L.currentCamera=L.cameras[G.defaults.camera];if(L.fogs&&G.defaults.fog)L.scene.fog=L.fogs[G.defaults.fog];K=G.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(K[0],K[1],K[2]);L.bgColorAlpha=G.defaults.bgalpha;for(o in G.geometries)if(y=G.geometries[o],y.type=="bin_mesh"||y.type=="ascii_mesh")Q+=1,e.onLoadStart();T=Q;for(o in G.geometries)y=G.geometries[o],y.type=="cube"?(B=new THREE.CubeGeometry(y.width,
+y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),L.geometries[o]=B):y.type=="plane"?(B=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),L.geometries[o]=B):y.type=="sphere"?(B=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),L.geometries[o]=B):y.type=="cylinder"?(B=new THREE.CylinderGeometry(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset),L.geometries[o]=B):y.type=="torus"?(B=new THREE.TorusGeometry(y.radius,
+y.tube,y.segmentsR,y.segmentsT),L.geometries[o]=B):y.type=="icosahedron"?(B=new THREE.IcosahedronGeometry(y.subdivisions),L.geometries[o]=B):y.type=="bin_mesh"?H.load({model:f(y.url,G.urlBaseType),callback:p(o)}):y.type=="ascii_mesh"?aa.load({model:f(y.url,G.urlBaseType),callback:p(o)}):y.type=="embedded_mesh"&&(y=G.embeds[y.id])&&aa.createModel(y,t(o),"");for(w in G.textures)if(o=G.textures[w],o.url instanceof Array){S+=o.url.length;for(H=0;H<o.url.length;H++)e.onLoadStart()}else S+=1,e.onLoadStart();
+k=S;for(w in G.textures){o=G.textures[w];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){H=[];for(var W=0;W<o.url.length;W++)H[W]=f(o.url[W],G.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,o.mapping,b)}else{H=THREE.ImageUtils.loadTexture(f(o.url,G.urlBaseType),o.mapping,b);if(THREE[o.minFilter]!=void 0)H.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)H.magFilter=THREE[o.magFilter];if(o.repeat){H.repeat.set(o.repeat[0],o.repeat[1]);
+if(o.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}o.offset&&H.offset.set(o.offset[0],o.offset[1]);if(o.wrap){aa={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(aa[o.wrap[0]]!==void 0)H.wrapS=aa[o.wrap[0]];if(aa[o.wrap[1]]!==void 0)H.wrapT=aa[o.wrap[1]]}}L.textures[w]=H}for(v in G.materials){w=G.materials[v];for(F in w.parameters)if(F=="envMap"||F=="map"||F=="lightMap")w.parameters[F]=L.textures[w.parameters[F]];else if(F=="shading")w.parameters[F]=
+w.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")w.parameters[F]=THREE[w.parameters[F]]?THREE[w.parameters[F]]:THREE.NormalBlending;else if(F=="combine")w.parameters[F]=w.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(w.parameters[F]=="face")w.parameters[F]=THREE.FaceColors;else if(w.parameters[F])w.parameters[F]=THREE.VertexColors;if(w.parameters.opacity!==void 0&&w.parameters.opacity<1)w.parameters.transparent=
+!0;if(w.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(o.uniforms);H=w.parameters.color;aa=w.parameters.specular;y=w.parameters.ambient;E=w.parameters.shininess;b.tNormal.texture=L.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=
+L.textures[w.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(H);b.uSpecularColor.value.setHex(aa);b.uAmbientColor.value.setHex(y);b.uShininess.value=E;if(w.parameters.opacity)b.uOpacity.value=w.parameters.opacity;w=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:b,lights:!0,fog:!0})}else w=new THREE[w.type](w.parameters);L.materials[v]=w}m();e.callbackSync(L)}}};
 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,g){return b+(c-b)*g};this.VIntX=function(b,c,g,k,h,m,o,t,n,p){h=(h-n)/(p-n);n=this.normal_cache;c[k]=m+h*this.delta;c[k+1]=o;c[k+2]=t;g[k]=this.lerp(n[b],n[b+3],h);g[k+1]=this.lerp(n[b+1],n[b+4],h);g[k+2]=this.lerp(n[b+2],n[b+5],h)};this.VIntY=function(b,c,g,k,h,m,o,t,n,p){h=(h-n)/(p-n);n=this.normal_cache;c[k]=m;c[k+1]=o+h*this.delta;c[k+
-2]=t;c=b+this.yd*3;g[k]=this.lerp(n[b],n[c],h);g[k+1]=this.lerp(n[b+1],n[c+1],h);g[k+2]=this.lerp(n[b+2],n[c+2],h)};this.VIntZ=function(b,c,g,k,h,m,o,t,n,p){h=(h-n)/(p-n);n=this.normal_cache;c[k]=m;c[k+1]=o;c[k+2]=t+h*this.delta;c=b+this.zd*3;g[k]=this.lerp(n[b],n[c],h);g[k+1]=this.lerp(n[b+1],n[c+1],h);g[k+2]=this.lerp(n[b+2],n[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,k,h,m){var o=k+1,t=k+this.yd,n=k+this.zd,p=o+this.yd,u=o+this.zd,v=k+this.yd+this.zd,x=o+this.yd+this.zd,z=0,y=this.field[k],w=this.field[o],H=this.field[t],A=this.field[p],J=this.field[n],G=this.field[u],C=this.field[v],P=this.field[x];y<h&&(z|=1);w<h&&(z|=2);H<h&&(z|=8);A<h&&(z|=4);J<h&&(z|=16);G<h&&(z|=32);C<h&&(z|=128);P<h&&(z|=64);var F=THREE.edgeTable[z];if(F==0)return 0;var K=this.delta,
-I=b+K,V=c+K,K=g+K;F&1&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,0,h,b,c,g,y,w));F&2&&(this.compNorm(o),this.compNorm(p),this.VIntY(o*3,this.vlist,this.nlist,3,h,I,c,g,w,A));F&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,b,V,g,H,A));F&8&&(this.compNorm(k),this.compNorm(t),this.VIntY(k*3,this.vlist,this.nlist,9,h,b,c,g,y,H));F&16&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,12,h,b,c,K,J,G));F&32&&(this.compNorm(u),
-this.compNorm(x),this.VIntY(u*3,this.vlist,this.nlist,15,h,I,c,K,G,P));F&64&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,18,h,b,V,K,C,P));F&128&&(this.compNorm(n),this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,21,h,b,c,K,J,C));F&256&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,24,h,b,c,g,y,J));F&512&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,27,h,I,c,g,w,G));F&1024&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*
-3,this.vlist,this.nlist,30,h,I,V,g,A,P));F&2048&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*3,this.vlist,this.nlist,33,h,b,V,g,H,C));z<<=4;for(h=k=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,k++;return k};this.posnormtriv=function(b,c,g,k,h,m){var o=this.count*3;this.positionArray[o]=b[g];this.positionArray[o+1]=b[g+1];this.positionArray[o+2]=b[g+2];this.positionArray[o+3]=b[k];this.positionArray[o+
-4]=b[k+1];this.positionArray[o+5]=b[k+2];this.positionArray[o+6]=b[h];this.positionArray[o+7]=b[h+1];this.positionArray[o+8]=b[h+2];this.normalArray[o]=c[g];this.normalArray[o+1]=c[g+1];this.normalArray[o+2]=c[g+2];this.normalArray[o+3]=c[k];this.normalArray[o+4]=c[k+1];this.normalArray[o+5]=c[k+2];this.normalArray[o+6]=c[h];this.normalArray[o+7]=c[h+1];this.normalArray[o+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,k,h){var m=this.size*Math.sqrt(k/h),o=g*this.size,t=c*this.size,n=b*this.size,p=Math.floor(o-m);p<1&&(p=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(t-m);u<1&&(u=1);t=Math.floor(t+m);t>this.size-1&&(t=this.size-1);var v=Math.floor(n-m);v<1&&(v=1);m=Math.floor(n+m);m>this.size-1&&(m=this.size-
-1);for(var x,z,y,w,H,A;p<o;p++){n=this.size2*p;z=p/this.size-g;H=z*z;for(z=u;z<t;z++){y=n+this.size*z;x=z/this.size-c;A=x*x;for(x=v;x<m;x++)w=x/this.size-b,w=k/(1.0E-6+w*w+A+H)-h,w>0&&(this.field[y+x]+=w)}}};this.addPlaneX=function(b,c){var g,k,h,m,o,t=this.size,n=this.yd,p=this.zd,u=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(g=0;g<v;g++)if(k=g/t,k*=k,m=b/(1.0E-4+k)-c,m>0)for(k=0;k<t;k++){o=g+k*n;for(h=0;h<t;h++)u[p*h+o]+=m}};this.addPlaneY=function(b,c){var g,k,h,m,o,t,n=this.size,p=this.yd,u=
-this.zd,v=this.field,x=n*Math.sqrt(b/c);x>n&&(x=n);for(k=0;k<x;k++)if(g=k/n,g*=g,m=b/(1.0E-4+g)-c,m>0){o=k*p;for(g=0;g<n;g++){t=o+g;for(h=0;h<n;h++)v[u*h+t]+=m}}};this.addPlaneZ=function(b,c){var g,k,h,m,o,t;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){o=zd*h;for(k=0;k<size;k++){t=o+k*yd;for(g=0;g<size;g++)field[t+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,k,h,m,o,t,n,p,u=this.size-2;for(h=1;h<u;h++){p=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(k=1;k<u;k++){n=p+this.size*k;o=(k-this.halfsize)/this.halfsize;for(g=1;g<u;g++)m=(g-this.halfsize)/this.halfsize,c=n+g,this.polygonize(m,o,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(k){var h,m,o,t,n,p,u,v;for(h=0;h<k.count;h++)u=h*3,n=u+1,v=u+2,m=k.positionArray[u],
-o=k.positionArray[n],t=k.positionArray[v],p=new THREE.Vector3(m,o,t),m=k.normalArray[u],o=k.normalArray[n],t=k.normalArray[v],u=new THREE.Vector3(m,o,t),u.normalize(),n=new THREE.Vertex(p),c.vertices.push(n),g.push(u);nfaces=k.count/3;for(h=0;h<nfaces;h++)u=(b+h)*3,n=u+1,v=u+2,p=g[u],m=g[n],o=g[v],u=new THREE.Face3(u,n,v,[p,m,o]),c.faces.push(u);b+=nfaces;k.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,h){return b+(c-b)*h};this.VIntX=function(b,c,h,g,j,m,p,t,n,o){j=(j-n)/(o-n);n=this.normal_cache;c[g]=m+j*this.delta;c[g+1]=p;c[g+2]=t;h[g]=this.lerp(n[b],n[b+3],j);h[g+1]=this.lerp(n[b+1],n[b+4],j);h[g+2]=this.lerp(n[b+2],n[b+5],j)};this.VIntY=function(b,c,h,g,j,m,p,t,n,o){j=(j-n)/(o-n);n=this.normal_cache;c[g]=m;c[g+1]=p+j*this.delta;c[g+
+2]=t;c=b+this.yd*3;h[g]=this.lerp(n[b],n[c],j);h[g+1]=this.lerp(n[b+1],n[c+1],j);h[g+2]=this.lerp(n[b+2],n[c+2],j)};this.VIntZ=function(b,c,h,g,j,m,p,t,n,o){j=(j-n)/(o-n);n=this.normal_cache;c[g]=m;c[g+1]=p;c[g+2]=t+j*this.delta;c=b+this.zd*3;h[g]=this.lerp(n[b],n[c],j);h[g+1]=this.lerp(n[b+1],n[c+1],j);h[g+2]=this.lerp(n[b+2],n[c+2],j)};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,g,j,m){var p=g+1,t=g+this.yd,n=g+this.zd,o=p+this.yd,v=p+this.zd,u=g+this.yd+this.zd,x=p+this.yd+this.zd,z=0,y=this.field[g],w=this.field[p],I=this.field[t],C=this.field[o],K=this.field[n],F=this.field[v],B=this.field[u],O=this.field[x];y<j&&(z|=1);w<j&&(z|=2);I<j&&(z|=8);C<j&&(z|=4);K<j&&(z|=16);F<j&&(z|=32);B<j&&(z|=128);O<j&&(z|=64);var E=THREE.edgeTable[z];if(E==0)return 0;var H=this.delta,
+P=b+H,V=c+H,H=h+H;E&1&&(this.compNorm(g),this.compNorm(p),this.VIntX(g*3,this.vlist,this.nlist,0,j,b,c,h,y,w));E&2&&(this.compNorm(p),this.compNorm(o),this.VIntY(p*3,this.vlist,this.nlist,3,j,P,c,h,w,C));E&4&&(this.compNorm(t),this.compNorm(o),this.VIntX(t*3,this.vlist,this.nlist,6,j,b,V,h,I,C));E&8&&(this.compNorm(g),this.compNorm(t),this.VIntY(g*3,this.vlist,this.nlist,9,j,b,c,h,y,I));E&16&&(this.compNorm(n),this.compNorm(v),this.VIntX(n*3,this.vlist,this.nlist,12,j,b,c,H,K,F));E&32&&(this.compNorm(v),
+this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,15,j,P,c,H,F,O));E&64&&(this.compNorm(u),this.compNorm(x),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,V,H,B,O));E&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,j,b,c,H,K,B));E&256&&(this.compNorm(g),this.compNorm(n),this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,c,h,y,K));E&512&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,27,j,P,c,h,w,F));E&1024&&(this.compNorm(o),this.compNorm(x),this.VIntZ(o*
+3,this.vlist,this.nlist,30,j,P,V,h,C,O));E&2048&&(this.compNorm(t),this.compNorm(u),this.VIntZ(t*3,this.vlist,this.nlist,33,j,b,V,h,I,B));z<<=4;for(j=g=0;THREE.triTable[z+j]!=-1;)b=z+j,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),j+=3,g++;return g};this.posnormtriv=function(b,c,h,g,j,m){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[g];this.positionArray[p+
+4]=b[g+1];this.positionArray[p+5]=b[g+2];this.positionArray[p+6]=b[j];this.positionArray[p+7]=b[j+1];this.positionArray[p+8]=b[j+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[g];this.normalArray[p+4]=c[g+1];this.normalArray[p+5]=c[g+2];this.normalArray[p+6]=c[j];this.normalArray[p+7]=c[j+1];this.normalArray[p+8]=c[j+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,g,j){var m=this.size*Math.sqrt(g/j),p=h*this.size,t=c*this.size,n=b*this.size,o=Math.floor(p-m);o<1&&(o=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(t-m);v<1&&(v=1);t=Math.floor(t+m);t>this.size-1&&(t=this.size-1);var u=Math.floor(n-m);u<1&&(u=1);m=Math.floor(n+m);m>this.size-1&&(m=this.size-
+1);for(var x,z,y,w,I,C;o<p;o++){n=this.size2*o;z=o/this.size-h;I=z*z;for(z=v;z<t;z++){y=n+this.size*z;x=z/this.size-c;C=x*x;for(x=u;x<m;x++)w=x/this.size-b,w=g/(1.0E-6+w*w+C+I)-j,w>0&&(this.field[y+x]+=w)}}};this.addPlaneX=function(b,c){var h,g,j,m,p,t=this.size,n=this.yd,o=this.zd,v=this.field,u=t*Math.sqrt(b/c);u>t&&(u=t);for(h=0;h<u;h++)if(g=h/t,g*=g,m=b/(1.0E-4+g)-c,m>0)for(g=0;g<t;g++){p=h+g*n;for(j=0;j<t;j++)v[o*j+p]+=m}};this.addPlaneY=function(b,c){var h,g,j,m,p,t,n=this.size,o=this.yd,v=
+this.zd,u=this.field,x=n*Math.sqrt(b/c);x>n&&(x=n);for(g=0;g<x;g++)if(h=g/n,h*=h,m=b/(1.0E-4+h)-c,m>0){p=g*o;for(h=0;h<n;h++){t=p+h;for(j=0;j<n;j++)u[v*j+t]+=m}}};this.addPlaneZ=function(b,c){var h,g,j,m,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(h=j/size,h*=h,m=b/(1.0E-4+h)-c,m>0){p=zd*j;for(g=0;g<size;g++){t=p+g*yd;for(h=0;h<size;h++)field[t+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,g,j,m,p,t,n,o,v=this.size-2;for(j=1;j<v;j++){o=this.size2*j;t=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++){n=o+this.size*g;p=(g-this.halfsize)/this.halfsize;for(h=1;h<v;h++)m=(h-this.halfsize)/this.halfsize,c=n+h,this.polygonize(m,p,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(g){var j,m,p,t,n,o,v,u;for(j=0;j<g.count;j++)v=j*3,n=v+1,u=v+2,m=g.positionArray[v],
+p=g.positionArray[n],t=g.positionArray[u],o=new THREE.Vector3(m,p,t),m=g.normalArray[v],p=g.normalArray[n],t=g.normalArray[u],v=new THREE.Vector3(m,p,t),v.normalize(),n=new THREE.Vertex(o),c.vertices.push(n),h.push(v);nfaces=g.count/3;for(j=0;j<nfaces;j++)v=(b+j)*3,n=v+1,u=v+2,o=h[v],m=h[n],p=h[u],v=new THREE.Face3(v,n,u,[o,m,p]),c.faces.push(v);b+=nfaces;g.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]);
@@ -597,27 +595,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,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=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.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,g,k=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>k?this.hits.push(g):this.hits.unshift(g),k=f;return this.hits};
+THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,g=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>g?this.hits.push(h):this.hits.unshift(h),g=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,g,k=0;k<c.numFaces;k++){var h=c.mesh.geometry.faces[k],m=c.mesh.geometry.vertices[h.a].position,o=c.mesh.geometry.vertices[h.b].position,t=c.mesh.geometry.vertices[h.c].position,n=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,m,o,t,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-h instanceof THREE.Face4&&(h=this.rayTriangle(e,m,o,n,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,o,t,n,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,k,h){var m=THREE.CollisionSystem.__v1,o=THREE.CollisionSystem.__v2;k.set(0,0,0);m.sub(e,c);o.sub(f,e);k.cross(m,o);m=k.dot(b.direction);if(!(m<0))if(h.doubleSided||h.flipSided)k.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;h=k.dot(c)-k.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(k.x)>
-Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=m.y-c.y,k=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,k=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(k.y)>Math.abs(k.z)?(b=m.x-c.x,k=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,k=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=k*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*=k*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,g=0;g<c.numFaces;g++){var j=c.mesh.geometry.faces[g],m=c.mesh.geometry.vertices[j.a].position,p=c.mesh.geometry.vertices[j.b].position,t=c.mesh.geometry.vertices[j.c].position,n=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(e,m,p,t,f,this.collisionNormal,c.mesh),j<f&&(f=j,h=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+j instanceof THREE.Face4&&(j=this.rayTriangle(e,m,p,n,f,this.collisionNormal,c.mesh),j<f&&(f=j,h=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(e,p,t,n,f,this.collisionNormal,c.mesh),j<f&&(f=j,h=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:h}};
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,h,g,j){var m=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;g.set(0,0,0);m.sub(e,c);p.sub(f,e);g.cross(m,p);m=g.dot(b.direction);if(!(m<0))if(j.doubleSided||j.flipSided)g.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=m*h))return Number.MAX_VALUE;j/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(j);m.addSelf(b.origin);Math.abs(g.x)>
+Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(b=m.y-c.y,g=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,g=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(g.y)>Math.abs(g.z)?(b=m.x-c.x,g=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,g=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=g*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*=g*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j};
 THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var 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,g=0,k=0,h=0,m=0,o=0,t=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,t=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,t=!1,h=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,t=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
-t=!1,m=1);e.origin.z<c.min.z?(k=c.min.z-e.origin.z,k/=e.direction.z,t=!1,o=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,t=!1,o=1);if(t)return-1;t=0;g>f&&(t=1,f=g);k>f&&(t=2,f=k);switch(t){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,o)}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,h=0,g=0,j=0,m=0,p=0,t=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,t=!1,j=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,t=!1,j=1);e.origin.y<c.min.y?(h=c.min.y-e.origin.y,h/=e.direction.y,t=!1,m=-1):e.origin.y>c.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y,
+t=!1,m=1);e.origin.z<c.min.z?(g=c.min.z-e.origin.z,g/=e.direction.z,t=!1,p=-1):e.origin.z>c.max.z&&(g=c.max.z-e.origin.z,g/=e.direction.z,t=!1,p=1);if(t)return-1;t=0;h>f&&(t=1,f=h);g>f&&(t=2,f=g);switch(t){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(j,0,0);break;case 1:j=e.origin.x+e.direction.x*f;if(j<c.min.x||j>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:j=e.origin.x+e.direction.x*f;if(j<c.min.x||j>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,g=new THREE.Camera,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,o,t,n;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:u}},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 x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||t!==e.near||n!==e.fov){o=e.aspect;t=e.near;n=e.fov;var w=e.projectionMatrix.clone(),H=125/30*0.5,A=H*t/125,J=t*Math.tan(n*Math.PI/360),G;h.n14=H;m.n14=-H;H=-J*o+A;G=J*o+A;w.n11=2*t/(G-H);w.n13=(G+H)/(G-H);g.projectionMatrix=w.clone();H=-J*o-A;G=J*o-A;w.n11=2*t/(G-H);
-w.n13=(G+H)/(G-H);k.projectionMatrix=w.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,p,!0);k.matrix=e.matrixWorld.clone().multiplySelf(h);k.update(null,!0);k.position.copy(e.position);k.near=t;k.far=e.far;f.call(c,b,k,u,!0);f.call(c,x,v)}};
-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,k,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;k=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,k);f.call(c,b,h);this.setViewport(g,0,g,k);f.call(c,b,m,!1)}};
+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,g=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,p,t,n;h.useTarget=g.useTarget=!1;h.matrixAutoUpdate=g.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=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:o},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 x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);o.width=b;o.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||n!==e.fov){p=e.aspect;t=e.near;n=e.fov;var w=e.projectionMatrix.clone(),I=125/30*0.5,C=I*t/125,K=t*Math.tan(n*Math.PI/360),F;j.n14=I;m.n14=-I;I=-K*p+C;F=K*p+C;w.n11=2*t/(F-I);w.n13=(F+I)/(F-I);h.projectionMatrix=w.clone();I=-K*p-C;F=K*p-C;w.n11=2*t/(F-I);
+w.n13=(F+I)/(F-I);g.projectionMatrix=w.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=t;h.far=e.far;f.call(c,b,h,o,!0);g.matrix=e.matrixWorld.clone().multiplySelf(j);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,v,!0);f.call(c,x,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,g,j=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;g=f};this.render=function(b,e){this.clear();j.fov=e.fov;j.aspect=0.5*e.aspect;j.near=e.near;j.far=e.far;
+j.updateProjectionMatrix();j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(c.separation);m.projectionMatrix=j.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,h,g);f.call(c,b,j);this.setViewport(h,0,h,g);f.call(c,b,m,!1)}};

+ 208 - 209
build/custom/ThreeExtras.js

@@ -1,12 +1,12 @@
 // ThreeExtras.js r42 - http://github.com/mrdoob/three.js
-THREE.ColorUtils={adjustHSV:function(a,c,b,g){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.ColorUtils.clamp(f.h+c,0,1);f.s=THREE.ColorUtils.clamp(f.s+b,0,1);f.v=THREE.ColorUtils.clamp(f.v+g,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,c){var b=a.r,g=a.g,f=a.b,h=Math.max(Math.max(b,g),f),e=Math.min(Math.min(b,g),f);if(e==h)e=b=0;else{var j=h-e,e=j/h,b=b==h?(g-f)/j:g==h?2+(f-b)/j:4+(b-g)/j;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=e;c.v=h;return c},
-clamp:function(a,c,b){return a<c?c:a>b?b:a}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,g=a.vertices.length,f=b?c.geometry:c,h=a.vertices,e=f.vertices,j=a.faces,k=f.faces,l=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var m=0,n=e.length;m<n;m++){var o=new THREE.Vertex(e[m].position.clone());b&&c.matrix.multiplyVector3(o.position);h.push(o)}m=0;for(n=k.length;m<n;m++){var e=k[m],p,w,t=e.vertexNormals,o=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+g,e.b+g,e.c+
-g):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));p.normal.copy(e.normal);b=0;for(h=t.length;b<h;b++)w=t[b],p.vertexNormals.push(w.clone());p.color.copy(e.color);b=0;for(h=o.length;b<h;b++)w=o[b],p.vertexColors.push(w.clone());p.materials=e.materials.slice();p.centroid.copy(e.centroid);j.push(p)}m=0;for(n=f.length;m<n;m++){g=f[m];j=[];b=0;for(h=g.length;b<h;b++)j.push(new THREE.UV(g[b].u,g[b].v));l.push(j)}},clone:function(a){var c=new THREE.Geometry,b,g=a.vertices,f=a.faces,
-h=a.faceVertexUvs[0],a=0;for(b=g.length;a<b;a++){var e=new THREE.Vertex(g[a].position.clone());c.vertices.push(e)}a=0;for(b=f.length;a<b;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);g=0;for(e=m.length;g<e;g++)l=m[g],k.vertexNormals.push(l.clone());k.color.copy(j.color);g=0;for(e=n.length;g<e;g++)l=n[g],k.vertexColors.push(l.clone());k.materials=j.materials.slice();
-k.centroid.copy(j.centroid);c.faces.push(k)}a=0;for(b=h.length;a<b;a++){f=h[a];k=[];g=0;for(e=f.length;g<e;g++)k.push(new THREE.UV(f[g].u,f[g].v));c.faceVertexUvs[0].push(k)}return c}};
-THREE.ImageUtils={loadTexture:function(a,c,b){var g=new Image,f=new THREE.Texture(g,c);g.onload=function(){f.needsUpdate=!0;b&&b(this)};g.crossOrigin="";g.src=a;return f},loadTextureCube:function(a,c,b){var g,f=[],h=new THREE.Texture(f,c),c=f.loadCount=0;for(g=a.length;c<g;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)h.needsUpdate=!0;b&&b(this)},f[c].crossOrigin="",f[c].src=a[c];return h}};
-THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,g,f=a.children.length;for(g=0;g<f;g++)b=a.children[g],c(b),THREE.SceneUtils.traverseHierarchy(b,c)}};
+THREE.ColorUtils={adjustHSV:function(a,b,c,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.ColorUtils.clamp(g.h+b,0,1);g.s=THREE.ColorUtils.clamp(g.s+c,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,b){var c=a.r,f=a.g,g=a.b,h=Math.max(Math.max(c,f),g),e=Math.min(Math.min(c,f),g);if(e==h)e=c=0;else{var j=h-e,e=j/h,c=c==h?(f-g)/j:f==h?2+(g-c)/j:4+(c-f)/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=e;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,f=a.vertices.length,g=c?b.geometry:b,h=a.vertices,e=g.vertices,j=a.faces,k=g.faces,l=a.faceVertexUvs[0],g=g.faceVertexUvs[0];c&&b.matrixAutoUpdate&&b.updateMatrix();for(var m=0,n=e.length;m<n;m++){var p=new THREE.Vertex(e[m].position.clone());c&&b.matrix.multiplyVector3(p.position);h.push(p)}m=0;for(n=k.length;m<n;m++){var e=k[m],o,x,w=e.vertexNormals,p=e.vertexColors;e instanceof THREE.Face3?o=new THREE.Face3(e.a+f,e.b+f,e.c+
+f):e instanceof THREE.Face4&&(o=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));o.normal.copy(e.normal);c=0;for(h=w.length;c<h;c++)x=w[c],o.vertexNormals.push(x.clone());o.color.copy(e.color);c=0;for(h=p.length;c<h;c++)x=p[c],o.vertexColors.push(x.clone());o.materials=e.materials.slice();o.centroid.copy(e.centroid);j.push(o)}m=0;for(n=g.length;m<n;m++){f=g[m];j=[];c=0;for(h=f.length;c<h;c++)j.push(new THREE.UV(f[c].u,f[c].v));l.push(j)}},clone:function(a){var b=new THREE.Geometry,c,f=a.vertices,g=a.faces,
+h=a.faceVertexUvs[0],a=0;for(c=f.length;a<c;a++){var e=new THREE.Vertex(f[a].position.clone());b.vertices.push(e)}a=0;for(c=g.length;a<c;a++){var j=g[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);f=0;for(e=m.length;f<e;f++)l=m[f],k.vertexNormals.push(l.clone());k.color.copy(j.color);f=0;for(e=n.length;f<e;f++)l=n[f],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++){g=h[a];k=[];f=0;for(e=g.length;f<e;f++)k.push(new THREE.UV(g[f].u,g[f].v));b.faceVertexUvs[0].push(k)}return b}};
+THREE.ImageUtils={loadTexture:function(a,b,c){var f=new Image,g=new THREE.Texture(f,b);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.crossOrigin="";f.src=a;return g},loadTextureCube:function(a,b,c){var f,g=[],h=new THREE.Texture(g,b),b=g.loadCount=0;for(f=a.length;b<f;++b)g[b]=new Image,g[b].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)},g[b].crossOrigin="",g[b].src=a[b];return h}};
+THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,f,g=a.children.length;for(f=0;f<g;f++)c=a.children[f],b(c),THREE.SceneUtils.traverseHierarchy(c,b)}};
 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;",
@@ -16,205 +16,204 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,g,f,h=2*Math.ceil(a*3)+1;h>25&&(h=25);f=(h-1)*0.5;b=Array(h);for(c=g=0;c<h;++c)b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a)),g+=b[c];for(c=0;c<h;++c)b[c]/=g;return b}};
-THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var g=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){g={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var k=0;k<a.hierarchy[b].keys[e].morphTargets.length;k++){var l=a.hierarchy[b].keys[e].morphTargets[k];g[l]=-1}a.hierarchy[b].usedMorphTargets=g;for(e=0;e<a.hierarchy[b].keys.length;e++){var m=
-{};for(l in g){for(k=0;k<a.hierarchy[b].keys[e].morphTargets.length;k++)if(a.hierarchy[b].keys[e].morphTargets[k]===l){m[l]=a.hierarchy[b].keys[e].morphTargetsInfluences[k];break}k===a.hierarchy[b].keys[e].morphTargets.length&&(m[l]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=m}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
-a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else g(a,b);return b}},g=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)g(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
-2;return b}();THREE.Animation=function(a,c,b,g){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==void 0?g:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,g=this.hierarchy.length,f;for(b=0;b<g;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
-THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[b].keys[0];h.rot=this.data.hierarchy[b].keys[0];h.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,f,g,h=2*Math.ceil(a*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(b=f=0;b<h;++b)c[b]=Math.exp(-((b-g)*(b-g))/(2*a*a)),f+=c[b];for(b=0;b<h;++b)c[b]/=f;return c}};
+THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
+0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var f=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(f[0],f[1],f[2],f[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){f={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var k=0;k<a.hierarchy[c].keys[e].morphTargets.length;k++){var l=a.hierarchy[c].keys[e].morphTargets[k];f[l]=-1}a.hierarchy[c].usedMorphTargets=f;for(e=0;e<a.hierarchy[c].keys.length;e++){var m=
+{};for(l in f){for(k=0;k<a.hierarchy[c].keys[e].morphTargets.length;k++)if(a.hierarchy[c].keys[e].morphTargets[k]===l){m[l]=a.hierarchy[c].keys[e].morphTargetsInfluences[k];break}k===a.hierarchy[c].keys[e].morphTargets.length&&(m[l]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=m}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
+a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else f(a,c);return c}},f=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)f(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
+2;return c}();THREE.Animation=function(a,b,c,f){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,f=this.hierarchy.length,g;for(c=0;c<f;c++){g=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===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 h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.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 c=["pos","rot","scl"],b,g,f,h,e,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 p=0,w=this.hierarchy.length;p<w;p++)if(a=this.hierarchy[p],k=a.animationCache,this.JITCompile&&m[p][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=m[p][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 t=0;t<3;t++){b=c[t];e=k.prevKey[b];j=k.nextKey[b];if(j.time<=o){if(n<o)if(this.loop){e=this.data.hierarchy[p].keys[0];for(j=this.getNextKeyWith(b,p,1);j.time<n;)e=j,j=this.getNextKeyWith(b,p,j.index+1)}else{this.stop();return}else{do e=j,j=this.getNextKeyWith(b,p,j.index+1);while(j.time<
-n)}k.prevKey[b]=e;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(n-e.time)/(j.time-e.time);f=e[b];h=j[b];if(g<0||g>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+p),g=g<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=f[0]+(h[0]-f[0])*g,b.y=f[1]+(h[1]-f[1])*g,b.z=f[2]+(h[2]-f[2])*g;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",p,e.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",p,j.index+1).pos,g=g*0.33+0.33,f=this.interpolateCatmullRom(this.points,g),b.x=f[0],b.y=f[1],b.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)g=this.interpolateCatmullRom(this.points,g*1.01),this.target.set(g[0],g[1],g[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),g=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,g,0)}else if(b===
-"rot")THREE.Quaternion.slerp(f,h,a.quaternion,g);else if(b==="scl")b=a.scale,b.x=f[0]+(h[0]-f[0])*g,b.y=f[1]+(h[1]-f[1])*g,b.z=f[2]+(h[2]-f[2])*g}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)m[p][l]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],g=[],f,h,e,j,k,l;f=(a.length-1)*c;h=Math.floor(f);f-=h;b[0]=h==0?h:h-1;b[1]=h;b[2]=h>a.length-2?h:h+1;b[3]=h>a.length-3?h:h+2;h=a[b[0]];j=a[b[1]];k=a[b[2]];l=a[b[3]];b=f*f;e=f*b;g[0]=this.interpolate(h[0],j[0],k[0],l[0],f,b,e);g[1]=this.interpolate(h[1],j[1],k[1],l[1],f,b,e);g[2]=this.interpolate(h[2],j[2],k[2],l[2],f,b,e);return g};
-THREE.Animation.prototype.interpolate=function(a,c,b,g,f,h,e){a=(b-a)*0.5;g=(g-c)*0.5;return(2*(c-b)+a+g)*e+(-3*(c-b)-2*a-g)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var g=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<g.length-1?b:g.length-1:b%=g.length;b<g.length;b++)if(g[b][a]!==void 0)return g[b];return this.data.hierarchy[c].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var g=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+g.length;b>=0;b--)if(g[b][a]!==void 0)return g[b];return this.data.hierarchy[c].keys[g.length-1]};
-THREE.FirstPersonCamera=function(a){function c(a,c){return function(){c.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,f,g,h,e,j,k,l,m=this.data.JIT.hierarchy,n,p;this.currentTime+=a*this.timeScale;p=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 o=0,x=this.hierarchy.length;o<x;o++)if(a=this.hierarchy[o],k=a.animationCache,this.JITCompile&&m[o][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[o][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=m[o][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];e=k.prevKey[c];j=k.nextKey[c];if(j.time<=p){if(n<p)if(this.loop){e=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(c,o,1);j.time<n;)e=j,j=this.getNextKeyWith(c,o,j.index+1)}else{this.stop();return}else{do e=j,j=this.getNextKeyWith(c,o,j.index+1);while(j.time<
+n)}k.prevKey[c]=e;k.nextKey[c]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(n-e.time)/(j.time-e.time);g=e[c];h=j[c];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+o),f=f<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=g[0]+(h[0]-g[0])*f,c.y=g[1]+(h[1]-g[1])*f,c.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",o,e.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,j.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),c.x=g[0],c.y=g[1],c.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,f,0)}else if(c===
+"rot")THREE.Quaternion.slerp(g,h,a.quaternion,f);else if(c==="scl")c=a.scale,c.x=g[0]+(h[0]-g[0])*f,c.y=g[1]+(h[1]-g[1])*f,c.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)m[o][l]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],f=[],g,h,e,j,k,l;g=(a.length-1)*b;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];j=a[c[1]];k=a[c[2]];l=a[c[3]];c=g*g;e=g*c;f[0]=this.interpolate(h[0],j[0],k[0],l[0],g,c,e);f[1]=this.interpolate(h[1],j[1],k[1],l[1],g,c,e);f[2]=this.interpolate(h[2],j[2],k[2],l[2],g,c,e);return f};
+THREE.Animation.prototype.interpolate=function(a,b,c,f,g,h,e){a=(c-a)*0.5;f=(f-b)*0.5;return(2*(b-c)+a+f)*e+(-3*(b-c)-2*a-f)*h+a*g+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<f.length-1?c:f.length-1:c%=f.length;c<f.length;c++)if(f[c][a]!==void 0)return f[c];return this.data.hierarchy[b].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var f=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][a]!==void 0)return f[c];return this.data.hierarchy[b].keys[f.length-1]};
+THREE.FirstPersonCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=
 a.movementSpeed;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.noFly!==void 0)this.noFly=a.noFly;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.autoForward!==void 0)this.autoForward=a.autoForward;if(a.activeLook!==void 0)this.activeLook=a.activeLook;if(a.heightSpeed!==void 0)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==void 0)this.heightCoef=a.heightCoef;if(a.heightMin!==void 0)this.heightMin=a.heightMin;if(a.heightMax!==void 0)this.heightMax=a.heightMax;if(a.constrainVertical!==
 void 0)this.constrainVertical=a.constrainVertical;if(a.verticalMin!==void 0)this.verticalMin=a.verticalMin;if(a.verticalMax!==void 0)this.verticalMax=a.verticalMax;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(a){a.preventDefault();
 a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.mouseX=a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.onKeyDown=function(a){switch(a.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(a){switch(a.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 a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;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 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)}a=
-1;this.constrainVertical&&(a=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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",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(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(a,b,c,e){var g={name:c,fps:0.6,length:e,hierarchy:[]},h,f=b.getControlPointsArray(),j=b.getLength(),k=f.length,y=0;h=k-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)y=e*j.chunks[h]/j.total,b.keys[h]={time:y,pos:f[h]};g.hierarchy[0]=b;THREE.AnimationHandler.add(g);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(a,b){var c,
-e,g=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),g.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return g}function g(a,c){var e=b(c,10),g=b(c,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<c.points.length;i++)e=new THREE.Mesh(g,h),e.position.copy(c.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=
+function(){var a=(new Date).getTime();this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;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 b=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.translateZ(b);this.moveLeft&&this.translateX(-b);
+this.moveRight&&this.translateX(b);this.moveUp&&this.translateY(b);this.moveDown&&this.translateY(-b);b=this.tdiff*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target.position,g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=
+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;g=this.position;a.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=g.y+100*Math.cos(this.phi);a.z=g.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 f={name:b,fps:0.6,length:e,hierarchy:[]},h,g=c.getControlPointsArray(),j=c.getLength(),k=g.length,y=0;h=k-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<k-1;h++)y=e*j.chunks[h]/j.total,c.keys[h]={time:y,pos:g[h]};f.hierarchy[0]=c;THREE.AnimationHandler.add(f);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(a,c){var b,
+e,f=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),f.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function f(a,b){var e=c(b,10),f=c(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,h);particleObj=new THREE.ParticleSystem(f,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);f=new THREE.SphereGeometry(1,
+16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)e=new THREE.Mesh(f,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!==
 void 0)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==void 0)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==void 0)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==void 0)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==void 0)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==void 0)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==void 0)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
-window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,h=Math.PI/180;this.update=function(a,b,c){var e,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)*h;this.theta=this.lon*h;e=this.phi%f;this.phi=e>=0?e:e+f;e=this.verticalAngleMap.srcRange;g=this.verticalAngleMap.dstRange;var j=g[1]-g[0];this.phi=
-TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(g[1]-g[0])/(e[1]-e[0])+g[0]-g[0])/j)*j+g[0];e=this.horizontalAngleMap.srcRange;g=this.horizontalAngleMap.dstRange;j=g[1]-g[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(g[1]-g[0])/(e[1]-e[0])+g[0]-g[0])/j)*j+g[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,b,c)};this.onMouseMove=function(a){this.mouseX=
+window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(a,c,b){var e,f;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;e=this.phi%g;this.phi=e>=0?e:e+g;e=this.verticalAngleMap.srcRange;f=this.verticalAngleMap.dstRange;var j=f[1]-f[0];this.phi=
+TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/j)*j+f[0];e=this.horizontalAngleMap.srcRange;f=this.horizontalAngleMap.dstRange;j=f[1]-f[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(f[1]-f[0])/(e[1]-e[0])+f[0]-f[0])/j)*j+f[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,a,c,b)};this.onMouseMove=function(a){this.mouseX=
 a.clientX-this.windowHalfX;this.mouseY=a.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),e=new THREE.MeshLambertMaterial({color:65280}),j=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,e);a.position.set(0,10,0);this.animation=
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&g(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(a,b){return function(){b.apply(a,arguments)}}(this,this.onMouseMove),
+b(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else this.animation=b(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(a,c){return function(){c.apply(a,arguments)}}(this,this.onMouseMove),
 !1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-THREE.FlyCamera=function(a){function c(a,c){return function(){c.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
+THREE.FlyCamera=function(a){function b(a,b){return function(){b.apply(a,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(a){if(a.movementSpeed!==void 0)this.movementSpeed=a.movementSpeed;if(a.rollSpeed!==void 0)this.rollSpeed=a.rollSpeed;if(a.dragToLook!==void 0)this.dragToLook=a.dragToLook;if(a.autoForward!==void 0)this.autoForward=
 a.autoForward;if(a.domElement!==void 0)this.domElement=a.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.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(a){switch(a.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(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),f=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(a.clientX-c.offset[0]-f)/f;this.moveState.pitchDown=(a.clientY-
-c.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,c=this.tdiff*
-this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);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 a=this.moveState.forward||
+case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),g=b.size[0]/2,h=b.size[1]/2;this.moveState.yawLeft=-(a.clientX-b.offset[0]-g)/g;this.moveState.pitchDown=(a.clientY-
+b.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var a=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=a;this.tdiff=(a-this.lastUpdate)/1E3;this.lastUpdate=a;var a=this.tdiff*this.movementSpeed,b=this.tdiff*
+this.rollSpeed;this.translateX(this.moveVector.x*a);this.translateY(this.moveVector.y*a);this.translateZ(this.moveVector.z*a);this.tmpQuaternion.set(this.rotationVector.x*b,this.rotationVector.y*b,this.rotationVector.z*b,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 a=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=-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",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,
+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,c,b,g){THREE.Camera.call(this,a,c,b,g);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,e=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,o=0,p=0,w=0,t=window.innerWidth/2,v=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*p),this.rotateVertically(a*w));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();e.copy(this.forward);h.set(0,1,0);f.cross(h,e).normalize();h.cross(e,f).normalize();this.matrix.n11=f.x;this.matrix.n12=h.x;this.matrix.n13=e.x;this.matrix.n21=f.y;this.matrix.n22=h.y;this.matrix.n23=e.y;this.matrix.n31=f.z;this.matrix.n32=h.z;this.matrix.n33=e.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);
+THREE.RollCamera=function(a,b,c,f){THREE.Camera.call(this,a,b,c,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.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,h=new THREE.Vector3,e=new THREE.Vector3,j=new THREE.Matrix4,k=!1,l=1,m=0,n=0,p=0,o=0,x=0,w=window.innerWidth/2,u=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*o),this.rotateVertically(a*x));a=this.delta*this.movementSpeed;this.translateZ(a*(m>0||this.autoForward&&!(m<0)?1:m));this.translateX(a*n);this.translateY(a*p);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();e.copy(this.forward);h.set(0,1,0);g.cross(h,e).normalize();h.cross(e,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=e.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=e.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=e.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){p=(a.clientX-t)/window.innerWidth;w=(a.clientY-v)/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;
+this.matrix.n23*a;this.position.z-=this.matrix.n33*a};this.rotateHorizontally=function(a){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(a);this.forward.subSelf(g);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){o=(a.clientX-w)/window.innerWidth;x=(a.clientY-u)/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:p=1;break;case 70:p=-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:p=0;break;case 70:p=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
-THREE.TrackballCamera=function(a){function c(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 b=!1,g=this.STATE.NONE,f=new THREE.Vector3,h=new THREE.Vector3,e=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(e)/h.length()/e.length());if(a){var b=(new THREE.Vector3).cross(h,e).normalize(),c=new THREE.Quaternion;a*=this.rotateSpeed;c.setFromAxisAngle(b,-a);c.multiplyVector3(f);c.multiplyVector3(this.up);c.multiplyVector3(e);this.staticMoving?h=e:(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 b=f.clone().crossSelf(this.up).setLength(a.x);b.addSelf(this.up.clone().setLength(a.y));this.position.addSelf(b);this.target.position.addSelf(b);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,b,c){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,b,c)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-c(this,function(a){b&&(h=e=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),b=!1);g!==this.STATE.NONE&&(g===this.STATE.ROTATE?e=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):g===this.STATE.PAN&&!this.noPan&&(m=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();
-a.stopPropagation();if(g===this.STATE.NONE)g=a.button,g===this.STATE.ROTATE?h=e=this.getMouseProjectionOnBall(a.clientX,a.clientY):g===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",c(this,function(a){a.preventDefault();a.stopPropagation();g=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(g===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])g=
-this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)g=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)g=this.STATE.PAN;g!==this.STATE.NONE&&(b=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(g!==this.STATE.NONE)g=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 c,b=[];for(c=0;c<=a;c++)b.push(this.getPoint(c/a));return b};
-THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var c,b=[];for(c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b};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 c=[],b,g=this.getPoint(0),f,h=0;for(f=1;f<=a;f++)b=this.getPoint(f/a),h+=b.distanceTo(g),c.push(h),g=b;return this.cacheLengths=c};
-THREE.Curve.prototype.getUtoTmapping=function(a,c){var b=this.getLengths(),g=0,f=b.length,h;for(h=c?c:a*b[f-1];g<f;){if(b[g]>h)break;g++}return g/f};THREE.LineCurve=function(a,c,b,g){this.x1=a;this.y1=c;this.x2=b;this.y2=g};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,c,b,g,f,h){this.x0=a;this.y0=c;this.x1=b;this.y1=g;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 c;c=THREE.FontUtils.b2(a,this.x0,this.x1,this.x2);a=THREE.FontUtils.b2(a,this.y0,this.y1,this.y2);return new THREE.Vector2(c,a)};
-THREE.QuadraticBezierCurve.prototype.getNormalVector=function(a){var c;c=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,c)).unit()};THREE.CubicBezierCurve=function(a,c,b,g,f,h,e,j){this.x0=a;this.y0=c;this.x1=b;this.y1=g;this.x2=f;this.y2=h;this.x3=e;this.y3=j};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
-THREE.CubicBezierCurve.prototype.getPoint=function(a){var c;c=THREE.FontUtils.b3(a,this.x0,this.x1,this.x2,this.x3);a=THREE.FontUtils.b3(a,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,a)};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 c=new THREE.Vector2,b=[],g=this.points,f;f=(g.length-1)*a;a=Math.floor(f);f-=a;b[0]=a==0?a:a-1;b[1]=a;b[2]=a>g.length-2?a:a+1;b[3]=a>g.length-3?a:a+2;c.x=THREE.Curve.Utils.interpolate(g[b[0]].x,g[b[1]].x,g[b[2]].x,g[b[3]].x,f);c.y=THREE.Curve.Utils.interpolate(g[b[0]].y,g[b[1]].y,g[b[2]].y,g[b[3]].y,f);return c};THREE.ArcCurve=function(a,c,b,g,f,h){this.aX=a;this.aY=c;this.aRadius=b;this.aStartAngle=g;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 c=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
-THREE.Curve.Utils={tangentQuadraticBezier:function(a,c,b,g){return 2*(1-a)*(b-c)+2*a*(g-b)},tangentSpline:function(){},interpolate:function(a,c,b,g,f){var a=(b-a)*0.5,g=(g-c)*0.5,h=f*f;return(2*c-2*b+a+g)*f*h+(-3*c+3*b-2*a-g)*h+a*f+c}};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 c,b=a.length;for(c=1;c<b;c++)this.lineTo(a[c].x,a[c].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,c){var b=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args,g=new THREE.LineCurve(g[g.length-2],g[g.length-1],a,c);this.curves.push(g);this.actions.push({action:THREE.PathActions.LINE_TO,args:b,curve:g})};
-THREE.Path.prototype.quadraticCurveTo=function(a,c,b,g){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,c,b,g);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f,curve:h})};
-THREE.Path.prototype.bezierCurveTo=function(a,c,b,g,f,h){var e=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,c,b,g,f,h);this.curves.push(j);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e,curve:j})};
-THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])],b=b.concat(a),b=new THREE.SplineCurve(b);this.curves.push(b);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:b})};
-THREE.Path.prototype.arc=function(a,c,b,g,f,h){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,g,f,h));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a,c){a||(a=40);for(var b=[],g=0;g<a;g++)b.push(this.getPoint(g/a));c&&b.push(b[0]);return b};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],g,f,h,e,j,k,l,m,n,o,p,w,t;g=0;for(f=this.actions.length;g<f;g++)switch(h=this.actions[g],e=h.action,h=h.args,e){case THREE.PathActions.LINE_TO:b.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];b.length>0?(e=b[b.length-1],p=e.x,w=e.y):(e=this.actions[g-1].args,p=e[e.length-2],w=e[e.length-1]);for(e=1;e<=a;e++)t=e/a,h=THREE.FontUtils.b2(t,p,n,j),t=THREE.FontUtils.b2(t,w,o,k),
-b.push(new THREE.Vector2(h,t));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];b.length>0?(e=b[b.length-1],p=e.x,w=e.y):(e=this.actions[g-1].args,p=e[e.length-2],w=e[e.length-1]);for(e=1;e<=a;e++)t=e/a,h=THREE.FontUtils.b3(t,p,n,l,j),t=THREE.FontUtils.b3(t,w,o,m,k),b.push(new THREE.Vector2(h,t));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[g-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];t=a*h[0].length;e=e.concat(h[0]);h=new THREE.SplineCurve(e);
-for(e=1;e<=t;e++)b.push(h.getPointAt(e/t));break;case THREE.PathActions.ARC:e=this.actions[g-1].args;j=h[0];k=h[1];l=h[2];n=h[3];t=h[4];o=!!h[5];m=e[e.length-2];p=e[e.length-1];e.length==0&&(m=p=0);w=t-n;var v=a*2;for(e=1;e<=v;e++)t=e/v,o||(t=1-t),t=n+t*w,h=m+j+l*Math.cos(t),t=p+k+l*Math.sin(t),b.push(new THREE.Vector2(h,t))}c&&b.push(b[0]);return b};
-THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),c,b,g,f;c=b=Number.NEGATIVE_INFINITY;g=f=Number.POSITIVE_INFINITY;var h,e,j;e=0;for(j=a.length;e<j;e++){h=a[e];if(h.x>c)c=h.x;else if(h.x<g)g=h.x;if(h.y>b)b=h.y;else if(h.y<b)f=h.y}return{minX:g,minY:f,maxX:c,maxY:b}};THREE.Path.prototype.getPoint=function(a){for(var c=a*this.getLength(),b=this.sums,a=0;a<b.length;){if(b[a]>=c)return c=b[a]-c,a=this.curves[a],c=1-c/a.getLength(),a.getPointAt(c);a++}return null};
-THREE.Path.prototype.getLength=function(){var a=[],c=0,b,g=this.curves.length;for(b=0;b<g;b++)c+=this.curves[b].getLength(),a.push(c);this.sums=a;return c};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 c=new THREE.Geometry,b=0;b<a.length;b++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(a[b].x,a[b].y,0)));return c};
-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 c=this.getMinAndMax(),b=this.getPoints(),g,f,h,e,j,k;g=0;for(f=b.length;g<f;g++)h=b[g],e=h.x,j=h.y,k=e/c.maxX,e=a.getPoint(k),j=a.getNormalVector(k).multiplyScalar(j),h.x=e.x+j.x,h.y=e.y+j.y;return b};
-THREE.Path.prototype.nltransform=function(a,c,b,g,f,h){var e=this.getPoints(),j,k,l,m,n;j=0;for(k=e.length;j<k;j++)l=e[j],m=l.x,n=l.y,l.x=a*m+c*n+b,l.y=g*n+f*m+h;return e};
-THREE.Path.prototype.debug=function(a){var c=this.getMinAndMax();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,g,f,a=0;for(b=this.actions.length;a<b;a++)g=this.actions[a],f=g.args,g=g.action,g!=THREE.PathActions.CSPLINE_THRU&&c[g].apply(c,f);c.stroke();c.closePath();c.strokeStyle="red";g=this.transform(0.866,
--0.866,0,0.5,0.5,-50);a=0;for(b=g.length;a<b;a++)f=g[a],c.beginPath(),c.arc(f.x,f.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};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(){var a,c=this.holes.length,b=[];for(a=0;a<c;a++)b[a]=this.holes[a].getPoints();return b};
-THREE.Shape.prototype.getSpacedPointsHoles=function(){var a,c=this.holes.length,b=[];for(a=0;a<c;a++)b[a]=this.holes[a].getSpacedPoints();return b};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),g=b.concat(),f,h,e,j,k,l,m,n,o,p,w=[];for(k=0;k<c.length;k++){l=c[k];g=g.concat(l);h=Number.POSITIVE_INFINITY;for(f=0;f<l.length;f++){o=l[f];p=[];for(n=0;n<b.length;n++)m=b[n],m=o.distanceTo(m),p.push(m),m<h&&(h=m,e=f,j=n)}f=j-1>=0?j-1:b.length-1;h=e-1>=0?e-1:l.length-1;var t=[l[e],b[j],b[f]];n=THREE.FontUtils.Triangulate.area(t);var v=[l[e],l[h],b[j]];o=THREE.FontUtils.Triangulate.area(v);p=j;m=e;j+=1;e+=-1;j<0&&(j+=b.length);j%=b.length;
-e<0&&(e+=l.length);e%=l.length;f=j-1>=0?j-1:b.length-1;h=e-1>=0?e-1:l.length-1;t=[l[e],b[j],b[f]];t=THREE.FontUtils.Triangulate.area(t);v=[l[e],l[h],b[j]];v=THREE.FontUtils.Triangulate.area(v);n+o>t+v&&(j=p,e=m,j<0&&(j+=b.length),j%=b.length,e<0&&(e+=l.length),e%=l.length,f=j-1>=0?j-1:b.length-1,h=e-1>=0?e-1:l.length-1);n=b.slice(0,j);o=b.slice(j);p=l.slice(e);m=l.slice(0,e);h=[l[e],l[h],b[j]];w.push([l[e],b[j],b[f]]);w.push(h);b=n.concat(p).concat(m).concat(o)}return{shape:b,isolatedPts:w,allpoints:g}},
-triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),g=b.allpoints,f=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),h,e,j,k;for(h=0;h<b.length;h++){k=b[h];for(e=0;e<3;e++)for(j=0;j<g.length;j++)g[j].equals(k[e])&&(k[e]=j)}for(h=0;h<f.length;h++){k=f[h];for(e=0;e<3;e++)for(j=0;j<g.length;j++)g[j].equals(k[e])&&(k[e]=j)}return b.concat(f)},isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0}};
-THREE.CubeGeometry=function(a,c,b,g,f,h,e,j,k){function l(a,b,c,e,j,k,l,n){var p,o,t=g||1,w=f||1,D=j/2,K=k/2,F=m.vertices.length;if(a=="x"&&b=="y"||a=="y"&&b=="x")p="z";else if(a=="x"&&b=="z"||a=="z"&&b=="x")p="y",w=h||1;else if(a=="z"&&b=="y"||a=="y"&&b=="z")p="x",t=h||1;var I=t+1,O=w+1;j/=t;var M=k/w;for(o=0;o<O;o++)for(k=0;k<I;k++){var C=new THREE.Vector3;C[a]=(k*j-D)*c;C[b]=(o*M-K)*e;C[p]=l;m.vertices.push(new THREE.Vertex(C))}for(o=0;o<w;o++)for(k=0;k<t;k++)m.faces.push(new THREE.Face4(k+I*o+
-F,k+I*(o+1)+F,k+1+I*(o+1)+F,k+1+I*o+F,null,null,n)),m.faceVertexUvs[0].push([new THREE.UV(k/t,o/w),new THREE.UV(k/t,(o+1)/w),new THREE.UV((k+1)/t,(o+1)/w),new THREE.UV((k+1)/t,o/w)])}THREE.Geometry.call(this);var m=this,n=a/2,o=c/2,p=b/2,j=j?-1:1;if(e!==void 0)if(e instanceof Array)this.materials=e;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([e])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var t in k)this.sides[t]!=void 0&&(this.sides[t]=
-k[t]);this.sides.px&&l("z","y",1*j,-1,b,c,-n,this.materials[0]);this.sides.nx&&l("z","y",-1*j,-1,b,c,n,this.materials[1]);this.sides.py&&l("x","z",1*j,1,a,b,o,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,b,-o,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,c,p,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,c,-p,this.materials[5]);(function(){for(var a=[],b=[],c=0,e=m.vertices.length;c<e;c++){for(var g=m.vertices[c],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){b[c]=f;h=!0;break}}if(!h)b[c]=a.length,a.push(new THREE.Vertex(g.position.clone()))}c=0;for(e=m.faces.length;c<e;c++)g=m.faces[c],g.a=b[g.a],g.b=b[g.b],g.c=b[g.c],g.d=b[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,c,b,g,f,h){function e(a,b,c){j.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}THREE.Geometry.call(this);var j=this,k,l=Math.PI*2,m=g/2;for(k=0;k<a;k++)e(Math.sin(l*k/a)*c,Math.cos(l*k/a)*c,-m);for(k=0;k<a;k++)e(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,m);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(b>0){e(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(c>0){e(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 c=[],b=this.faces[k],f=this.vertices[b.a],h=this.vertices[b.b],m=this.vertices[b.c],n=this.vertices[b.d];c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/l,0.5+f.position.z/g));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/g));c.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
-g));b instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/l,0.5+n.position.z/g));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
-THREE.ExtrudeGeometry=function(a,c){function b(a,b,c,e){a=a.clone().subSelf(b);c/=a.length();return a.multiplyScalar(e?1+c:1-c).addSelf(b)}function g(a){for(A=a.length;--A>=0;){O=A;M=A-1;M<0&&(M=a.length-1);for(var b=0,b=0;b<n+m*2;b++){var c=I*b,e=I*(b+1);y.faces.push(new THREE.Face4(C+O+c,C+M+c,C+M+e,C+O+e))}}}function f(a,b,c){y.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){y.faces.push(new THREE.Face3(a,b,c))}var e=c.amount!==void 0?c.amount:100,j=c.bevelThickness!==
-void 0?c.bevelThickness:8,k=c.bevelSize!==void 0?c.bevelSize:j,l=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.bevelSegments!==void 0?c.bevelSegments:3;l||(m=0);var n=c.steps!==void 0?c.steps:1,o=c.path!==void 0?c.path:null,p,w=!1;if(o)p=o.getPoints(),n=p.length,w=!0;THREE.Geometry.call(this);var t,v,x,y=this,o=a.extractAllPoints(),u=o.shape,o=o.holes,z=!THREE.Shape.Utils.isClockWise(u);if(z){u=u.reverse();v=0;for(x=o.length;v<x;v++)t=o[v],THREE.Shape.Utils.isClockWise(t)&&(o[v]=t.reverse());z=!1}var z=
-THREE.Shape.Utils.triangulateShape(u,o),B=u;v=0;for(x=o.length;v<x;v++)t=o[v],u=u.concat(t);var A,E,G=new THREE.Vector2;A=0;for(E=B.length;A<E;A++)G.addSelf(B[A]);var H=G.divideScalar(B.length),L=[];v=0;for(x=o.length;v<x;v++){G=new THREE.Vector2;t=o[v];A=0;for(E=t.length;A<E;A++)G.addSelf(t[A]);L[v]=G.divideScalar(t.length)}var J,D,K,F,I=u.length,G=z.length;for(J=m;J>0;J--){t=J/m;K=j*t;D=k*(1-Math.sin((1-t)*Math.PI/2));A=0;for(E=B.length;A<E;A++)F=b(B[A],H,D,!1),f(F.x,F.y,-K);v=0;for(x=o.length;v<
-x;v++){t=o[v];A=0;for(E=t.length;A<E;A++)F=b(t[A],L[v],D,!0),f(F.x,F.y,-K)}}for(A=0;A<I;A++)F=u[A],w?f(F.x,F.y+p[0].y,p[0].x):f(F.x,F.y,0);for(t=1;t<=n;t++)for(A=0;A<I;A++)F=u[A],w?f(F.x,F.y+p[t-1].y,p[t-1].x):f(F.x,F.y,e/n*t);for(J=1;J<=m;J++){t=J/m;K=j*t;D=k*(1-Math.sin((1-t)*Math.PI/2));A=0;for(E=B.length;A<E;A++)F=b(B[A],H,D,!1),f(F.x,F.y,e+K);v=0;for(x=o.length;v<x;v++){t=o[v];A=0;for(E=t.length;A<E;A++)F=b(t[A],L[v],D,!0),w?f(F.x,F.y+p[n-1].y,p[n-1].x+K):f(F.x,F.y,e+K)}}if(l){j=I*0;for(A=0;A<
-G;A++)e=z[A],h(e[2]+j,e[1]+j,e[0]+j);j=I*(n+m*2);for(A=0;A<G;A++)e=z[A],h(e[0]+j,e[1]+j,e[2]+j)}else{for(A=0;A<G;A++)e=z[A],h(e[2],e[1],e[0]);for(A=0;A<G;A++)e=z[A],h(e[0]+I*n,e[1]+I*n,e[2]+I*n)}var O,M,C=0;g(B);C+=B.length;v=0;for(x=o.length;v<x;v++)t=o[v],g(t),C+=t.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function g(a,b){var e=f.vertices[a].position,g=f.vertices[b].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,h=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var j in h.faces){var k=g(h.faces[j].a,h.faces[j].b),l=g(h.faces[j].b,h.faces[j].c),m=g(h.faces[j].c,h.faces[j].a);b(h.faces[j].a,k,m,e);b(h.faces[j].b,l,k,e);
-b(h.faces[j].c,m,l,e);b(k,l,m,e)}h.faces=e.faces}f.faces=h.faces;delete h;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],g=[],f=[],h=[],e=(new THREE.Matrix4).setRotationZ(c),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),b[j]=a[j].clone(),g[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=c){for(j=0;j<b.length;j++)k<this.angle?(b[j]=e.multiplyVector3(b[j].clone()),this.vertices.push(new THREE.Vertex(b[j])),f[j]=this.vertices.length-1):f=h;k==0&&(h=g);
-for(j=0;j<g.length-1;j++)this.faces.push(new THREE.Face4(f[j],f[j+1],g[j+1],g[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-c)/this.angle,(j+1)/a.length),new THREE.UV(1-(k-c)/this.angle,j/a.length)]);g=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
-THREE.PlaneGeometry=function(a,c,b,g){THREE.Geometry.call(this);var f,h=a/2,e=c/2,b=b||1,g=g||1,j=b+1,k=g+1;a/=b;var l=c/g;for(f=0;f<k;f++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-h,-(f*l-e),0)));for(f=0;f<g;f++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+j*f,c+j*(f+1),c+1+j*(f+1),c+1+j*f)),this.faceVertexUvs[0].push([new THREE.UV(c/b,f/g),new THREE.UV(c/b,(f+1)/g),new THREE.UV((c+1)/b,(f+1)/g),new THREE.UV((c+1)/b,f/g)]);this.computeCentroids();this.computeFaceNormals()};
+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,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,e=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);g=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(b.y);e.addSelf(this.up.clone().crossSelf(g).setLength(b.x));e.addSelf(g.setLength(b.z));return e};
+this.rotateCamera=function(){var a=Math.acos(h.dot(e)/h.length()/e.length());if(a){var c=(new THREE.Vector3).cross(h,e).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,-a);b.multiplyVector3(g);b.multiplyVector3(this.up);b.multiplyVector3(e);this.staticMoving?h=e:(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&&(g.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(g.length()*this.panSpeed);var c=g.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),
+g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(a,c,b){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,a,c,b)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",
+b(this,function(a){c&&(h=e=this.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=this.getMouseOnScreen(a.clientX,a.clientY),l=m=this.getMouseOnScreen(a.clientX,a.clientY),c=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?e=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?k=this.getMouseOnScreen(a.clientX,a.clientY):f===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(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?h=e=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===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();f=this.STATE.NONE}),!1);window.addEventListener("keydown",b(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=
+this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(c=!0)}}),!1);window.addEventListener("keyup",b(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(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,f=this.getPoint(0),g,h=0;for(g=1;g<=a;g++)c=this.getPoint(g/a),h+=c.distanceTo(f),b.push(h),f=c;return this.cacheLengths=b};
+THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),f=0,g=c.length,h;for(h=b?b:a*c[g-1];f<g;){if(c[f]>h)break;f++}return f/g};THREE.LineCurve=function(a,b,c,f){this.x1=a;this.y1=b;this.x2=c;this.y2=f};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,f,g,h){this.x0=a;this.y0=b;this.x1=c;this.y1=f;this.x2=g;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,f,g,h,e,j){this.x0=a;this.y0=b;this.x1=c;this.y1=f;this.x2=g;this.y2=h;this.x3=e;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.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],f=this.points,g;g=(f.length-1)*a;a=Math.floor(g);g-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>f.length-2?a:a+1;c[3]=a>f.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(f[c[0]].x,f[c[1]].x,f[c[2]].x,f[c[3]].x,g);b.y=THREE.Curve.Utils.interpolate(f[c[0]].y,f[c[1]].y,f[c[2]].y,f[c[3]].y,g);return b};THREE.ArcCurve=function(a,b,c,f,g,h){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=f;this.aEndAngle=g;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,f){return 2*(1-a)*(c-b)+2*a*(f-c)},tangentSpline:function(){},interpolate:function(a,b,c,f,g){var a=(c-a)*0.5,f=(f-b)*0.5,h=g*g;return(2*b-2*c+a+f)*g*h+(-3*b+3*c-2*a-f)*h+a*g+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,c,f,g,h){this.x1=a;this.y1=b;this.z1=c;this.x2=f;this.y2=g;this.z2=h},function(a){return new THREE.Vector3(this.x1+(this.x2-this.x1)*a,this.y1+(this.y2-this.y1)*a,this.z1+(this.z2-this.z1)*a)});
+THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c,f,g,h,e,j,k){this.x0=a;this.y0=b;this.z0=c;this.x1=f;this.y1=g;this.z1=h;this.x2=e;this.y2=j;this.z2=k},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.x0,this.x1,this.x2);c=THREE.Shape.Utils.b2(a,this.y0,this.y1,this.y2);a=THREE.Shape.Utils.b2(a,this.z0,this.z1,this.z2);return new THREE.Vector2(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),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],a,b);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:c,curve:f})};
+THREE.Path.prototype.quadraticCurveTo=function(a,b,c,f){var g=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,f);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:h})};
+THREE.Path.prototype.bezierCurveTo=function(a,b,c,f,g,h){var e=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,f,g,h);this.curves.push(j);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e,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,f,g,h){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,f,g,h));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],f=0;f<a;f++)c.push(this.getPoint(f/a));b&&c.push(c[0]);return c};
+THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],f,g,h,e,j,k,l,m,n,p,o,x,w;f=0;for(g=this.actions.length;f<g;f++)switch(h=this.actions[f],e=h.action,h=h.args,e){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];p=h[1];c.length>0?(e=c[c.length-1],o=e.x,x=e.y):(e=this.actions[f-1].args,o=e[e.length-2],x=e[e.length-1]);for(e=1;e<=a;e++)w=e/a,h=THREE.Shape.Utils.b2(w,o,n,j),w=THREE.Shape.Utils.b2(w,x,p,
+k),c.push(new THREE.Vector2(h,w));break;case THREE.PathActions.BEZIER_CURVE_TO:j=h[4];k=h[5];n=h[0];p=h[1];l=h[2];m=h[3];c.length>0?(e=c[c.length-1],o=e.x,x=e.y):(e=this.actions[f-1].args,o=e[e.length-2],x=e[e.length-1]);for(e=1;e<=a;e++)w=e/a,h=THREE.Shape.Utils.b3(w,o,n,l,j),w=THREE.Shape.Utils.b3(w,x,p,m,k),c.push(new THREE.Vector2(h,w));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[f-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];w=a*h[0].length;e=e.concat(h[0]);h=new THREE.SplineCurve(e);
+for(e=1;e<=w;e++)c.push(h.getPointAt(e/w));break;case THREE.PathActions.ARC:e=this.actions[f-1].args;j=h[0];k=h[1];l=h[2];n=h[3];w=h[4];p=!!h[5];m=e[e.length-2];o=e[e.length-1];e.length==0&&(m=o=0);x=w-n;var u=a*2;for(e=1;e<=u;e++)w=e/u,p||(w=1-w),w=n+w*x,h=m+j+l*Math.cos(w),w=o+k+l*Math.sin(w),c.push(new THREE.Vector2(h,w))}b&&c.push(c[0]);return c};
+THREE.Path.prototype.getMinAndMax=function(){var a=this.getPoints(),b,c,f,g;b=c=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var h,e,j;e=0;for(j=a.length;e<j;e++){h=a[e];if(h.x>b)b=h.x;else if(h.x<f)f=h.x;if(h.y>c)c=h.y;else if(h.y<c)g=h.y}return{minX:f,minY:g,maxX:b,maxY:c}};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,f=this.curves.length;for(c=0;c<f;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.getMinAndMax(),c=this.getPoints(),f,g,h,e,j,k;f=0;for(g=c.length;f<g;f++)h=c[f],e=h.x,j=h.y,k=e/b.maxX,e=a.getPoint(k),j=a.getNormalVector(k).multiplyScalar(j),h.x=e.x+j.x,h.y=e.y+j.y;return c};
+THREE.Path.prototype.nltransform=function(a,b,c,f,g,h){var e=this.getPoints(),j,k,l,m,n;j=0;for(k=e.length;j<k;j++)l=e[j],m=l.x,n=l.y,l.x=a*m+b*n+c,l.y=f*n+g*m+h;return e};
+THREE.Path.prototype.debug=function(a){var b=this.getMinAndMax();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,f,g,a=0;for(c=this.actions.length;a<c;a++)f=this.actions[a],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&b[f].apply(b,g);b.stroke();b.closePath();b.strokeStyle="red";f=this.getPoints();
+a=0;for(c=f.length;a<c;a++)g=f[a],b.beginPath(),b.arc(g.x,g.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
+THREE.Path.prototype.toShapes=function(){var a,b,c,f,g=[],h=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],f=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(g.push(h),h=new THREE.Path),h[c].apply(h,f);h.actions.length!=0&&g.push(h);if(g.length==0)return[];var e,h=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(b=g.length;a<b;a++)f=g[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(e&&h.push(e),e=new THREE.Shape,e.actions=f.actions,e.curves=
+f.curves):e.holes.push(f);h.push(e)}else{e=new THREE.Shape;a=0;for(b=g.length;a<b;a++)f=g[a],THREE.Shape.Utils.isClockWise(f.getPoints())?(e.actions=f.actions,e.curves=f.curves,h.push(e),e=new THREE.Shape):e.holes.push(f)}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(){var a,b=this.holes.length,c=[];for(a=0;a<b;a++)c[a]=this.holes[a].getPoints();return c};THREE.Shape.prototype.getSpacedPointsHoles=function(){var a,b=this.holes.length,c=[];for(a=0;a<b;a++)c[a]=this.holes[a].getSpacedPoints();return c};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),f=c.concat(),g,h,e,j,k,l,m,n,p,o,x=[];for(k=0;k<b.length;k++){l=b[k];f=f.concat(l);h=Number.POSITIVE_INFINITY;for(g=0;g<l.length;g++){p=l[g];o=[];for(n=0;n<c.length;n++)m=c[n],m=p.distanceTo(m),o.push(m),m<h&&(h=m,e=g,j=n)}g=j-1>=0?j-1:c.length-1;h=e-1>=0?e-1:l.length-1;var w=[l[e],c[j],c[g]];n=THREE.FontUtils.Triangulate.area(w);var u=[l[e],l[h],c[j]];p=THREE.FontUtils.Triangulate.area(u);o=j;m=e;j+=1;e+=-1;j<0&&(j+=c.length);j%=c.length;
+e<0&&(e+=l.length);e%=l.length;g=j-1>=0?j-1:c.length-1;h=e-1>=0?e-1:l.length-1;w=[l[e],c[j],c[g]];w=THREE.FontUtils.Triangulate.area(w);u=[l[e],l[h],c[j]];u=THREE.FontUtils.Triangulate.area(u);n+p>w+u&&(j=o,e=m,j<0&&(j+=c.length),j%=c.length,e<0&&(e+=l.length),e%=l.length,g=j-1>=0?j-1:c.length-1,h=e-1>=0?e-1:l.length-1);n=c.slice(0,j);p=c.slice(j);o=l.slice(e);m=l.slice(0,e);h=[l[e],l[h],c[j]];x.push([l[e],c[j],c[g]]);x.push(h);c=n.concat(o).concat(m).concat(p)}return{shape:c,isolatedPts:x,allpoints:f}},
+triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),f=c.allpoints,g=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,e,j,k;for(h=0;h<c.length;h++){k=c[h];for(e=0;e<3;e++)for(j=0;j<f.length;j++)f[j].equals(k[e])&&(k[e]=j)}for(h=0;h<g.length;h++){k=g[h];for(e=0;e<3;e++)for(j=0;j<f.length;j++)f[j].equals(k[e])&&(k[e]=j)}return c.concat(g)},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,f){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,f)},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,f,g){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,f)+this.b3p3(a,g)}};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,f=b.font!==void 0?b.font:"helvetiker",g=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=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=h};
+THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,f=a.length;c<f;c++)b=b.concat(a[c].toShapes());return b};
+THREE.CubeGeometry=function(a,b,c,f,g,h,e,j,k){function l(a,c,b,e,j,k,l,o){var n,p,x=f||1,w=g||1,E=j/2,L=k/2,H=m.vertices.length;if(a=="x"&&c=="y"||a=="y"&&c=="x")n="z";else if(a=="x"&&c=="z"||a=="z"&&c=="x")n="y",w=h||1;else if(a=="z"&&c=="y"||a=="y"&&c=="z")n="x",x=h||1;var I=x+1,O=w+1;j/=x;var Q=k/w;for(p=0;p<O;p++)for(k=0;k<I;k++){var C=new THREE.Vector3;C[a]=(k*j-E)*b;C[c]=(p*Q-L)*e;C[n]=l;m.vertices.push(new THREE.Vertex(C))}for(p=0;p<w;p++)for(k=0;k<x;k++)m.faces.push(new THREE.Face4(k+I*p+
+H,k+I*(p+1)+H,k+1+I*(p+1)+H,k+1+I*p+H,null,null,o)),m.faceVertexUvs[0].push([new THREE.UV(k/x,p/w),new THREE.UV(k/x,(p+1)/w),new THREE.UV((k+1)/x,(p+1)/w),new THREE.UV((k+1)/x,p/w)])}THREE.Geometry.call(this);var m=this,n=a/2,p=b/2,o=c/2,j=j?-1:1;if(e!==void 0)if(e instanceof Array)this.materials=e;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([e])}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,p,this.materials[2]);this.sides.ny&&l("x","z",1*j,-1,a,c,-p,this.materials[3]);this.sides.pz&&l("x","y",1*j,-1,a,b,o,this.materials[4]);this.sides.nz&&l("x","y",-1*j,-1,a,b,-o,this.materials[5]);(function(){for(var a=[],c=[],b=0,e=m.vertices.length;b<e;b++){for(var f=m.vertices[b],h=!1,g=0,j=a.length;g<j;g++){var k=a[g];if(f.position.x==k.position.x&&
+f.position.y==k.position.y&&f.position.z==k.position.z){c[b]=g;h=!0;break}}if(!h)c[b]=a.length,a.push(new THREE.Vertex(f.position.clone()))}b=0;for(e=m.faces.length;b<e;b++)f=m.faces[b],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.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,f,g,h){function e(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=f/2;for(k=0;k<a;k++)e(Math.sin(l*k/a)*b,Math.cos(l*k/a)*b,-m);for(k=0;k<a;k++)e(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){e(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){e(0,0,m+
+(g||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],g=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(g.position.x,g.position.y)/l,0.5+g.position.z/f));b.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/l,0.5+h.position.z/f));b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.position.y)/l,0.5+m.position.z/
+f));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/f));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,f=a.length,g;for(c=0;c<f;c++)g=a[c],this.addShape(g,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){return a.clone().addSelf(c.clone().multiplyScalar(b))}function f(a,c,b){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;return(new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec))).normalize()}function g(a){for(z=a.length;--z>=0;){M=z;N=z-1;N<0&&(N=a.length-1);for(var c=0,c=0;c<p+m*2;c++){var b=I*c,e=I*(c+1),f=R+M+b,b=R+N+b,h=R+N+e,e=R+M+e;f+=A;b+=A;h+=A;e+=A;t.faces.push(new THREE.Face4(f,
+b,h,e))}}}function h(a,c,b){t.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function e(a,c,b){a+=A;c+=A;b+=A;t.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;n||(l=k=m=0);var p=b.steps!==void 0?b.steps:1,o=b.path!==void 0?b.path:null,x,w=!1;if(o)x=o.getPoints(),p=x.length,w=!0;var u,v,y,t=
+this,A=this.vertices.length,o=a.extractAllPoints(),B=o.shape,o=o.holes,G=!THREE.Shape.Utils.isClockWise(B);if(G){B=B.reverse();v=0;for(y=o.length;v<y;v++)u=o[v],THREE.Shape.Utils.isClockWise(u)&&(o[v]=u.reverse());G=!1}var G=THREE.Shape.Utils.triangulateShape(B,o),F=B;v=0;for(y=o.length;v<y;v++)u=o[v],B=B.concat(u);var z,D,J=new THREE.Vector2;z=0;for(D=F.length;z<D;z++)J.addSelf(F[z]);J.divideScalar(F.length);v=0;for(y=o.length;v<y;v++){J=new THREE.Vector2;u=o[v];z=0;for(D=u.length;z<D;z++)J.addSelf(u[z]);
+J.divideScalar(u.length)}var K,E,L,H,I=B.length,J=G.length,O=[];z=0;D=F.length;M=D-1;for(N=z+1;z<D;z++,M++,N++)M==D&&(M=0),N==D&&(N=0),O[z]=f(F[z],F[M],F[N]);var Q=[],C,P=O.concat();v=0;for(y=o.length;v<y;v++){u=o[v];C=[];z=0;D=u.length;M=D-1;for(N=z+1;z<D;z++,M++,N++)M==D&&(M=0),N==D&&(N=0),C[z]=f(u[z],u[M],u[N]);Q.push(C);P=P.concat(C)}for(K=0;K<m;K++){u=K/m;L=k*(1-u);E=l*Math.sin(u*Math.PI/2);z=0;for(D=F.length;z<D;z++)H=c(F[z],O[z],E),h(H.x,H.y,-L);v=0;for(y=o.length;v<y;v++){u=o[v];C=Q[v];z=
+0;for(D=u.length;z<D;z++)H=c(u[z],C[z],E),h(H.x,H.y,-L)}}E=l;for(z=0;z<I;z++)H=c(B[z],P[z],E),w?h(H.x,H.y+x[0].y,x[0].x):h(H.x,H.y,0);for(u=1;u<=p;u++)for(z=0;z<I;z++)H=c(B[z],P[z],E),w?h(H.x,H.y+x[u-1].y,x[u-1].x):h(H.x,H.y,j/p*u);for(K=m-1;K>=0;K--){u=K/m;L=k*(1-u);E=l*Math.sin(u*Math.PI/2);z=0;for(D=F.length;z<D;z++)H=c(F[z],O[z],E),h(H.x,H.y,j+L);v=0;for(y=o.length;v<y;v++){u=o[v];C=Q[v];z=0;for(D=u.length;z<D;z++)H=c(u[z],C[z],E),w?h(H.x,H.y+x[p-1].y,x[p-1].x+L):h(H.x,H.y,j+L)}}if(n){k=I*0;for(z=
+0;z<J;z++)j=G[z],e(j[2]+k,j[1]+k,j[0]+k);k=I*(p+m*2);for(z=0;z<J;z++)j=G[z],e(j[0]+k,j[1]+k,j[2]+k)}else{for(z=0;z<J;z++)j=G[z],e(j[2],j[1],j[0]);for(z=0;z<J;z++)j=G[z],e(j[0]+I*p,j[1]+I*p,j[2]+I*p)}var M,N,R=0;g(F);R+=F.length;v=0;for(y=o.length;v<y;v++)u=o[v],g(u),R+=u.length;this.computeCentroids();this.computeFaceNormals()};
+THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return g.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 f(a,c){var e=g.vertices[a].position,f=g.vertices[c].position;return b((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry,e;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++){e=new THREE.Geometry;for(var j in h.faces){var k=f(h.faces[j].a,h.faces[j].b),l=f(h.faces[j].b,h.faces[j].c),m=f(h.faces[j].c,h.faces[j].a);c(h.faces[j].a,k,m,e);c(h.faces[j].b,l,k,e);
+c(h.faces[j].c,m,l,e);c(k,l,m,e)}h.faces=e.faces}g.faces=h.faces;delete h;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],f=[],g=[],h=[],e=(new THREE.Matrix4).setRotationZ(b),j=0;j<a.length;j++)this.vertices.push(new THREE.Vertex(a[j])),c[j]=a[j].clone(),f[j]=this.vertices.length-1;for(var k=0;k<=this.angle+0.0010;k+=b){for(j=0;j<c.length;j++)k<this.angle?(c[j]=e.multiplyVector3(c[j].clone()),this.vertices.push(new THREE.Vertex(c[j])),g[j]=this.vertices.length-1):g=h;k==0&&(h=f);
+for(j=0;j<f.length-1;j++)this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[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)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
+THREE.PlaneGeometry=function(a,b,c,f){THREE.Geometry.call(this);var g,h=a/2,e=b/2,c=c||1,f=f||1,j=c+1,k=f+1;a/=c;var l=b/f;for(g=0;g<k;g++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(g*l-e),0)));for(g=0;g<f;g++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+j*g,b+j*(g+1),b+1+j*(g+1),b+1+j*g)),this.faceVertexUvs[0].push([new THREE.UV(b/c,g/f),new THREE.UV(b/c,(g+1)/f),new THREE.UV((b+1)/c,(g+1)/f),new THREE.UV((b+1)/c,g/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,g,f=Math.PI,h=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){g=b/e;var j=a*Math.cos(g*f),k=a*Math.sin(g*f),l=[],m=0;for(g=0;g<h;g++){var n=2*g/h,o=k*Math.sin(n*f),n=k*Math.cos(n*f);(b==0||b==e)&&g>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,o)))-1);l.push(m)}c.push(l)}for(var p,w,t,f=c.length,b=0;b<f;b++)if(h=c[b].length,b>0)for(g=0;g<h;g++){l=g==h-1;e=c[b][l?0:g+1];j=c[b][l?h-1:g];k=c[b-1][l?
-h-1:g];l=c[b-1][l?0:g+1];o=b/(f-1);p=(b-1)/(f-1);w=(g+1)/h;var n=g/h,m=new THREE.UV(1-w,o),o=new THREE.UV(1-n,o),n=new THREE.UV(1-n,p),v=new THREE.UV(1-w,p);b<c.length-1&&(p=this.vertices[e].position.clone(),w=this.vertices[j].position.clone(),t=this.vertices[k].position.clone(),p.normalize(),w.normalize(),t.normalize(),this.faces.push(new THREE.Face3(e,j,k,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z)])),this.faceVertexUvs[0].push([m,o,n]));b>1&&(p=
-this.vertices[e].position.clone(),w=this.vertices[k].position.clone(),t=this.vertices[l].position.clone(),p.normalize(),w.normalize(),t.normalize(),this.faces.push(new THREE.Face3(e,k,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z)])),this.faceVertexUvs[0].push([m,n,v]))}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,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(a)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
-THREE.TextGeometry.prototype.set=function(a,c){function b(a,b,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function g(a,b,c,e){w.faces.push(new THREE.Face4(a,b,c,e))}this.text=a;var c=c||this.parameters,f=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",j=c.weight!==void 0?c.weight:"normal",k=c.style!==void 0?c.style:"normal",l=c.bevelThickness!==void 0?c.bevelThickness:10,m=c.bevelSize!==void 0?c.bevelSize:8,n=c.bevelEnabled!==
-void 0?c.bevelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=e;THREE.FontUtils.weight=j;THREE.FontUtils.style=k;THREE.FontUtils.bevelSize=m;var j=THREE.FontUtils.drawText(a),h=j.points,o=j.faces,e=j.contour,p=j.bevel,w=this;w.vertices=[];w.faces=[];for(var t,k=h.length,v=o.length,m=p.length,j=0;j<k;j++)t=h[j],b(t.x,t.y,0);for(j=0;j<k;j++)t=h[j],b(t.x,t.y,f);if(n){for(j=0;j<m;j++)t=p[j],b(t.x,t.y,l);for(j=0;j<m;j++)t=p[j],b(t.x,t.y,f-l)}for(j=
-0;j<v;j++)f=o[j],w.faces.push(new THREE.Face3(f[2],f[1],f[0]));for(j=0;j<v;j++)f=o[j],w.faces.push(new THREE.Face3(f[0]+k,f[1]+k,f[2]+k));var x;if(n)for(j=p.length;--j>0;){if(x){if(x.equals(e[j])){x=null;continue}}else x=e[j];l=k*2+j;o=l-1;g(l,o,o+m,l+m);for(n=0;n<k;n++)if(h[n].equals(e[j]))break;for(f=0;f<k;f++)if(h[f].equals(e[j-1]))break;g(n,f,o,l);g(l+m,o+m,f+k,n+k)}else for(j=e.length;--j>0;){if(x){if(x.equals(e[j])){x=null;continue}}else x=e[j];for(n=0;n<k;n++)if(h[n].equals(e[j]))break;for(f=
-0;f<k;f++)if(h[f].equals(e[j-1]))break;g(n,f,f+k,n+k)}this.computeCentroids();this.computeFaceNormals()};
-THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},extractPoints:function(a,c){if(a.length<3)return console.log("not valid polygon"),
-{points:a,faces:[]};for(var b,g,f,h,e,j=[],k=0;k<c.length;k++){e=c[k];h=[];for(b=0;b<e.length;b++)g=e[b],h.push(g.x+","+g.y);var l;b=h.slice(1).indexOf(h[0]);var m=this.Triangulate.area(e.slice(0,b+1))<0;g=[];for(b=-1;b<h.length;){l=b+1;b=h[l];b=h.slice(l+1).indexOf(b)+l;if(b<=l)break;var n=e.slice(l,b+1);m?this.Triangulate.area(n)<0?(l>0&&j.push({shape:f,holes:g}),f=n,g=[]):g.push(n):this.Triangulate.area(n)<0?(j.push({shape:n,holes:g}),g=[]):g.push(n);b++}m&&j.push({shape:f,holes:g})}var o,p,w,
-t,v,x;h=[];for(e=0;e<j.length;e++){k=j[e];f=k.shape;g=k.holes;for(l=0;l<g.length;l++){m=g[l];w=Number.POSITIVE_INFINITY;for(n=0;n<m.length;n++){v=m[n];for(b=0;b<f.length;b++)t=f[b],t=v.distanceTo(t),t<w&&(w=t,o=n,p=b)}b=p-1>=0?p-1:f.length-1;var n=o-1>=0?o-1:m.length-1,y=[];y.push(m[o]);y.push(f[p]);y.push(f[b]);w=this.Triangulate.area(y);var u=[];u.push(m[o]);u.push(m[n]);u.push(f[p]);v=this.Triangulate.area(u);t=p;x=o;p+=1;o+=-1;p<0&&(p+=f.length);p%=f.length;o<0&&(o+=m.length);o%=f.length;b=p-
-1>=0?p-1:f.length-1;n=o-1>=0?o-1:m.length-1;y=[];y.push(m[o]);y.push(f[p]);y.push(f[b]);y=this.Triangulate.area(y);u=[];u.push(m[o]);u.push(m[n]);u.push(f[p]);u=this.Triangulate.area(u);w+v>y+u&&(p=t,o=x,p<0&&(p+=f.length),p%=f.length,o<0&&(o+=m.length),o%=f.length,b=p-1>=0?p-1:f.length-1,n=o-1>=0?o-1:m.length-1);w=f.slice(0,p);v=f.slice(p);t=m.slice(o);x=m.slice(0,o);h.push(m[o]);h.push(f[p]);h.push(f[b]);h.push(m[o]);h.push(m[n]);h.push(f[p]);f=w.concat(t).concat(x).concat(v)}k.shape=f}o=[];p=[];
-for(e=l=0;e<j.length;e++){k=j[e];f=k.shape;o=o.concat(f);m=THREE.FontUtils.Triangulate(f,!0);for(g=0;g<m.length;g++)k=m[g],k[0]+=l,k[1]+=l,k[2]+=l;p=p.concat(m);l+=f.length}var z;for(g=0;g<h.length/3;g++){k=[];for(j=0;j<3;j++){e=!1;for(f=0;f<o.length&&!e;f++)z=g*3+j,o[f].equals(h[z])&&(k.push(f),e=!0);e||(o.push(h[z]),k.push(o.length-1),console.log("not found"))}p.push(k)}return{points:o,faces:p}},drawText:function(a){var c=[],b=[],g,f=this.getFace(),h=this.size/f.resolution,e=0;g=String(a).split("");
-for(var j=g.length,k=new THREE.Path,a=0;a<j;a++){var l=this.extractGlyphPoints(g[a],f,h,e,k);e+=l.offset;c.push(l.points);b=b.concat(l.points)}a=e/2;for(g=0;g<b.length;g++)b[g].x-=a;c=this.extractPoints(b,c);c.contour=b;f=[];h=[];g=[];for(var e=[],j=new THREE.Vector2,m,a=b.length;--a>=0;){if(m){if(m.equals(b[a])){m=null;k=this.Triangulate.area(g)>0;e.push(k);h.push(j.divideScalar(g.length));g=[];j=new THREE.Vector2;continue}}else m=b[a];j.addSelf(b[a]);g.push(b[a])}a=b.length;for(g=0;--a>=0;)k=b[a],
-j=h[g],k=k.clone().subSelf(j),l=this.bevelSize/k.length(),e[g]?l+=1:l=1-l,l=k.multiplyScalar(l).addSelf(j),f.unshift(l),m?m.equals(b[a])&&(m=null,g++):m=b[a];c.bevel=f;return c},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,g){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,g)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,
-c){return a*a*a*c},b3:function(a,c,b,g,f){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,g)+this.b3p3(a,f)},extractGlyphPoints:function(a,c,b,g,f){var h=[],e,j,k,l,m,n,o,p,w,t,v=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(v){if(v.o){c=v._cachedOutline||(v._cachedOutline=v.o.split(" "));k=c.length;for(a=0;a<k;)switch(j=c[a++],j){case "m":j=c[a++]*b+g;l=c[a++]*b;h.push(new THREE.Vector2(j,l));f.moveTo(j,l);break;case "l":j=c[a++]*b+g;l=c[a++]*b;h.push(new THREE.Vector2(j,l));f.lineTo(j,
-l);break;case "q":j=c[a++]*b+g;l=c[a++]*b;o=c[a++]*b+g;p=c[a++]*b;f.quadraticCurveTo(o,p,j,l);if(e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++){var x=e/divisions,y=THREE.FontUtils.b2(x,m,o,j),x=THREE.FontUtils.b2(x,n,p,l);h.push(new THREE.Vector2(y,x))}}break;case "b":if(j=c[a++]*b+g,l=c[a++]*b,o=c[a++]*b+g,p=c[a++]*-b,w=c[a++]*b+g,t=c[a++]*-b,f.bezierCurveTo(j,l,o,p,w,t),e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++)x=e/divisions,
-y=THREE.FontUtils.b3(x,m,o,w,j),x=THREE.FontUtils.b3(x,n,p,t,l),h.push(new THREE.Vector2(y,x))}}}return{offset:v.ha*b,points:h,path:f}}}};
-(function(a){var c=function(a){for(var c=a.length,f=0,h=c-1,e=0;e<c;h=e++)f+=a[h].x*a[e].y-a[e].x*a[h].y;return f*0.5};a.Triangulate=function(a,g){var f=a.length;if(f<3)return null;var h=[],e=[],j=[],k,l,m;if(c(a)>0)for(l=0;l<f;l++)e[l]=l;else for(l=0;l<f;l++)e[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(g)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 p=k,w=l,t=m,v=f,x=e,y=void 0,u=void 0,z=void 0,
-B=void 0,A=void 0,E=void 0,G=void 0,H=void 0,L=void 0,u=o[x[p]].x,z=o[x[p]].y,B=o[x[w]].x,A=o[x[w]].y,E=o[x[t]].x,G=o[x[t]].y;if(1.0E-10>(B-u)*(G-z)-(A-z)*(E-u))o=!1;else{for(y=0;y<v;y++)if(!(y==p||y==w||y==t)){var H=o[x[y]].x,L=o[x[y]].y,J=void 0,D=void 0,K=void 0,F=void 0,I=void 0,O=void 0,M=void 0,C=void 0,P=void 0,N=void 0,R=void 0,S=void 0,J=K=I=void 0,J=E-B,D=G-A,K=u-E,F=z-G,I=B-u,O=A-z,M=H-u,C=L-z,P=H-B,N=L-A,R=H-E,S=L-G,J=J*N-D*P,I=I*C-O*M,K=K*S-F*R;if(J>=0&&K>=0&&I>=0){o=!1;break a}}o=!0}}if(o){h.push([a[e[k]],
-a[e[l]],a[e[m]]]);j.push([e[k],e[l],e[m]]);k=l;for(m=l+1;m<f;k++,m++)e[k]=e[m];f--;n=2*f}}if(g)return j;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
-THREE.TorusGeometry=function(a,c,b,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=g||6;a=[];for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){var g=b/this.segmentsT*2*Math.PI,f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(g),(this.radius+this.tube*Math.cos(f))*Math.sin(g),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
-1;b<=this.segmentsT;++b){var g=(this.segmentsT+1)*c+b,f=(this.segmentsT+1)*c+b-1,h=(this.segmentsT+1)*(c-1)+b-1,e=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(g,f,h,e));this.faceVertexUvs[0].push([new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,f,g=Math.PI,h=Math.max(3,b||8),e=Math.max(2,c||6),b=[],c=0;c<e+1;c++){f=c/e;var j=a*Math.cos(f*g),k=a*Math.sin(f*g),l=[],m=0;for(f=0;f<h;f++){var n=2*f/h,p=k*Math.sin(n*g),n=k*Math.cos(n*g);(c==0||c==e)&&f>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,j,p)))-1);l.push(m)}b.push(l)}for(var o,x,w,g=b.length,c=0;c<g;c++)if(h=b[c].length,c>0)for(f=0;f<h;f++){l=f==h-1;e=b[c][l?0:f+1];j=b[c][l?h-1:f];k=b[c-1][l?
+h-1:f];l=b[c-1][l?0:f+1];p=c/(g-1);o=(c-1)/(g-1);x=(f+1)/h;var n=f/h,m=new THREE.UV(1-x,p),p=new THREE.UV(1-n,p),n=new THREE.UV(1-n,o),u=new THREE.UV(1-x,o);c<b.length-1&&(o=this.vertices[e].position.clone(),x=this.vertices[j].position.clone(),w=this.vertices[k].position.clone(),o.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(e,j,k,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,p,n]));c>1&&(o=
+this.vertices[e].position.clone(),x=this.vertices[k].position.clone(),w=this.vertices[l].position.clone(),o.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(e,k,l,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([m,n,u]))}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.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,f=0,g=String(a).split(""),h=g.length,e=[],a=0;a<h;a++){var j=new THREE.Path,j=this.extractGlyphPoints(g[a],b,c,f,j);f+=j.offset;e.push(j.path)}return{paths:e,offset:f/2}},extractGlyphPoints:function(a,b,c,f,g){var h=[],e,j,k,l,m,n,p,o,x,w,u=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;)switch(j=b[a++],j){case "m":j=b[a++]*c+f;l=b[a++]*c;h.push(new THREE.Vector2(j,
+l));g.moveTo(j,l);break;case "l":j=b[a++]*c+f;l=b[a++]*c;h.push(new THREE.Vector2(j,l));g.lineTo(j,l);break;case "q":j=b[a++]*c+f;l=b[a++]*c;p=b[a++]*c+f;o=b[a++]*c;g.quadraticCurveTo(p,o,j,l);if(e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++){var v=e/divisions,y=THREE.Shape.Utils.b2(v,m,p,j),v=THREE.Shape.Utils.b2(v,n,o,l);h.push(new THREE.Vector2(y,v))}}break;case "b":if(j=b[a++]*c+f,l=b[a++]*c,p=b[a++]*c+f,o=b[a++]*-c,x=b[a++]*c+f,w=b[a++]*-c,g.bezierCurveTo(j,l,
+p,o,x,w),e=h[h.length-1]){m=e.x;n=e.y;e=1;for(divisions=this.divisions;e<=divisions;e++)v=e/divisions,y=THREE.Shape.Utils.b3(v,m,p,x,j),v=THREE.Shape.Utils.b3(v,n,o,w,l),h.push(new THREE.Vector2(y,v))}}}return{offset:u.ha*c,points:h,path:g}}}};
+(function(a){var b=function(a){for(var b=a.length,g=0,h=b-1,e=0;e<b;h=e++)g+=a[h].x*a[e].y-a[e].x*a[h].y;return g*0.5};a.Triangulate=function(a,f){var g=a.length;if(g<3)return null;var h=[],e=[],j=[],k,l,m;if(b(a)>0)for(l=0;l<g;l++)e[l]=l;else for(l=0;l<g;l++)e[l]=g-1-l;var n=2*g;for(l=g-1;g>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return j;return h}k=l;g<=k&&(k=0);l=k+1;g<=l&&(l=0);m=l+1;g<=m&&(m=0);var p;a:{p=a;var o=k,x=l,w=m,u=g,v=e,y=void 0,t=void 0,A=void 0,
+B=void 0,G=void 0,F=void 0,z=void 0,D=void 0,J=void 0,t=p[v[o]].x,A=p[v[o]].y,B=p[v[x]].x,G=p[v[x]].y,F=p[v[w]].x,z=p[v[w]].y;if(1.0E-10>(B-t)*(z-A)-(G-A)*(F-t))p=!1;else{for(y=0;y<u;y++)if(!(y==o||y==x||y==w)){var D=p[v[y]].x,J=p[v[y]].y,K=void 0,E=void 0,L=void 0,H=void 0,I=void 0,O=void 0,Q=void 0,C=void 0,P=void 0,M=void 0,N=void 0,R=void 0,K=L=I=void 0,K=F-B,E=z-G,L=t-F,H=A-z,I=B-t,O=G-A,Q=D-t,C=J-A,P=D-B,M=J-G,N=D-F,R=J-z,K=K*M-E*P,I=I*C-O*Q,L=L*R-H*N;if(K>=0&&L>=0&&I>=0){p=!1;break a}}p=!0}}if(p){h.push([a[e[k]],
+a[e[l]],a[e[m]]]);j.push([e[k],e[l],e[m]]);k=l;for(m=l+1;m<g;k++,m++)e[k]=e[m];g--;n=2*g}}if(f)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,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=f||6;a=[];for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){var f=c/this.segmentsT*2*Math.PI,g=b/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))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
+1;c<=this.segmentsT;++c){var f=(this.segmentsT+1)*b+c,g=(this.segmentsT+1)*b+c-1,h=(this.segmentsT+1)*(b-1)+c-1,e=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(f,g,h,e));this.faceVertexUvs[0].push([new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[e][0],a[e][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,c,b,g,f,h,e){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=c||40;this.segmentsR=b||64;this.segmentsT=g||8;this.p=f||2;this.q=h||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;g=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
-this.segmentsT;++c){var k=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,f=j(k,e,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=k.x-f.x;b.y=k.y-f.y;b.z=k.z-f.z;g.x=k.x+f.x;g.y=k.y+f.y;g.z=k.z+f.z;h.cross(b,g);g.cross(h,b);h.normalize();g.normalize();k=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);f.x+=k*g.x+e*h.x;f.y+=k*g.y+e*h.y;f.z+=k*g.z+e*h.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
-f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var g=(a+1)%this.segmentsR,h=(c+1)%this.segmentsT,f=this.grid[a][c],b=this.grid[g][c],g=this.grid[g][h],h=this.grid[a][h],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,b,g,h));this.faceVertexUvs[0].push([e,k,l,m])}this.computeCentroids();
+THREE.TorusKnotGeometry=function(a,b,c,f,g,h,e){function j(a,c,b,e,f,h){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(f*(2+b)*0.5*Math.cos(a),f*(2+b)*Math.sin(a)*0.5,h*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=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,e=b/this.segmentsT*2*Math.PI,g=j(k,e,this.q,this.p,this.radius,this.heightScale),k=j(k+0.01,e,this.q,this.p,this.radius,this.heightScale);c.x=k.x-g.x;c.y=k.y-g.y;c.z=k.z-g.z;f.x=k.x+g.x;f.y=k.y+g.y;f.z=k.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();k=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=k*f.x+e*h.x;g.y+=k*f.y+e*h.y;g.z+=k*f.z+e*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,g=this.grid[a][b],c=this.grid[f][b],f=this.grid[f][h],h=this.grid[a][h],e=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(g,c,f,h));this.faceVertexUvs[0].push([e,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(){}};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
-this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var g=0;g<c.length;++g)a.materials[g]=[THREE.Loader.prototype.createMaterial(c[g],b)]},hasNormals:function(a){var c,b,g=a.materials.length;for(b=0;b<g;b++)if(c=a.materials[b][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function g(a,c){var e=
-new Image;e.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function f(a,b,e,h,f,j){var k=document.createElement("canvas");a[b]=new THREE.Texture(k);a[b].sourceFile=e;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;if(h[1]!=
-1)a[b].wrapT=THREE.RepeatWrapping}f&&a[b].offset.set(f[0],f[1]);if(j){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[j[0]]!==void 0)a[b].wrapS=h[j[0]];if(h[j[1]]!==void 0)a[b].wrapT=h[j[1]]}g(a[b],c+"/"+e)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,j,k;j="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?j="MeshPhongMaterial":a.shading=="Basic"&&(j="MeshBasicMaterial"));
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,b,c){a.materials=[];for(var f=0;f<b.length;++f)a.materials[f]=[THREE.Loader.prototype.createMaterial(b[f],c)]},hasNormals:function(a){var b,c,f=a.materials.length;for(c=0;c<f;c++)if(b=a.materials[c][0],b instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a}function f(a,b){var e=
+new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}function g(a,c,e,h,g,j){var k=document.createElement("canvas");a[c]=new THREE.Texture(k);a[c].sourceFile=e;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(h[1]!=
+1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(j){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[j[0]]!==void 0)a[c].wrapS=h[j[0]];if(h[j[1]]!==void 0)a[c].wrapT=h[j[1]]}f(a[c],b+"/"+e)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,j,k;j="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?j="MeshPhongMaterial":a.shading=="Basic"&&(j="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")e.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")e.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")e.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)e.transparent=a.transparent;if(a.depthTest!==void 0)e.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")e.vertexColors=THREE.FaceColors;else if(a.vertexColors)e.vertexColors=THREE.VertexColors;if(a.colorDiffuse)e.color=h(a.colorDiffuse);
-else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=h(a.colorSpecular);if(a.colorAmbient)e.ambient=h(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&f(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&f(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&f(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&f(e,"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=e.color;j=e.specular;k=e.ambient;var o=e.shininess;m.tNormal.texture=e.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(e.map)m.tDiffuse.texture=e.map,m.enableDiffuse.value=!0;if(e.specularMap)m.tSpecular.texture=e.specularMap,m.enableSpecular.value=!0;if(e.lightMap)m.tAO.texture=
-e.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(e.opacity)m.uOpacity.value=e.opacity;e=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else e=new THREE[j](e);return e}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
-THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,g=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b),a=new Worker(b);a.onmessage=function(a){c.createModel(a.data,g,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var g=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.init_materials(g,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,f,k,l,m,n,o,p,w,t,v,x,y,u,z=a.faces;n=a.vertices;var B=a.normals,A=a.colors,E=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&E++;for(c=0;c<E;c++)g.faceUvs[c]=[],g.faceVertexUvs[c]=[];l=0;for(m=n.length;l<m;)o=new THREE.Vertex,o.position.x=n[l++]*b,o.position.y=
-n[l++]*b,o.position.z=n[l++]*b,g.vertices.push(o);l=0;for(m=z.length;l<m;){b=z[l++];n=b&1;k=b&2;c=b&4;f=b&8;p=b&16;o=b&32;t=b&64;b&=128;n?(v=new THREE.Face4,v.a=z[l++],v.b=z[l++],v.c=z[l++],v.d=z[l++],n=4):(v=new THREE.Face3,v.a=z[l++],v.b=z[l++],v.c=z[l++],n=3);if(k)k=z[l++],v.materials=g.materials[k];k=g.faces.length;if(c)for(c=0;c<E;c++)x=a.uvs[c],w=z[l++],u=x[w*2],w=x[w*2+1],g.faceUvs[c][k]=new THREE.UV(u,w);if(f)for(c=0;c<E;c++){x=a.uvs[c];y=[];for(f=0;f<n;f++)w=z[l++],u=x[w*2],w=x[w*2+1],y[f]=
-new THREE.UV(u,w);g.faceVertexUvs[c][k]=y}if(p)p=z[l++]*3,f=new THREE.Vector3,f.x=B[p++],f.y=B[p++],f.z=B[p],v.normal=f;if(o)for(c=0;c<n;c++)p=z[l++]*3,f=new THREE.Vector3,f.x=B[p++],f.y=B[p++],f.z=B[p],v.vertexNormals.push(f);if(t)o=z[l++],o=new THREE.Color(A[o]),v.color=o;if(b)for(c=0;c<n;c++)o=z[l++],o=new THREE.Color(A[o]),v.vertexColors.push(o);g.faces.push(v)}}})(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],g.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],g.skinIndices.push(new THREE.Vector4(f,k,0,0))}g.bones=a.bones;g.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,k,l,m,n,o,p,w;c=0;for(f=a.morphTargets.length;c<f;c++){g.morphTargets[c]={};g.morphTargets[c].name=a.morphTargets[c].name;g.morphTargets[c].vertices=[];p=g.morphTargets[c].vertices;w=a.morphTargets[c].vertices;k=0;for(l=w.length;k<l;k+=3)m=w[k]*b,n=w[k+1]*
-b,o=w[k+2]*b,p.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++){g.morphColors[c]={};g.morphColors[c].name=a.morphColors[c].name;g.morphColors[c].colors=[];l=g.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],g.edges.push(new THREE.Edge(g.vertices[c],
-g.vertices[f],c,f))}})();g.computeCentroids();g.computeFaceNormals();this.hasNormals(g)&&g.computeTangents();c(g)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,g=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c),a=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,b,f,g,h)};c.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,g,f,h){var e=new XMLHttpRequest,j=g+"/"+a,k=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,f,c):alert("Couldn't load ["+j+"] ["+e.status+"]"):e.readyState==3?h&&(k==0&&(k=e.getResponseHeader("Content-Length")),h({total:k,loaded:e.responseText.length})):e.readyState==2&&(k=e.getResponseHeader("Content-Length"))};e.open("GET",j,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
-e.setRequestHeader("Content-Type","text/plain");e.send(null)},createBinModel:function(a,c,b,g){var f=function(b){function c(a,b){var g=m(a,b),e=m(a,b+1),f=m(a,b+2),h=m(a,b+3),j=(h<<1&255|f>>7)-127;g|=(f&127)<<16|e<<8;if(g==0&&j==-127)return 0;return(1-2*(h>>7))*(1+g*Math.pow(2,-23))*Math.pow(2,j)}function f(a,b){var c=m(a,b),g=m(a,b+1),e=m(a,b+2);return(m(a,b+3)<<24)+(e<<16)+(g<<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,g,e;c=f(a,b);g=f(a,b+A);e=f(a,b+E);b=k(a,b+G);THREE.BinaryLoader.prototype.f3(x,c,g,e,b)}function o(b){var c,g,e,h,l,m;c=f(a,b);g=f(a,b+A);e=f(a,b+E);h=k(a,b+G);l=f(a,b+H);m=f(a,b+L);b=f(a,b+J);THREE.BinaryLoader.prototype.f3n(x,z,c,g,e,h,l,m,b)}function p(b){var c,g,e,h;c=f(a,b);g=f(a,b+D);e=f(a,b+K);h=f(a,b+F);b=k(a,b+I);THREE.BinaryLoader.prototype.f4(x,c,g,e,h,b)}function w(b){var c,g,e,h,l,m,n,o;c=f(a,b);g=f(a,b+D);e=f(a,b+K);h=f(a,b+F);l=k(a,
-b+I);m=f(a,b+O);n=f(a,b+M);o=f(a,b+C);b=f(a,b+P);THREE.BinaryLoader.prototype.f4n(x,z,c,g,e,h,l,m,n,o,b)}function t(b){var c,g;c=f(a,b);g=f(a,b+N);b=f(a,b+R);THREE.BinaryLoader.prototype.uv3(x.faceVertexUvs[0],B[c*2],B[c*2+1],B[g*2],B[g*2+1],B[b*2],B[b*2+1])}function v(b){var c,g,e;c=f(a,b);g=f(a,b+S);e=f(a,b+Y);b=f(a,b+Z);THREE.BinaryLoader.prototype.uv4(x.faceVertexUvs[0],B[c*2],B[c*2+1],B[g*2],B[g*2+1],B[e*2],B[e*2+1],B[b*2],B[b*2+1])}var x=this,y=0,u,z=[],B=[],A,E,G,H,L,J,D,K,F,I,O,M,C,P,N,R,
-S,Y,Z,T,U,V,W,X,Q;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(x,g,b);u={signature:a.substr(y,8),header_bytes:m(a,y+8),vertex_coordinate_bytes:m(a,y+9),normal_coordinate_bytes:m(a,y+10),uv_coordinate_bytes:m(a,y+11),vertex_index_bytes:m(a,y+12),normal_index_bytes:m(a,y+13),uv_index_bytes:m(a,y+14),material_index_bytes:m(a,y+15),nvertices:f(a,y+16),nnormals:f(a,y+16+4),nuvs:f(a,y+16+8),ntri_flat:f(a,y+16+12),ntri_smooth:f(a,y+16+16),ntri_flat_uv:f(a,y+16+20),ntri_smooth_uv:f(a,y+
-16+24),nquad_flat:f(a,y+16+28),nquad_smooth:f(a,y+16+32),nquad_flat_uv:f(a,y+16+36),nquad_smooth_uv:f(a,y+16+40)};y+=u.header_bytes;A=u.vertex_index_bytes;E=u.vertex_index_bytes*2;G=u.vertex_index_bytes*3;H=u.vertex_index_bytes*3+u.material_index_bytes;L=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;J=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;D=u.vertex_index_bytes;K=u.vertex_index_bytes*2;F=u.vertex_index_bytes*3;I=u.vertex_index_bytes*4;O=u.vertex_index_bytes*
-4+u.material_index_bytes;M=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes;C=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;P=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;N=u.uv_index_bytes;R=u.uv_index_bytes*2;S=u.uv_index_bytes;Y=u.uv_index_bytes*2;Z=u.uv_index_bytes*3;b=u.vertex_index_bytes*3+u.material_index_bytes;Q=u.vertex_index_bytes*4+u.material_index_bytes;T=u.ntri_flat*b;U=u.ntri_smooth*(b+u.normal_index_bytes*3);V=u.ntri_flat_uv*
-(b+u.uv_index_bytes*3);W=u.ntri_smooth_uv*(b+u.normal_index_bytes*3+u.uv_index_bytes*3);X=u.nquad_flat*Q;b=u.nquad_smooth*(Q+u.normal_index_bytes*4);Q=u.nquad_flat_uv*(Q+u.uv_index_bytes*4);y+=function(b){for(var g,f,h,j=u.vertex_coordinate_bytes*3,k=b+u.nvertices*j;b<k;b+=j)g=c(a,b),f=c(a,b+u.vertex_coordinate_bytes),h=c(a,b+u.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(x,g,f,h);return u.nvertices*j}(y);y+=function(b){for(var c,g,e,f=u.normal_coordinate_bytes*3,h=b+u.nnormals*f;b<h;b+=
-f)c=l(a,b),g=l(a,b+u.normal_coordinate_bytes),e=l(a,b+u.normal_coordinate_bytes*2),z.push(c/127,g/127,e/127);return u.nnormals*f}(y);y+=function(b){for(var g,f,h=u.uv_coordinate_bytes*2,j=b+u.nuvs*h;b<j;b+=h)g=c(a,b),f=c(a,b+u.uv_coordinate_bytes),B.push(g,f);return u.nuvs*h}(y);T=y+T;U=T+U;V=U+V;W=V+W;X=W+X;b=X+b;Q=b+Q;(function(a){var b,c=u.vertex_index_bytes*3+u.material_index_bytes,g=c+u.uv_index_bytes*3,e=a+u.ntri_flat_uv*g;for(b=a;b<e;b+=g)n(b),t(b+c);return e-a})(U);(function(a){var b,c=u.vertex_index_bytes*
-3+u.material_index_bytes+u.normal_index_bytes*3,g=c+u.uv_index_bytes*3,e=a+u.ntri_smooth_uv*g;for(b=a;b<e;b+=g)o(b),t(b+c);return e-a})(V);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes,g=c+u.uv_index_bytes*4,e=a+u.nquad_flat_uv*g;for(b=a;b<e;b+=g)p(b),v(b+c);return e-a})(b);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,g=c+u.uv_index_bytes*4,e=a+u.nquad_smooth_uv*g;for(b=a;b<e;b+=g)w(b),v(b+c);return e-a})(Q);(function(a){var b,c=u.vertex_index_bytes*
-3+u.material_index_bytes,g=a+u.ntri_flat*c;for(b=a;b<g;b+=c)n(b);return g-a})(y);(function(a){var b,c=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,g=a+u.ntri_smooth*c;for(b=a;b<g;b+=c)o(b);return g-a})(T);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes,g=a+u.nquad_flat*c;for(b=a;b<g;b+=c)p(b);return g-a})(W);(function(a){var b,c=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,g=a+u.nquad_smooth*c;for(b=a;b<g;b+=c)w(b);return g-a})(X);
-this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,g){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,g)))},f3:function(a,c,b,g,f){a.faces.push(new THREE.Face3(c,b,g,null,null,a.materials[f]))},f4:function(a,c,b,g,f,h){a.faces.push(new THREE.Face4(c,b,g,f,null,null,a.materials[h]))},f3n:function(a,c,b,g,f,h,e,j,k){var h=a.materials[h],l=c[j*
-3],m=c[j*3+1],j=c[j*3+2],n=c[k*3],o=c[k*3+1],k=c[k*3+2];a.faces.push(new THREE.Face3(b,g,f,[new THREE.Vector3(c[e*3],c[e*3+1],c[e*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,o,k)],null,h))},f4n:function(a,c,b,g,f,h,e,j,k,l,m){var e=a.materials[e],n=c[k*3],o=c[k*3+1],k=c[k*3+2],p=c[l*3],w=c[l*3+1],l=c[l*3+2],t=c[m*3],v=c[m*3+1],m=c[m*3+2];a.faces.push(new THREE.Face4(b,g,f,h,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(p,w,l),new THREE.Vector3(t,v,
-m)],null,e))},uv3:function(a,c,b,g,f,h,e){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(g,f));j.push(new THREE.UV(h,e));a.push(j)},uv4:function(a,c,b,g,f,h,e,j,k){var l=[];l.push(new THREE.UV(c,b));l.push(new THREE.UV(g,f));l.push(new THREE.UV(h,e));l.push(new THREE.UV(j,k));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,g=new Worker(a);g.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);g.onmessage=function(a){function g(a,b){return b=="relativeToHTML"?a:f+"/"+a}function j(){for(p in D.objects)if(!C.objects[p])if(y=D.objects[p],y.geometry!==void 0){if(A=C.geometries[y.geometry]){var a=!1;L=[];for(N=0;N<y.materials.length;N++)L[N]=C.materials[y.materials[N]],a=L[N]instanceof THREE.MeshShaderMaterial;a&&A.computeTangents();u=y.position;r=y.rotation;
-q=y.quaternion;s=y.scale;q=0;L.length==0&&(L[0]=new THREE.MeshFaceMaterial);L.length>1&&(L=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(A,L);object.name=p;object.position.set(u[0],u[1],u[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=y.visible;C.scene.addObject(object);C.objects[p]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),C.scene.collisions.colliders.push(a));
-if(y.castsShadow)a=new THREE.ShadowVolume(A),C.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},C.triggers[object.name]=a)}}else u=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(u[0],u[1],u[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=y.visible!==void 0?y.visible:!1,C.scene.addObject(object),C.objects[p]=object,C.empties[p]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},C.triggers[object.name]=a)}function k(a){return function(c){C.geometries[a]=c;j();F-=1;b.onLoadComplete();m()}}function l(a){return function(b){C.geometries[a]=b}}function m(){b.callbackProgress({totalModels:O,totalTextures:M,loadedModels:O-F,loadedTextures:M-I},C);b.onLoadProgress();F==0&&I==0&&c(C)}var n,
-o,p,w,t,v,x,y,u,z,B,A,E,G,H,L,J,D,K,F,I,O,M,C;D=a.data;H=new THREE.BinaryLoader;K=new THREE.JSONLoader;I=F=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in D.objects)if(y=D.objects[p],y.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(D.transform){a=D.transform.position;z=D.transform.rotation;var P=D.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(){I-=1;m();b.onLoadComplete()};for(t in D.cameras){z=D.cameras[t];if(z.type=="perspective")E=new THREE.Camera(z.fov,z.aspect,z.near,z.far);else if(z.type=="ortho")E=new THREE.Camera,E.projectionMatrix=THREE.Matrix4.makeOrtho(z.left,z.right,z.top,z.bottom,z.near,z.far);u=z.position;z=z.target;E.position.set(u[0],u[1],u[2]);E.target.position.set(z[0],z[1],z[2]);C.cameras[t]=E}for(w in D.lights)t=D.lights[w],
-E=t.color!==void 0?t.color:16777215,z=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(u=t.direction,J=new THREE.DirectionalLight(E,z),J.position.set(u[0],u[1],u[2]),J.position.normalize()):t.type=="point"?(u=t.position,d=t.distance,J=new THREE.PointLight(E,z,d),J.position.set(u[0],u[1],u[2])):t.type=="ambient"&&(J=new THREE.AmbientLight(E)),C.scene.addLight(J),C.lights[w]=J;for(v in D.fogs)w=D.fogs[v],w.type=="linear"?G=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(G=new THREE.FogExp2(0,
-w.density)),z=w.color,G.color.setRGB(z[0],z[1],z[2]),C.fogs[v]=G;if(C.cameras&&D.defaults.camera)C.currentCamera=C.cameras[D.defaults.camera];if(C.fogs&&D.defaults.fog)C.scene.fog=C.fogs[D.defaults.fog];z=D.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(z[0],z[1],z[2]);C.bgColorAlpha=D.defaults.bgalpha;for(n in D.geometries)if(v=D.geometries[n],v.type=="bin_mesh"||v.type=="ascii_mesh")F+=1,b.onLoadStart();O=F;for(n in D.geometries)v=D.geometries[n],v.type=="cube"?(A=new THREE.CubeGeometry(v.width,
-v.height,v.depth,v.segmentsWidth,v.segmentsHeight,v.segmentsDepth,null,v.flipped,v.sides),C.geometries[n]=A):v.type=="plane"?(A=new THREE.PlaneGeometry(v.width,v.height,v.segmentsWidth,v.segmentsHeight),C.geometries[n]=A):v.type=="sphere"?(A=new THREE.SphereGeometry(v.radius,v.segmentsWidth,v.segmentsHeight),C.geometries[n]=A):v.type=="cylinder"?(A=new THREE.CylinderGeometry(v.numSegs,v.topRad,v.botRad,v.height,v.topOffset,v.botOffset),C.geometries[n]=A):v.type=="torus"?(A=new THREE.TorusGeometry(v.radius,
-v.tube,v.segmentsR,v.segmentsT),C.geometries[n]=A):v.type=="icosahedron"?(A=new THREE.IcosahedronGeometry(v.subdivisions),C.geometries[n]=A):v.type=="bin_mesh"?H.load({model:g(v.url,D.urlBaseType),callback:k(n)}):v.type=="ascii_mesh"?K.load({model:g(v.url,D.urlBaseType),callback:k(n)}):v.type=="embedded_mesh"&&(v=D.embeds[v.id])&&K.createModel(v,l(n),"");for(x in D.textures)if(n=D.textures[x],n.url instanceof Array){I+=n.url.length;for(H=0;H<n.url.length;H++)b.onLoadStart()}else I+=1,b.onLoadStart();
-M=I;for(x in D.textures){n=D.textures[x];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){H=[];for(var N=0;N<n.url.length;N++)H[N]=g(n.url[N],D.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,n.mapping,a)}else{H=THREE.ImageUtils.loadTexture(g(n.url,D.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)H.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)H.magFilter=THREE[n.magFilter];if(n.repeat){H.repeat.set(n.repeat[0],n.repeat[1]);
-if(n.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}n.offset&&H.offset.set(n.offset[0],n.offset[1]);if(n.wrap){K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(K[n.wrap[0]]!==void 0)H.wrapS=K[n.wrap[0]];if(K[n.wrap[1]]!==void 0)H.wrapT=K[n.wrap[1]]}}C.textures[x]=H}for(o in D.materials){x=D.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);H=x.parameters.color;K=x.parameters.specular;v=x.parameters.ambient;G=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(H);a.uSpecularColor.value.setHex(K);a.uAmbientColor.value.setHex(v);a.uShininess.value=G;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();b.callbackSync(C)}}};
-THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];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,c,f){return a+(c-a)*f};this.VIntX=function(a,c,f,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;c[h]=j+e*this.delta;c[h+1]=k;c[h+2]=l;f[h]=this.lerp(m[a],m[a+3],e);f[h+1]=this.lerp(m[a+1],m[a+4],e);f[h+2]=this.lerp(m[a+2],m[a+5],e)};this.VIntY=function(a,c,f,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;c[h]=j;c[h+1]=k+e*this.delta;c[h+
-2]=l;c=a+this.yd*3;f[h]=this.lerp(m[a],m[c],e);f[h+1]=this.lerp(m[a+1],m[c+1],e);f[h+2]=this.lerp(m[a+2],m[c+2],e)};this.VIntZ=function(a,c,f,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;c[h]=j;c[h+1]=k;c[h+2]=l+e*this.delta;c=a+this.zd*3;f[h]=this.lerp(m[a],m[c],e);f[h+1]=this.lerp(m[a+1],m[c+1],e);f[h+2]=this.lerp(m[a+2],m[c+2],e)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-this.field[a+
-this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,f,h,e,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,o=k+this.zd,p=h+this.yd+this.zd,w=k+this.yd+this.zd,t=0,v=this.field[h],x=this.field[k],y=this.field[l],u=this.field[n],z=this.field[m],B=this.field[o],A=this.field[p],E=this.field[w];v<e&&(t|=1);x<e&&(t|=2);y<e&&(t|=8);u<e&&(t|=4);z<e&&(t|=16);B<e&&(t|=32);A<e&&(t|=128);E<e&&(t|=64);var G=THREE.edgeTable[t];if(G==0)return 0;var H=this.delta,
-L=a+H,J=c+H,H=f+H;G&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,e,a,c,f,v,x));G&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,e,L,c,f,x,u));G&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,e,a,J,f,y,u));G&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,e,a,c,f,v,y));G&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,e,a,c,H,z,B));G&32&&(this.compNorm(o),
-this.compNorm(w),this.VIntY(o*3,this.vlist,this.nlist,15,e,L,c,H,B,E));G&64&&(this.compNorm(p),this.compNorm(w),this.VIntX(p*3,this.vlist,this.nlist,18,e,a,J,H,A,E));G&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,e,a,c,H,z,A));G&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,e,a,c,f,v,z));G&512&&(this.compNorm(k),this.compNorm(o),this.VIntZ(k*3,this.vlist,this.nlist,27,e,L,c,f,x,B));G&1024&&(this.compNorm(n),this.compNorm(w),this.VIntZ(n*
-3,this.vlist,this.nlist,30,e,L,J,f,u,E));G&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,e,a,J,f,y,A));t<<=4;for(e=h=0;THREE.triTable[t+e]!=-1;)a=t+e,c=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[f],j),e+=3,h++;return h};this.posnormtriv=function(a,c,f,h,e,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[e];this.positionArray[k+7]=a[e+1];this.positionArray[k+8]=a[e+2];this.normalArray[k]=c[f];this.normalArray[k+1]=c[f+1];this.normalArray[k+2]=c[f+2];this.normalArray[k+3]=c[h];this.normalArray[k+4]=c[h+1];this.normalArray[k+5]=c[h+2];this.normalArray[k+6]=c[e];this.normalArray[k+7]=c[e+1];this.normalArray[k+8]=c[e+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 c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,f,h,e){var j=this.size*Math.sqrt(h/e),k=f*this.size,l=c*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 p=Math.floor(m-j);p<1&&(p=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
-1);for(var w,t,v,x,y,u;n<k;n++){m=this.size2*n;t=n/this.size-f;y=t*t;for(t=o;t<l;t++){v=m+this.size*t;w=t/this.size-c;u=w*w;for(w=p;w<j;w++)x=w/this.size-a,x=h/(1.0E-6+x*x+u+y)-e,x>0&&(this.field[v+w]+=x)}}};this.addPlaneX=function(a,c){var f,h,e,j,k,l=this.size,m=this.yd,n=this.zd,o=this.field,p=l*Math.sqrt(a/c);p>l&&(p=l);for(f=0;f<p;f++)if(h=f/l,h*=h,j=a/(1.0E-4+h)-c,j>0)for(h=0;h<l;h++){k=f+h*m;for(e=0;e<l;e++)o[n*e+k]+=j}};this.addPlaneY=function(a,c){var f,h,e,j,k,l,m=this.size,n=this.yd,o=
-this.zd,p=this.field,w=m*Math.sqrt(a/c);w>m&&(w=m);for(h=0;h<w;h++)if(f=h/m,f*=f,j=a/(1.0E-4+f)-c,j>0){k=h*n;for(f=0;f<m;f++){l=k+f;for(e=0;e<m;e++)p[o*e+l]+=j}}};this.addPlaneZ=function(a,c){var f,h,e,j,k,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(e=0;e<dist;e++)if(f=e/size,f*=f,j=a/(1.0E-4+f)-c,j>0){k=zd*e;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 c,f,h,e,j,k,l,m,n,o=this.size-2;for(e=1;e<o;e++){n=this.size2*e;l=(e-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,c=m+f,this.polygonize(j,k,l,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,f=[];this.render(function(h){var e,j,k,l,m,n,o,p;for(e=0;e<h.count;e++)o=e*3,m=o+1,p=o+2,j=h.positionArray[o],
-k=h.positionArray[m],l=h.positionArray[p],n=new THREE.Vector3(j,k,l),j=h.normalArray[o],k=h.normalArray[m],l=h.normalArray[p],o=new THREE.Vector3(j,k,l),o.normalize(),m=new THREE.Vertex(n),c.vertices.push(m),f.push(o);nfaces=h.count/3;for(e=0;e<nfaces;e++)o=(a+e)*3,m=o+1,p=o+2,n=f[o],j=f[m],k=f[p],o=new THREE.Face3(o,m,p,[n,j,k]),c.faces.push(o);a+=nfaces;h.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=h(a.colorSpecular);if(a.colorAmbient)e.ambient=h(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&b&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
+a.mapSpecular&&b&&g(e,"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=e.color;j=e.specular;k=e.ambient;var p=e.shininess;m.tNormal.texture=e.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(e.map)m.tDiffuse.texture=e.map,m.enableDiffuse.value=!0;if(e.specularMap)m.tSpecular.texture=e.specularMap,m.enableSpecular.value=!0;if(e.lightMap)m.tAO.texture=
+e.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(n);m.uSpecularColor.value.setHex(j);m.uAmbientColor.value.setHex(k);m.uShininess.value=p;if(e.opacity)m.uOpacity.value=e.opacity;e=new THREE.MeshShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else e=new THREE[j](e);return e}};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,f=a.callback,g=a.texture_path?a.texture_path:this.extractUrlbase(c),a=new Worker(c);a.onmessage=function(a){b.createModel(a.data,f,g);b.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var f=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.init_materials(f,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,g,k,l,m,n,p,o,x,w,u,v,y,t,A=a.faces;n=a.vertices;var B=a.normals,G=a.colors,F=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&F++;for(b=0;b<F;b++)f.faceUvs[b]=[],f.faceVertexUvs[b]=[];l=0;for(m=n.length;l<m;)p=new THREE.Vertex,p.position.x=n[l++]*c,p.position.y=
+n[l++]*c,p.position.z=n[l++]*c,f.vertices.push(p);l=0;for(m=A.length;l<m;){c=A[l++];n=c&1;k=c&2;b=c&4;g=c&8;o=c&16;p=c&32;w=c&64;c&=128;n?(u=new THREE.Face4,u.a=A[l++],u.b=A[l++],u.c=A[l++],u.d=A[l++],n=4):(u=new THREE.Face3,u.a=A[l++],u.b=A[l++],u.c=A[l++],n=3);if(k)k=A[l++],u.materials=f.materials[k];k=f.faces.length;if(b)for(b=0;b<F;b++)v=a.uvs[b],x=A[l++],t=v[x*2],x=v[x*2+1],f.faceUvs[b][k]=new THREE.UV(t,x);if(g)for(b=0;b<F;b++){v=a.uvs[b];y=[];for(g=0;g<n;g++)x=A[l++],t=v[x*2],x=v[x*2+1],y[g]=
+new THREE.UV(t,x);f.faceVertexUvs[b][k]=y}if(o)o=A[l++]*3,g=new THREE.Vector3,g.x=B[o++],g.y=B[o++],g.z=B[o],u.normal=g;if(p)for(b=0;b<n;b++)o=A[l++]*3,g=new THREE.Vector3,g.x=B[o++],g.y=B[o++],g.z=B[o],u.vertexNormals.push(g);if(w)p=A[l++],p=new THREE.Color(G[p]),u.color=p;if(c)for(b=0;b<n;b++)p=A[l++],p=new THREE.Color(G[p]),u.vertexColors.push(p);f.faces.push(u)}}})(g);(function(){var c,b,g,k;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)g=a.skinWeights[c],k=a.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
+k,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)g=a.skinIndices[c],k=a.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,k,0,0))}f.bones=a.bones;f.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,g,k,l,m,n,p,o,x;b=0;for(g=a.morphTargets.length;b<g;b++){f.morphTargets[b]={};f.morphTargets[b].name=a.morphTargets[b].name;f.morphTargets[b].vertices=[];o=f.morphTargets[b].vertices;x=a.morphTargets[b].vertices;k=0;for(l=x.length;k<l;k+=3)m=x[k]*c,n=x[k+1]*
+c,p=x[k+2]*c,o.push(new THREE.Vertex(new THREE.Vector3(m,n,p)))}}if(a.morphColors!==void 0){b=0;for(g=a.morphColors.length;b<g;b++){f.morphColors[b]={};f.morphColors[b].name=a.morphColors[b].name;f.morphColors[b].colors=[];l=f.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)}}})(g);(function(){if(a.edges!==void 0){var c,b,g;for(c=0;c<a.edges.length;c+=2)b=a.edges[c],g=a.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[b],
+f.vertices[g],b,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();b(f)};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,f=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b),g=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,g,f,h)};b.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};
+b.postMessage(a)},loadAjaxBuffers:function(a,b,c,f,g,h){var e=new XMLHttpRequest,j=f+"/"+a,k=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,c,g,b):alert("Couldn't load ["+j+"] ["+e.status+"]"):e.readyState==3?h&&(k==0&&(k=e.getResponseHeader("Content-Length")),h({total:k,loaded:e.responseText.length})):e.readyState==2&&(k=e.getResponseHeader("Content-Length"))};e.open("GET",j,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
+e.setRequestHeader("Content-Type","text/plain");e.send(null)},createBinModel:function(a,b,c,f){var g=function(c){function b(a,c){var f=m(a,c),e=m(a,c+1),g=m(a,c+2),h=m(a,c+3),j=(h<<1&255|g>>7)-127;f|=(g&127)<<16|e<<8;if(f==0&&j==-127)return 0;return(1-2*(h>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,j)}function g(a,c){var b=m(a,c),f=m(a,c+1),e=m(a,c+2);return(m(a,c+3)<<24)+(e<<16)+(f<<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,f,e;b=g(a,c);f=g(a,c+G);e=g(a,c+F);c=k(a,c+z);THREE.BinaryLoader.prototype.f3(v,b,f,e,c)}function p(c){var b,f,e,h,l,m;b=g(a,c);f=g(a,c+G);e=g(a,c+F);h=k(a,c+z);l=g(a,c+D);m=g(a,c+J);c=g(a,c+K);THREE.BinaryLoader.prototype.f3n(v,A,b,f,e,h,l,m,c)}function o(c){var b,f,e,h;b=g(a,c);f=g(a,c+E);e=g(a,c+L);h=g(a,c+H);c=k(a,c+I);THREE.BinaryLoader.prototype.f4(v,b,f,e,h,c)}function x(c){var b,f,e,h,l,m,n,o;b=g(a,c);f=g(a,c+E);e=g(a,c+L);h=g(a,c+H);l=k(a,
+c+I);m=g(a,c+O);n=g(a,c+Q);o=g(a,c+C);c=g(a,c+P);THREE.BinaryLoader.prototype.f4n(v,A,b,f,e,h,l,m,n,o,c)}function w(c){var b,f;b=g(a,c);f=g(a,c+M);c=g(a,c+N);THREE.BinaryLoader.prototype.uv3(v.faceVertexUvs[0],B[b*2],B[b*2+1],B[f*2],B[f*2+1],B[c*2],B[c*2+1])}function u(c){var b,f,e;b=g(a,c);f=g(a,c+R);e=g(a,c+Y);c=g(a,c+Z);THREE.BinaryLoader.prototype.uv4(v.faceVertexUvs[0],B[b*2],B[b*2+1],B[f*2],B[f*2+1],B[e*2],B[e*2+1],B[c*2],B[c*2+1])}var v=this,y=0,t,A=[],B=[],G,F,z,D,J,K,E,L,H,I,O,Q,C,P,M,N,
+R,Y,Z,T,U,V,W,X,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,f,c);t={signature:a.substr(y,8),header_bytes:m(a,y+8),vertex_coordinate_bytes:m(a,y+9),normal_coordinate_bytes:m(a,y+10),uv_coordinate_bytes:m(a,y+11),vertex_index_bytes:m(a,y+12),normal_index_bytes:m(a,y+13),uv_index_bytes:m(a,y+14),material_index_bytes:m(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,y+16+20),ntri_smooth_uv:g(a,y+
+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=t.header_bytes;G=t.vertex_index_bytes;F=t.vertex_index_bytes*2;z=t.vertex_index_bytes*3;D=t.vertex_index_bytes*3+t.material_index_bytes;J=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;K=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;E=t.vertex_index_bytes;L=t.vertex_index_bytes*2;H=t.vertex_index_bytes*3;I=t.vertex_index_bytes*4;O=t.vertex_index_bytes*
+4+t.material_index_bytes;Q=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes;C=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;P=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;M=t.uv_index_bytes;N=t.uv_index_bytes*2;R=t.uv_index_bytes;Y=t.uv_index_bytes*2;Z=t.uv_index_bytes*3;c=t.vertex_index_bytes*3+t.material_index_bytes;S=t.vertex_index_bytes*4+t.material_index_bytes;T=t.ntri_flat*c;U=t.ntri_smooth*(c+t.normal_index_bytes*3);V=t.ntri_flat_uv*
+(c+t.uv_index_bytes*3);W=t.ntri_smooth_uv*(c+t.normal_index_bytes*3+t.uv_index_bytes*3);X=t.nquad_flat*S;c=t.nquad_smooth*(S+t.normal_index_bytes*4);S=t.nquad_flat_uv*(S+t.uv_index_bytes*4);y+=function(c){for(var f,g,h,j=t.vertex_coordinate_bytes*3,k=c+t.nvertices*j;c<k;c+=j)f=b(a,c),g=b(a,c+t.vertex_coordinate_bytes),h=b(a,c+t.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(v,f,g,h);return t.nvertices*j}(y);y+=function(c){for(var b,f,e,g=t.normal_coordinate_bytes*3,h=c+t.nnormals*g;c<h;c+=
+g)b=l(a,c),f=l(a,c+t.normal_coordinate_bytes),e=l(a,c+t.normal_coordinate_bytes*2),A.push(b/127,f/127,e/127);return t.nnormals*g}(y);y+=function(c){for(var f,g,h=t.uv_coordinate_bytes*2,j=c+t.nuvs*h;c<j;c+=h)f=b(a,c),g=b(a,c+t.uv_coordinate_bytes),B.push(f,g);return t.nuvs*h}(y);T=y+T;U=T+U;V=U+V;W=V+W;X=W+X;c=X+c;S=c+S;(function(a){var c,b=t.vertex_index_bytes*3+t.material_index_bytes,f=b+t.uv_index_bytes*3,e=a+t.ntri_flat_uv*f;for(c=a;c<e;c+=f)n(c),w(c+b);return e-a})(U);(function(a){var c,b=t.vertex_index_bytes*
+3+t.material_index_bytes+t.normal_index_bytes*3,f=b+t.uv_index_bytes*3,e=a+t.ntri_smooth_uv*f;for(c=a;c<e;c+=f)p(c),w(c+b);return e-a})(V);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes,f=b+t.uv_index_bytes*4,e=a+t.nquad_flat_uv*f;for(c=a;c<e;c+=f)o(c),u(c+b);return e-a})(c);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,f=b+t.uv_index_bytes*4,e=a+t.nquad_smooth_uv*f;for(c=a;c<e;c+=f)x(c),u(c+b);return e-a})(S);(function(a){var c,b=t.vertex_index_bytes*
+3+t.material_index_bytes,f=a+t.ntri_flat*b;for(c=a;c<f;c+=b)n(c);return f-a})(y);(function(a){var c,b=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*3,f=a+t.ntri_smooth*b;for(c=a;c<f;c+=b)p(c);return f-a})(T);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes,f=a+t.nquad_flat*b;for(c=a;c<f;c+=b)o(c);return f-a})(W);(function(a){var c,b=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*4,f=a+t.nquad_smooth*b;for(c=a;c<f;c+=b)x(c);return f-a})(X);
+this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))},v:function(a,b,c,f){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,f)))},f3:function(a,b,c,f,g){a.faces.push(new THREE.Face3(b,c,f,null,null,a.materials[g]))},f4:function(a,b,c,f,g,h){a.faces.push(new THREE.Face4(b,c,f,g,null,null,a.materials[h]))},f3n:function(a,b,c,f,g,h,e,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],p=b[k*3+1],k=b[k*3+2];a.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(b[e*3],b[e*3+1],b[e*3+2]),new THREE.Vector3(l,m,j),new THREE.Vector3(n,p,k)],null,h))},f4n:function(a,b,c,f,g,h,e,j,k,l,m){var e=a.materials[e],n=b[k*3],p=b[k*3+1],k=b[k*3+2],o=b[l*3],x=b[l*3+1],l=b[l*3+2],w=b[m*3],u=b[m*3+1],m=b[m*3+2];a.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(o,x,l),new THREE.Vector3(w,u,
+m)],null,e))},uv3:function(a,b,c,f,g,h,e){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(f,g));j.push(new THREE.UV(h,e));a.push(j)},uv4:function(a,b,c,f,g,h,e,j,k){var l=[];l.push(new THREE.UV(b,c));l.push(new THREE.UV(f,g));l.push(new THREE.UV(h,e));l.push(new THREE.UV(j,k));a.push(l)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
+THREE.SceneLoader.prototype={load:function(a,b){var c=this,f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(a){function f(a,c){return c=="relativeToHTML"?a:g+"/"+a}function j(){for(o in E.objects)if(!C.objects[o])if(y=E.objects[o],y.geometry!==void 0){if(G=C.geometries[y.geometry]){var a=!1;J=[];for(M=0;M<y.materials.length;M++)J[M]=C.materials[y.materials[M]],a=J[M]instanceof THREE.MeshShaderMaterial;a&&G.computeTangents();t=y.position;r=y.rotation;
+q=y.quaternion;s=y.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=o;object.position.set(t[0],t[1],t[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=y.visible;C.scene.addObject(object);C.objects[o]=object;y.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),C.scene.collisions.colliders.push(a));
+if(y.castsShadow)a=new THREE.ShadowVolume(G),C.scene.addChild(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},C.triggers[object.name]=a)}}else t=y.position,r=y.rotation,q=y.quaternion,s=y.scale,q=0,object=new THREE.Object3D,object.name=o,object.position.set(t[0],t[1],t[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=y.visible!==void 0?y.visible:!1,C.scene.addObject(object),C.objects[o]=object,C.empties[o]=object,y.trigger&&y.trigger.toLowerCase()!="none"&&(a={type:y.trigger,object:y},C.triggers[object.name]=a)}function k(a){return function(b){C.geometries[a]=b;j();H-=1;c.onLoadComplete();m()}}function l(a){return function(c){C.geometries[a]=c}}function m(){c.callbackProgress({totalModels:O,totalTextures:Q,loadedModels:O-H,loadedTextures:Q-I},C);c.onLoadProgress();H==0&&I==0&&b(C)}var n,
+p,o,x,w,u,v,y,t,A,B,G,F,z,D,J,K,E,L,H,I,O,Q,C;E=a.data;D=new THREE.BinaryLoader;L=new THREE.JSONLoader;I=H=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in E.objects)if(y=E.objects[o],y.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(){I-=1;m();c.onLoadComplete()};for(w in E.cameras){A=E.cameras[w];if(A.type=="perspective")F=new THREE.Camera(A.fov,A.aspect,A.near,A.far);else if(A.type=="ortho")F=new THREE.Camera,F.projectionMatrix=THREE.Matrix4.makeOrtho(A.left,A.right,A.top,A.bottom,A.near,A.far);t=A.position;A=A.target;F.position.set(t[0],t[1],t[2]);F.target.position.set(A[0],A[1],A[2]);C.cameras[w]=F}for(x in E.lights)w=E.lights[x],
+F=w.color!==void 0?w.color:16777215,A=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(t=w.direction,K=new THREE.DirectionalLight(F,A),K.position.set(t[0],t[1],t[2]),K.position.normalize()):w.type=="point"?(t=w.position,d=w.distance,K=new THREE.PointLight(F,A,d),K.position.set(t[0],t[1],t[2])):w.type=="ambient"&&(K=new THREE.AmbientLight(F)),C.scene.addLight(K),C.lights[x]=K;for(u in E.fogs)x=E.fogs[u],x.type=="linear"?z=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(z=new THREE.FogExp2(0,
+x.density)),A=x.color,z.color.setRGB(A[0],A[1],A[2]),C.fogs[u]=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(u=E.geometries[n],u.type=="bin_mesh"||u.type=="ascii_mesh")H+=1,c.onLoadStart();O=H;for(n in E.geometries)u=E.geometries[n],u.type=="cube"?(G=new THREE.CubeGeometry(u.width,
+u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),C.geometries[n]=G):u.type=="plane"?(G=new THREE.PlaneGeometry(u.width,u.height,u.segmentsWidth,u.segmentsHeight),C.geometries[n]=G):u.type=="sphere"?(G=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),C.geometries[n]=G):u.type=="cylinder"?(G=new THREE.CylinderGeometry(u.numSegs,u.topRad,u.botRad,u.height,u.topOffset,u.botOffset),C.geometries[n]=G):u.type=="torus"?(G=new THREE.TorusGeometry(u.radius,
+u.tube,u.segmentsR,u.segmentsT),C.geometries[n]=G):u.type=="icosahedron"?(G=new THREE.IcosahedronGeometry(u.subdivisions),C.geometries[n]=G):u.type=="bin_mesh"?D.load({model:f(u.url,E.urlBaseType),callback:k(n)}):u.type=="ascii_mesh"?L.load({model:f(u.url,E.urlBaseType),callback:k(n)}):u.type=="embedded_mesh"&&(u=E.embeds[u.id])&&L.createModel(u,l(n),"");for(v in E.textures)if(n=E.textures[v],n.url instanceof Array){I+=n.url.length;for(D=0;D<n.url.length;D++)c.onLoadStart()}else I+=1,c.onLoadStart();
+Q=I;for(v in E.textures){n=E.textures[v];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){D=[];for(var M=0;M<n.url.length;M++)D[M]=f(n.url[M],E.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,n.mapping,a)}else{D=THREE.ImageUtils.loadTexture(f(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){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[n.wrap[0]]!==void 0)D.wrapS=L[n.wrap[0]];if(L[n.wrap[1]]!==void 0)D.wrapT=L[n.wrap[1]]}}C.textures[v]=D}for(p in E.materials){v=E.materials[p];for(B in v.parameters)if(B=="envMap"||B=="map"||B=="lightMap")v.parameters[B]=C.textures[v.parameters[B]];else if(B=="shading")v.parameters[B]=
+v.parameters[B]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(B=="blending")v.parameters[B]=THREE[v.parameters[B]]?THREE[v.parameters[B]]:THREE.NormalBlending;else if(B=="combine")v.parameters[B]=v.parameters[B]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(B=="vertexColors")if(v.parameters[B]=="face")v.parameters[B]=THREE.FaceColors;else if(v.parameters[B])v.parameters[B]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=
+!0;if(v.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);D=v.parameters.color;L=v.parameters.specular;u=v.parameters.ambient;z=v.parameters.shininess;a.tNormal.texture=C.textures[v.parameters.normalMap];if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;if(v.parameters.map)a.tDiffuse.texture=v.parameters.map,a.enableDiffuse.value=!0;if(v.parameters.lightMap)a.tAO.texture=v.parameters.lightMap,a.enableAO.value=!0;if(v.parameters.specularMap)a.tSpecular.texture=
+C.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(u);a.uShininess.value=z;if(v.parameters.opacity)a.uOpacity.value=v.parameters.opacity;v=new THREE.MeshShaderMaterial({fragmentShader:n.fragmentShader,vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);C.materials[p]=v}j();c.callbackSync(C)}}};
+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,g){return a+(b-a)*g};this.VIntX=function(a,b,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;b[h]=j+e*this.delta;b[h+1]=k;b[h+2]=l;g[h]=this.lerp(m[a],m[a+3],e);g[h+1]=this.lerp(m[a+1],m[a+4],e);g[h+2]=this.lerp(m[a+2],m[a+5],e)};this.VIntY=function(a,b,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k+e*this.delta;b[h+
+2]=l;b=a+this.yd*3;g[h]=this.lerp(m[a],m[b],e);g[h+1]=this.lerp(m[a+1],m[b+1],e);g[h+2]=this.lerp(m[a+2],m[b+2],e)};this.VIntZ=function(a,b,g,h,e,j,k,l,m,n){e=(e-m)/(n-m);m=this.normal_cache;b[h]=j;b[h+1]=k;b[h+2]=l+e*this.delta;b=a+this.zd*3;g[h]=this.lerp(m[a],m[b],e);g[h+1]=this.lerp(m[a+1],m[b+1],e);g[h+2]=this.lerp(m[a+2],m[b+2],e)};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,g,h,e,j){var k=h+1,l=h+this.yd,m=h+this.zd,n=k+this.yd,p=k+this.zd,o=h+this.yd+this.zd,x=k+this.yd+this.zd,w=0,u=this.field[h],v=this.field[k],y=this.field[l],t=this.field[n],A=this.field[m],B=this.field[p],G=this.field[o],F=this.field[x];u<e&&(w|=1);v<e&&(w|=2);y<e&&(w|=8);t<e&&(w|=4);A<e&&(w|=16);B<e&&(w|=32);G<e&&(w|=128);F<e&&(w|=64);var z=THREE.edgeTable[w];if(z==0)return 0;var D=this.delta,
+J=a+D,K=b+D,D=g+D;z&1&&(this.compNorm(h),this.compNorm(k),this.VIntX(h*3,this.vlist,this.nlist,0,e,a,b,g,u,v));z&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,3,e,J,b,g,v,t));z&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(l*3,this.vlist,this.nlist,6,e,a,K,g,y,t));z&8&&(this.compNorm(h),this.compNorm(l),this.VIntY(h*3,this.vlist,this.nlist,9,e,a,b,g,u,y));z&16&&(this.compNorm(m),this.compNorm(p),this.VIntX(m*3,this.vlist,this.nlist,12,e,a,b,D,A,B));z&32&&(this.compNorm(p),
+this.compNorm(x),this.VIntY(p*3,this.vlist,this.nlist,15,e,J,b,D,B,F));z&64&&(this.compNorm(o),this.compNorm(x),this.VIntX(o*3,this.vlist,this.nlist,18,e,a,K,D,G,F));z&128&&(this.compNorm(m),this.compNorm(o),this.VIntY(m*3,this.vlist,this.nlist,21,e,a,b,D,A,G));z&256&&(this.compNorm(h),this.compNorm(m),this.VIntZ(h*3,this.vlist,this.nlist,24,e,a,b,g,u,A));z&512&&(this.compNorm(k),this.compNorm(p),this.VIntZ(k*3,this.vlist,this.nlist,27,e,J,b,g,v,B));z&1024&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*
+3,this.vlist,this.nlist,30,e,J,K,g,t,F));z&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(l*3,this.vlist,this.nlist,33,e,a,K,g,y,G));w<<=4;for(e=h=0;THREE.triTable[w+e]!=-1;)a=w+e,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],j),e+=3,h++;return h};this.posnormtriv=function(a,b,g,h,e,j){var k=this.count*3;this.positionArray[k]=a[g];this.positionArray[k+1]=a[g+1];this.positionArray[k+2]=a[g+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[e];this.positionArray[k+7]=a[e+1];this.positionArray[k+8]=a[e+2];this.normalArray[k]=b[g];this.normalArray[k+1]=b[g+1];this.normalArray[k+2]=b[g+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[e];this.normalArray[k+7]=b[e+1];this.normalArray[k+8]=b[e+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,g,h,e){var j=this.size*Math.sqrt(h/e),k=g*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 p=Math.floor(l-j);p<1&&(p=1);l=Math.floor(l+j);l>this.size-1&&(l=this.size-1);var o=Math.floor(m-j);o<1&&(o=1);j=Math.floor(m+j);j>this.size-1&&(j=this.size-
+1);for(var x,w,u,v,y,t;n<k;n++){m=this.size2*n;w=n/this.size-g;y=w*w;for(w=p;w<l;w++){u=m+this.size*w;x=w/this.size-b;t=x*x;for(x=o;x<j;x++)v=x/this.size-a,v=h/(1.0E-6+v*v+t+y)-e,v>0&&(this.field[u+x]+=v)}}};this.addPlaneX=function(a,b){var g,h,e,j,k,l=this.size,m=this.yd,n=this.zd,p=this.field,o=l*Math.sqrt(a/b);o>l&&(o=l);for(g=0;g<o;g++)if(h=g/l,h*=h,j=a/(1.0E-4+h)-b,j>0)for(h=0;h<l;h++){k=g+h*m;for(e=0;e<l;e++)p[n*e+k]+=j}};this.addPlaneY=function(a,b){var g,h,e,j,k,l,m=this.size,n=this.yd,p=
+this.zd,o=this.field,x=m*Math.sqrt(a/b);x>m&&(x=m);for(h=0;h<x;h++)if(g=h/m,g*=g,j=a/(1.0E-4+g)-b,j>0){k=h*n;for(g=0;g<m;g++){l=k+g;for(e=0;e<m;e++)o[p*e+l]+=j}}};this.addPlaneZ=function(a,b){var g,h,e,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(e=0;e<dist;e++)if(g=e/size,g*=g,j=a/(1.0E-4+g)-b,j>0){k=zd*e;for(h=0;h<size;h++){l=k+h*yd;for(g=0;g<size;g++)field[l+g]+=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,g,h,e,j,k,l,m,n,p=this.size-2;for(e=1;e<p;e++){n=this.size2*e;l=(e-this.halfsize)/this.halfsize;for(h=1;h<p;h++){m=n+this.size*h;k=(h-this.halfsize)/this.halfsize;for(g=1;g<p;g++)j=(g-this.halfsize)/this.halfsize,b=m+g,this.polygonize(j,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,g=[];this.render(function(h){var e,j,k,l,m,n,p,o;for(e=0;e<h.count;e++)p=e*3,m=p+1,o=p+2,j=h.positionArray[p],
+k=h.positionArray[m],l=h.positionArray[o],n=new THREE.Vector3(j,k,l),j=h.normalArray[p],k=h.normalArray[m],l=h.normalArray[o],p=new THREE.Vector3(j,k,l),p.normalize(),m=new THREE.Vertex(n),b.vertices.push(m),g.push(p);nfaces=h.count/3;for(e=0;e<nfaces;e++)p=(a+e)*3,m=p+1,o=p+2,n=g[p],j=g[m],k=g[o],p=new THREE.Face3(p,m,o,[n,j,k]),b.faces.push(p);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,
 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]);
@@ -239,27 +238,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(a){function c(b){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:b}))}function b(a,b){var c=new THREE.Geometry;c.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(c,new THREE.LineBasicMaterial({color:b}))}THREE.Object3D.call(this);var g=Math.PI/2,f,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(f in THREE.Trident.defaultParams)a.hasOwnProperty(f)||(a[f]=THREE.Trident.defaultParams[f]);
-this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(b(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(b(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(b(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)f=c(a.xAxisColor),f.rotation.y=-g,f.position.x=a.length,this.addChild(f),f=c(a.yAxisColor),f.rotation.x=g,f.position.y=a.length,this.addChild(f),f=c(a.zAxisColor),f.rotation.y=Math.PI,f.position.z=a.length,this.addChild(f)};
-THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(a,c){this.point=a;this.normal=c};THREE.SphereCollider=function(a,c){this.center=a;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(a,c){this.min=a;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
-THREE.MeshCollider=function(a,c){this.mesh=a;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(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
-THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,g,f,h=0;c=0;for(b=this.colliders.length;c<b;c++)if(f=this.colliders[c],g=this.rayCast(a,f),g<Number.MAX_VALUE)f.distance=g,g>h?this.hits.push(f):this.hits.unshift(f),h=g;return this.hits};
-THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var g=this.rayMesh(a,c[b]);if(g.dist<Number.MAX_VALUE){c[b].distance=g.dist;c[b].faceIndex=g.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
-THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),g=Number.MAX_VALUE,f,h=0;h<c.numFaces;h++){var e=c.mesh.geometry.faces[h],j=c.mesh.geometry.vertices[e.a].position,k=c.mesh.geometry.vertices[e.b].position,l=c.mesh.geometry.vertices[e.c].position,m=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,j,k,l,g,this.collisionNormal,c.mesh),e<g&&(g=e,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-e instanceof THREE.Face4&&(e=this.rayTriangle(b,j,k,m,g,this.collisionNormal,c.mesh),e<g&&(g=e,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,k,l,m,g,this.collisionNormal,c.mesh),e<g&&(g=e,f=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:g,faceIndex:f}};
-THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,g,f,h,e){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(b,c);k.sub(g,b);h.cross(j,k);j=h.dot(a.direction);if(!(j<0))if(e.doubleSided||e.flipSided)h.multiplyScalar(-1),j*=-1;else return Number.MAX_VALUE;e=h.dot(c)-h.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=j*f))return Number.MAX_VALUE;e/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(e);j.addSelf(a.origin);Math.abs(h.x)>
-Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=j.y-c.y,h=b.y-c.y,f=g.y-c.y,j=j.z-c.z,b=b.z-c.z,g=g.z-c.z):(a=j.x-c.x,h=b.x-c.x,f=g.x-c.x,j=j.y-c.y,b=b.y-c.y,g=g.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(a=j.x-c.x,h=b.x-c.x,f=g.x-c.x,j=j.z-c.z,b=b.z-c.z,g=g.z-c.z):(a=j.x-c.x,h=b.x-c.x,f=g.x-c.x,j=j.y-c.y,b=b.y-c.y,g=g.y-c.y);c=h*g-b*f;if(c==0)return Number.MAX_VALUE;c=1/c;g=(a*g-j*f)*c;if(!(g>=0))return Number.MAX_VALUE;c*=h*j-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-g-c>=0))return Number.MAX_VALUE;return e};
-THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,b);var g=THREE.CollisionSystem.__r;g.origin.copy(a.origin);g.direction.copy(a.direction);b.multiplyVector3(g.origin);b.rotateAxis(g.direction);g.direction.normalize();return g};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var g=0,f=0,h=0,e=0,j=0,k=0,l=!0;b.origin.x<c.min.x?(g=c.min.x-b.origin.x,g/=b.direction.x,l=!1,e=-1):b.origin.x>c.max.x&&(g=c.max.x-b.origin.x,g/=b.direction.x,l=!1,e=1);b.origin.y<c.min.y?(f=c.min.y-b.origin.y,f/=b.direction.y,l=!1,j=-1):b.origin.y>c.max.y&&(f=c.max.y-b.origin.y,f/=b.direction.y,
-l=!1,j=1);b.origin.z<c.min.z?(h=c.min.z-b.origin.z,h/=b.direction.z,l=!1,k=-1):b.origin.z>c.max.z&&(h=c.max.z-b.origin.z,h/=b.direction.z,l=!1,k=1);if(l)return-1;l=0;f>g&&(l=1,g=f);h>g&&(l=2,g=h);switch(l){case 0:j=b.origin.y+b.direction.y*g;if(j<c.min.y||j>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*g;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(e,0,0);break;case 1:e=b.origin.x+b.direction.x*g;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
-g;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,j,0);break;case 2:e=b.origin.x+b.direction.x*g;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;j=b.origin.y+b.direction.y*g;if(j<c.min.y||j>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,k)}return g};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),g=c.point.dot(c.normal);if(b<0)b=(g-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
-THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var g=b.dot(a.direction.clone());if(g<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-g*g);if(b>=0)return Math.abs(g)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
-THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
+THREE.Trident=function(a){function b(b){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,a.length/20,a.length/5),new THREE.MeshBasicMaterial({color:b}))}function c(a,b){var c=new THREE.Geometry;c.vertices=[new THREE.Vertex,new THREE.Vertex(a)];return new THREE.Line(c,new THREE.LineBasicMaterial({color:b}))}THREE.Object3D.call(this);var f=Math.PI/2,g,a=a||THREE.Trident.defaultParams;if(a!==THREE.Trident.defaultParams)for(g in THREE.Trident.defaultParams)a.hasOwnProperty(g)||(a[g]=THREE.Trident.defaultParams[g]);
+this.scale=new THREE.Vector3(a.scale,a.scale,a.scale);this.addChild(c(new THREE.Vector3(a.length,0,0),a.xAxisColor));this.addChild(c(new THREE.Vector3(0,a.length,0),a.yAxisColor));this.addChild(c(new THREE.Vector3(0,0,a.length),a.zAxisColor));if(a.showArrows)g=b(a.xAxisColor),g.rotation.y=-f,g.position.x=a.length,this.addChild(g),g=b(a.yAxisColor),g.rotation.x=f,g.position.y=a.length,this.addChild(g),g=b(a.zAxisColor),g.rotation.y=Math.PI,g.position.z=a.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(a,b){this.point=a;this.normal=b};THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3};
+THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;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(a){this.colliders=this.colliders.concat(a.colliders);this.hits=this.hits.concat(a.hits)};
+THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,f,g,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(g=this.colliders[b],f=this.rayCast(a,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
+THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var f=this.rayMesh(a,b[c]);if(f.dist<Number.MAX_VALUE){b[c].distance=f.dist;b[c].faceIndex=f.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
+THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
+THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),f=Number.MAX_VALUE,g,h=0;h<b.numFaces;h++){var e=b.mesh.geometry.faces[h],j=b.mesh.geometry.vertices[e.a].position,k=b.mesh.geometry.vertices[e.b].position,l=b.mesh.geometry.vertices[e.c].position,m=e instanceof THREE.Face4?b.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(c,j,k,l,f,this.collisionNormal,b.mesh),e<f&&(f=e,g=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
+e instanceof THREE.Face4&&(e=this.rayTriangle(c,j,k,m,f,this.collisionNormal,b.mesh),e<f&&(f=e,g=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),e=this.rayTriangle(c,k,l,m,f,this.collisionNormal,b.mesh),e<f&&(f=e,g=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:f,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,f,g,h,e){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(c,b);k.sub(f,c);h.cross(j,k);j=h.dot(a.direction);if(!(j<0))if(e.doubleSided||e.flipSided)h.multiplyScalar(-1),j*=-1;else return Number.MAX_VALUE;e=h.dot(b)-h.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=j*g))return Number.MAX_VALUE;e/=j;j=THREE.CollisionSystem.__v3;j.copy(a.direction);j.multiplyScalar(e);j.addSelf(a.origin);Math.abs(h.x)>
+Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=j.y-b.y,h=c.y-b.y,g=f.y-b.y,j=j.z-b.z,c=c.z-b.z,f=f.z-b.z):(a=j.x-b.x,h=c.x-b.x,g=f.x-b.x,j=j.y-b.y,c=c.y-b.y,f=f.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=j.x-b.x,h=c.x-b.x,g=f.x-b.x,j=j.z-b.z,c=c.z-b.z,f=f.z-b.z):(a=j.x-b.x,h=c.x-b.x,g=f.x-b.x,j=j.y-b.y,c=c.y-b.y,f=f.y-b.y);b=h*f-c*g;if(b==0)return Number.MAX_VALUE;b=1/b;f=(a*f-j*g)*b;if(!(f>=0))return Number.MAX_VALUE;b*=h*j-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-f-b>=0))return Number.MAX_VALUE;return e};
+THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var f=THREE.CollisionSystem.__r;f.origin.copy(a.origin);f.direction.copy(a.direction);c.multiplyVector3(f.origin);c.rotateAxis(f.direction);f.direction.normalize();return f};
+THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var f=0,g=0,h=0,e=0,j=0,k=0,l=!0;c.origin.x<b.min.x?(f=b.min.x-c.origin.x,f/=c.direction.x,l=!1,e=-1):c.origin.x>b.max.x&&(f=b.max.x-c.origin.x,f/=c.direction.x,l=!1,e=1);c.origin.y<b.min.y?(g=b.min.y-c.origin.y,g/=c.direction.y,l=!1,j=-1):c.origin.y>b.max.y&&(g=b.max.y-c.origin.y,g/=c.direction.y,
+l=!1,j=1);c.origin.z<b.min.z?(h=b.min.z-c.origin.z,h/=c.direction.z,l=!1,k=-1):c.origin.z>b.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,l=!1,k=1);if(l)return-1;l=0;g>f&&(l=1,f=g);h>f&&(l=2,f=h);switch(l){case 0:j=c.origin.y+c.direction.y*f;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(e,0,0);break;case 1:e=c.origin.x+c.direction.x*f;if(e<b.min.x||e>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
+f;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,j,0);break;case 2:e=c.origin.x+c.direction.x*f;if(e<b.min.x||e>b.max.x)return Number.MAX_VALUE;j=c.origin.y+c.direction.y*f;if(j<b.min.y||j>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,k)}return f};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),f=b.point.dot(b.normal);if(c<0)c=(f-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
+THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var f=c.dot(a.direction.clone());if(f<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-f*f);if(c>=0)return Math.abs(f)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
+THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
 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 c=this,b=this.setSize,g=this.render,f=new THREE.Camera,h=new THREE.Camera,e=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),p=new THREE.Camera(53,1,1,1E4);p.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 w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){b.call(c,a,e);n.width=a;n.height=e;o.width=a;o.height=e};this.render=function(a,b){b.update(null,!0);if(k!==b.aspect||l!==b.near||m!==b.fov){k=b.aspect;l=b.near;m=b.fov;var x=b.projectionMatrix.clone(),y=125/30*0.5,u=y*l/125,z=l*Math.tan(m*Math.PI/360),B;e.n14=y;j.n14=-y;y=-z*k+u;B=z*k+u;x.n11=2*l/(B-y);x.n13=(B+y)/(B-y);f.projectionMatrix=x.clone();y=-z*k-u;B=z*k-u;x.n11=2*l/(B-y);
-x.n13=(B+y)/(B-y);h.projectionMatrix=x.clone()}f.matrix=b.matrixWorld.clone().multiplySelf(j);f.update(null,!0);f.position.copy(b.position);f.near=l;f.far=b.far;g.call(c,a,f,n,!0);h.matrix=b.matrixWorld.clone().multiplySelf(e);h.update(null,!0);h.position.copy(b.position);h.near=l;h.far=b.far;g.call(c,a,h,o,!0);g.call(c,w,p)}};
-if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,g=this.render,f,h,e=new THREE.Camera,j=new THREE.Camera;c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(a,e){b.call(c,a,e);f=a/2;h=e};this.render=function(a,b){this.clear();e.fov=b.fov;e.aspect=0.5*b.aspect;e.near=b.near;e.far=b.far;
-e.updateProjectionMatrix();e.position.copy(b.position);e.target.position.copy(b.target.position);e.translateX(c.separation);j.projectionMatrix=e.projectionMatrix;j.position.copy(b.position);j.target.position.copy(b.target.position);j.translateX(-c.separation);this.setViewport(0,0,f,h);g.call(c,a,e);this.setViewport(f,0,f,h);g.call(c,a,j,!1)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,e=new THREE.Matrix4,j=new THREE.Matrix4,k,l,m;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.Camera(53,1,1,1E4);o.position.z=
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:p}},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 x=new THREE.Scene;x.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;p.width=a;p.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 v=c.projectionMatrix.clone(),y=125/30*0.5,t=y*l/125,A=l*Math.tan(m*Math.PI/360),B;e.n14=y;j.n14=-y;y=-A*k+t;B=A*k+t;v.n11=2*l/(B-y);v.n13=(B+y)/(B-y);g.projectionMatrix=v.clone();y=-A*k-t;B=A*k-t;v.n11=2*l/(B-y);
+v.n13=(B+y)/(B-y);h.projectionMatrix=v.clone()}g.matrix=c.matrixWorld.clone().multiplySelf(j);g.update(null,!0);g.position.copy(c.position);g.near=l;g.far=c.far;f.call(b,a,g,n,!0);h.matrix=c.matrixWorld.clone().multiplySelf(e);h.update(null,!0);h.position.copy(c.position);h.near=l;h.far=c.far;f.call(b,a,h,p,!0);f.call(b,x,o)}};
+if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,f=this.render,g,h,e=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);g=a/2;h=e};this.render=function(a,c){this.clear();e.fov=c.fov;e.aspect=0.5*c.aspect;e.near=c.near;e.far=c.far;
+e.updateProjectionMatrix();e.position.copy(c.position);e.target.position.copy(c.target.position);e.translateX(b.separation);j.projectionMatrix=e.projectionMatrix;j.position.copy(c.position);j.target.position.copy(c.target.position);j.translateX(-b.separation);this.setViewport(0,0,g,h);f.call(b,a,e);this.setViewport(g,0,g,h);f.call(b,a,j,!1)}};

+ 18 - 21
examples/canvas_geometry_text.html

@@ -20,11 +20,11 @@
 
 		<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 -->
 
 		<script type="text/javascript" src="fonts/helvetiker_regular.typeface.js"></script>
-        
+
 
 		<script type="text/javascript">
 
@@ -69,47 +69,44 @@
 				// Get text from hash
 
 				var theText = "Hello three.js! :)";
-				
+
 				var hash = document.location.hash.substr( 1 );
-				
+
 				if ( hash.length !== 0 ) {
-                   
+
 					theText = hash;
 
 				}
-                
-		var text3d = new THREE.TextGeometry( theText, {
 
-					size: 80, 
+				var text3d = new THREE.TextGeometry( theText, {
+
+					size: 80,
 					height: 20,
 					curveSegments: 2,
 					font: "helvetiker"
 
 				});
 
-                var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe:false } );
+				text3d.computeBoundingBox();
+				var centerOffset = -0.5 * ( text3d.boundingBox.x[ 1 ] - text3d.boundingBox.x[ 0 ] );
+
+                var textMaterial = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, wireframe: false } );
                 text = new THREE.Mesh( text3d, textMaterial );
 
                 text.doubleSided = false;
 
-                text.position.y = 0;
+                text.position.x = centerOffset;
                 text.position.y = 100;
                 text.position.z = 0;
 
                 text.rotation.x = 0;
-                text.rotation.y = Math.PI*2;
+                text.rotation.y = Math.PI * 2;
 				text.overdraw = true;
 
-                scene.addObject( text );
-
-				// Plane
-
-				plane = new THREE.Mesh( new THREE.PlaneGeometry( 800, 800 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0, wireframe:true }) );
-				plane.rotation.x = - 90 * ( Math.PI / 180 );
-                plane.position.x = 0;
-				plane.overdraw = true;
+				parent = new THREE.Object3D();
+                parent.addChild( text );
 
-				//scene.addObject( plane );
+				scene.addObject( parent );
 
 				renderer = new THREE.CanvasRenderer();
                 renderer.setSize( window.innerWidth, window.innerHeight );
@@ -205,7 +202,7 @@
 
 			function render() {
 
-				plane.rotation.z = text.rotation.y += ( targetRotation - text.rotation.y ) * 0.05;
+				parent.rotation.y += ( targetRotation - parent.rotation.y ) * 0.05;
 				renderer.render( scene, camera );
 
 			}

+ 23 - 53
examples/webgl_geometry_text.html

@@ -84,6 +84,7 @@
 
 				bevelThickness = 2,
 				bevelSize = 1.5,
+				bevelSegments = 3,
 				bevelEnabled = true,
 
 				font = "optimer", 		// helvetiker, optimer, gentilis, droid sans, droid serif
@@ -204,55 +205,15 @@
 
 				}
 
-				textGeo = new THREE.TextGeometry( text, {
-
-					size: size,
-					height: height,
-					curveSegments: curveSegments,
-
-					font: font,
-					weight: weight,
-					style: style,
-
-					bevelThickness: bevelThickness,
-					bevelSize: bevelSize,
-					bevelEnabled: bevelEnabled
-
-				});
-
 				textMaterial = new THREE.MeshPhongMaterial( { color: 0xffffff, wireframe: false } );
 
 				parent = new THREE.Object3D();
-
-				textMesh1 = new THREE.Mesh( textGeo, textMaterial );
-
-				textMesh1.position.x = 0;
-				textMesh1.position.y = hover;
-				textMesh1.position.z = 0;
-
-				textMesh1.rotation.x = 0;
-				textMesh1.rotation.y = Math.PI * 2;
-
-				parent.addChild( textMesh1 );
-
-				if ( mirror ) {
-
-					textMesh2 = new THREE.Mesh( textGeo, textMaterial );
-
-					textMesh2.position.x = 0;
-					textMesh2.position.y = -hover;
-					textMesh2.position.z = height;
-
-					textMesh2.rotation.x = Math.PI;
-					textMesh2.rotation.y = Math.PI * 2;
-
-					parent.addChild( textMesh2 );
-
-				}
-
 				parent.position.y = 100;
+
 				scene.addChild( parent );
 
+				createText();
+
 				var plane = new THREE.Mesh( new THREE.PlaneGeometry( 10000, 10000 ), new THREE.MeshBasicMaterial( { color: 0xffffff, opacity: 0.5, transparent: true } ) );
 				plane.rotation.x = -1.57;
 				plane.position.y = 100;
@@ -414,11 +375,7 @@
 
 			}
 
-			function refreshText() {
-
-				updatePermalink();
-
-				scene.removeChild( textMesh1 );
+			function createText() {
 
 				textGeo = new THREE.TextGeometry( text, {
 
@@ -436,9 +393,12 @@
 
 				});
 
+				textGeo.computeBoundingBox();
+				var centerOffset = -0.5 * ( textGeo.boundingBox.x[ 1 ] - textGeo.boundingBox.x[ 0 ] );
+
 				textMesh1 = new THREE.Mesh( textGeo, textMaterial );
 
-				textMesh1.position.x = 0;
+				textMesh1.position.x = centerOffset;
 				textMesh1.position.y = hover;
 				textMesh1.position.z = 0;
 
@@ -449,24 +409,34 @@
 
 				if ( mirror ) {
 
-					scene.removeChild( textMesh2 );
-
 					textMesh2 = new THREE.Mesh( textGeo, textMaterial );
 
-					textMesh2.position.x = 0;
+					textMesh2.position.x = centerOffset;
 					textMesh2.position.y = -hover;
 					textMesh2.position.z = height;
 
 					textMesh2.rotation.x = Math.PI;
 					textMesh2.rotation.y = Math.PI * 2;
 
-
 					parent.addChild( textMesh2 );
 
 				}
 
 			}
 
+			function refreshText() {
+
+				updatePermalink();
+
+				scene.removeChild( textMesh1 );
+				if ( mirror ) scene.removeChild( textMesh2 );
+
+				if ( !text ) return;
+
+				createText();
+
+			}
+
 			function onDocumentMouseDown( event ) {
 
 				event.preventDefault();

+ 5 - 1
examples/webgl_shadowmap.html

@@ -194,15 +194,19 @@
 					weight: "bold",
 					style: "normal",
 
-					bevelThickness: 1,
+					bevelThickness: 2,
 					bevelSize: 5,
 					bevelEnabled: true
 
 				});
 
+				textGeo.computeBoundingBox();
+				var centerOffset = -0.5 * ( textGeo.boundingBox.x[ 1 ] - textGeo.boundingBox.x[ 0 ] );
+
 				var textMaterial = new THREE.MeshPhongMaterial( { color: 0xff0000, specular: 0xffffff, ambient: 0xaa0000 } );
 
 				var mesh = new THREE.Mesh( textGeo, textMaterial );
+				mesh.position.x = centerOffset;
 				mesh.position.y = FLOOR + 67;
 
 				mesh.castShadow = true;

+ 9 - 0
src/extras/ShaderUtils.js

@@ -1,6 +1,15 @@
 /**
  * @author alteredq / http://alteredqualia.com/
  * @author mr.doob / http://mrdoob.com/
+ *
+ * ShaderUtils currently contains
+ *	fresnel
+ *	normal
+ * 	cube
+ * 	convolution
+ * 	film
+ * 	screen
+ *	basic
  */
 
 if ( THREE.WebGLRenderer ) {

+ 95 - 6
src/extras/geometries/Curve.js

@@ -206,8 +206,8 @@ THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) {
 
 	var tx, ty;
 
-	tx = THREE.FontUtils.b2( t, this.x0, this.x1, this.x2 );
-	ty = THREE.FontUtils.b2( t, this.y0, this.y1, this.y2 );
+	tx = THREE.Shape.Utils.b2( t, this.x0, this.x1, this.x2 );
+	ty = THREE.Shape.Utils.b2( t, this.y0, this.y1, this.y2 );
 
 	return new THREE.Vector2( tx, ty );
 
@@ -270,8 +270,8 @@ THREE.CubicBezierCurve.prototype.getPoint = function ( t ) {
 
 	var tx, ty;
 
-	tx = THREE.FontUtils.b3( t, this.x0, this.x1, this.x2, this.x3 );
-	ty = THREE.FontUtils.b3( t, this.y0, this.y1, this.y2, this.y3 );
+	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 );
 
 	return new THREE.Vector2( tx, ty );
 
@@ -281,7 +281,7 @@ THREE.CubicBezierCurve.prototype.getPoint = function ( t ) {
  *	Spline curve
  **************************************************************/
 
-THREE.SplineCurve = function ( points ) {
+THREE.SplineCurve = function ( points /* array of Vector2*/ ) {
 
 	this.points = points;
 
@@ -403,4 +403,93 @@ curve.getPoints(); DONE
 curve.getPointAtArcLength(t); DONE
 curve.transform(params);
 curve.getTangentAt(t)
-*/
+*/
+
+/**************************************************************
+ *	3D Curves
+ **************************************************************/
+
+
+// A Factory Method for creating new curve subclasses
+THREE.Curve.create = function(constructor, getpointfunc) {
+    
+    var subClass = constructor;
+    subClass.prototype = new THREE.Curve();
+    subClass.prototype.constructor = constructor;
+    subClass.prototype.getPoint = getpointfunc;
+    return subClass;
+    
+};
+
+
+
+/**************************************************************
+ *	Line3D
+ **************************************************************/
+
+
+THREE.LineCurve3 = THREE.Curve.create(
+	
+	function ( x1, y1, z1, x2, y2, z2 ) {
+
+		this.x1 = x1;
+		this.y1 = y1;
+		this.z1 = z1;
+
+		this.x2 = x2;
+		this.y2 = y2;
+		this.z2 = z2;
+
+	},
+	
+	function ( t ) {
+
+		var dx = this.x2 - this.x1;
+		var dy = this.y2 - this.y1;
+		var dz = this.z2 - this.z1;
+		
+		var tx = this.x1 + dx * t;
+		var ty = this.y1 + dy * t;
+		var tz = this.z1 + dz * t;
+
+		return new THREE.Vector3( tx, ty, tz );
+
+	}
+);
+
+
+/**************************************************************
+ *	Quadratic Bezier 3D curve
+ **************************************************************/
+
+THREE.QuadraticBezierCurve3 = THREE.Curve.create(
+	function ( x0, y0, z0,
+			x1, y1, z1,
+			x2, y2, z2 ) { // Qn should we use 2 Vector3 instead?
+
+		this.x0 = x0;
+		this.y0 = y0;
+		this.z0 = z0;
+
+		this.x1 = x1;
+		this.y1 = y1;
+		this.z1 = z1;
+
+		this.x2 = x2;
+		this.y2 = y2;
+		this.z2 = z2;
+
+	},
+	
+	function ( t ) {
+
+		var tx, ty, tz;
+
+		tx = THREE.Shape.Utils.b2( t, this.x0, this.x1, this.x2 );
+		ty = THREE.Shape.Utils.b2( t, this.y0, this.y1, this.y2 );
+		tz = THREE.Shape.Utils.b2( t, this.z0, this.z1, this.z2 );
+
+		return new THREE.Vector2( tx, ty, tz );
+
+	}
+);

+ 197 - 38
src/extras/geometries/ExtrudeGeometry.js

@@ -1,23 +1,76 @@
 /**
  * @author zz85 / http://www.lab4games.net/zz85/blog
+ *
  * Creates extruded geometry from a path shape.
- **/
+ *
+ * parameters = {
+ *  size: 			<float>, 	// size of the text
+ *  height: 		<float>, 	// thickness to extrude text
+ *  curveSegments: 	<int>,		// number of points on the curves
+ *
+ *  font: 			<string>,		// font name
+ *  weight: 		<string>,		// font weight (normal, bold)
+ *  style: 			<string>,		// font style  (normal, italics)
+ *
+ *  bevelEnabled:	<bool>,			// turn on bevel
+ *  bevelThickness: <float>, 		// how deep into text bevel goes
+ *  bevelSize:		<float>, 		// how far from text outline is bevel
+ *  bevelSegments:	<int>, 			// number of bevel layers
+ *  }
+  **/
+
+THREE.ExtrudeGeometry = function( shapes, options ) {
+
+	if( typeof( shapes ) == "undefined" ) {
+
+		shapes = [];
+		return;
 
-THREE.ExtrudeGeometry = function ( shape, options ) {
+	}
+
+	THREE.Geometry.call( this );
+
+	shapes = shapes instanceof Array ? shapes : [ shapes ];
+
+	var s, sl = shapes.length, shape;
+
+	for ( s = 0; s < sl; s ++ ) {
+
+		shape = shapes[ s ];
+
+		//console.log(shape);
+
+		this.addShape( shape, options );
+
+	}
+
+};
+
+THREE.ExtrudeGeometry.prototype = new THREE.Geometry();
+THREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry;
+
+
+THREE.ExtrudeGeometry.prototype.addShape = function( shape, options ) {
 
 	var amount = options.amount !== undefined ? options.amount : 100;
 
-	// todo: bevel
+	var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10
+	var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; // 8
+	var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
 
-	var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 8; // 10
-	var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness; // 8
 	var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false
-	var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
 
 	// We should set bevel segments to 0 if bevel is not enabled.
+	// (also bevelThickness and bevelSize make mess when bevel is not enabled,
+	//  whole shape gets thicker)
+
+	if ( !bevelEnabled ) {
 
-	if ( !bevelEnabled ) bevelSegments = 0;
+		bevelSegments = 0;
+		bevelThickness = 0;
+		bevelSize = 0;
 
+	}
 
 	var steps = options.steps !== undefined ? options.steps : 1;
 
@@ -35,14 +88,15 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 
 	// TODO, extrude by path's tangents? also via 3d path?
 
-	THREE.Geometry.call( this );
-
 	// Variables initalization
 
 	var ahole, h, hl; // looping of holes
 	var scope = this;
 	var bevelPoints = [];
 
+	var shapesOffset = this.vertices.length;
+
+	//extractAllPoints
 	var shapePoints = shape.extractAllPoints(); // use shape.extractAllSpacedPoints() for points with equal divisions
 
     var vertices = shapePoints.shape;
@@ -142,28 +196,125 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 	}
 
 
+	function scalePt2 ( pt, vec, size ) {
+
+		//return vec.clone().multiplyScalar( size ).addSelf( pt );
+		return pt.clone().addSelf( vec.clone().multiplyScalar( size ) );
+
+	}
+
 	var b, bs, t, z,
 		vert, vlen = vertices.length,
 		face, flen = faces.length,
 		cont, clen = contour.length;
 
+
+	//------
+	// Find directions for point movement
+	//
+
+	var RAD_TO_DEGREES = 180 / Math.PI;
+
+
+	function getBevelVec( pt_i, pt_j, pt_k ) {
+
+		var anglea = Math.atan2( pt_j.y - pt_i.y, pt_j.x - pt_i.x );
+		var angleb = Math.atan2( pt_k.y - pt_i.y, pt_k.x - pt_i.x );
+
+		if ( anglea > angleb ) {
+
+			angleb += Math.PI * 2;
+
+		}
+
+		// var anglea = Math.atan2(pt_i.y - pt_j.y, pt_i.x - pt_j.x);
+		//	var angleb = Math.atan2(pt_i.y - pt_k.y, pt_i.x - pt_k.x);
+
+		// 	console.log('>?', anglea > angleb);
+		//
+		// if ( anglea < angleb) {
+ 		// 	angleb += Math.PI*2;
+	 	// 	 	}
+
+
+		//x = Math.cos(anglea) + Math.cos(angleb);
+		//y = Math.sin(anglea) + Math.sin(angleb);
+		//anglec = Math.atan2(y,x);
+
+		anglec = ( anglea + angleb ) / 2;
+
+		//console.log('angle1', anglea * RAD_TO_DEGREES,'angle2', angleb * RAD_TO_DEGREES, 'anglec', anglec *RAD_TO_DEGREES);
+
+		var x = - Math.cos( anglec );
+		var y = - Math.sin( anglec );
+
+		var vec = new THREE.Vector2( x, y ).normalize();
+
+		return vec;
+
+	}
+
+	var contourMovements = [];
+
+	for ( i = 0, il = contour.length, j = il-1, k = i + 1; i < il; i++, j++, k++ ) {
+
+		if ( j == il ) j = 0;
+		if ( k == il ) k = 0;
+
+		//  (j)---(i)---(k)
+		// console.log('i,j,k', i, j , k)
+
+		var pt_i = contour[ i ];
+		var pt_j = contour[ j ];
+		var pt_k = contour[ k ];
+
+		contourMovements[ i ]= getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
+
+	}
+
+	var holesMovements = [], oneHoleMovements, verticesMovements = contourMovements.concat();
+
+	for ( h = 0, hl = holes.length; h < hl; h++ ) {
+
+		ahole = holes[ h ];
+
+		oneHoleMovements = [];
+
+		for ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++ ) {
+
+			if ( j == il ) j = 0;
+			if ( k == il ) k = 0;
+
+			//  (j)---(i)---(k)
+			oneHoleMovements[ i ]= getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );
+
+		}
+
+		holesMovements.push( oneHoleMovements );
+		verticesMovements = verticesMovements.concat( oneHoleMovements );
+
+	}
+
+
 	// Loop bevelSegments, 1 for the front, 1 for the back
 
-	for ( b = bevelSegments; b > 0; b -- ) {
+	for ( b = 0; b < bevelSegments; b ++ ) {
+	//for ( b = bevelSegments; b > 0; b -- ) {
 
 		t = b / bevelSegments;
-		z = bevelThickness * t;
-
-		// Formula could probably be simplified
+		z = bevelThickness * ( 1 - t );
 
-		bs = bevelSize * ( 1 - Math.sin ( ( 1 - t ) * Math.PI/2 ) ) ; // bevelSize * t ;
+		//z = bevelThickness * t;
+		bs = bevelSize * ( Math.sin ( t * Math.PI/2 ) ) ; // curved
+		//bs = bevelSize * t ; // linear
 
 		// contract shape
 
 		for ( i = 0, il = contour.length; i < il; i ++ ) {
 
-			vert = scalePt( contour[ i ], contourCentroid, bs, false );
-			v( vert.x, vert.y, -z );
+			vert = scalePt2( contour[ i ], contourMovements[ i ], bs );
+			//vert = scalePt( contour[ i ], contourCentroid, bs, false );
+			v( vert.x, vert.y,  - z );
 
 		}
 
@@ -172,10 +323,13 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 		for ( h = 0, hl = holes.length; h < hl; h++ ) {
 
 			ahole = holes[ h ];
+			oneHoleMovements = holesMovements[ h ];
 
 			for ( i = 0, il = ahole.length; i < il; i++ ) {
 
-				vert = scalePt( ahole[ i ], holesCentroids[ h ], bs, true );
+				vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );
+				//vert = scalePt( ahole[ i ], holesCentroids[ h ], bs, true );
+
 				v( vert.x, vert.y,  -z );
 
 			}
@@ -184,13 +338,14 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 
 	}
 
+	bs = bevelSize;
 
 	// Back facing vertices
 
 	for ( i = 0; i < vlen; i ++ ) {
 
-		vert = vertices[ i ];
-		//v( vert.x, vert.y, 0 );
+		//vert = vertices[ i ];
+		vert = scalePt2( vertices[ i ], verticesMovements[ i ], bs );
 
 		if ( !extrudeByPath ) {
 
@@ -213,7 +368,8 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 
 		for ( i = 0; i < vlen; i ++ ) {
 
-			vert = vertices[ i ];
+			//vert = vertices[ i ];
+			vert = scalePt2(vertices[ i ], verticesMovements[i], bs);
 
 			if ( !extrudeByPath ) {
 
@@ -232,30 +388,35 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 
 	// Add bevel segments planes
 
-	for ( b = 1; b <= bevelSegments; b ++ ) {
+	//for ( b = 1; b <= bevelSegments; b ++ ) {
+	for ( b = bevelSegments - 1; b >= 0; b -- ) {
 
 		t = b / bevelSegments;
-		z = bevelThickness * t;
-		bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) );
+		z = bevelThickness * ( 1 - t );
+		//bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) );
+		bs = bevelSize * Math.sin ( t * Math.PI/2 ) ;
 
 		// contract shape
 
-		for ( i = 0, il = contour.length; i < il; i++ ) {
+		for ( i = 0, il = contour.length; i < il; i ++ ) {
 
-			vert = scalePt( contour[ i ], contourCentroid, bs, false );
+			vert = scalePt2(contour[i], contourMovements[i], bs);
+			//vert = scalePt( contour[ i ], contourCentroid, bs, false );
 			v( vert.x, vert.y,  amount + z);
 
 		}
 
 		// expand holes
 
-		for ( h = 0, hl = holes.length; h < hl; h++ ) {
+		for ( h = 0, hl = holes.length; h < hl; h ++ ) {
 
 			ahole = holes[ h ];
+			oneHoleMovements = holesMovements[ h ];
 
 			for ( i = 0, il = ahole.length; i < il; i++ ) {
 
-				vert = scalePt( ahole[ i ], holesCentroids[h], bs, true );
+				//vert = scalePt( ahole[ i ], holesCentroids[h], bs, true );
+				vert = scalePt2(ahole[i], oneHoleMovements[i], bs);
 
 				if ( !extrudeByPath ) {
 
@@ -393,20 +554,20 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 
 	function f3( a, b, c ) {
 
-		// if ( reverse ) { // Can now be removed
-		//
-		// 		scope.faces.push( new THREE.Face3( c, b, a ) );
-		//
-		// 	} else {
-		//
-		 		scope.faces.push( new THREE.Face3( a, b, c ) );
-		//
-		// 	}
+		a += shapesOffset;
+		b += shapesOffset;
+		c += shapesOffset;
+
+		scope.faces.push( new THREE.Face3( a, b, c ) );
 
 	}
 
 	function f4( a, b, c, d ) {
 
+		a += shapesOffset;
+		b += shapesOffset;
+		c += shapesOffset;
+		d += shapesOffset;
 
  		scope.faces.push( new THREE.Face4( a, b, c, d ) );
 
@@ -415,5 +576,3 @@ THREE.ExtrudeGeometry = function ( shape, options ) {
 };
 
 
-THREE.ExtrudeGeometry.prototype = new THREE.Geometry();
-THREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry;

+ 116 - 15
src/extras/geometries/Path.js

@@ -251,8 +251,8 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 
 				t = j / divisions;
 
-				tx = THREE.FontUtils.b2( t, cpx0, cpx1, cpx );
-				ty = THREE.FontUtils.b2( t, cpy0, cpy1, cpy );
+				tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );
+				ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );
 
 				points.push( new THREE.Vector2( tx, ty ) );
 
@@ -292,8 +292,8 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 
 				t = j / divisions;
 
-				tx = THREE.FontUtils.b3( t, cpx0, cpx1, cpx2, cpx );
-				ty = THREE.FontUtils.b3( t, cpy0, cpy1, cpy2, cpy );
+				tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );
+				ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );
 
 				points.push( new THREE.Vector2( tx, ty ) );
 
@@ -681,10 +681,10 @@ THREE.Path.prototype.debug = function( canvas ) {
 
 	/* TO CLEAN UP */
 
-	//var p, points = this.getPoints();
+	var p, points = this.getPoints();
 
-	var theta = -90 /180 * Math.PI;
-	var p, points = this.transform( 0.866, - 0.866,0, 0.500 , 0.50,-50 );
+	//var theta = -90 /180 * Math.PI;
+	//var p, points = this.transform( 0.866, - 0.866,0, 0.500 , 0.50,-50 );
 
 	//0.866, - 0.866,0, 0.500 , 0.50,-50
 
@@ -693,14 +693,6 @@ THREE.Path.prototype.debug = function( canvas ) {
 
 	// translate, scale, rotation
 
-	// a - horizontal size
-	// b - lean
-	// c - x offset
-	// d - vertical size
-	// e - climb
-	// f - y offset
-	// 1,0,0,
-	// -1,0,100
 
 	for ( i = 0, il = points.length; i < il; i ++ ) {
 
@@ -714,3 +706,112 @@ THREE.Path.prototype.debug = function( canvas ) {
 	}
 
 };
+
+// Breaks path into shapes
+
+THREE.Path.prototype.toShapes = function() {
+
+	var i, il, item, action, args;
+
+	var subPaths = [], lastPath = new THREE.Path();
+
+	for ( i = 0, il = this.actions.length; i < il; i ++ ) {
+
+		item = this.actions[ i ];
+
+		args = item.args;
+		action = item.action;
+
+		if ( action == THREE.PathActions.MOVE_TO ) {
+
+			if ( lastPath.actions.length != 0 ) {
+
+				subPaths.push( lastPath );
+				lastPath = new THREE.Path();
+
+			}
+
+		}
+
+		lastPath[ action ].apply( lastPath, args );
+
+	}
+
+	if ( lastPath.actions.length != 0 ) {
+
+		subPaths.push( lastPath );
+
+	}
+
+	//console.log(subPaths);
+
+	if ( subPaths.length ==0 ) return [];
+
+	var holesFirst = !THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() );
+
+	var tmpPath, tmpShape, shapes = [];
+
+	//console.log("Holes first", holesFirst);
+
+	if ( holesFirst ) {
+
+		tmpShape = new THREE.Shape();
+
+		for ( i = 0, il = subPaths.length; i < il; i ++ ) {
+
+			tmpPath = subPaths[ i ];
+
+			if ( THREE.Shape.Utils.isClockWise( tmpPath.getPoints() ) ) {
+
+				tmpShape.actions = tmpPath.actions;
+				tmpShape.curves = tmpPath.curves;
+
+				shapes.push( tmpShape );
+				tmpShape = new THREE.Shape();
+
+				//console.log('cw', i);
+
+			} else {
+
+				tmpShape.holes.push( tmpPath );
+
+				//console.log('ccw', i);
+
+			}
+
+		}
+
+	} else {
+
+		// Shapes first
+
+		for ( i = 0, il = subPaths.length; i < il; i ++ ) {
+
+			tmpPath = subPaths[ i ];
+
+			if ( THREE.Shape.Utils.isClockWise( tmpPath.getPoints() ) ) {
+
+
+				if ( tmpShape ) shapes.push( tmpShape );
+
+				tmpShape = new THREE.Shape();
+				tmpShape.actions = tmpPath.actions;
+				tmpShape.curves = tmpPath.curves;
+
+			} else {
+
+				tmpShape.holes.push( tmpPath );
+
+			}
+
+		}
+
+		shapes.push( tmpShape );
+
+	}
+
+	//console.log("shape", shapes);
+
+	return shapes;
+
+};

+ 77 - 8
src/extras/geometries/Shape.js

@@ -7,7 +7,7 @@
 // STEP 2 Turn path into shape.
 // STEP 3 ExtrudeGeometry takes in Shape/Shapes
 // STEP 3a - Extract points from each shape, turn to vertices
-// STEP 3b - Triangulate each shape
+// STEP 3b - Triangulate each shape, add faces.
 
 THREE.Shape = function ( ) {
 
@@ -32,6 +32,7 @@ THREE.Shape.prototype.extrude = function ( options ) {
 
 THREE.Shape.prototype.getPointsHoles = function () {
 
+
 	var i, il = this.holes.length, holesPts = [];
 
 	for ( i = 0; i < il; i ++ ) {
@@ -60,6 +61,7 @@ THREE.Shape.prototype.getSpacedPointsHoles = function () {
 
 };
 
+
 // Get points of shape and holes (keypoints based on segments parameter)
 
 THREE.Shape.prototype.extractAllPoints = function () {
@@ -86,6 +88,10 @@ THREE.Shape.prototype.extractAllSpacedPoints = function () {
 
 };
 
+/**************************************************************
+ *	Utils
+ **************************************************************/
+
 THREE.Shape.Utils = {
 
 	/*
@@ -113,7 +119,6 @@ THREE.Shape.Utils = {
 			verts = [];
 
 		for ( h = 0; h < holes.length; h++ ) {
-		//for ( h = holes.length; h-- > 0; ) {
 
 			hole = holes[ h ];
 
@@ -130,8 +135,8 @@ THREE.Shape.Utils = {
 
 			// Find the shortest pair of pts between shape and hole
 
-			// TODO we could optimize with
-			// http://en.wikipedia.org/wiki/Proximity_problems
+			// Note: Actually, I'm not sure now if we could optimize this to be faster than O(m*n)
+			// But one thing is that we could speed this up by not running square roots on the pts differences
 			// http://en.wikipedia.org/wiki/Closest_pair_of_points
 			// http://stackoverflow.com/questions/1602164/shortest-distance-between-points-algorithm
 
@@ -342,7 +347,6 @@ THREE.Shape.Utils = {
 
 		}
 
-		//console.log("edited?" , triangles);
 		return triangles.concat( isolatedPts );
 
 	}, // end triangulate shapes
@@ -350,9 +354,8 @@ THREE.Shape.Utils = {
 	/*
 	triangulate2 : function( pts, holes ) {
 
-		// For use Poly2Tri.js
+		// For use with Poly2Tri.js
 
-		//var pts = this.getPoints();
 		var allpts = pts.concat();
 		var shape = [];
 		for (var p in pts) {
@@ -380,6 +383,7 @@ THREE.Shape.Utils = {
 			}
 			return -1;
 		};
+
 		// triangulate
 		js.poly2tri.sweep.Triangulate(swctx);
 
@@ -402,12 +406,77 @@ THREE.Shape.Utils = {
 		// Returns array of faces with 3 element each
 	return facesPts;
 	},
-	*/
+*/
 
 	isClockWise: function ( pts ) {
 
 		return THREE.FontUtils.Triangulate.area( pts ) < 0;
 
+	},
+
+	// Bezier Curves formulas obtained from
+	// http://en.wikipedia.org/wiki/B%C3%A9zier_curve
+
+	// Quad Bezier Functions
+
+	b2p0: function ( t, p ) {
+
+		var k = 1 - t;
+		return k * k * p;
+
+	},
+
+	b2p1: function ( t, p ) {
+
+		return 2 * ( 1 - t ) * t * p;
+
+	},
+
+	b2p2: function ( t, p ) {
+
+		return t * t * p;
+
+	},
+
+	b2: function ( t, p0, p1, p2 ) {
+
+		return this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 );
+
+	},
+
+	// Cubic Bezier Functions
+
+	b3p0: function ( t, p ) {
+
+		var k = 1 - t;
+		return k * k * k * p;
+
+	},
+
+	b3p1: function ( t, p ) {
+
+		var k = 1 - t;
+		return 3 * k * k * t * p;
+
+	},
+
+	b3p2: function ( t, p ) {
+
+		var k = 1 - t;
+		return 3 * k * t * t * p;
+
+	},
+
+	b3p3: function ( t, p ) {
+
+		return t * t * t * p;
+
+	},
+
+	b3: function ( t, p0, p1, p2, p3 ) {
+
+		return this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) +  this.b3p3( t, p3 );
+
 	}
 
 };

+ 61 - 387
src/extras/geometries/TextGeometry.js

@@ -37,229 +37,46 @@
 
 THREE.TextGeometry = function ( text, parameters ) {
 
-	THREE.Geometry.call( this );
+	var textPath = new THREE.TextPath( text, parameters );
+	var textShapes = textPath.toShapes();
 
-	this.parameters = parameters || {};
-	this.set( text );
+	// translate parameters to ExtrudeGeometry API
 
-};
-
-THREE.TextGeometry.prototype = new THREE.Geometry();
-THREE.TextGeometry.prototype.constructor = THREE.TextGeometry;
-
-THREE.TextGeometry.prototype.set = function ( text, parameters ) {
-
-	this.text = text;
-	var parameters = parameters || this.parameters;
-
-	var size = parameters.size !== undefined ? parameters.size : 100;
-	var height = parameters.height !== undefined ? parameters.height : 50;
-	var curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments: 4;
-
-	var font = parameters.font !== undefined ? parameters.font : "helvetiker";
-	var weight = parameters.weight !== undefined ? parameters.weight : "normal";
-	var style = parameters.style !== undefined ? parameters.style : "normal";
-
-	var bevelThickness = parameters.bevelThickness !== undefined ? parameters.bevelThickness : 10;
-	var bevelSize = parameters.bevelSize !== undefined ? parameters.bevelSize : 8;
-	var bevelEnabled = parameters.bevelEnabled !== undefined ? parameters.bevelEnabled : false;
-
-	THREE.FontUtils.size = size;
-	THREE.FontUtils.divisions = curveSegments;
-
-	THREE.FontUtils.face = font;
-	THREE.FontUtils.weight = weight;
-	THREE.FontUtils.style = style;
-
-	THREE.FontUtils.bevelSize = bevelSize;
-
-	// Get a Font data json object
-
-	var data = THREE.FontUtils.drawText( text );
-
-	var vertices = data.points;
-	var faces = data.faces;
-	var contour = data.contour;
-	var bevelPoints = data.bevel;
-
-	var scope = this;
-
-	scope.vertices = [];
-	scope.faces = [];
-
-	var i,
-		vert, vlen = vertices.length,
-		face, flen = faces.length,
-		bevelPt, blen = bevelPoints.length;
-
-	// Back facing vertices
-
-	for ( i = 0; i < vlen; i++ ) {
-
-		vert = vertices[ i ];
-		v( vert.x, vert.y, 0 );
-
-	}
-
-	// Front facing vertices
-
-	for ( i = 0; i < vlen; i++ ) {
-
-		vert = vertices[ i ];
-		v( vert.x, vert.y, height );
-
-	}
-
-	if ( bevelEnabled ) {
-
-		for ( i = 0; i < blen; i++ ) {
-
-			bevelPt = bevelPoints[ i ];
-			v( bevelPt.x, bevelPt.y, bevelThickness );
-
-		}
-
-		for ( i = 0; i < blen; i++ ) {
-
-			bevelPt = bevelPoints[ i ];
-			v( bevelPt.x, bevelPt.y, height - bevelThickness );
-
-		}
-
-	}
-
-	// Bottom faces
-
-	for ( i = 0; i < flen; i++ ) {
-
-		face = faces[ i ];
-		f3( face[ 2 ], face[ 1 ], face[ 0 ] );
-
-	}
-
-	// Top faces
-
-	for ( i = 0; i < flen; i++ ) {
-
-		face = faces[ i ];
-		f3( face[ 0 ] + vlen, face[ 1 ] + vlen, face[ 2 ] + vlen );
-
-	}
-
-	var lastV;
-	var j, k, l, m;
-
-	if ( bevelEnabled ) {
-
-		i = bevelPoints.length;
+	parameters.amount = parameters.height !== undefined ? parameters.height : 50;
 
-		while ( --i > 0 ) {
+	// defaults
 
-			if ( !lastV ) {
+	if ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;
+	if ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;
+	if ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;
 
-				lastV = contour[ i ];
+	THREE.ExtrudeGeometry.call( this, textShapes, parameters );
 
-			} else if ( lastV.equals( contour[ i ] ) ) {
-
-				// We reached the last point of a closed loop
-
-				lastV = null;
-				continue;
-
-			}
-
-			l = vlen * 2 + i;
-			m = l - 1;
-
-			// Create faces for the z-sides of the text
-
-			f4( l, m, m + blen, l + blen );
-
-			for ( j = 0; j < vlen; j++ ) {
-
-				if ( vertices[ j ].equals( contour[ i ] ) ) break;
-
-			}
-
-			for ( k = 0; k < vlen; k++ ) {
-
-				if ( vertices[ k ].equals( contour[ i - 1 ] ) ) break;
-
-			}
-
-			// Create faces for the z-sides of the text
-
-			f4( j, k, m, l );
-			f4( l + blen, m + blen, k + vlen, j + vlen );
-
-		}
-
-	} else {
-
-		i = contour.length;
-
-		while ( --i > 0 ) {
-
-			if ( !lastV ) {
-
-				lastV = contour[ i ];
-
-			} else if ( lastV.equals( contour[ i ] ) ) {
-
-				// We reached the last point of a closed loop
-
-				lastV = null;
-				continue;
-
-			}
-
-			for ( j = 0; j < vlen; j++ ) {
-
-				if ( vertices[ j ].equals( contour[ i ] ) ) break;
-
-			}
-
-			for ( k = 0; k < vlen; k++ ) {
-
-				if ( vertices[ k ].equals( contour[ i - 1 ] ) ) break;
-
-			}
-
-			// Create faces for the z-sides of the text
-
-			f4( j, k, k + vlen, j + vlen );
-
-		}
-	}
-
-
-	// UVs to be added
-
-	this.computeCentroids();
-	this.computeFaceNormals();
-	//this.computeVertexNormals();
+};
 
-	function v( x, y, z ) {
+THREE.TextGeometry.prototype = new THREE.ExtrudeGeometry();
+THREE.TextGeometry.prototype.constructor = THREE.TextGeometry;
 
-		scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
 
-	}
+/*
+	// TextGeometry wrapper
 
-	function f3( a, b, c ) {
+	var text3d = new TextGeometry( text, options );
 
-		scope.faces.push( new THREE.Face3( a, b, c ) );
+	// Complete manner
 
-	}
+	var textPath = new TextPath( text, options );
+	var textShapes = textPath.toShapes();
+	var text3d = new ExtrudeGeometry( textShapes, options );
 
-	function f4( a, b, c, d ) {
+	// Factory Method
 
-		scope.faces.push( new THREE.Face4( a, b, c, d ) );
+	var textShapes = FontUtils.getTextShapes( text, options );
+	text3d = new ExtrudeGeometry( textShapes, options );
 
-	}
+*/
 
 
-};
-
 THREE.FontUtils = {
 
 	faces : {},
@@ -278,6 +95,14 @@ THREE.FontUtils = {
 
 	},
 
+	getTextShapes: function( text, options ) {
+
+		var textPath = new TextPath( text, options );
+		var textShapes = textPath.toShapes();
+		return textShapes;
+
+	},
+
 	loadFace : function( data ) {
 
 		var family = data.familyName.toLowerCase();
@@ -295,6 +120,7 @@ THREE.FontUtils = {
 
 	},
 
+/* LEGACY CODE
 
 	extractPoints : function( allPoints, charactersPoints ) {
 
@@ -414,7 +240,7 @@ THREE.FontUtils = {
 
 		//console.log("isolatedShapes", isolatedShapes);
 
-		/* For each isolated shape, find the closest points and break to the hole to allow triangulation*/
+		// For each isolated shape, find the closest points and break to the hole to allow triangulation
 
 		// Find closest points between holes
 
@@ -649,7 +475,7 @@ THREE.FontUtils = {
 
 		};
 
-	},
+	},*/
 
 	drawText : function( text ) {
 
@@ -666,200 +492,45 @@ THREE.FontUtils = {
 
 		var fontPaths = [];
 
-		var path = new THREE.Path();
-		for ( i = 0; i < length; i++ ) {
+		for ( i = 0; i < length; i ++ ) {
+
+			var path = new THREE.Path();
 
 			var ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path );
 			offset += ret.offset;
-			characterPts.push( ret.points );
-			allPts = allPts.concat( ret.points );
-			//fontPaths.push( ret.path );
+			//characterPts.push( ret.points );
+			//allPts = allPts.concat( ret.points );
+			fontPaths.push( ret.path );
 
 		}
 
-		//path.debug(document.getElementById("boo"));
-		//console.log(path);
-
-
 		// get the width
 
 		var width = offset / 2;
+		//
+		// for ( p = 0; p < allPts.length; p++ ) {
+		//
+		// 	allPts[ p ].x -= width;
+		//
+		// }
 
-		for ( p = 0; p < allPts.length; p++ ) {
-
-			allPts[ p ].x -= width;
-
-		}
-
-		var extract = this.extractPoints( allPts, characterPts );
-		extract.contour = allPts;
-
-		var bevelPoints = [];
-
-		var centroids = [], forCentroids = [], expandOutwards = [], sum = new THREE.Vector2(), lastV;
-
-		i = allPts.length;
-
-		while ( --i >= 0 ) {
-
-			if ( !lastV ) {
-
-				lastV = allPts[ i ];
-
-			} else if ( lastV.equals( allPts[ i ] ) ) {
-
-				// We reached the last point of a closed loop
-
-				lastV = null;
-
-				var bool = this.Triangulate.area( forCentroids ) > 0;
-				expandOutwards.push( bool );
-				centroids.push( sum.divideScalar( forCentroids.length ) );
-				forCentroids = [];
-
-				sum = new THREE.Vector2();
-				continue;
-
-			}
-
-			sum.addSelf( allPts[ i ] );
-			forCentroids.push( allPts[ i ] );
-
-		}
-
-
-		i = allPts.length;
-		p = 0;
-		var pt, centroid ;
-		var dirV, adj;
-
-		while ( --i >= 0 ) {
-
-			pt = allPts[ i ];
-			centroid = centroids[ p ];
-
-			dirV = pt.clone().subSelf( centroid );
-			adj = this.bevelSize / dirV.length();
-
-			if ( expandOutwards[ p ] ) {
-
-				adj += 1;
-
-			}  else {
-
-				adj = 1 - adj;
-
-			}
-
-			adj = dirV.multiplyScalar( adj ).addSelf( centroid );
-			bevelPoints.unshift( adj );
-
-
-			if ( !lastV ) {
-
-				lastV = allPts[ i ];
-
-			} else if ( lastV.equals( allPts[ i ] ) ) {
-
-				// We reached the last point of a closed loop
-
-				lastV = null;
-				p++;
-				continue;
-
-			}
-
-		}
-
-
-		/*
-		for ( p = 0; p < allPts.length; p++ ) {
-
-			pt = allPts[ p ];
-			bevelPoints.push( new THREE.Vector2( pt.x + this.bevelSize, pt.y + this.bevelSize ) );
-
-		}
-		*/
-
-		extract.bevel = bevelPoints;
-
-		return extract;
-
-	},
-
-
-	// Bezier Curves formulas obtained from
-	// http://en.wikipedia.org/wiki/B%C3%A9zier_curve
-
-	// Quad Bezier Functions
-
-	b2p0: function ( t, p ) {
-
-		var k = 1 - t;
-		return k * k * p;
-
-	},
-
-	b2p1: function ( t, p ) {
-
-		return 2 * ( 1 - t ) * t * p;
-
-	},
-
-	b2p2: function ( t, p ) {
-
-		return t * t * p;
-
-	},
+		//var extract = this.extractPoints( allPts, characterPts );
+		//extract.contour = allPts;
 
-	b2: function ( t, p0, p1, p2 ) {
+		//extract.paths = fontPaths;
+		//extract.offset = width;
 
-		return this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 );
+		return { paths : fontPaths, offset : width };
 
 	},
 
-	// Cubic Bezier Functions
-
-	b3p0: function ( t, p ) {
-
-		var k = 1 - t;
-		return k * k * k * p;
-
-	},
-
-	b3p1: function ( t, p ) {
-
-		var k = 1 - t;
-		return 3 * k * k * t * p;
-
-	},
-
-	b3p2: function ( t, p ) {
-
-		var k = 1 - t;
-		return 3 * k * t * t * p;
-
-	},
 
-	b3p3: function ( t, p ) {
-
-		return t * t * t * p;
-
-	},
-
-	b3: function ( t, p0, p1, p2, p3 ) {
-
-		return this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) +  this.b3p3( t, p3 );
-
-	},
 
 
 	extractGlyphPoints : function( c, face, scale, offset, path ) {
 
 		var pts = [];
 
-
-
 		var i, i2,
 			outline, action, length,
 			scaleX, scaleY,
@@ -879,8 +550,10 @@ THREE.FontUtils = {
 
 			for ( i = 0; i < length; ) {
 
-				action = outline[ i++ ];
-				//console.log(action);
+				action = outline[ i ++ ];
+
+				//console.log( action );
+
 				switch( action ) {
 
 				case 'm':
@@ -889,9 +562,10 @@ THREE.FontUtils = {
 
 					x = outline[ i++ ] * scaleX + offset;
 					y = outline[ i++ ] * scaleY;
+
 					pts.push( new THREE.Vector2( x, y ) );
 
-					path.moveTo(x,y);
+					path.moveTo( x, y );
 					break;
 
 				case 'l':
@@ -925,8 +599,8 @@ THREE.FontUtils = {
 						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2++ ) {
 
 							var t = i2 / divisions;
-							var tx = THREE.FontUtils.b2( t, cpx0, cpx1, cpx );
-							var ty = THREE.FontUtils.b2( t, cpy0, cpy1, cpy );
+							var tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );
+							var ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );
 							pts.push( new THREE.Vector2( tx, ty ) );
 
 					  }
@@ -958,8 +632,8 @@ THREE.FontUtils = {
 						for ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2++ ) {
 
 							var t = i2 / divisions;
-							var tx = THREE.FontUtils.b3( t, cpx0, cpx1, cpx2, cpx );
-							var ty = THREE.FontUtils.b3( t, cpy0, cpy1, cpy2, cpy );
+							var tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );
+							var ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );
 							pts.push( new THREE.Vector2( tx, ty ) );
 
 						}

+ 68 - 0
src/extras/geometries/TextPath.js

@@ -0,0 +1,68 @@
+/**
+ * @author zz85 / http://www.lab4games.net/zz85/blog
+ *
+ * TextPath
+ *
+ **/
+
+THREE.TextPath = function ( text, parameters ) {
+
+	THREE.Path.call( this );
+
+	this.parameters = parameters || {};
+
+	this.set( text );
+
+};
+
+THREE.TextPath.prototype.set = function ( text, parameters ) {
+
+	this.text = text;
+
+	var parameters = parameters || this.parameters;
+
+	var size = parameters.size !== undefined ? parameters.size : 100;
+	var curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments: 4;
+
+	var font = parameters.font !== undefined ? parameters.font : "helvetiker";
+	var weight = parameters.weight !== undefined ? parameters.weight : "normal";
+	var style = parameters.style !== undefined ? parameters.style : "normal";
+
+	THREE.FontUtils.size = size;
+	THREE.FontUtils.divisions = curveSegments;
+
+	THREE.FontUtils.face = font;
+	THREE.FontUtils.weight = weight;
+	THREE.FontUtils.style = style;
+
+};
+
+
+
+THREE.TextPath.prototype.toShapes = function () {
+
+	// Get a Font data json object
+
+	var data = THREE.FontUtils.drawText( this.text );
+
+	var paths = data.paths;
+	var shapes = [];
+
+	for ( var p = 0, pl = paths.length; p < pl; p ++ ) {
+
+		shapes = shapes.concat( paths[ p ].toShapes() );
+
+	}
+
+	return shapes;
+
+	//console.log(path);
+	//console.log(fontShapes);
+
+	// Either find actions or curves.
+
+	//var text3d = new THREE.ExtrudeGeometry( shapes , { amount: 20, bevelEnabled:true, bevelThickness:3	} );
+
+	//return text3d;
+
+};

+ 1 - 0
utils/build.py

@@ -97,6 +97,7 @@ EXTRAS_FILES = [
 'extras/geometries/Curve.js',
 'extras/geometries/Path.js',
 'extras/geometries/Shape.js',
+'extras/geometries/TextPath.js',
 'extras/geometries/CubeGeometry.js',
 'extras/geometries/CylinderGeometry.js',
 'extras/geometries/ExtrudeGeometry.js',