瀏覽代碼

Removed workers from SceneLoader.

Also manually fixed buffalo model and test scene to be valid JSONs.
alteredq 13 年之前
父節點
當前提交
81a8eec8ee
共有 5 個文件被更改,包括 1104 次插入1090 次删除
  1. 372 370
      build/Three.js
  2. 176 174
      build/custom/ThreeExtras.js
  3. 13 18
      examples/obj/buffalo/buffalo.js
  4. 87 111
      examples/scenes/test_scene.js
  5. 456 417
      src/extras/loaders/SceneLoader.js

+ 372 - 370
build/Three.js

@@ -15,64 +15,64 @@ this.y=Math.asin(a.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
 c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};
-THREE.Ray=function(a,c){function b(a,b,c){m.sub(c,a);u=m.dot(b);if(u<=0)return null;p=o.add(a,n.copy(b).multiplyScalar(u));return r=c.distanceTo(p)}function d(a,b,c,d){m.sub(d,b);o.sub(c,b);n.sub(a,b);t=m.dot(m);x=m.dot(o);q=m.dot(n);s=o.dot(o);v=o.dot(n);y=1/(t*s-x*x);G=(s*q-x*v)*y;K=(t*v-x*q)*y;return G>=0&&K>=0&&G+K<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
-c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var g=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,c=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(n){for(var m,p=[],o=0,u=n.children.length;o<u;o++)Array.prototype.push.apply(p,this.intersectObject(n.children[o]));if(n instanceof THREE.Particle){o=
-b(this.origin,this.direction,n.matrixWorld.getPosition());if(o===null||o>n.scale.x)return[];m={distance:o,point:n.position,face:null,object:n};p.push(m)}else if(n instanceof THREE.Mesh){o=b(this.origin,this.direction,n.matrixWorld.getPosition());if(o===null||o>n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)))return p;var q,r=n.geometry,t=r.vertices,x;n.matrixRotationWorld.extractRotation(n.matrixWorld);o=0;for(u=r.faces.length;o<u;o++)if(m=r.faces[o],a.copy(this.origin),
-c.copy(this.direction),x=n.matrixWorld,i=x.multiplyVector3(i.copy(m.centroid)).subSelf(a),q=i.dot(c),!(q<=0)&&(g=x.multiplyVector3(g.copy(t[m.a].position)),e=x.multiplyVector3(e.copy(t[m.b].position)),f=x.multiplyVector3(f.copy(t[m.c].position)),h=m instanceof THREE.Face4?x.multiplyVector3(h.copy(t[m.d].position)):null,l=n.matrixRotationWorld.multiplyVector3(l.copy(m.normal)),q=c.dot(l),n.doubleSided||(n.flipSided?q>0:q<0)))if(q=l.dot(i.sub(g,a))/q,k.add(a,c.multiplyScalar(q)),m instanceof THREE.Face3)d(k,
-g,e,f)&&(m={distance:a.distanceTo(k),point:k.clone(),face:m,object:n},p.push(m));else if(m instanceof THREE.Face4&&(d(k,g,e,h)||d(k,e,f,h)))m={distance:a.distanceTo(k),point:k.clone(),face:m,object:n},p.push(m)}return p};var m=new THREE.Vector3,o=new THREE.Vector3,n=new THREE.Vector3,u,p,r,t,x,q,s,v,y,G,K};
-THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,k,m){h=!1;c=e;b=f;d=k;g=m;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
-function(e,f,k,m,o,n){h?(h=!1,c=e<k?e<o?e:o:k<o?k:o,b=f<m?f<n?f:n:m<n?m:n,d=e>k?e>o?e:o:k>o?k:o,g=f>m?f>n?f:n:m>n?m:n):(c=e<k?e<o?e<c?e:c:o<c?o:c:k<o?k<c?k:c:o<c?o:c,b=f<m?f<n?f<b?f:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b,d=e>k?e>o?e>d?e:d:o>d?o:d:k>o?k>d?k:d:o>d?o:d,g=f>m?f>n?f>g?f:g:n>g?n:g:m>n?m>g?m:g:n>g?n:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
+THREE.Ray=function(a,c){function b(a,b,c){o.sub(c,a);r=o.dot(b);if(r<=0)return null;m=p.add(a,n.copy(b).multiplyScalar(r));return s=c.distanceTo(m)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);n.sub(a,b);u=o.dot(o);t=o.dot(p);q=o.dot(n);A=p.dot(p);w=p.dot(n);E=1/(u*A-t*t);x=(A*q-t*w)*E;I=(u*w-t*q)*E;return x>=0&&I>=0&&x+I<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
+c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var g=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,c=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.intersectObject=function(n){for(var m,o=[],p=0,r=n.children.length;p<r;p++)Array.prototype.push.apply(o,this.intersectObject(n.children[p]));if(n instanceof THREE.Particle){p=
+b(this.origin,this.direction,n.matrixWorld.getPosition());if(p===null||p>n.scale.x)return[];m={distance:p,point:n.position,face:null,object:n};o.push(m)}else if(n instanceof THREE.Mesh){p=b(this.origin,this.direction,n.matrixWorld.getPosition());if(p===null||p>n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)))return o;var s,q=n.geometry,u=q.vertices,t;n.matrixRotationWorld.extractRotation(n.matrixWorld);p=0;for(r=q.faces.length;p<r;p++)if(m=q.faces[p],a.copy(this.origin),
+c.copy(this.direction),t=n.matrixWorld,i=t.multiplyVector3(i.copy(m.centroid)).subSelf(a),s=i.dot(c),!(s<=0)&&(g=t.multiplyVector3(g.copy(u[m.a].position)),e=t.multiplyVector3(e.copy(u[m.b].position)),f=t.multiplyVector3(f.copy(u[m.c].position)),h=m instanceof THREE.Face4?t.multiplyVector3(h.copy(u[m.d].position)):null,k=n.matrixRotationWorld.multiplyVector3(k.copy(m.normal)),s=c.dot(k),n.doubleSided||(n.flipSided?s>0:s<0)))if(s=k.dot(i.sub(g,a))/s,l.add(a,c.multiplyScalar(s)),m instanceof THREE.Face3)d(l,
+g,e,f)&&(m={distance:a.distanceTo(l),point:l.clone(),face:m,object:n},o.push(m));else if(m instanceof THREE.Face4&&(d(l,g,e,h)||d(l,e,f,h)))m={distance:a.distanceTo(l),point:l.clone(),face:m,object:n},o.push(m)}return o};var o=new THREE.Vector3,p=new THREE.Vector3,n=new THREE.Vector3,r,m,s,u,t,q,A,w,E,x,I};
+THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,o){h=!1;c=e;b=f;d=l;g=o;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
+function(e,f,l,o,p,n){h?(h=!1,c=e<l?e<p?e:p:l<p?l:p,b=f<o?f<n?f:n:o<n?o:n,d=e>l?e>p?e:p:l>p?l:p,g=f>o?f>n?f:n:o>n?o:n):(c=e<l?e<p?e<c?e:c:p<c?p:c:l<p?l<c?l:c:p<c?p:c,b=f<o?f<n?f<b?f:b:n<b?n:b:o<n?o<b?o:b:n<b?n:b,d=e>l?e>p?e>d?e:d:p>d?p:d:l>p?l>d?l:d:p>d?p:d,g=f>o?f>n?f>g?f:g:n>g?n:g:o>n?o>g?o:g:n>g?n:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
 e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d<e.getRight()?d:e.getRight();g=g<e.getBottom()?g:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}};
 THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,d,g){return d+(a-c)*(g-d)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,l,k,m,o,n,u,p){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,l||0,k!==void 0?k:1,m||0,o||0,n||0,u||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,l,k,m,o,n,u,p){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=m;this.n41=o;this.n42=n;this.n43=u;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,m=a.n32,o=a.n33,n=a.n34,u=a.n41,p=a.n42,r=a.n43,
-t=a.n44,x=c.n11,q=c.n12,s=c.n13,v=c.n14,y=c.n21,G=c.n22,K=c.n23,F=c.n24,z=c.n31,D=c.n32,P=c.n33,J=c.n34,$=c.n41,L=c.n42,Q=c.n43,da=c.n44;this.n11=b*x+d*y+g*z+e*$;this.n12=b*q+d*G+g*D+e*L;this.n13=b*s+d*K+g*P+e*Q;this.n14=b*v+d*F+g*J+e*da;this.n21=f*x+h*y+i*z+l*$;this.n22=f*q+h*G+i*D+l*L;this.n23=f*s+h*K+i*P+l*Q;this.n24=f*v+h*F+i*J+l*da;this.n31=k*x+m*y+o*z+n*$;this.n32=k*q+m*G+o*D+n*L;this.n33=k*s+m*K+o*P+n*Q;this.n34=k*v+m*F+o*J+n*da;this.n41=u*x+p*y+r*z+t*$;this.n42=u*q+p*G+r*D+t*L;this.n43=u*
-s+p*K+r*P+t*Q;this.n44=u*v+p*F+r*J+t*da;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
-this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
-c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*
-a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,m=this.n34,o=this.n41,n=this.n42,u=this.n43,p=this.n44;return d*f*l*o-b*h*l*o-d*e*k*o+c*h*k*o+b*e*m*o-c*f*m*o-d*f*i*n+b*h*i*n+d*g*k*n-a*h*k*n-b*g*m*n+a*f*m*n+d*e*i*u-c*h*i*u-d*g*l*u+a*h*l*u+c*g*m*u-a*e*m*u-b*e*i*p+c*f*i*p+b*g*l*p-a*f*l*p-c*g*k*p+a*e*k*
-p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
-a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;
-a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;
-a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,
-0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,l=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+b,l*h-d*e,0,i*h-d*f,l*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,m=a.n33,o=a.n34,n=a.n41,u=a.n42,p=a.n43,r=a.n44;this.n11=h*o*u-i*m*u+i*k*p-f*o*p-h*k*r+f*m*r;this.n12=g*m*u-d*o*u-g*k*p+b*o*p+d*k*r-b*m*r;this.n13=d*i*u-g*h*u+g*f*p-b*i*p-d*f*r+b*h*r;this.n14=g*h*k-d*i*k-g*f*m+b*i*m+d*f*o-b*h*o;this.n21=i*m*n-h*o*n-i*l*p+e*o*p+h*l*r-e*m*r;this.n22=d*o*n-g*m*n+
-g*l*p-c*o*p-d*l*r+c*m*r;this.n23=g*h*n-d*i*n-g*e*p+c*i*p+d*e*r-c*h*r;this.n24=d*i*l-g*h*l+g*e*m-c*i*m-d*e*o+c*h*o;this.n31=f*o*n-i*k*n+i*l*u-e*o*u-f*l*r+e*k*r;this.n32=g*k*n-b*o*n-g*l*u+c*o*u+b*l*r-c*k*r;this.n33=d*i*n-g*f*n+g*e*u-c*i*u-b*e*r+c*f*r;this.n34=g*f*l-b*i*l-g*e*k+c*i*k+b*e*o-c*f*o;this.n41=h*k*n-f*m*n-h*l*u+e*m*u+f*l*p-e*k*p;this.n42=b*m*n-d*k*n+d*l*u-c*m*u-b*l*p+c*k*p;this.n43=d*f*n-b*h*n-d*e*u+c*h*u+b*e*p-c*f*p;this.n44=b*h*l-d*f*l+d*e*k-c*h*k-b*e*m+c*f*m;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,l=f*g,k=d*h,m=d*g;this.n11=i+m*b;this.n12=k*b-l;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=l*b-k;this.n32=m+i*b;this.n33=e*f;break;case "ZXY":i=f*h;l=f*g;k=d*h;m=d*g;this.n11=i-m*b;this.n12=-e*g;this.n13=k+l*b;this.n21=l+k*b;this.n22=e*h;this.n23=m-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
-e*h;l=e*g;k=b*h;m=b*g;this.n11=f*h;this.n12=k*d-l;this.n13=i*d+m;this.n21=f*g;this.n22=m*d+i;this.n23=l*d-k;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;l=e*d;k=b*f;m=b*d;this.n11=f*h;this.n12=m-i*g;this.n13=k*g+l;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=l*g+k;this.n33=i-m*g;break;case "XZY":i=e*f;l=e*d;k=b*f;m=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+m;this.n22=e*h;this.n23=l*g-k;this.n31=k*g-l;this.n32=b*h;this.n33=m*g+i;break;default:i=e*h,l=e*
-g,k=b*h,m=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=l+k*d,this.n22=i-m*d,this.n23=-b*f,this.n31=m-i*d,this.n32=k+l*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var l=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(l+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+l);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
+THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,k,l,o,p,n,r,m){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,k||0,l!==void 0?l:1,o||0,p||0,n||0,r||0,m!==void 0?m:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,k,l,o,p,n,r,m){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=o;this.n41=p;this.n42=n;this.n43=r;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,o=a.n32,p=a.n33,n=a.n34,r=a.n41,m=a.n42,s=a.n43,
+u=a.n44,t=c.n11,q=c.n12,A=c.n13,w=c.n14,E=c.n21,x=c.n22,I=c.n23,M=c.n24,D=c.n31,F=c.n32,P=c.n33,K=c.n34,$=c.n41,S=c.n42,R=c.n43,V=c.n44;this.n11=b*t+d*E+g*D+e*$;this.n12=b*q+d*x+g*F+e*S;this.n13=b*A+d*I+g*P+e*R;this.n14=b*w+d*M+g*K+e*V;this.n21=f*t+h*E+i*D+k*$;this.n22=f*q+h*x+i*F+k*S;this.n23=f*A+h*I+i*P+k*R;this.n24=f*w+h*M+i*K+k*V;this.n31=l*t+o*E+p*D+n*$;this.n32=l*q+o*x+p*F+n*S;this.n33=l*A+o*I+p*P+n*R;this.n34=l*w+o*M+p*K+n*V;this.n41=r*t+m*E+s*D+u*$;this.n42=r*q+m*x+s*F+u*S;this.n43=r*A+m*
+I+s*P+u*R;this.n44=r*w+m*M+s*K+u*V;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*c+this.n22*
+b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*
+a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,o=this.n34,p=this.n41,n=this.n42,r=this.n43,m=this.n44;return d*f*k*p-b*h*k*p-d*e*l*p+c*h*l*p+b*e*o*p-c*f*o*p-d*f*i*n+b*h*i*n+d*g*l*n-a*h*l*n-b*g*o*n+a*f*o*n+d*e*i*r-c*h*i*r-d*g*k*r+a*h*k*r+c*g*o*r-a*e*o*r-b*e*i*m+c*f*i*m+b*g*k*m-a*f*k*m-c*g*l*m+a*e*l*m},transpose:function(){var a;
+a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
+a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
+a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},
+setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},
+setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,o=a.n33,p=a.n34,n=a.n41,r=a.n42,m=a.n43,s=a.n44;this.n11=h*p*r-i*o*r+i*l*m-f*p*m-h*l*s+f*o*s;this.n12=g*o*r-d*p*r-g*l*m+b*p*m+d*l*s-b*o*s;this.n13=d*i*r-g*h*r+g*f*m-b*i*m-d*f*s+b*h*s;this.n14=g*h*l-d*i*l-g*f*o+b*i*o+d*f*p-b*h*p;this.n21=i*o*n-h*p*n-i*k*m+e*p*m+h*k*s-e*o*s;this.n22=d*p*n-g*o*n+
+g*k*m-c*p*m-d*k*s+c*o*s;this.n23=g*h*n-d*i*n-g*e*m+c*i*m+d*e*s-c*h*s;this.n24=d*i*k-g*h*k+g*e*o-c*i*o-d*e*p+c*h*p;this.n31=f*p*n-i*l*n+i*k*r-e*p*r-f*k*s+e*l*s;this.n32=g*l*n-b*p*n-g*k*r+c*p*r+b*k*s-c*l*s;this.n33=d*i*n-g*f*n+g*e*r-c*i*r-b*e*s+c*f*s;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*p-c*f*p;this.n41=h*l*n-f*o*n-h*k*r+e*o*r+f*k*m-e*l*m;this.n42=b*o*n-d*l*n+d*k*r-c*o*r-b*k*m+c*l*m;this.n43=d*f*n-b*h*n-d*e*r+c*h*r+b*e*m-c*f*m;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*o+c*f*o;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,k=f*g,l=d*h,o=d*g;this.n11=i+o*b;this.n12=l*b-k;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=k*b-l;this.n32=o+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;o=d*g;this.n11=i-o*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=o-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
+e*h;k=e*g;l=b*h;o=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+o;this.n21=f*g;this.n22=o*d+i;this.n23=k*d-l;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;k=e*d;l=b*f;o=b*d;this.n11=f*h;this.n12=o-i*g;this.n13=l*g+k;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=k*g+l;this.n33=i-o*g;break;case "XZY":i=e*f;k=e*d;l=b*f;o=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+o;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=o*g+i;break;default:i=e*h,k=e*
+g,l=b*h,o=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-o*d,this.n23=-b*f,this.n31=o-i*d,this.n32=l+k*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var k=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(k+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+k);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
 a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var d=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(c);g.setScale(b.x,b.y,b.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);e.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=d.length();b.y=g.length();b.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=b.x;d.n21/=b.x;d.n31/=b.x;d.n12/=b.y;d.n22/=b.y;d.n32/=b.y;d.n13/=b.z;d.n23/=b.z;d.n33/=b.z;c.setFromRotationMatrix(d);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),d=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*l;b[7]=a*k;b[8]=a*m;return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*k;b[7]=a*l;b[8]=a*o;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,d,g,e){var f;f=new THREE.Matrix4;f.n11=2*g/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*g/(d-b);f.n23=(d+b)/(d-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(e+g)/(e-g);f.n34=-2*e*g/(e-g);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,d){var g,a=b*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,b,d)};
-THREE.Matrix4.makeOrtho=function(a,c,b,d,g,e){var f,h,i,l;f=new THREE.Matrix4;h=c-a;i=b-d;l=e-g;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((c+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((b+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((e+g)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,c,b,d,g,e){var f,h,i,k;f=new THREE.Matrix4;h=c-a;i=b-d;k=e-g;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((c+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((b+d)/i);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((e+g)/k);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,d,g;b=0;for(d=this.children.length;b<d;b++){g=this.children[b];if(g.name===a)return g;
 if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,l=[],
-k,m,o=[],n,u=[],p,r,t=[],x,q,s=[],v={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,G=new THREE.Vector4,K=new THREE.Matrix4,F=new THREE.Matrix4,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=z[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);K.multiply(b.projectionMatrix,b.matrixWorldInverse);K.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-K.multiply(b.matrixWorld,b.projectionMatrixInverse);K.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=z[h].x*d.n14+z[h].y*d.n24+z[h].z*d.n34+z[h].w,c<=e){c=!1;break a}c=!0}c?(K.multiplyVector3(y.copy(b.position)),g=a(),g.object=b,g.z=y.z,v.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(K.multiplyVector3(y.copy(b.position)),g=a(),g.object=b,g.z=y.z,v.sprites.push(g)):b instanceof THREE.Light&&v.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
-v.objects.sort(b);return v};this.projectScene=function(a,e,g){var f=e.near,y=e.far,z,S,A,C,I,j,O,fa,Y,R,N,ea,V,ca,Z,X;q=r=n=m=0;v.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);K.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(K);v=this.projectGraph(a,!1);a=0;for(z=v.objects.length;a<z;a++)if(Y=v.objects[a].object,R=Y.matrixWorld,
-ea=Y.material,i=0,Y instanceof THREE.Mesh){N=Y.geometry;V=Y.geometry.materials;C=N.vertices;ca=N.faces;Z=N.faceVertexUvs;N=Y.matrixRotationWorld.extractRotation(R);S=0;for(A=C.length;S<A;S++)h=c(),h.positionWorld.copy(C[S].position),R.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),K.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<y;C=0;for(S=ca.length;C<S;C++){A=
-ca[C];if(A instanceof THREE.Face3)if(I=l[A.a],j=l[A.b],O=l[A.c],I.visible&&j.visible&&O.visible&&(Y.doubleSided||Y.flipSided!=(O.positionScreen.x-I.positionScreen.x)*(j.positionScreen.y-I.positionScreen.y)-(O.positionScreen.y-I.positionScreen.y)*(j.positionScreen.x-I.positionScreen.x)<0))fa=o[m]=o[m]||new THREE.RenderableFace3,m++,k=fa,k.v1.copy(I),k.v2.copy(j),k.v3.copy(O);else continue;else if(A instanceof THREE.Face4)if(I=l[A.a],j=l[A.b],O=l[A.c],fa=l[A.d],I.visible&&j.visible&&O.visible&&fa.visible&&
-(Y.doubleSided||Y.flipSided!=((fa.positionScreen.x-I.positionScreen.x)*(j.positionScreen.y-I.positionScreen.y)-(fa.positionScreen.y-I.positionScreen.y)*(j.positionScreen.x-I.positionScreen.x)<0||(j.positionScreen.x-O.positionScreen.x)*(fa.positionScreen.y-O.positionScreen.y)-(j.positionScreen.y-O.positionScreen.y)*(fa.positionScreen.x-O.positionScreen.x)<0)))X=u[n]=u[n]||new THREE.RenderableFace4,n++,k=X,k.v1.copy(I),k.v2.copy(j),k.v3.copy(O),k.v4.copy(fa);else continue;k.normalWorld.copy(A.normal);
-N.multiplyVector3(k.normalWorld);k.centroidWorld.copy(A.centroid);R.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);K.multiplyVector3(k.centroidScreen);O=A.vertexNormals;I=0;for(j=O.length;I<j;I++)fa=k.vertexNormalsWorld[I],fa.copy(O[I]),N.multiplyVector3(fa);I=0;for(j=Z.length;I<j;I++)if(X=Z[I][C]){O=0;for(fa=X.length;O<fa;O++)k.uvs[I][O]=X[O]}k.material=ea;k.faceMaterial=A.materialIndex!==null?V[A.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(Y instanceof
-THREE.Line){F.multiply(K,R);C=Y.geometry.vertices;I=c();I.positionScreen.copy(C[0].position);F.multiplyVector4(I.positionScreen);S=1;for(A=C.length;S<A;S++)if(I=c(),I.positionScreen.copy(C[S].position),F.multiplyVector4(I.positionScreen),j=l[i-2],D.copy(I.positionScreen),P.copy(j.positionScreen),d(D,P))D.multiplyScalar(1/D.w),P.multiplyScalar(1/P.w),Y=t[r]=t[r]||new THREE.RenderableLine,r++,p=Y,p.v1.positionScreen.copy(D),p.v2.positionScreen.copy(P),p.z=Math.max(D.z,P.z),p.material=ea,v.elements.push(p)}a=
-0;for(z=v.sprites.length;a<z;a++)if(Y=v.sprites[a].object,R=Y.matrixWorld,Y instanceof THREE.Particle&&(G.set(R.n14,R.n24,R.n34,1),K.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))f=s[q]=s[q]||new THREE.RenderableParticle,q++,x=f,x.x=G.x/G.w,x.y=G.y/G.w,x.z=G.z,x.rotation=Y.rotation.z,x.scale.x=Y.scale.x*Math.abs(x.x-(G.x+e.projectionMatrix.n11)/(G.w+e.projectionMatrix.n14)),x.scale.y=Y.scale.y*Math.abs(x.y-(G.y+e.projectionMatrix.n22)/(G.w+e.projectionMatrix.n24)),x.material=Y.material,v.elements.push(x);
-g&&v.elements.sort(b);return v}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
+THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,k=[],
+l,o,p=[],n,r=[],m,s,u=[],t,q,A=[],w={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,x=new THREE.Vector4,I=new THREE.Matrix4,M=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],F=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){D[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);D[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);D[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);D[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);D[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);D[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=D[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+I.multiply(b.matrixWorld,b.projectionMatrixInverse);I.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=D[h].x*d.n14+D[h].y*d.n24+D[h].z*d.n34+D[h].w,c<=e){c=!1;break a}c=!0}c?(I.multiplyVector3(E.copy(b.position)),g=a(),g.object=b,g.z=E.z,w.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(I.multiplyVector3(E.copy(b.position)),g=a(),g.object=b,g.z=E.z,w.sprites.push(g)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
+w.objects.sort(b);return w};this.projectScene=function(a,e,g){var f=e.near,E=e.far,D,y,H,z,L,j,aa,ga,N,W,T,ca,Q,C,ka,da;q=s=n=o=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);I.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(I);w=this.projectGraph(a,!1);a=0;for(D=w.objects.length;a<D;a++)if(N=w.objects[a].object,W=N.matrixWorld,
+ca=N.material,i=0,N instanceof THREE.Mesh){T=N.geometry;Q=N.geometry.materials;z=T.vertices;C=T.faces;ka=T.faceVertexUvs;T=N.matrixRotationWorld.extractRotation(W);y=0;for(H=z.length;y<H;y++)h=c(),h.positionWorld.copy(z[y].position),W.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),I.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<E;z=0;for(y=C.length;z<y;z++){H=
+C[z];if(H instanceof THREE.Face3)if(L=k[H.a],j=k[H.b],aa=k[H.c],L.visible&&j.visible&&aa.visible&&(N.doubleSided||N.flipSided!=(aa.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(aa.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0))ga=p[o]=p[o]||new THREE.RenderableFace3,o++,l=ga,l.v1.copy(L),l.v2.copy(j),l.v3.copy(aa);else continue;else if(H instanceof THREE.Face4)if(L=k[H.a],j=k[H.b],aa=k[H.c],ga=k[H.d],L.visible&&j.visible&&aa.visible&&
+ga.visible&&(N.doubleSided||N.flipSided!=((ga.positionScreen.x-L.positionScreen.x)*(j.positionScreen.y-L.positionScreen.y)-(ga.positionScreen.y-L.positionScreen.y)*(j.positionScreen.x-L.positionScreen.x)<0||(j.positionScreen.x-aa.positionScreen.x)*(ga.positionScreen.y-aa.positionScreen.y)-(j.positionScreen.y-aa.positionScreen.y)*(ga.positionScreen.x-aa.positionScreen.x)<0)))da=r[n]=r[n]||new THREE.RenderableFace4,n++,l=da,l.v1.copy(L),l.v2.copy(j),l.v3.copy(aa),l.v4.copy(ga);else continue;l.normalWorld.copy(H.normal);
+T.multiplyVector3(l.normalWorld);l.centroidWorld.copy(H.centroid);W.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);I.multiplyVector3(l.centroidScreen);aa=H.vertexNormals;L=0;for(j=aa.length;L<j;L++)ga=l.vertexNormalsWorld[L],ga.copy(aa[L]),T.multiplyVector3(ga);L=0;for(j=ka.length;L<j;L++)if(da=ka[L][z]){aa=0;for(ga=da.length;aa<ga;aa++)l.uvs[L][aa]=da[aa]}l.material=ca;l.faceMaterial=H.materialIndex!==null?Q[H.materialIndex]:null;l.z=l.centroidScreen.z;w.elements.push(l)}}else if(N instanceof
+THREE.Line){M.multiply(I,W);z=N.geometry.vertices;L=c();L.positionScreen.copy(z[0].position);M.multiplyVector4(L.positionScreen);y=1;for(H=z.length;y<H;y++)if(L=c(),L.positionScreen.copy(z[y].position),M.multiplyVector4(L.positionScreen),j=k[i-2],F.copy(L.positionScreen),P.copy(j.positionScreen),d(F,P))F.multiplyScalar(1/F.w),P.multiplyScalar(1/P.w),N=u[s]=u[s]||new THREE.RenderableLine,s++,m=N,m.v1.positionScreen.copy(F),m.v2.positionScreen.copy(P),m.z=Math.max(F.z,P.z),m.material=ca,w.elements.push(m)}a=
+0;for(D=w.sprites.length;a<D;a++)if(N=w.sprites[a].object,W=N.matrixWorld,N instanceof THREE.Particle&&(x.set(W.n14,W.n24,W.n34,1),I.multiplyVector4(x),x.z/=x.w,x.z>0&&x.z<1))f=A[q]=A[q]||new THREE.RenderableParticle,q++,t=f,t.x=x.x/x.w,t.y=x.y/x.w,t.z=x.z,t.rotation=N.rotation.z,t.scale.x=N.scale.x*Math.abs(t.x-(x.x+e.projectionMatrix.n11)/(x.w+e.projectionMatrix.n14)),t.scale.y=N.scale.y*Math.abs(t.y-(x.y+e.projectionMatrix.n22)/(x.w+e.projectionMatrix.n24)),t.material=N.material,w.elements.push(t);
+g&&w.elements.sort(b);return w}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
 this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
-this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,l=i*b+f*g-h*d,k=i*d+h*b-e*g,m=i*g+e*d-f*b,b=-e*
-b-f*d-h*g;c.x=l*i+b*-e+k*-h-m*-f;c.y=k*i+b*-f+m*-e-l*-h;c.z=m*i+b*-h+l*-f-k*-e;return c}};
+this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,o=i*g+e*d-f*b,b=-e*
+b-f*d-h*g;c.x=k*i+b*-e+l*-h-o*-f;c.y=l*i+b*-f+o*-e-k*-h;c.z=o*i+b*-h+k*-f-l*-e;return c}};
 THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
@@ -83,14 +83,14 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
 b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);c=0;for(b=e.vertexNormals.length;c<b;c++)h.addSelf(e.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[e.a],b=this.vertices[e.b],f=this.vertices[e.c],h.sub(f.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
-b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];m=f[g];o=f[j];n=i.x-h.x;u=l.x-h.x;p=i.y-h.y;r=l.y-h.y;t=i.z-h.z;x=l.z-h.z;q=m.u-k.u;s=o.u-k.u;v=m.v-k.v;y=o.v-k.v;G=1/(q*y-s*v);D.set((y*n-v*u)*G,(y*p-v*r)*G,(y*t-v*x)*G);P.set((q*u-s*n)*G,(q*r-s*p)*G,(q*x-s*t)*G);F[b].addSelf(D);F[c].addSelf(D);F[d].addSelf(D);z[b].addSelf(P);
-z[c].addSelf(P);z[d].addSelf(P)}var c,b,d,g,e,f,h,i,l,k,m,o,n,u,p,r,t,x,q,s,v,y,G,K,F=[],z=[],D=new THREE.Vector3,P=new THREE.Vector3,J=new THREE.Vector3,$=new THREE.Vector3,L=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)F[c]=new THREE.Vector3,z[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var Q=["a","b",
-"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),g=e[Q[d]],K=F[g],J.copy(K),J.subSelf(L.multiplyScalar(L.dot(K))).normalize(),$.cross(e.vertexNormals[d],K),g=$.dot(z[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];o=f[g];p=f[j];n=i.x-h.x;r=k.x-h.x;m=i.y-h.y;s=k.y-h.y;u=i.z-h.z;t=k.z-h.z;q=o.u-l.u;A=p.u-l.u;w=o.v-l.v;E=p.v-l.v;x=1/(q*E-A*w);F.set((E*n-w*r)*x,(E*m-w*s)*x,(E*u-w*t)*x);P.set((q*r-A*n)*x,(q*s-A*m)*x,(q*t-A*u)*x);M[b].addSelf(F);M[c].addSelf(F);M[d].addSelf(F);D[b].addSelf(P);
+D[c].addSelf(P);D[d].addSelf(P)}var c,b,d,g,e,f,h,i,k,l,o,p,n,r,m,s,u,t,q,A,w,E,x,I,M=[],D=[],F=new THREE.Vector3,P=new THREE.Vector3,K=new THREE.Vector3,$=new THREE.Vector3,S=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)M[c]=new THREE.Vector3,D[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):e instanceof THREE.Face4&&(a(this,e.a,e.b,e.c,0,1,2),a(this,e.a,e.b,e.d,0,1,3));var R=["a","b",
+"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)S.copy(e.vertexNormals[d]),g=e[R[d]],I=M[g],K.copy(I),K.subSelf(S.multiplyScalar(S.dot(I))).normalize(),$.cross(e.vertexNormals[d],I),g=$.dot(D[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(K.x,K.y,K.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
 b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,l,k,m,o;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;l=this.points[b[0]];k=this.points[b[1]];
-m=this.points[b[2]];o=this.points[b[3]];h=f*f;i=f*h;d.x=c(l.x,k.x,m.x,o.x,f,h,i);d.y=c(l.y,k.y,m.y,o.y,f,h,i);d.z=c(l.z,k.z,m.z,o.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
+THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,k,l,o,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;k=this.points[b[0]];l=this.points[b[1]];
+o=this.points[b[2]];p=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,o.x,p.x,f,h,i);d.y=c(k.y,l.y,o.y,p.y,f,h,i);d.z=c(k.z,l.z,o.z,p.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
 g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,l=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];f=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
 h}};THREE.Edge=function(a,c,b,d){this.vertices=[a,c];this.vertexIndices=[b,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
 THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,d,g,e){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
@@ -148,46 +148,46 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,l,k,m,o,n,u,p;a=c.projectScene(b,d);i=0;for(l=a.length;i<l;i++)if(o=a[i],o instanceof THREE.RenderableParticle){u=o.x*g+g;p=o.y*e+e;k=0;for(m=o.material.length;k<m;k++)if(n=o.material[k],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=u+"px",n.style.top=p+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(x!=a)p.globalAlpha=x=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}q=a}}function d(a){if(s!=a)p.strokeStyle=s=a}function g(a){if(v!=a)p.fillStyle=v=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-m,o,n,u,p=k.getContext("2d"),r=new THREE.Color(0),t=0,x=1,q=0,s=null,v=null,y=null,G=null,K=null,F,z,D,P,J=new THREE.RenderableVertex,$=new THREE.RenderableVertex,L,Q,da,ia,S,A,C,I,j,O,fa,Y,R=new THREE.Color,N=new THREE.Color,ea=new THREE.Color,V=new THREE.Color,ca=new THREE.Color,Z=[],X,ka,qa,ma,sa,ua,pa,ra,wa,T,w=new THREE.Rectangle,H=new THREE.Rectangle,ba=new THREE.Rectangle,ga=!1,la=new THREE.Color,W=new THREE.Color,U=new THREE.Color,aa=new THREE.Vector3,ha,xa,M,na,ta,ja,a=16;ha=document.createElement("canvas");
-ha.width=ha.height=2;xa=ha.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);M=xa.getImageData(0,0,2,2);na=M.data;ta=document.createElement("canvas");ta.width=ta.height=a;ja=ta.getContext("2d");ja.translate(-a/2,-a/2);ja.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){m=a;o=b;n=Math.floor(m/2);u=Math.floor(o/2);k.width=m;k.height=o;w.set(-n,-u,n,u);H.set(-n,-u,n,u);x=1;q=0;K=G=
-y=v=s=null};this.setClearColor=function(a,b){r.copy(a);t=b;H.set(-n,-u,n,u)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;H.set(-n,-u,n,u)};this.clear=function(){p.setTransform(1,0,0,-1,n,u);H.isEmpty()||(H.minSelf(w),H.inflate(2),t<1&&p.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),t>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+t+")"),p.fillRect(Math.floor(H.getX()),
-Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(a,k){function m(a){var b,c,d,e;la.setRGB(0,0,0);W.setRGB(0,0,0);U.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(la.r+=e.r,la.g+=e.g,la.b+=e.b):d instanceof THREE.DirectionalLight?(W.r+=e.r,W.g+=e.g,W.b+=e.b):d instanceof THREE.PointLight&&(U.r+=e.r,U.g+=e.g,U.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,f instanceof
-THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(aa.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function q(a,e,f){c(f.opacity);b(f.blending);var j,h,i,l,k,m;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)l=f.map.image,k=l.width>>1,m=l.height>>1,f=e.scale.x*
-n,i=e.scale.y*u,j=f*k,h=i*m,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),w.intersects(ba)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-k,-m),p.drawImage(l,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*u,ba.set(a.x-j,a.y-h,a.x+j,a.y+h),w.intersects(ba)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function r(a,e,g,f){c(f.opacity);
-b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(y!=a)p.lineWidth=y=a;a=f.linecap;if(G!=a)p.lineCap=G=a;a=f.linejoin;if(K!=a)p.lineJoin=K=a;d(f.color.getContextStyle());p.stroke();ba.inflate(f.linewidth*2)}}function t(a,d,f,g,j,h,n,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);L=a.positionScreen.x;Q=a.positionScreen.y;da=
-d.positionScreen.x;ia=d.positionScreen.y;S=f.positionScreen.x;A=f.positionScreen.y;s(L,Q,da,ia,S,A);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ma=n.uvs[0],Ga(L,Q,da,ia,S,A,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,aa.copy(n.vertexNormalsWorld[g]),sa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ua=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+
-0.5,aa.copy(n.vertexNormalsWorld[j]),pa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,ra=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,aa.copy(n.vertexNormalsWorld[h]),wa=(aa.x*a.n11+aa.y*a.n12+aa.z*a.n13)*0.5+0.5,T=-(aa.x*a.n21+aa.y*a.n22+aa.z*a.n23)*0.5+0.5,Ga(L,Q,da,ia,S,A,sa,ua,pa,ra,wa,T,l.envMap)}else l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):v(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&
-(ma=n.uvs[0],Ga(L,Q,da,ia,S,A,ma[g].u,ma[g].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map)),b(THREE.SubtractiveBlending)),ga?!l.wireframe&&l.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==3?(N.r=ea.r=V.r=la.r,N.g=ea.g=V.g=la.g,N.b=ea.b=V.b=la.b,o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],N),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ea),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],V),N.r=Math.max(0,Math.min(l.color.r*N.r,1)),N.g=Math.max(0,Math.min(l.color.g*N.g,1)),N.b=Math.max(0,
-Math.min(l.color.b*N.b,1)),ea.r=Math.max(0,Math.min(l.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(l.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(l.color.b*ea.b,1)),V.r=Math.max(0,Math.min(l.color.r*V.r,1)),V.g=Math.max(0,Math.min(l.color.g*V.g,1)),V.b=Math.max(0,Math.min(l.color.b*V.b,1)),ca.r=(ea.r+V.r)*0.5,ca.g=(ea.g+V.g)*0.5,ca.b=(ea.b+V.b)*0.5,qa=Da(N,ea,V,ca),Ba(L,Q,da,ia,S,A,0,0,1,0,0,1,qa)):(R.r=la.r,R.g=la.g,R.b=la.b,o(i,n.centroidWorld,n.normalWorld,R),R.r=Math.max(0,Math.min(l.color.r*R.r,1)),
-R.g=Math.max(0,Math.min(l.color.g*R.g,1)),R.b=Math.max(0,Math.min(l.color.b*R.b,1)),l.wireframe?ya(R,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):v(R)):l.wireframe?ya(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):v(l.color);else if(l instanceof THREE.MeshDepthMaterial)X=k.near,ka=k.far,N.r=N.g=N.b=1-Aa(a.positionScreen.z,X,ka),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,X,ka),V.r=V.g=V.b=1-Aa(f.positionScreen.z,X,ka),ca.r=(ea.r+V.r)*0.5,ca.g=(ea.g+V.g)*0.5,ca.b=(ea.b+
-V.b)*0.5,qa=Da(N,ea,V,ca),Ba(L,Q,da,ia,S,A,0,0,1,0,0,1,qa);else if(l instanceof THREE.MeshNormalMaterial)R.r=Ca(n.normalWorld.x),R.g=Ca(n.normalWorld.y),R.b=Ca(n.normalWorld.z),l.wireframe?ya(R,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):v(R)}function x(a,d,f,g,h,l,n,m,ja){e.info.render.vertices+=4;e.info.render.faces++;c(m.opacity);b(m.blending);if(m.map||m.envMap)t(a,d,g,0,1,3,n,m,ja),t(h,f,l,1,2,3,n,m,ja);else if(L=a.positionScreen.x,Q=a.positionScreen.y,da=d.positionScreen.x,
-ia=d.positionScreen.y,S=f.positionScreen.x,A=f.positionScreen.y,C=g.positionScreen.x,I=g.positionScreen.y,j=h.positionScreen.x,O=h.positionScreen.y,fa=l.positionScreen.x,Y=l.positionScreen.y,m instanceof THREE.MeshBasicMaterial)Ea(L,Q,da,ia,S,A,C,I),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(m.color);else if(m instanceof THREE.MeshLambertMaterial)ga?!m.wireframe&&m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(N.r=ea.r=V.r=ca.r=la.r,N.g=ea.g=
-V.g=ca.g=la.g,N.b=ea.b=V.b=ca.b=la.b,o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],N),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ea),o(i,n.v4.positionWorld,n.vertexNormalsWorld[3],V),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],ca),N.r=Math.max(0,Math.min(m.color.r*N.r,1)),N.g=Math.max(0,Math.min(m.color.g*N.g,1)),N.b=Math.max(0,Math.min(m.color.b*N.b,1)),ea.r=Math.max(0,Math.min(m.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(m.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(m.color.b*ea.b,1)),V.r=
-Math.max(0,Math.min(m.color.r*V.r,1)),V.g=Math.max(0,Math.min(m.color.g*V.g,1)),V.b=Math.max(0,Math.min(m.color.b*V.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),qa=Da(N,ea,V,ca),s(L,Q,da,ia,C,I),Ba(L,Q,da,ia,C,I,0,0,1,0,0,1,qa),s(j,O,S,A,fa,Y),Ba(j,O,S,A,fa,Y,1,0,1,1,0,1,qa)):(R.r=la.r,R.g=la.g,R.b=la.b,o(i,n.centroidWorld,n.normalWorld,R),R.r=Math.max(0,Math.min(m.color.r*R.r,1)),R.g=Math.max(0,Math.min(m.color.g*
-R.g,1)),R.b=Math.max(0,Math.min(m.color.b*R.b,1)),Ea(L,Q,da,ia,S,A,C,I),m.wireframe?ya(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(R)):(Ea(L,Q,da,ia,S,A,C,I),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(m.color));else if(m instanceof THREE.MeshNormalMaterial)R.r=Ca(n.normalWorld.x),R.g=Ca(n.normalWorld.y),R.b=Ca(n.normalWorld.z),Ea(L,Q,da,ia,S,A,C,I),m.wireframe?ya(R,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):v(R);else if(m instanceof
-THREE.MeshDepthMaterial)X=k.near,ka=k.far,N.r=N.g=N.b=1-Aa(a.positionScreen.z,X,ka),ea.r=ea.g=ea.b=1-Aa(d.positionScreen.z,X,ka),V.r=V.g=V.b=1-Aa(g.positionScreen.z,X,ka),ca.r=ca.g=ca.b=1-Aa(f.positionScreen.z,X,ka),qa=Da(N,ea,V,ca),s(L,Q,da,ia,C,I),Ba(L,Q,da,ia,C,I,0,0,1,0,0,1,qa),s(j,O,S,A,fa,Y),Ba(j,O,S,A,fa,Y,1,0,1,1,0,1,qa)}function s(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function Ea(a,b,c,d,e,f,g,j){p.beginPath();p.moveTo(a,b);p.lineTo(c,
-d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function ya(a,b,c,e){if(y!=b)p.lineWidth=y=b;if(G!=c)p.lineCap=G=c;if(K!=e)p.lineJoin=K=e;d(a.getContextStyle());p.stroke();ba.inflate(b*2)}function v(a){g(a.getContextStyle());p.fill()}function Ga(a,b,c,d,e,f,j,h,i,l,n,m,k){if(k.image.width!=0){if(k.needsUpdate==!0||Z[k.id]==void 0){var ja=k.wrapS==THREE.RepeatWrapping,o=k.wrapT==THREE.RepeatWrapping;Z[k.id]=p.createPattern(k.image,ja&&o?"repeat":ja&&!o?"repeat-x":!ja&&o?"repeat-y":"no-repeat");
-k.needsUpdate=!1}g(Z[k.id]);var ja=k.offset.x/k.repeat.x,o=k.offset.y/k.repeat.y,T=(k.image.width-1)*k.repeat.x,k=(k.image.height-1)*k.repeat.y,j=(j+ja)*T,h=(h+o)*k,i=(i+ja)*T,l=(l+o)*k,n=(n+ja)*T,m=(m+o)*k;c-=a;d-=b;e-=a;f-=b;i-=j;l-=h;n-=j;m-=h;ja=1/(i*m-n*l);k=(m*c-l*e)*ja;l=(m*d-l*f)*ja;c=(i*e-n*c)*ja;d=(i*f-n*d)*ja;a=a-k*j-c*h;b=b-l*j-d*h;p.save();p.transform(k,l,c,d,a,b);p.fill();p.restore()}}function Ba(a,b,c,d,e,f,g,j,h,i,l,n,k){var m,ja;m=k.width-1;ja=k.height-1;g*=m;j*=ja;h*=m;i*=ja;l*=
-m;n*=ja;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;l-=g;n-=j;ja=1/(h*n-l*i);m=(n*c-i*e)*ja;i=(n*d-i*f)*ja;c=(h*e-l*c)*ja;d=(h*f-l*d)*ja;a=a-m*g-c*j;b=b-i*g-d*j;p.save();p.transform(m,i,c,d,a,b);p.clip();p.drawImage(k,0,0);p.restore()}function Da(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),l=~~(d.r*255),n=~~(d.g*255),d=~~(d.b*255);na[0]=e<0?0:e>255?255:e;na[1]=f<0?0:f>255?255:f;na[2]=a<0?0:a>255?255:a;na[4]=g<0?0:g>255?
-255:g;na[5]=j<0?0:j>255?255:j;na[6]=b<0?0:b>255?255:b;na[8]=h<0?0:h>255?255:h;na[9]=i<0?0:i>255?255:i;na[10]=c<0?0:c>255?255:c;na[12]=l<0?0:l>255?255:l;na[13]=n<0?0:n>255?255:n;na[14]=d<0?0:d>255?255:d;xa.putImageData(M,0,0);ja.drawImage(ha,0,0);return ta}function Aa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ha,oa,va;this.autoClear?
-this.clear():p.setTransform(1,0,0,-1,n,u);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ga=i.length>0)&&m(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(oa=h[Fa],va=oa.material,va=va instanceof THREE.MeshFaceMaterial?oa.faceMaterial:va,!(va==null||va.opacity==0)){ba.empty();if(oa instanceof THREE.RenderableParticle)F=oa,F.x*=n,F.y*=u,q(F,oa,va,a);else if(oa instanceof THREE.RenderableLine)F=oa.v1,z=oa.v2,F.positionScreen.x*=n,F.positionScreen.y*=
-u,z.positionScreen.x*=n,z.positionScreen.y*=u,ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(z.positionScreen.x,z.positionScreen.y),w.intersects(ba)&&r(F,z,oa,va,a);else if(oa instanceof THREE.RenderableFace3)F=oa.v1,z=oa.v2,D=oa.v3,F.positionScreen.x*=n,F.positionScreen.y*=u,z.positionScreen.x*=n,z.positionScreen.y*=u,D.positionScreen.x*=n,D.positionScreen.y*=u,va.overdraw&&(za(F.positionScreen,z.positionScreen),za(z.positionScreen,D.positionScreen),za(D.positionScreen,F.positionScreen)),
-ba.add3Points(F.positionScreen.x,F.positionScreen.y,z.positionScreen.x,z.positionScreen.y,D.positionScreen.x,D.positionScreen.y),w.intersects(ba)&&t(F,z,D,0,1,2,oa,va,a);else if(oa instanceof THREE.RenderableFace4)F=oa.v1,z=oa.v2,D=oa.v3,P=oa.v4,F.positionScreen.x*=n,F.positionScreen.y*=u,z.positionScreen.x*=n,z.positionScreen.y*=u,D.positionScreen.x*=n,D.positionScreen.y*=u,P.positionScreen.x*=n,P.positionScreen.y*=u,J.positionScreen.copy(z.positionScreen),$.positionScreen.copy(P.positionScreen),
-va.overdraw&&(za(F.positionScreen,z.positionScreen),za(z.positionScreen,P.positionScreen),za(P.positionScreen,F.positionScreen),za(D.positionScreen,J.positionScreen),za(D.positionScreen,$.positionScreen)),ba.addPoint(F.positionScreen.x,F.positionScreen.y),ba.addPoint(z.positionScreen.x,z.positionScreen.y),ba.addPoint(D.positionScreen.x,D.positionScreen.y),ba.addPoint(P.positionScreen.x,P.positionScreen.y),w.intersects(ba)&&x(F,z,D,P,J,$,oa,va,a);H.addRectangle(ba)}p.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(F.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){z[a]==null&&(z[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),L==0&&z[a].setAttribute("shape-rendering","crispEdges"));return z[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,m,o,n,u,p,r,t=new THREE.Rectangle,x=new THREE.Rectangle,q=!1,s=new THREE.Color,v=new THREE.Color,y=new THREE.Color,G=new THREE.Color,K,F=new THREE.Vector3,z=[],D=[],P,J,$,L=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){l=a;k=b;m=l/2;o=k/2;i.setAttribute("viewBox",-m+" "+-o+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);t.set(-m,-o,m,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var F,z,A,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);e=g.elements;
-f=g.lights;$=J=0;if(q=f.length>0){v.setRGB(0,0,0);y.setRGB(0,0,0);G.setRGB(0,0,0);F=0;for(z=f.length;F<z;F++)C=f[F],A=C.color,C instanceof THREE.AmbientLight?(v.r+=A.r,v.g+=A.g,v.b+=A.b):C instanceof THREE.DirectionalLight?(y.r+=A.r,y.g+=A.g,y.b+=A.b):C instanceof THREE.PointLight&&(G.r+=A.r,G.g+=A.g,G.b+=A.b)}F=0;for(z=e.length;F<z;F++)if(A=e[F],C=A.material,C=C instanceof THREE.MeshFaceMaterial?A.faceMaterial:C,!(C==null||C.opacity==0))if(x.empty(),A instanceof THREE.RenderableParticle)n=A,n.x*=
-m,n.y*=-o;else if(A instanceof THREE.RenderableLine){if(n=A.v1,u=A.v2,n.positionScreen.x*=m,n.positionScreen.y*=-o,u.positionScreen.x*=m,u.positionScreen.y*=-o,x.addPoint(n.positionScreen.x,n.positionScreen.y),x.addPoint(u.positionScreen.x,u.positionScreen.y),t.intersects(x)){A=n;var I=u,j=$++;D[j]==null&&(D[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&D[j].setAttribute("shape-rendering","crispEdges"));P=D[j];P.setAttribute("x1",A.positionScreen.x);P.setAttribute("y1",A.positionScreen.y);
-P.setAttribute("x2",I.positionScreen.x);P.setAttribute("y2",I.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin),i.appendChild(P))}}else if(A instanceof THREE.RenderableFace3){if(n=A.v1,u=A.v2,p=A.v3,n.positionScreen.x*=m,n.positionScreen.y*=-o,u.positionScreen.x*=m,u.positionScreen.y*=-o,p.positionScreen.x*=
-m,p.positionScreen.y*=-o,x.addPoint(n.positionScreen.x,n.positionScreen.y),x.addPoint(u.positionScreen.x,u.positionScreen.y),x.addPoint(p.positionScreen.x,p.positionScreen.y),t.intersects(x)){var I=n,j=u,O=p;d.info.render.vertices+=3;d.info.render.faces++;P=c(J++);P.setAttribute("d","M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?s.copy(C.color):C instanceof THREE.MeshLambertMaterial?
-q?(s.r=v.r,s.g=v.g,s.b=v.b,a(f,A.centroidWorld,A.normalWorld,s),s.r=Math.max(0,Math.min(C.color.r*s.r,1)),s.g=Math.max(0,Math.min(C.color.g*s.g,1)),s.b=Math.max(0,Math.min(C.color.b*s.b,1))):s.copy(C.color):C instanceof THREE.MeshDepthMaterial?(K=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear),s.setRGB(K,K,K)):C instanceof THREE.MeshNormalMaterial&&s.setRGB(b(A.normalWorld.x),b(A.normalWorld.y),b(A.normalWorld.z));C.wireframe?P.setAttribute("style","fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+
-C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):P.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(P)}}else if(A instanceof THREE.RenderableFace4&&(n=A.v1,u=A.v2,p=A.v3,r=A.v4,n.positionScreen.x*=m,n.positionScreen.y*=-o,u.positionScreen.x*=m,u.positionScreen.y*=-o,p.positionScreen.x*=m,p.positionScreen.y*=-o,r.positionScreen.x*=m,r.positionScreen.y*=-o,x.addPoint(n.positionScreen.x,
-n.positionScreen.y),x.addPoint(u.positionScreen.x,u.positionScreen.y),x.addPoint(p.positionScreen.x,p.positionScreen.y),x.addPoint(r.positionScreen.x,r.positionScreen.y),t.intersects(x))){var I=n,j=u,O=p,fa=r;d.info.render.vertices+=4;d.info.render.faces++;P=c(J++);P.setAttribute("d","M "+I.positionScreen.x+" "+I.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
-s.copy(C.color):C instanceof THREE.MeshLambertMaterial?q?(s.r=v.r,s.g=v.g,s.b=v.b,a(f,A.centroidWorld,A.normalWorld,s),s.r=Math.max(0,Math.min(C.color.r*s.r,1)),s.g=Math.max(0,Math.min(C.color.g*s.g,1)),s.b=Math.max(0,Math.min(C.color.b*s.b,1))):s.copy(C.color):C instanceof THREE.MeshDepthMaterial?(K=1-C.__2near/(C.__farPlusNear-A.z*C.__farMinusNear),s.setRGB(K,K,K)):C instanceof THREE.MeshNormalMaterial&&s.setRGB(b(A.normalWorld.x),b(A.normalWorld.y),b(A.normalWorld.z));C.wireframe?P.setAttribute("style",
-"fill: none; stroke: "+s.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):P.setAttribute("style","fill: "+s.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(P)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,k,l,o,p,n,r,m;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(p=a[i],p instanceof THREE.RenderableParticle){r=p.x*g+g;m=p.y*e+e;l=0;for(o=p.material.length;l<o;l++)if(n=p.material[l],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=r+"px",n.style.top=m+"px"}}};
+THREE.CanvasRenderer=function(a){function c(a){if(t!=a)m.globalAlpha=t=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=a}}function d(a){if(A!=a)m.strokeStyle=A=a}function g(a){if(w!=a)m.fillStyle=w=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+o,p,n,r,m=l.getContext("2d"),s=new THREE.Color(0),u=0,t=1,q=0,A=null,w=null,E=null,x=null,I=null,M,D,F,P,K=new THREE.RenderableVertex,$=new THREE.RenderableVertex,S,R,V,ja,y,H,z,L,j,aa,ga,N,W=new THREE.Color,T=new THREE.Color,ca=new THREE.Color,Q=new THREE.Color,C=new THREE.Color,ka=[],da,X,oa,la,ra,ta,pa,qa,wa,U,v=new THREE.Rectangle,J=new THREE.Rectangle,Y=new THREE.Rectangle,ea=!1,ba=new THREE.Color,ua=new THREE.Color,Z=new THREE.Color,fa=new THREE.Vector3,ia,xa,O,ma,sa,ha,a=16;ia=document.createElement("canvas");
+ia.width=ia.height=2;xa=ia.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);O=xa.getImageData(0,0,2,2);ma=O.data;sa=document.createElement("canvas");sa.width=sa.height=a;ha=sa.getContext("2d");ha.translate(-a/2,-a/2);ha.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){o=a;p=b;n=Math.floor(o/2);r=Math.floor(p/2);l.width=o;l.height=p;v.set(-n,-r,n,r);J.set(-n,-r,n,r);t=1;q=0;I=x=
+E=w=A=null};this.setClearColor=function(a,b){s.copy(a);u=b;J.set(-n,-r,n,r)};this.setClearColorHex=function(a,b){s.setHex(a);u=b;J.set(-n,-r,n,r)};this.clear=function(){m.setTransform(1,0,0,-1,n,r);J.isEmpty()||(J.minSelf(v),J.inflate(2),u<1&&m.clearRect(Math.floor(J.getX()),Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight())),u>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(s.r*255)+","+Math.floor(s.g*255)+","+Math.floor(s.b*255)+","+u+")"),m.fillRect(Math.floor(J.getX()),
+Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight()))),J.empty())};this.render=function(a,l){function p(a){var b,c,d,e;ba.setRGB(0,0,0);ua.setRGB(0,0,0);Z.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ba.r+=e.r,ba.g+=e.g,ba.b+=e.b):d instanceof THREE.DirectionalLight?(ua.r+=e.r,ua.g+=e.g,ua.b+=e.b):d instanceof THREE.PointLight&&(Z.r+=e.r,Z.g+=e.g,Z.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
+f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(fa.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function s(a,e,f){c(f.opacity);b(f.blending);var j,h,i,l,k,ha;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)l=f.map.image,k=l.width>>1,ha=
+l.height>>1,f=e.scale.x*n,i=e.scale.y*r,j=f*k,h=i*ha,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),v.intersects(Y)&&(m.save(),m.translate(a.x,a.y),m.rotate(-e.rotation),m.scale(f,-i),m.translate(-k,-ha),m.drawImage(l,0,0),m.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*r,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),v.intersects(Y)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-e.rotation),m.scale(j,h),f.program(m),m.restore()))}function q(a,
+e,g,f){c(f.opacity);b(f.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(e.positionScreen.x,e.positionScreen.y);m.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(E!=a)m.lineWidth=E=a;a=f.linecap;if(x!=a)m.lineCap=x=a;a=f.linejoin;if(I!=a)m.lineJoin=I=a;d(f.color.getContextStyle());m.stroke();Y.inflate(f.linewidth*2)}}function u(a,d,g,f,j,h,n,k){e.info.render.vertices+=3;e.info.render.faces++;c(k.opacity);b(k.blending);S=a.positionScreen.x;R=a.positionScreen.y;
+V=d.positionScreen.x;ja=d.positionScreen.y;y=g.positionScreen.x;H=g.positionScreen.y;A(S,R,V,ja,y,H);if(k instanceof THREE.MeshBasicMaterial)if(k.map)k.map.mapping instanceof THREE.UVMapping&&(la=n.uvs[0],Ga(S,R,V,ja,y,H,la[f].u,la[f].v,la[j].u,la[j].v,la[h].u,la[h].v,k.map));else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,fa.copy(n.vertexNormalsWorld[f]),ra=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,ta=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+
+0.5,fa.copy(n.vertexNormalsWorld[j]),pa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,qa=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,fa.copy(n.vertexNormalsWorld[h]),wa=(fa.x*a.n11+fa.y*a.n12+fa.z*a.n13)*0.5+0.5,U=-(fa.x*a.n21+fa.y*a.n22+fa.z*a.n23)*0.5+0.5,Ga(S,R,V,ja,y,H,ra,ta,pa,qa,wa,U,k.envMap)}else k.wireframe?ya(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(k.color);else if(k instanceof THREE.MeshLambertMaterial)k.map&&!k.wireframe&&(k.map.mapping instanceof THREE.UVMapping&&
+(la=n.uvs[0],Ga(S,R,V,ja,y,H,la[f].u,la[f].v,la[j].u,la[j].v,la[h].u,la[h].v,k.map)),b(THREE.SubtractiveBlending)),ea?!k.wireframe&&k.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==3?(T.r=ca.r=Q.r=ba.r,T.g=ca.g=Q.g=ba.g,T.b=ca.b=Q.b=ba.b,o(i,n.v1.positionWorld,n.vertexNormalsWorld[0],T),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ca),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],Q),T.r=Math.max(0,Math.min(k.color.r*T.r,1)),T.g=Math.max(0,Math.min(k.color.g*T.g,1)),T.b=Math.max(0,Math.min(k.color.b*
+T.b,1)),ca.r=Math.max(0,Math.min(k.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(k.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(k.color.b*ca.b,1)),Q.r=Math.max(0,Math.min(k.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(k.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(k.color.b*Q.b,1)),C.r=(ca.r+Q.r)*0.5,C.g=(ca.g+Q.g)*0.5,C.b=(ca.b+Q.b)*0.5,oa=Da(T,ca,Q,C),Ba(S,R,V,ja,y,H,0,0,1,0,0,1,oa)):(W.r=ba.r,W.g=ba.g,W.b=ba.b,o(i,n.centroidWorld,n.normalWorld,W),W.r=Math.max(0,Math.min(k.color.r*W.r,1)),W.g=Math.max(0,Math.min(k.color.g*
+W.g,1)),W.b=Math.max(0,Math.min(k.color.b*W.b,1)),k.wireframe?ya(W,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(W)):k.wireframe?ya(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(k.color);else if(k instanceof THREE.MeshDepthMaterial)da=l.near,X=l.far,T.r=T.g=T.b=1-Aa(a.positionScreen.z,da,X),ca.r=ca.g=ca.b=1-Aa(d.positionScreen.z,da,X),Q.r=Q.g=Q.b=1-Aa(g.positionScreen.z,da,X),C.r=(ca.r+Q.r)*0.5,C.g=(ca.g+Q.g)*0.5,C.b=(ca.b+Q.b)*0.5,oa=Da(T,ca,Q,C),Ba(S,R,
+V,ja,y,H,0,0,1,0,0,1,oa);else if(k instanceof THREE.MeshNormalMaterial)W.r=Ca(n.normalWorld.x),W.g=Ca(n.normalWorld.y),W.b=Ca(n.normalWorld.z),k.wireframe?ya(W,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):w(W)}function t(a,d,g,f,h,k,n,m,ha){e.info.render.vertices+=4;e.info.render.faces++;c(m.opacity);b(m.blending);if(m.map||m.envMap)u(a,d,f,0,1,3,n,m,ha),u(h,g,k,1,2,3,n,m,ha);else if(S=a.positionScreen.x,R=a.positionScreen.y,V=d.positionScreen.x,ja=d.positionScreen.y,y=g.positionScreen.x,
+H=g.positionScreen.y,z=f.positionScreen.x,L=f.positionScreen.y,j=h.positionScreen.x,aa=h.positionScreen.y,ga=k.positionScreen.x,N=k.positionScreen.y,m instanceof THREE.MeshBasicMaterial)Ea(S,R,V,ja,y,H,z,L),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(m.color);else if(m instanceof THREE.MeshLambertMaterial)ea?!m.wireframe&&m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(T.r=ca.r=Q.r=C.r=ba.r,T.g=ca.g=Q.g=C.g=ba.g,T.b=ca.b=Q.b=C.b=ba.b,o(i,n.v1.positionWorld,
+n.vertexNormalsWorld[0],T),o(i,n.v2.positionWorld,n.vertexNormalsWorld[1],ca),o(i,n.v4.positionWorld,n.vertexNormalsWorld[3],Q),o(i,n.v3.positionWorld,n.vertexNormalsWorld[2],C),T.r=Math.max(0,Math.min(m.color.r*T.r,1)),T.g=Math.max(0,Math.min(m.color.g*T.g,1)),T.b=Math.max(0,Math.min(m.color.b*T.b,1)),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(m.color.b*ca.b,1)),Q.r=Math.max(0,Math.min(m.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(m.color.g*
+Q.g,1)),Q.b=Math.max(0,Math.min(m.color.b*Q.b,1)),C.r=Math.max(0,Math.min(m.color.r*C.r,1)),C.g=Math.max(0,Math.min(m.color.g*C.g,1)),C.b=Math.max(0,Math.min(m.color.b*C.b,1)),oa=Da(T,ca,Q,C),A(S,R,V,ja,z,L),Ba(S,R,V,ja,z,L,0,0,1,0,0,1,oa),A(j,aa,y,H,ga,N),Ba(j,aa,y,H,ga,N,1,0,1,1,0,1,oa)):(W.r=ba.r,W.g=ba.g,W.b=ba.b,o(i,n.centroidWorld,n.normalWorld,W),W.r=Math.max(0,Math.min(m.color.r*W.r,1)),W.g=Math.max(0,Math.min(m.color.g*W.g,1)),W.b=Math.max(0,Math.min(m.color.b*W.b,1)),Ea(S,R,V,ja,y,H,z,L),
+m.wireframe?ya(W,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(W)):(Ea(S,R,V,ja,y,H,z,L),m.wireframe?ya(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(m.color));else if(m instanceof THREE.MeshNormalMaterial)W.r=Ca(n.normalWorld.x),W.g=Ca(n.normalWorld.y),W.b=Ca(n.normalWorld.z),Ea(S,R,V,ja,y,H,z,L),m.wireframe?ya(W,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):w(W);else if(m instanceof THREE.MeshDepthMaterial)da=l.near,X=l.far,T.r=T.g=T.b=1-
+Aa(a.positionScreen.z,da,X),ca.r=ca.g=ca.b=1-Aa(d.positionScreen.z,da,X),Q.r=Q.g=Q.b=1-Aa(f.positionScreen.z,da,X),C.r=C.g=C.b=1-Aa(g.positionScreen.z,da,X),oa=Da(T,ca,Q,C),A(S,R,V,ja,z,L),Ba(S,R,V,ja,z,L,0,0,1,0,0,1,oa),A(j,aa,y,H,ga,N),Ba(j,aa,y,H,ga,N,1,0,1,1,0,1,oa)}function A(a,b,c,d,e,g){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,g);m.lineTo(a,b);m.closePath()}function Ea(a,b,c,d,e,g,f,j){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(e,g);m.lineTo(f,j);m.lineTo(a,b);m.closePath()}
+function ya(a,b,c,e){if(E!=b)m.lineWidth=E=b;if(x!=c)m.lineCap=x=c;if(I!=e)m.lineJoin=I=e;d(a.getContextStyle());m.stroke();Y.inflate(b*2)}function w(a){g(a.getContextStyle());m.fill()}function Ga(a,b,c,d,e,f,j,h,i,n,k,l,ha){if(ha.image.width!=0){if(ha.needsUpdate==!0||ka[ha.id]==void 0){var o=ha.wrapS==THREE.RepeatWrapping,p=ha.wrapT==THREE.RepeatWrapping;ka[ha.id]=m.createPattern(ha.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");ha.needsUpdate=!1}g(ka[ha.id]);var o=ha.offset.x/
+ha.repeat.x,p=ha.offset.y/ha.repeat.y,U=(ha.image.width-1)*ha.repeat.x,ha=(ha.image.height-1)*ha.repeat.y,j=(j+o)*U,h=(h+p)*ha,i=(i+o)*U,n=(n+p)*ha,k=(k+o)*U,l=(l+p)*ha;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;l-=h;o=1/(i*l-k*n);ha=(l*c-n*e)*o;n=(l*d-n*f)*o;c=(i*e-k*c)*o;d=(i*f-k*d)*o;a=a-ha*j-c*h;b=b-n*j-d*h;m.save();m.transform(ha,n,c,d,a,b);m.fill();m.restore()}}function Ba(a,b,c,d,e,g,f,j,h,i,n,k,l){var ha,o;ha=l.width-1;o=l.height-1;f*=ha;j*=o;h*=ha;i*=o;n*=ha;k*=o;c-=a;d-=b;e-=a;g-=b;h-=f;i-=j;n-=
+f;k-=j;o=1/(h*k-n*i);ha=(k*c-i*e)*o;i=(k*d-i*g)*o;c=(h*e-n*c)*o;d=(h*g-n*d)*o;a=a-ha*f-c*j;b=b-i*f-d*j;m.save();m.transform(ha,i,c,d,a,b);m.clip();m.drawImage(l,0,0);m.restore()}function Da(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),n=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);ma[0]=e<0?0:e>255?255:e;ma[1]=f<0?0:f>255?255:f;ma[2]=a<0?0:a>255?255:a;ma[4]=g<0?0:g>255?255:g;ma[5]=j<0?0:j>255?255:j;ma[6]=b<0?
+0:b>255?255:b;ma[8]=h<0?0:h>255?255:h;ma[9]=i<0?0:i>255?255:i;ma[10]=c<0?0:c>255?255:c;ma[12]=n<0?0:n>255?255:n;ma[13]=k<0?0:k>255?255:k;ma[14]=d<0?0:d>255?255:d;xa.putImageData(O,0,0);ha.drawImage(ia,0,0);return sa}function Aa(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ha,na,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,n,r);
+e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ea=i.length>0)&&p(i);Fa=0;for(Ha=h.length;Fa<Ha;Fa++)if(na=h[Fa],va=na.material,va=va instanceof THREE.MeshFaceMaterial?na.faceMaterial:va,!(va==null||va.opacity==0)){Y.empty();if(na instanceof THREE.RenderableParticle)M=na,M.x*=n,M.y*=r,s(M,na,va,a);else if(na instanceof THREE.RenderableLine)M=na.v1,D=na.v2,M.positionScreen.x*=n,M.positionScreen.y*=r,D.positionScreen.x*=n,D.positionScreen.y*=
+r,Y.addPoint(M.positionScreen.x,M.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),v.intersects(Y)&&q(M,D,na,va,a);else if(na instanceof THREE.RenderableFace3)M=na.v1,D=na.v2,F=na.v3,M.positionScreen.x*=n,M.positionScreen.y*=r,D.positionScreen.x*=n,D.positionScreen.y*=r,F.positionScreen.x*=n,F.positionScreen.y*=r,va.overdraw&&(za(M.positionScreen,D.positionScreen),za(D.positionScreen,F.positionScreen),za(F.positionScreen,M.positionScreen)),Y.add3Points(M.positionScreen.x,M.positionScreen.y,
+D.positionScreen.x,D.positionScreen.y,F.positionScreen.x,F.positionScreen.y),v.intersects(Y)&&u(M,D,F,0,1,2,na,va,a);else if(na instanceof THREE.RenderableFace4)M=na.v1,D=na.v2,F=na.v3,P=na.v4,M.positionScreen.x*=n,M.positionScreen.y*=r,D.positionScreen.x*=n,D.positionScreen.y*=r,F.positionScreen.x*=n,F.positionScreen.y*=r,P.positionScreen.x*=n,P.positionScreen.y*=r,K.positionScreen.copy(D.positionScreen),$.positionScreen.copy(P.positionScreen),va.overdraw&&(za(M.positionScreen,D.positionScreen),
+za(D.positionScreen,P.positionScreen),za(P.positionScreen,M.positionScreen),za(F.positionScreen,K.positionScreen),za(F.positionScreen,$.positionScreen)),Y.addPoint(M.positionScreen.x,M.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),Y.addPoint(F.positionScreen.x,F.positionScreen.y),Y.addPoint(P.positionScreen.x,P.positionScreen.y),v.intersects(Y)&&t(M,D,F,P,K,$,na,va,a);J.addRectangle(Y)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(M.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){D[a]==null&&(D[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),S==0&&D[a].setAttribute("shape-rendering","crispEdges"));return D[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,o,p,n,r,m,s,u=new THREE.Rectangle,t=new THREE.Rectangle,q=!1,A=new THREE.Color,w=new THREE.Color,E=new THREE.Color,x=new THREE.Color,I,M=new THREE.Vector3,D=[],F=[],P,K,$,S=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":S=1;break;case "low":S=0}};this.setSize=function(a,b){k=a;l=b;o=k/2;p=l/2;i.setAttribute("viewBox",-o+" "+-p+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var M,y,H,z;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements;
+f=g.lights;$=K=0;if(q=f.length>0){w.setRGB(0,0,0);E.setRGB(0,0,0);x.setRGB(0,0,0);M=0;for(y=f.length;M<y;M++)z=f[M],H=z.color,z instanceof THREE.AmbientLight?(w.r+=H.r,w.g+=H.g,w.b+=H.b):z instanceof THREE.DirectionalLight?(E.r+=H.r,E.g+=H.g,E.b+=H.b):z instanceof THREE.PointLight&&(x.r+=H.r,x.g+=H.g,x.b+=H.b)}M=0;for(y=e.length;M<y;M++)if(H=e[M],z=H.material,z=z instanceof THREE.MeshFaceMaterial?H.faceMaterial:z,!(z==null||z.opacity==0))if(t.empty(),H instanceof THREE.RenderableParticle)n=H,n.x*=
+o,n.y*=-p;else if(H instanceof THREE.RenderableLine){if(n=H.v1,r=H.v2,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),u.intersects(t)){H=n;var L=r,j=$++;F[j]==null&&(F[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),S==0&&F[j].setAttribute("shape-rendering","crispEdges"));P=F[j];P.setAttribute("x1",H.positionScreen.x);P.setAttribute("y1",H.positionScreen.y);
+P.setAttribute("x2",L.positionScreen.x);P.setAttribute("y2",L.positionScreen.y);z instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+z.color.getContextStyle()+"; stroke-width: "+z.linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.linecap+"; stroke-linejoin: "+z.linejoin),i.appendChild(P))}}else if(H instanceof THREE.RenderableFace3){if(n=H.v1,r=H.v2,m=H.v3,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,m.positionScreen.x*=
+o,m.positionScreen.y*=-p,t.addPoint(n.positionScreen.x,n.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),u.intersects(t)){var L=n,j=r,D=m;d.info.render.vertices+=3;d.info.render.faces++;P=c(K++);P.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?A.copy(z.color):z instanceof THREE.MeshLambertMaterial?
+q?(A.r=w.r,A.g=w.g,A.b=w.b,a(f,H.centroidWorld,H.normalWorld,A),A.r=Math.max(0,Math.min(z.color.r*A.r,1)),A.g=Math.max(0,Math.min(z.color.g*A.g,1)),A.b=Math.max(0,Math.min(z.color.b*A.b,1))):A.copy(z.color):z instanceof THREE.MeshDepthMaterial?(I=1-z.__2near/(z.__farPlusNear-H.z*z.__farMinusNear),A.setRGB(I,I,I)):z instanceof THREE.MeshNormalMaterial&&A.setRGB(b(H.normalWorld.x),b(H.normalWorld.y),b(H.normalWorld.z));z.wireframe?P.setAttribute("style","fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+
+z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):P.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(P)}}else if(H instanceof THREE.RenderableFace4&&(n=H.v1,r=H.v2,m=H.v3,s=H.v4,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,m.positionScreen.x*=o,m.positionScreen.y*=-p,s.positionScreen.x*=o,s.positionScreen.y*=-p,t.addPoint(n.positionScreen.x,
+n.positionScreen.y),t.addPoint(r.positionScreen.x,r.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),u.intersects(t))){var L=n,j=r,D=m,ga=s;d.info.render.vertices+=4;d.info.render.faces++;P=c(K++);P.setAttribute("d","M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+D.positionScreen.x+","+D.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?
+A.copy(z.color):z instanceof THREE.MeshLambertMaterial?q?(A.r=w.r,A.g=w.g,A.b=w.b,a(f,H.centroidWorld,H.normalWorld,A),A.r=Math.max(0,Math.min(z.color.r*A.r,1)),A.g=Math.max(0,Math.min(z.color.g*A.g,1)),A.b=Math.max(0,Math.min(z.color.b*A.b,1))):A.copy(z.color):z instanceof THREE.MeshDepthMaterial?(I=1-z.__2near/(z.__farPlusNear-H.z*z.__farMinusNear),A.setRGB(I,I,I)):z instanceof THREE.MeshNormalMaterial&&A.setRGB(b(H.normalWorld.x),b(H.normalWorld.y),b(H.normalWorld.z));z.wireframe?P.setAttribute("style",
+"fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):P.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(P)}}};
 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 float flipEnvMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
@@ -222,123 +222,123 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},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"),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}"}};
 THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
-function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,l=i.length,n=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,T=a.__webglCustomAttributesList;if(c.sortParticles){H.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,la.copy(e),H.multiplyVector3(la),m[d]=[la.z,d];m.sort(function(a,
-b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[m[d][1]].position,g=d*3,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;for(d=0;d<l;d++)g=d*3,e=i[m[d][1]],k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(T){i=0;for(l=T.length;i<l;i++)if(h=T[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=m[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=m[d][1],f=h.value[f],
-h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(o)for(d=0;d<f;d++)e=h[d].position,g=d*3,n[g]=e.x,n[g+1]=e.y,n[g+2]=e.z;if(p)for(d=0;d<l;d++)e=i[d],g=d*3,k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(T){i=0;for(l=T.length;i<l;i++)if(h=T[i],h.needsUpdate&&(h.boundTo===void 0||
+function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,n=i.length,k=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,U=a.__webglCustomAttributesList;if(c.sortParticles){J.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ba.copy(e),J.multiplyVector3(ba),m[d]=[ba.z,d];m.sort(function(a,
+b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[m[d][1]].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;for(d=0;d<n;d++)g=d*3,e=i[m[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(U){i=0;for(n=U.length;i<n;i++)if(h=U[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=m[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=m[d][1],f=h.value[f],
+h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(o)for(d=0;d<f;d++)e=h[d].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;if(p)for(d=0;d<n;d++)e=i[d],g=d*3,l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(U){i=0;for(n=U.length;i<n;i++)if(h=U[i],h.needsUpdate&&(h.boundTo===void 0||
 h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
-g+=4}}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,n,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(T){i=0;for(l=T.length;i<l;i++)if(h=T[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
-a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,l,n,k,m,o=a.count*3;for(m=0;m<o;m+=9)c=a.normalArray,d=c[m],e=c[m+1],g=c[m+2],f=c[m+3],i=c[m+4],n=c[m+5],h=c[m+6],l=c[m+7],k=c[m+8],d=(d+f+h)/3,e=(e+i+l)/3,g=
-(g+n+k)/3,c[m]=d,c[m+1]=e,c[m+2]=g,c[m+3]=d,c[m+4]=e,c[m+5]=g,c[m+6]=d,c[m+7]=e,c[m+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=r(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==N&&(N=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
+g+=4}}if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(U){i=0;for(n=U.length;i<n;i++)if(h=U[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
+a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,n,k,l,m,o=a.count*3;for(m=0;m<o;m+=9)c=a.normalArray,d=c[m],e=c[m+1],g=c[m+2],f=c[m+3],i=c[m+4],k=c[m+5],h=c[m+6],n=c[m+7],l=c[m+8],d=(d+f+h)/3,e=(e+i+n)/3,g=
+(g+k+l)/3,c[m]=d,c[m+1]=e,c[m+2]=g,c[m+3]=d,c[m+4]=e,c[m+5]=g,c[m+6]=d,c[m+7]=e,c[m+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=s(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==T&&(T=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
 e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
-f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],l=-1,n=0;h=g.morphTargetInfluences;var m,k=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(m=0;m<k;m++)!i[m]&&h[m]>l&&(n=m,l=h[n]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
-l;i[n]=1;l=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
+f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],n=-1,k=0;h=g.morphTargetInfluences;var l,m=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<m;l++)!i[l]&&h[l]>n&&(k=l,n=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
+n;i[k]=1;n=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
 3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
 j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ua&&(j.lineWidth(d),ua=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),I.info.render.calls++,I.info.render.vertices+=
-e.__webglFaceCount,I.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ua&&(j.lineWidth(d),ua=d),j.drawArrays(g,0,e.__webglLineCount),I.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),I.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),I.info.render.calls++)}}function f(a){w[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
-a.n13,a.n44-a.n14);w[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);w[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);w[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);w[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);w[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=w[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
-a.scale.z)),d=0;d<6;d++)if(a=w[d].x*b.n14+w[d].y*b.n24+w[d].z*b.n34+w[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,l,n,m,k,o=0,p=a.lights;U||(U=new THREE.PerspectiveCamera(I.shadowCameraFov,I.shadowMapWidth/I.shadowMapHeight,I.shadowCameraNear,I.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(k=p[b],k.castShadow&&k instanceof THREE.SpotLight){R=-1;I.shadowMap[o]||(I.shadowMap[o]=new THREE.WebGLRenderTarget(I.shadowMapWidth,I.shadowMapHeight,{minFilter:THREE.LinearFilter,
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),aa[o]=new THREE.Matrix4);d=I.shadowMap[o];i=aa[o];U.position.copy(k.position);U.lookAt(k.target.position);U.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(U));this.autoUpdateScene&&a.updateMatrixWorld();U.matrixWorldInverse.getInverse(U.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(U.projectionMatrix);i.multiplySelf(U.matrixWorldInverse);U.matrixWorldInverse.flattenToArray(ga);U.projectionMatrix.flattenToArray(ba);
-H.multiply(U.projectionMatrix,U.matrixWorldInverse);f(H);D(d);j.clearColor(1,1,1,1);I.clear();j.clearColor(S.r,S.g,S.b,A);i=a.__webglObjects.length;for(d=0;d<i;d++)if(n=a.__webglObjects[d],k=n.object,n.render=!1,k.visible&&k.castShadow&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||h(k)))k.matrixWorld.flattenToArray(k._objectMatrixArray),t(k,U,!1),n.render=!0;q(!0);y(THREE.NormalBlending);for(d=0;d<i;d++)if(n=a.__webglObjects[d],n.render)k=n.object,n=n.buffer,x(k),m=k.customDepthMaterial?k.customDepthMaterial:
-k.geometry.morphTargets.length?xa:ha,e(U,p,null,m,n,k);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)n=a.__webglObjectsImmediate[d],k=n.object,k.visible&&k.castShadow&&(k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),N=-1,t(k,U,!1),x(k),l=r(U,p,null,ha,k),k.immediateRenderCallback?k.immediateRenderCallback(l,j,w):k.render(function(a){g(a,l,ha.shading)}));o++}}function k(a,b,c,d,g,f,h,j){var i,l,n,k;b?(l=a.length-1,k=b=-1):(l=0,b=a.length,k=1);for(var m=l;m!==b;m+=k)if(i=
-a[m],i.render){l=i.object;n=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&y(i.blending);q(i.depthTest);s(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}x(l);e(d,g,f,i,n,l)}}function m(a,b,c,d,e,f,h){for(var i,l,n,k,m=0,o=a.length;m<o;m++)if(i=a[m],l=i.object,l.visible){N=-1;if(h)n=h;else{n=i[b];if(!n)continue;f&&y(n.blending);q(n.depthTest);s(n.depthWrite);v(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits)}x(l);k=r(c,d,e,n,l);l.immediateRenderCallback?l.immediateRenderCallback(k,
-j,w):l.render(function(a){g(a,k,n.shading)})}}function o(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function u(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,b,c,d,e){d.program||I.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets);
-for(var g=0,f=I.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==fa&&(j.useProgram(g),fa=g,h=!0);if(d.id!==R)R=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ba);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,
-n,k=0,m=0,o=0,p,T,u,H=W,q=H.directional.colors,r=H.directional.positions,t=H.point.colors,w=H.point.positions,x=H.point.distances,s=0,C=0,c=l=u=0,h=b.length;c<h;c++)if(l=b[c],n=l.color,p=l.position,T=l.intensity,u=l.distance,l instanceof THREE.AmbientLight)I.gammaInput?(k+=n.r*n.r,m+=n.g*n.g,o+=n.b*n.b):(k+=n.r,m+=n.g,o+=n.b);else if(l instanceof THREE.DirectionalLight)u=s*3,I.gammaInput?(q[u]=n.r*n.r*T*T,q[u+1]=n.g*n.g*T*T,q[u+2]=n.b*n.b*T*T):(q[u]=n.r*T,q[u+1]=n.g*T,q[u+2]=n.b*T),r[u]=p.x,r[u+1]=
-p.y,r[u+2]=p.z,s+=1;else if(l instanceof THREE.SpotLight)u=s*3,I.gammaInput?(q[u]=n.r*n.r*T*T,q[u+1]=n.g*n.g*T*T,q[u+2]=n.b*n.b*T*T):(q[u]=n.r*T,q[u+1]=n.g*T,q[u+2]=n.b*T),n=1/p.length(),r[u]=p.x*n,r[u+1]=p.y*n,r[u+2]=p.z*n,s+=1;else if(l instanceof THREE.PointLight)l=C*3,I.gammaInput?(t[l]=n.r*n.r*T*T,t[l+1]=n.g*n.g*T*T,t[l+2]=n.b*n.b*T*T):(t[l]=n.r*T,t[l+1]=n.g*T,t[l+2]=n.b*T),w[l]=p.x,w[l+1]=p.y,w[l+2]=p.z,x[C]=u,C+=1;c=s*3;for(h=q.length;c<h;c++)q[c]=0;c=C*3;for(h=t.length;c<h;c++)t[c]=0;H.point.length=
-C;H.directional.length=s;H.ambient[0]=k;H.ambient[1]=m;H.ambient[2]=o;b=W;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,I.gammaInput?
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ta&&(j.lineWidth(d),ta=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=
+e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ta&&(j.lineWidth(d),ta=d),j.drawArrays(g,0,e.__webglLineCount),L.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}}function f(a){v[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
+a.n13,a.n44-a.n14);v[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);v[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);v[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);v[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);v[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=v[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
+a.scale.z)),d=0;d<6;d++)if(a=v[d].x*b.n14+v[d].y*b.n24+v[d].z*b.n34+v[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i,n,k,l,m,o=0,p=a.lights;Z||(Z=new THREE.PerspectiveCamera(L.shadowCameraFov,L.shadowMapWidth/L.shadowMapHeight,L.shadowCameraNear,L.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(m=p[b],m.castShadow&&m instanceof THREE.SpotLight){W=-1;L.shadowMap[o]||(L.shadowMap[o]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),fa[o]=new THREE.Matrix4);d=L.shadowMap[o];i=fa[o];Z.position.copy(m.position);Z.lookAt(m.target.position);Z.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(Z));this.autoUpdateScene&&a.updateMatrixWorld();Z.matrixWorldInverse.getInverse(Z.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(Z.projectionMatrix);i.multiplySelf(Z.matrixWorldInverse);Z.matrixWorldInverse.flattenToArray(ea);Z.projectionMatrix.flattenToArray(Y);
+J.multiply(Z.projectionMatrix,Z.matrixWorldInverse);f(J);F(d);j.clearColor(1,1,1,1);L.clear();j.clearColor(y.r,y.g,y.b,H);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],m=k.object,k.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),u(m,Z,!1),k.render=!0;q(!0);E(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)m=k.object,k=k.buffer,t(m),l=m.customDepthMaterial?m.customDepthMaterial:
+m.geometry.morphTargets.length?xa:ia,e(Z,p,null,l,k,m);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],m=k.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),T=-1,u(m,Z,!1),t(m),n=s(Z,p,null,ia,m),m.immediateRenderCallback?m.immediateRenderCallback(n,j,v):m.render(function(a){g(a,n,ia.shading)}));o++}}function l(a,b,c,d,g,f,h,j){var i,k,m,n;b?(k=a.length-1,n=b=-1):(k=0,b=a.length,n=1);for(var l=k;l!==b;l+=n)if(i=
+a[l],i.render){k=i.object;m=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&E(i.blending);q(i.depthTest);A(i.depthWrite);w(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}t(k);e(d,g,f,i,m,k)}}function o(a,b,c,d,e,f,h){for(var i,k,m,n,l=0,o=a.length;l<o;l++)if(i=a[l],k=i.object,k.visible){T=-1;if(h)m=h;else{m=i[b];if(!m)continue;f&&E(m.blending);q(m.depthTest);A(m.depthWrite);w(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}t(k);n=s(c,d,e,m,k);k.immediateRenderCallback?k.immediateRenderCallback(n,
+j,v):k.render(function(a){g(a,n,m.shading)})}}function p(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function r(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function m(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function s(a,b,c,d,e){d.program||L.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);
+for(var g=0,f=L.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==ga&&(j.useProgram(g),ga=g,h=!0);if(d.id!==W)W=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,Y);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var k,
+m,n=0,l=0,o=0,p,U,r,J=ua,s=J.directional.colors,v=J.directional.positions,q=J.point.colors,u=J.point.positions,t=J.point.distances,A=0,C=0,c=k=r=0,h=b.length;c<h;c++)if(k=b[c],m=k.color,p=k.position,U=k.intensity,r=k.distance,k instanceof THREE.AmbientLight)L.gammaInput?(n+=m.r*m.r,l+=m.g*m.g,o+=m.b*m.b):(n+=m.r,l+=m.g,o+=m.b);else if(k instanceof THREE.DirectionalLight)r=A*3,L.gammaInput?(s[r]=m.r*m.r*U*U,s[r+1]=m.g*m.g*U*U,s[r+2]=m.b*m.b*U*U):(s[r]=m.r*U,s[r+1]=m.g*U,s[r+2]=m.b*U),v[r]=p.x,v[r+
+1]=p.y,v[r+2]=p.z,A+=1;else if(k instanceof THREE.SpotLight)r=A*3,L.gammaInput?(s[r]=m.r*m.r*U*U,s[r+1]=m.g*m.g*U*U,s[r+2]=m.b*m.b*U*U):(s[r]=m.r*U,s[r+1]=m.g*U,s[r+2]=m.b*U),m=1/p.length(),v[r]=p.x*m,v[r+1]=p.y*m,v[r+2]=p.z*m,A+=1;else if(k instanceof THREE.PointLight)k=C*3,L.gammaInput?(q[k]=m.r*m.r*U*U,q[k+1]=m.g*m.g*U*U,q[k+2]=m.b*m.b*U*U):(q[k]=m.r*U,q[k+1]=m.g*U,q[k+2]=m.b*U),u[k]=p.x,u[k+1]=p.y,u[k+2]=p.z,t[C]=r,C+=1;c=A*3;for(h=s.length;c<h;c++)s[c]=0;c=C*3;for(h=q.length;c<h;c++)q[c]=0;J.point.length=
+C;J.directional.length=A;J.ambient[0]=n;J.ambient[1]=l;J.ambient[2]=o;b=ua;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,L.gammaInput?
 i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof
-THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=$.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,I.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)I.gammaInput?
-i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<aa.length;b++)i.shadowMatrix.value[b]=aa[b],i.shadowMap.texture[b]=I.shadowMap[b];i.shadowDarkness.value=I.shadowMapDarkness;i.shadowBias.value=I.shadowMapBias}b=d.uniformsList;i=0;for(c=
-b.length;i<c;i++)if(m=g.uniforms[b[i][1]])if(k=b[i][0],o=k.type,h=k.value,o==="i")j.uniform1i(m,h);else if(o==="f")j.uniform1f(m,h);else if(o==="v2")j.uniform2f(m,h.x,h.y);else if(o==="v3")j.uniform3f(m,h.x,h.y,h.z);else if(o==="v4")j.uniform4f(m,h.x,h.y,h.z,h.w);else if(o==="c")j.uniform3f(m,h.r,h.g,h.b);else if(o==="fv1")j.uniform1fv(m,h);else if(o==="fv")j.uniform3fv(m,h);else if(o==="v3v"){if(!k._array)k._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)H=o*3,k._array[H]=h[o].x,k._array[H+
-1]=h[o].y,k._array[H+2]=h[o].z;j.uniform3fv(m,k._array)}else if(o==="m4"){if(!k._array)k._array=new Float32Array(16);h.flattenToArray(k._array);j.uniformMatrix4fv(m,!1,k._array)}else if(o==="m4v"){if(!k._array)k._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(k._array,o*16);j.uniformMatrix4fv(m,!1,k._array)}else if(o==="t"){if(j.uniform1i(m,h),m=k.texture)if(m.image instanceof Array&&m.image.length===6){if(k=m,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
-j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,k.image[h]);K(j.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(k=m,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,k.__webglTexture)):F(m,h)}else if(o===
-"tv"){if(!k._array){k._array=[];o=0;for(p=k.texture.length;o<p;o++)k._array[o]=h+o}j.uniform1iv(m,k._array);o=0;for(p=k.texture.length;o<p;o++)(m=k.texture[o])&&F(m,k._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&
-j.uniformMatrix4fv(f.viewMatrix,!1,ga);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ga),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function t(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
-a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function x(a){if(V!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),V=a.doubleSided;if(ca!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ca=a.flipSided}function q(a){X!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),X=a)}function s(a){ka!==a&&(j.depthMask(a),ka=a)}function v(a,b,c){qa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
-j.disable(j.POLYGON_OFFSET_FILL),qa=a);if(a&&(ma!==b||sa!==c))j.polygonOffset(b,c),ma=b,sa=c}function y(a){if(a!==Z){switch(a){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)}Z=a}}function G(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function K(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,J(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,J(b.wrapT)),
-j.texParameteri(a,j.TEXTURE_MAG_FILTER,J(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,J(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,P(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,P(b.minFilter)))}function F(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),I.info.memory.textures++;j.activeTexture(j.TEXTURE0+
-b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.image.width,a.image.height,0,J(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);K(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function z(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
-j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):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,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function D(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;
-if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);K(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,
-a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);z(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),K(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,
-c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),z(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=wa,a=T,d=pa,e=ra);b!==Y&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),Y=b)}function P(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
-default:return j.LINEAR}}function J(a){switch(a){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;
+THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=$.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)L.gammaInput?
+i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<fa.length;b++)i.shadowMatrix.value[b]=fa[b],i.shadowMap.texture[b]=L.shadowMap[b];i.shadowDarkness.value=L.shadowMapDarkness;i.shadowBias.value=L.shadowMapBias}b=d.uniformsList;i=0;for(c=
+b.length;i<c;i++)if(l=g.uniforms[b[i][1]])if(n=b[i][0],o=n.type,h=n.value,o==="i")j.uniform1i(l,h);else if(o==="f")j.uniform1f(l,h);else if(o==="v2")j.uniform2f(l,h.x,h.y);else if(o==="v3")j.uniform3f(l,h.x,h.y,h.z);else if(o==="v4")j.uniform4f(l,h.x,h.y,h.z,h.w);else if(o==="c")j.uniform3f(l,h.r,h.g,h.b);else if(o==="fv1")j.uniform1fv(l,h);else if(o==="fv")j.uniform3fv(l,h);else if(o==="v3v"){if(!n._array)n._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)J=o*3,n._array[J]=h[o].x,n._array[J+
+1]=h[o].y,n._array[J+2]=h[o].z;j.uniform3fv(l,n._array)}else if(o==="m4"){if(!n._array)n._array=new Float32Array(16);h.flattenToArray(n._array);j.uniformMatrix4fv(l,!1,n._array)}else if(o==="m4v"){if(!n._array)n._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(n._array,o*16);j.uniformMatrix4fv(l,!1,n._array)}else if(o==="t"){if(j.uniform1i(l,h),l=n.texture)if(l.image instanceof Array&&l.image.length===6){if(n=l,n.image.length===6)if(n.needsUpdate){if(!n.image.__webglTextureCube)n.image.__webglTextureCube=
+j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,n.image[h]);I(j.TEXTURE_CUBE_MAP,n,n.image[0]);n.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,n.image.__webglTextureCube)}else l instanceof THREE.WebGLRenderTargetCube?(n=l,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,n.__webglTexture)):M(l,h)}else if(o===
+"tv"){if(!n._array){n._array=[];o=0;for(p=n.texture.length;o<p;o++)n._array[o]=h+o}j.uniform1iv(l,n._array);o=0;for(p=n.texture.length;o<p;o++)(l=n.texture[o])&&M(l,n._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&
+j.uniformMatrix4fv(f.viewMatrix,!1,ea);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ea),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function u(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
+a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function t(a){if(Q!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Q=a.doubleSided;if(C!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),C=a.flipSided}function q(a){da!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),da=a)}function A(a){X!==a&&(j.depthMask(a),X=a)}function w(a,b,c){oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
+j.disable(j.POLYGON_OFFSET_FILL),oa=a);if(a&&(la!==b||ra!==c))j.polygonOffset(b,c),la=b,ra=c}function E(a){if(a!==ka){switch(a){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)}ka=a}}function x(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function I(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,K(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,K(b.wrapT)),
+j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,P(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,P(b.minFilter)))}function M(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),L.info.memory.textures++;j.activeTexture(j.TEXTURE0+
+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,K(a.format),a.image.width,a.image.height,0,K(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);I(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function D(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
+j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):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,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function F(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;
+if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);I(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,
+a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);D(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),I(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,K(a.format),a.width,a.height,0,K(a.format),K(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,
+c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),D(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=wa,a=U,d=pa,e=qa);b!==N&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),N=b)}function P(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
+default:return j.LINEAR}}function K(a){switch(a){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 a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),L=a.precision!==void 0?a.precision:"highp",Q=a.antialias!==void 0?a.antialias:!1,da=a.stencil!==void 0?a.stencil:!0,ia=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,S=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),A=a.clearAlpha!==void 0?a.clearAlpha:0,C=a.maxLights!==void 0?a.maxLights:4;this.domElement=$;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
-this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var I=
-this,j,O=[],fa=null,Y=null,R=-1,N=null,ea=0,V=null,ca=null,Z=null,X=null,ka=null,qa=null,ma=null,sa=null,ua=null,pa=0,ra=0,wa=0,T=0,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Matrix4,ba=new Float32Array(16),ga=new Float32Array(16),la=new THREE.Vector4,W={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},U,aa=[],ha,xa,M={},na=!1;j=function(){var a;try{if(!(a=
-$.getContext("experimental-webgl",{antialias:Q,stencil:da,preserveDrawingBuffer:ia})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);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(S.r,S.g,S.b,A);(function(){M.vertices=new Float32Array(16);M.faces=new Uint16Array(6);var a=0;M.vertices[a++]=-1;M.vertices[a++]=-1;M.vertices[a++]=0;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=-1;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=1;M.vertices[a++]=0;M.vertices[a++]=-1;M.vertices[a++]=1;M.vertices[a++]=0;a=M.vertices[a++]=0;M.faces[a++]=0;M.faces[a++]=
-1;M.faces[a++]=2;M.faces[a++]=0;M.faces[a++]=2;M.faces[a++]=3;M.vertexBuffer=j.createBuffer();M.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,M.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,M.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,M.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,M.faces,j.STATIC_DRAW);M.program=j.createProgram();j.attachShader(M.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(M.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));
-j.linkProgram(M.program);M.attributes={};M.uniforms={};M.attributes.position=j.getAttribLocation(M.program,"position");M.attributes.uv=j.getAttribLocation(M.program,"uv");M.uniforms.uvOffset=j.getUniformLocation(M.program,"uvOffset");M.uniforms.uvScale=j.getUniformLocation(M.program,"uvScale");M.uniforms.rotation=j.getUniformLocation(M.program,"rotation");M.uniforms.scale=j.getUniformLocation(M.program,"scale");M.uniforms.alignment=j.getUniformLocation(M.program,"alignment");M.uniforms.color=j.getUniformLocation(M.program,
-"color");M.uniforms.map=j.getUniformLocation(M.program,"map");M.uniforms.opacity=j.getUniformLocation(M.program,"opacity");M.uniforms.useScreenCoordinates=j.getUniformLocation(M.program,"useScreenCoordinates");M.uniforms.affectedByDistance=j.getUniformLocation(M.program,"affectedByDistance");M.uniforms.screenPosition=j.getUniformLocation(M.program,"screenPosition");M.uniforms.modelViewMatrix=j.getUniformLocation(M.program,"modelViewMatrix");M.uniforms.projectionMatrix=j.getUniformLocation(M.program,
-"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});ha._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
-function(){return ta};this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,d){pa=a;ra=b;wa=c;T=d;j.viewport(pa,ra,wa,T)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){S.setHex(a);A=b;j.clearColor(S.r,S.g,S.b,A)};this.setClearColor=function(a,b){S.copy(a);A=b;j.clearColor(S.r,S.g,S.b,A)};this.getClearColor=
-function(){return S};this.getClearAlpha=function(){return A};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){D(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=
+var a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),S=a.precision!==void 0?a.precision:"highp",R=a.antialias!==void 0?a.antialias:!1,V=a.stencil!==void 0?a.stencil:!0,ja=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,y=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),H=a.clearAlpha!==void 0?a.clearAlpha:0,z=a.maxLights!==void 0?a.maxLights:4;this.domElement=$;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var L=
+this,j,aa=[],ga=null,N=null,W=-1,T=null,ca=0,Q=null,C=null,ka=null,da=null,X=null,oa=null,la=null,ra=null,ta=null,pa=0,qa=0,wa=0,U=0,v=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,Y=new Float32Array(16),ea=new Float32Array(16),ba=new THREE.Vector4,ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Z,fa=[],ia,xa,O={},ma=!1;j=function(){var a;try{if(!(a=
+$.getContext("experimental-webgl",{antialias:R,stencil:V,preserveDrawingBuffer:ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);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(y.r,y.g,y.b,H);(function(){O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);var a=0;O.vertices[a++]=-1;O.vertices[a++]=-1;O.vertices[a++]=0;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=0;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=0;a=O.vertices[a++]=0;O.faces[a++]=0;O.faces[a++]=
+1;O.faces[a++]=2;O.faces[a++]=0;O.faces[a++]=2;O.faces[a++]=3;O.vertexBuffer=j.createBuffer();O.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,O.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,O.faces,j.STATIC_DRAW);O.program=j.createProgram();j.attachShader(O.program,x("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(O.program,x("vertex",THREE.ShaderLib.sprite.vertexShader));
+j.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.position=j.getAttribLocation(O.program,"position");O.attributes.uv=j.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=j.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=j.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=j.getUniformLocation(O.program,"rotation");O.uniforms.scale=j.getUniformLocation(O.program,"scale");O.uniforms.alignment=j.getUniformLocation(O.program,"alignment");O.uniforms.color=j.getUniformLocation(O.program,
+"color");O.uniforms.map=j.getUniformLocation(O.program,"map");O.uniforms.opacity=j.getUniformLocation(O.program,"opacity");O.uniforms.useScreenCoordinates=j.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=j.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=j.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=j.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=j.getUniformLocation(O.program,
+"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ia=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});ia._shadowPass=!0;xa._shadowPass=!0})();this.context=j;var sa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
+function(){return sa};this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,d){pa=a;qa=b;wa=c;U=d;j.viewport(pa,qa,wa,U)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){y.setHex(a);H=b;j.clearColor(y.r,y.g,y.b,H)};this.setClearColor=function(a,b){y.copy(a);H=b;j.clearColor(y.r,y.g,y.b,H)};this.getClearColor=
+function(){return y};this.getClearAlpha=function(){return H};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){F(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=
 a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
-0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);I.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),I.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),I.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
-I.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),I.info.memory.textures--};this.updateShadowMap=function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,n,o,p=a.lights,u=a.fog;R=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&l(a,b);I.info.render.calls=0;I.info.render.vertices=0;I.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ga);b.projectionMatrix.flattenToArray(ba);H.multiply(b.projectionMatrix,b.matrixWorldInverse);f(H);D(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);o=a.__webglObjects;d=0;for(e=o.length;d<e;d++)if(g=o[d],n=g.object,g.render=!1,n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||h(n))){n.matrixWorld.flattenToArray(n._objectMatrixArray);
-t(n,b,!0);var r=g,w=r.object,x=r.buffer,C=void 0,C=C=void 0,C=w.material;if(C instanceof THREE.MeshFaceMaterial){if(C=x.materialIndex,C>=0)C=w.geometry.materials[C],C.transparent?(r.transparent=C,r.opaque=null):(r.opaque=C,r.transparent=null)}else if(C)C.transparent?(r.transparent=C,r.opaque=null):(r.opaque=C,r.transparent=null);g.render=!0;if(this.sortObjects)n.renderDepth?g.z=n.renderDepth:(la.copy(n.position),H.multiplyVector3(la),g.z=la.z)}this.sortObjects&&o.sort(i);o=a.__webglObjectsImmediate;
-d=0;for(e=o.length;d<e;d++)if(g=o[d],n=g.object,n.visible)n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),t(n,b,!0),n=g.object.material,n.transparent?(g.transparent=n,g.opaque=null):(g.opaque=n,g.transparent=null);a.overrideMaterial?(y(a.overrideMaterial.blending),q(a.overrideMaterial.depthTest),s(a.overrideMaterial.depthWrite),v(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,p,u,!0,a.overrideMaterial),
-m(a.__webglObjectsImmediate,"",b,p,u,!1,a.overrideMaterial)):(y(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,p,u,!1),m(a.__webglObjectsImmediate,"opaque",b,p,u,!1),k(a.__webglObjects,!1,"transparent",b,p,u,!0),m(a.__webglObjectsImmediate,"transparent",b,p,u,!0));if(a.__webglSprites.length){n=M.attributes;p=M.uniforms;u=T/wa;d=[];e=wa*0.5;o=T*0.5;g=!0;j.useProgram(M.program);fa=M.program;N=X=Z=-1;na||(j.enableVertexAttribArray(M.attributes.position),j.enableVertexAttribArray(M.attributes.uv),
-na=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,M.vertexBuffer);j.vertexAttribPointer(n.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(n.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,M.elementBuffer);j.uniformMatrix4fv(p.projectionMatrix,!1,ba);j.activeTexture(j.TEXTURE0);j.uniform1i(p.map,0);n=0;for(r=a.__webglSprites.length;n<r;n++)if(w=a.__webglSprites[n],w.visible&&w.opacity!==0)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
-w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);a.__webglSprites.sort(i);n=0;for(r=a.__webglSprites.length;n<r;n++)w=a.__webglSprites[n],w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(j.uniform1i(p.useScreenCoordinates,1),j.uniform3f(p.screenPosition,(w.position.x-e)/e,(o-w.position.y)/o,Math.max(0,Math.min(1,w.position.z)))):(j.uniform1i(p.useScreenCoordinates,0),j.uniform1i(p.affectedByDistance,w.affectedByDistance?1:0),j.uniformMatrix4fv(p.modelViewMatrix,
-!1,w._modelViewMatrixArray)),b=w.map.image.width/(w.scaleByViewport?T:1),d[0]=b*u*w.scale.x,d[1]=b*w.scale.y,j.uniform2f(p.uvScale,w.uvScale.x,w.uvScale.y),j.uniform2f(p.uvOffset,w.uvOffset.x,w.uvOffset.y),j.uniform2f(p.alignment,w.alignment.x,w.alignment.y),j.uniform1f(p.opacity,w.opacity),j.uniform3f(p.color,w.color.r,w.color.g,w.color.b),j.uniform1f(p.rotation,w.rotation),j.uniform2fv(p.scale,d),w.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!w.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),y(w.blending),
-F(w.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
-[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!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),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,l=void 0,k=void 0,m=void 0,T=void 0,
-w=void 0,H=void 0,q=void 0,r={},t=i.morphTargets.length;i.geometryGroups={};l=0;for(k=i.faces.length;l<k;l++)m=i.faces[l],T=m.materialIndex,H=T!==void 0?T:-1,r[H]===void 0&&(r[H]={hash:H,counter:0}),q=r[H].hash+"_"+r[H].counter,i.geometryGroups[q]===void 0&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:T,vertices:0,numMorphTargets:t}),w=m instanceof THREE.Face3?3:4,i.geometryGroups[q].vertices+w>65535&&(r[H].counter+=1,q=r[H].hash+"_"+r[H].counter,i.geometryGroups[q]===void 0&&(i.geometryGroups[q]=
-{faces3:[],faces4:[],materialIndex:T,vertices:0,numMorphTargets:t})),m instanceof THREE.Face3?i.geometryGroups[q].faces3.push(l):i.geometryGroups[q].faces4.push(l),i.geometryGroups[q].vertices+=w;i.geometryGroupsList=[];l=void 0;for(l in i.geometryGroups)i.geometryGroups[l].id=ea++,i.geometryGroupsList.push(i.geometryGroups[l])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){l=i;l.__webglVertexBuffer=j.createBuffer();l.__webglNormalBuffer=j.createBuffer();l.__webglTangentBuffer=
-j.createBuffer();l.__webglColorBuffer=j.createBuffer();l.__webglUVBuffer=j.createBuffer();l.__webglUV2Buffer=j.createBuffer();l.__webglSkinVertexABuffer=j.createBuffer();l.__webglSkinVertexBBuffer=j.createBuffer();l.__webglSkinIndicesBuffer=j.createBuffer();l.__webglSkinWeightsBuffer=j.createBuffer();l.__webglFaceBuffer=j.createBuffer();l.__webglLineBuffer=j.createBuffer();if(l.numMorphTargets){m=k=void 0;l.__webglMorphTargetsBuffers=[];k=0;for(m=l.numMorphTargets;k<m;k++)l.__webglMorphTargetsBuffers.push(j.createBuffer())}I.info.memory.geometries++;
-T=e;w=T.geometry;k=i.faces3;H=i.faces4;l=k.length*3+H.length*4;m=k.length*1+H.length*2;H=k.length*3+H.length*4;k=b(T,i);q=k.map||k.lightMap||k instanceof THREE.ShaderMaterial?!0:!1;r=k instanceof THREE.MeshBasicMaterial&&!k.envMap||k instanceof THREE.MeshDepthMaterial?!1:k&&k.shading!==void 0&&k.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;t=k.vertexColors?k.vertexColors:!1;i.__vertexArray=new Float32Array(l*3);if(r)i.__normalArray=new Float32Array(l*3);if(w.hasTangents)i.__tangentArray=
-new Float32Array(l*4);if(t)i.__colorArray=new Float32Array(l*3);if(q){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)i.__uvArray=new Float32Array(l*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(l*2)}if(T.geometry.skinWeights.length&&T.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(l*4),i.__skinVertexBArray=new Float32Array(l*4),i.__skinIndexArray=new Float32Array(l*4),i.__skinWeightArray=new Float32Array(l*4);i.__faceArray=new Uint16Array(m*3);
-i.__lineArray=new Uint16Array(H*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];T=0;for(w=i.numMorphTargets;T<w;T++)i.__morphTargetsArrays.push(new Float32Array(l*3))}i.__needsSmoothNormals=r===THREE.SmoothShading;i.__uvType=q;i.__vertexColorType=t;i.__normalType=r;i.__webglFaceCount=m*3;i.__webglLineCount=H*2;if(k.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];m=void 0;for(m in k.attributes){var T=k.attributes[m],w={},x;for(x in T)w[x]=T[x];if(!w.__webglInitialized||
-w.createUniqueBuffers)w.__webglInitialized=!0,H=1,w.type==="v2"?H=2:w.type==="v3"?H=3:w.type==="v4"?H=4:w.type==="c"&&(H=3),w.size=H,w.array=new Float32Array(l*H),w.buffer=j.createBuffer(),w.buffer.belongsToAttribute=m,T.needsUpdate=!0,w.__original=T;i.__webglCustomAttributesList.push(w)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,
-!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),I.info.memory.geometries++,i=h,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglVertexCount=l,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),I.info.memory.geometries++,i=h,l=e,k=i.vertices.length,
-i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*3),i.__webglLineCount=k,c(i,l),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),I.info.geometries++,i=h,l=e,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*3),i.__sortArray=[],i.__webglParticleCount=k,c(i,l),h.__dirtyVertices=!0,h.__dirtyColors=
-!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],o(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,o(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,
-1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)p(g.__webglObjects,e);else if(e instanceof THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(x=
-a.__webglObjects[e].object,f=x.geometry,h=m=k=void 0,x instanceof THREE.Mesh){i=0;for(l=f.geometryGroupsList.length;i<l;i++)if(k=f.geometryGroupsList[i],h=b(x,k),m=h.attributes&&n(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||m)if(m=j.DYNAMIC_DRAW,T=!f.dynamic,k.__inittedArrays){var C=H=w=void 0,s=void 0,ba=void 0,ca=void 0,v=void 0,D=void 0,F=void 0,la=void 0,G=void 0,Z=C=ca=void 0,y=void 0,A=void 0,z=void 0,ga=
-s=void 0,M=void 0,O=s=F=G=void 0,X=void 0,K=z=A=y=v=void 0,U=s=z=A=y=K=z=A=y=K=z=A=y=void 0,J=void 0,L=ca=void 0,P=void 0,R=void 0,ka=void 0,Q=void 0,W=Z=R=J=0,Y=0,aa=U=C=0,N=v=ga=0,E=0,S=void 0,N=k.__vertexArray,P=k.__uvArray,E=k.__uv2Array,L=k.__normalArray,ba=k.__tangentArray,M=k.__colorArray,O=k.__skinVertexAArray,X=k.__skinVertexBArray,D=k.__skinIndexArray,V=k.__skinWeightArray,K=k.__morphTargetsArrays,q=k.__webglCustomAttributesList,B=void 0,B=k.__faceArray,S=k.__lineArray,da=k.__needsSmoothNormals,
-G=k.__vertexColorType,la=k.__uvType,ca=k.__normalType,F=x.geometry,fa=F.__dirtyElements,$=F.__dirtyUvs,qa=F.__dirtyNormals,ia=F.__dirtyTangents,xa=F.__dirtyColors,ka=F.__dirtyMorphTargets,Q=F.vertices,r=k.faces3,t=k.faces4,ha=F.faces,ma=F.faceVertexUvs[0],ua=F.faceVertexUvs[1],ta=F.skinVerticesA,sa=F.skinVerticesB,ra=F.skinIndices,na=F.skinWeights,pa=F.morphTargets;if(F.__dirtyVertices){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],y=Q[s.a].position,A=Q[s.b].position,z=Q[s.c].position,N[R]=y.x,N[R+1]=y.y,
-N[R+2]=y.z,N[R+3]=A.x,N[R+4]=A.y,N[R+5]=A.z,N[R+6]=z.x,N[R+7]=z.y,N[R+8]=z.z,R+=9;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],y=Q[s.a].position,A=Q[s.b].position,z=Q[s.c].position,s=Q[s.d].position,N[R]=y.x,N[R+1]=y.y,N[R+2]=y.z,N[R+3]=A.x,N[R+4]=A.y,N[R+5]=A.z,N[R+6]=z.x,N[R+7]=z.y,N[R+8]=z.z,N[R+9]=s.x,N[R+10]=s.y,N[R+11]=s.z,R+=12;j.bindBuffer(j.ARRAY_BUFFER,k.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,N,m)}if(ka){R=0;for(ka=pa.length;R<ka;R++){w=N=0;for(H=r.length;w<H;w++)s=ha[r[w]],y=pa[R].vertices[s.a].position,
-A=pa[R].vertices[s.b].position,z=pa[R].vertices[s.c].position,Q=K[R],Q[N]=y.x,Q[N+1]=y.y,Q[N+2]=y.z,Q[N+3]=A.x,Q[N+4]=A.y,Q[N+5]=A.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,N+=9;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],y=pa[R].vertices[s.a].position,A=pa[R].vertices[s.b].position,z=pa[R].vertices[s.c].position,s=pa[R].vertices[s.d].position,Q=K[R],Q[N]=y.x,Q[N+1]=y.y,Q[N+2]=y.z,Q[N+3]=A.x,Q[N+4]=A.y,Q[N+5]=A.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,Q[N+9]=s.x,Q[N+10]=s.y,Q[N+11]=s.z,N+=12;j.bindBuffer(j.ARRAY_BUFFER,
-k.__webglMorphTargetsBuffers[R]);j.bufferData(j.ARRAY_BUFFER,K[R],m)}}if(na.length){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],y=na[s.a],A=na[s.b],z=na[s.c],V[v]=y.x,V[v+1]=y.y,V[v+2]=y.z,V[v+3]=y.w,V[v+4]=A.x,V[v+5]=A.y,V[v+6]=A.z,V[v+7]=A.w,V[v+8]=z.x,V[v+9]=z.y,V[v+10]=z.z,V[v+11]=z.w,y=ra[s.a],A=ra[s.b],z=ra[s.c],D[v]=y.x,D[v+1]=y.y,D[v+2]=y.z,D[v+3]=y.w,D[v+4]=A.x,D[v+5]=A.y,D[v+6]=A.z,D[v+7]=A.w,D[v+8]=z.x,D[v+9]=z.y,D[v+10]=z.z,D[v+11]=z.w,y=ta[s.a],A=ta[s.b],z=ta[s.c],O[v]=y.x,O[v+1]=y.y,O[v+2]=
-y.z,O[v+3]=1,O[v+4]=A.x,O[v+5]=A.y,O[v+6]=A.z,O[v+7]=1,O[v+8]=z.x,O[v+9]=z.y,O[v+10]=z.z,O[v+11]=1,y=sa[s.a],A=sa[s.b],z=sa[s.c],X[v]=y.x,X[v+1]=y.y,X[v+2]=y.z,X[v+3]=1,X[v+4]=A.x,X[v+5]=A.y,X[v+6]=A.z,X[v+7]=1,X[v+8]=z.x,X[v+9]=z.y,X[v+10]=z.z,X[v+11]=1,v+=12;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],y=na[s.a],A=na[s.b],z=na[s.c],K=na[s.d],V[v]=y.x,V[v+1]=y.y,V[v+2]=y.z,V[v+3]=y.w,V[v+4]=A.x,V[v+5]=A.y,V[v+6]=A.z,V[v+7]=A.w,V[v+8]=z.x,V[v+9]=z.y,V[v+10]=z.z,V[v+11]=z.w,V[v+12]=K.x,V[v+13]=K.y,V[v+14]=
-K.z,V[v+15]=K.w,y=ra[s.a],A=ra[s.b],z=ra[s.c],K=ra[s.d],D[v]=y.x,D[v+1]=y.y,D[v+2]=y.z,D[v+3]=y.w,D[v+4]=A.x,D[v+5]=A.y,D[v+6]=A.z,D[v+7]=A.w,D[v+8]=z.x,D[v+9]=z.y,D[v+10]=z.z,D[v+11]=z.w,D[v+12]=K.x,D[v+13]=K.y,D[v+14]=K.z,D[v+15]=K.w,y=ta[s.a],A=ta[s.b],z=ta[s.c],K=ta[s.d],O[v]=y.x,O[v+1]=y.y,O[v+2]=y.z,O[v+3]=1,O[v+4]=A.x,O[v+5]=A.y,O[v+6]=A.z,O[v+7]=1,O[v+8]=z.x,O[v+9]=z.y,O[v+10]=z.z,O[v+11]=1,O[v+12]=K.x,O[v+13]=K.y,O[v+14]=K.z,O[v+15]=1,y=sa[s.a],A=sa[s.b],z=sa[s.c],s=sa[s.d],X[v]=y.x,X[v+
-1]=y.y,X[v+2]=y.z,X[v+3]=1,X[v+4]=A.x,X[v+5]=A.y,X[v+6]=A.z,X[v+7]=1,X[v+8]=z.x,X[v+9]=z.y,X[v+10]=z.z,X[v+11]=1,X[v+12]=s.x,X[v+13]=s.y,X[v+14]=s.z,X[v+15]=1,v+=16;v>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,O,m),j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,X,m),j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,D,m),j.bindBuffer(j.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,
-V,m))}if(xa&&G){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],v=s.vertexColors,D=s.color,v.length===3&&G===THREE.VertexColors?(s=v[0],O=v[1],X=v[2]):X=O=s=D,M[ga]=s.r,M[ga+1]=s.g,M[ga+2]=s.b,M[ga+3]=O.r,M[ga+4]=O.g,M[ga+5]=O.b,M[ga+6]=X.r,M[ga+7]=X.g,M[ga+8]=X.b,ga+=9;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],v=s.vertexColors,D=s.color,v.length===4&&G===THREE.VertexColors?(s=v[0],O=v[1],X=v[2],v=v[3]):v=X=O=s=D,M[ga]=s.r,M[ga+1]=s.g,M[ga+2]=s.b,M[ga+3]=O.r,M[ga+4]=O.g,M[ga+5]=O.b,M[ga+6]=X.r,M[ga+7]=X.g,M[ga+
-8]=X.b,M[ga+9]=v.r,M[ga+10]=v.g,M[ga+11]=v.b,ga+=12;ga>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,M,m))}if(ia&&F.hasTangents){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],F=s.vertexTangents,ga=F[0],M=F[1],G=F[2],ba[U]=ga.x,ba[U+1]=ga.y,ba[U+2]=ga.z,ba[U+3]=ga.w,ba[U+4]=M.x,ba[U+5]=M.y,ba[U+6]=M.z,ba[U+7]=M.w,ba[U+8]=G.x,ba[U+9]=G.y,ba[U+10]=G.z,ba[U+11]=G.w,U+=12;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],F=s.vertexTangents,ga=F[0],M=F[1],G=F[2],F=F[3],ba[U]=ga.x,ba[U+1]=
-ga.y,ba[U+2]=ga.z,ba[U+3]=ga.w,ba[U+4]=M.x,ba[U+5]=M.y,ba[U+6]=M.z,ba[U+7]=M.w,ba[U+8]=G.x,ba[U+9]=G.y,ba[U+10]=G.z,ba[U+11]=G.w,ba[U+12]=F.x,ba[U+13]=F.y,ba[U+14]=F.z,ba[U+15]=F.w,U+=16;j.bindBuffer(j.ARRAY_BUFFER,k.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,ba,m)}if(qa&&ca){w=0;for(H=r.length;w<H;w++)if(s=ha[r[w]],ba=s.vertexNormals,ca=s.normal,ba.length===3&&da)for(U=0;U<3;U++)ca=ba[U],L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;else for(U=0;U<3;U++)L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;w=0;
-for(H=t.length;w<H;w++)if(s=ha[t[w]],ba=s.vertexNormals,ca=s.normal,ba.length===4&&da)for(U=0;U<4;U++)ca=ba[U],L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;else for(U=0;U<4;U++)L[C]=ca.x,L[C+1]=ca.y,L[C+2]=ca.z,C+=3;j.bindBuffer(j.ARRAY_BUFFER,k.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,L,m)}if($&&ma&&la){w=0;for(H=r.length;w<H;w++)if(C=r[w],C=ma[C],C!==void 0)for(U=0;U<3;U++)L=C[U],P[Z]=L.u,P[Z+1]=L.v,Z+=2;w=0;for(H=t.length;w<H;w++)if(C=t[w],C=ma[C],C!==void 0)for(U=0;U<4;U++)L=C[U],P[Z]=L.u,P[Z+
-1]=L.v,Z+=2;Z>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,P,m))}if($&&ua&&la){w=0;for(H=r.length;w<H;w++)if(C=r[w],Z=ua[C],Z!==void 0)for(U=0;U<3;U++)P=Z[U],E[W]=P.u,E[W+1]=P.v,W+=2;w=0;for(H=t.length;w<H;w++)if(C=t[w],Z=ua[C],Z!==void 0)for(U=0;U<4;U++)P=Z[U],E[W]=P.u,E[W+1]=P.v,W+=2;W>0&&(j.bindBuffer(j.ARRAY_BUFFER,k.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,E,m))}if(fa){w=0;for(H=r.length;w<H;w++)B[Y]=J,B[Y+1]=J+1,B[Y+2]=J+2,Y+=3,S[aa]=J,S[aa+1]=J+1,S[aa+
-2]=J,S[aa+3]=J+2,S[aa+4]=J+1,S[aa+5]=J+2,aa+=6,J+=3;w=0;for(H=t.length;w<H;w++)B[Y]=J,B[Y+1]=J+1,B[Y+2]=J+3,B[Y+3]=J+1,B[Y+4]=J+2,B[Y+5]=J+3,Y+=6,S[aa]=J,S[aa+1]=J+1,S[aa+2]=J,S[aa+3]=J+3,S[aa+4]=J+1,S[aa+5]=J+2,S[aa+6]=J+2,S[aa+7]=J+3,aa+=8,J+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,B,m);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S,m)}if(q){U=0;for(J=q.length;U<J;U++)if(B=q[U],B.__original.needsUpdate){E=
-0;if(B.size===1)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],B.array[E]=B.value[s.a],B.array[E+1]=B.value[s.b],B.array[E+2]=B.value[s.c],E+=3;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],B.array[E]=B.value[s.a],B.array[E+1]=B.value[s.b],B.array[E+2]=B.value[s.c],B.array[E+3]=B.value[s.d],E+=4}else{if(B.boundTo==="faces"){w=0;for(H=r.length;w<H;w++)S=B.value[r[w]],B.array[E]=S,B.array[E+1]=S,B.array[E+2]=S,E+=3;w=0;for(H=t.length;w<H;w++)S=B.value[t[w]],B.array[E]=
-S,B.array[E+1]=S,B.array[E+2]=S,B.array[E+3]=S,E+=4}}else if(B.size===2)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,E+=6;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],s=B.value[s.d],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=
-z.y,B.array[E+6]=s.x,B.array[E+7]=s.y,E+=8}else{if(B.boundTo==="faces"){w=0;for(H=r.length;w<H;w++)z=A=y=S=B.value[r[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,E+=6;w=0;for(H=t.length;w<H;w++)s=z=A=y=S=B.value[t[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=A.x,B.array[E+3]=A.y,B.array[E+4]=z.x,B.array[E+5]=z.y,B.array[E+6]=s.x,B.array[E+7]=s.y,E+=8}}else if(B.size===3)if(W=B.type==="c"?["r","g","b"]:["x","y","z"],B.boundTo===void 0||
-B.boundTo==="vertices"){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],E+=9;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],s=B.value[s.d],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+
-5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],B.array[E+9]=s[W[0]],B.array[E+10]=s[W[1]],B.array[E+11]=s[W[2]],E+=12}else{if(B.boundTo==="faces"){w=0;for(H=r.length;w<H;w++)z=A=y=S=B.value[r[w]],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],E+=9;w=0;for(H=t.length;w<H;w++)s=z=A=y=S=B.value[t[w]],B.array[E]=y[W[0]],B.array[E+1]=y[W[1]],
-B.array[E+2]=y[W[2]],B.array[E+3]=A[W[0]],B.array[E+4]=A[W[1]],B.array[E+5]=A[W[2]],B.array[E+6]=z[W[0]],B.array[E+7]=z[W[1]],B.array[E+8]=z[W[2]],B.array[E+9]=s[W[0]],B.array[E+10]=s[W[1]],B.array[E+11]=s[W[2]],E+=12}}else if(B.size===4)if(B.boundTo===void 0||B.boundTo==="vertices"){w=0;for(H=r.length;w<H;w++)s=ha[r[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,
-B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,E+=12;w=0;for(H=t.length;w<H;w++)s=ha[t[w]],y=B.value[s.a],A=B.value[s.b],z=B.value[s.c],s=B.value[s.d],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,B.array[E+12]=s.x,B.array[E+13]=s.y,B.array[E+14]=s.z,B.array[E+15]=s.w,E+=16}else if(B.boundTo==="faces"){w=0;for(H=r.length;w<
-H;w++)z=A=y=S=B.value[r[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,E+=12;w=0;for(H=t.length;w<H;w++)s=z=A=y=S=B.value[t[w]],B.array[E]=y.x,B.array[E+1]=y.y,B.array[E+2]=y.z,B.array[E+3]=y.w,B.array[E+4]=A.x,B.array[E+5]=A.y,B.array[E+6]=A.z,B.array[E+7]=A.w,B.array[E+8]=z.x,B.array[E+9]=z.y,B.array[E+10]=z.z,B.array[E+11]=z.w,B.array[E+
-12]=s.x,B.array[E+13]=s.y,B.array[E+14]=s.z,B.array[E+15]=s.w,E+=16}j.bindBuffer(j.ARRAY_BUFFER,B.buffer);j.bufferData(j.ARRAY_BUFFER,B.array,m)}}T&&(delete k.__inittedArrays,delete k.__colorArray,delete k.__normalArray,delete k.__tangentArray,delete k.__uvArray,delete k.__uv2Array,delete k.__faceArray,delete k.__vertexArray,delete k.__lineArray,delete k.__skinVertexAArray,delete k.__skinVertexBArray,delete k.__skinIndexArray,delete k.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=
-!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&u(h)}else if(x instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;x=j.DYNAMIC_DRAW;w=i=w=T=T=void 0;H=h.vertices;l=h.colors;q=H.length;k=l.length;r=h.__vertexArray;m=h.__colorArray;t=h.__dirtyColors;if(h.__dirtyVertices){for(T=0;T<q;T++)w=H[T].position,i=T*3,r[i]=w.x,r[i+1]=w.y,r[i+2]=w.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,
-x)}if(t){for(T=0;T<k;T++)w=l[T],i=T*3,m[i]=w.r,m[i+1]=w.g,m[i+2]=w.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,x)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(x instanceof THREE.Line){h=b(x,k);m=h.attributes&&n(h);if(f.__dirtyVertices||f.__dirtyColors||m){x=f;i=j.DYNAMIC_DRAW;q=l=J=H=ha=void 0;H=x.vertices;k=x.colors;q=H.length;m=k.length;r=x.__vertexArray;T=x.__colorArray;t=x.__dirtyColors;w=x.__webglCustomAttributesList;Z=aa=Y=W=J=ha=void 0;if(x.__dirtyVertices){for(ha=
-0;ha<q;ha++)J=H[ha].position,l=ha*3,r[l]=J.x,r[l+1]=J.y,r[l+2]=J.z;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,r,i)}if(t){for(H=0;H<m;H++)q=k[H],l=H*3,T[l]=q.r,T[l+1]=q.g,T[l+2]=q.b;j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,T,i)}if(w){ha=0;for(J=w.length;ha<J;ha++)if(Z=w[ha],Z.needsUpdate&&(Z.boundTo===void 0||Z.boundTo==="vertices")){l=0;Y=Z.value.length;if(Z.size===1)for(W=0;W<Y;W++)Z.array[W]=Z.value[W];else if(Z.size===2)for(W=
-0;W<Y;W++)aa=Z.value[W],Z.array[l]=aa.x,Z.array[l+1]=aa.y,l+=2;else if(Z.size===3)if(Z.type==="c")for(W=0;W<Y;W++)aa=Z.value[W],Z.array[l]=aa.r,Z.array[l+1]=aa.g,Z.array[l+2]=aa.b,l+=3;else for(W=0;W<Y;W++)aa=Z.value[W],Z.array[l]=aa.x,Z.array[l+1]=aa.y,Z.array[l+2]=aa.z,l+=3;else if(Z.size===4)for(W=0;W<Y;W++)aa=Z.value[W],Z.array[l]=aa.x,Z.array[l+1]=aa.y,Z.array[l+2]=aa.z,Z.array[l+3]=aa.w,l+=4;j.bindBuffer(j.ARRAY_BUFFER,Z.buffer);j.bufferData(j.ARRAY_BUFFER,Z.array,i)}}}f.__dirtyVertices=!1;
-f.__dirtyColors=!1;h.attributes&&u(h)}else if(x instanceof THREE.ParticleSystem)h=b(x,k),m=h.attributes&&n(h),(f.__dirtyVertices||f.__dirtyColors||x.sortParticles||m)&&d(f,j.DYNAMIC_DRAW,x),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&u(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof
-THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,n;k=n=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&n++,f instanceof THREE.DirectionalLight&&n++,f instanceof THREE.PointLight&&i++;i+n<=C?k=n:(k=Math.ceil(C*n/(i+n)),i=C-k);f={directional:k,
-point:i};i=n=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&n++;var m=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)m=d.bones.length;var w;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,
-maxBones:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},o,d=[];h?d.push(h):(d.push(k),d.push(l));for(o in c)d.push(o),d.push(c[o]);h=d.join();o=0;for(d=O.length;o<d;o++)if(O[o].code===h){w=O[o].program;break a}o=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?
-"#define GAMMA_OUTPUT":"",I.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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.perPixel?"#define PHONG_PER_PIXEL":"",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");
-f=["#ifdef GL_ES","precision "+L+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",I.gammaInput?"#define GAMMA_INPUT":"",I.gammaOutput?"#define GAMMA_OUTPUT":"",I.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&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.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",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(o,G("fragment",f+k));j.attachShader(o,
-G("vertex",d+l));j.linkProgram(o);j.getProgramParameter(o,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(o,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");o.uniforms={};o.attributes={};var p,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in i)d.push(p);p=d;d=0;for(i=p.length;d<i;d++)k=p[d],o.uniforms[k]=j.getUniformLocation(o,
-k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(p=0;p<c.maxMorphTargets;p++)d.push("morphTarget"+p);for(w in b)d.push(w);w=d;p=0;for(b=w.length;p<b;p++)c=w[p],o.attributes[c]=j.getAttribLocation(o,c);o.id=O.length;O.push({program:o,code:h});I.info.memory.programs=O.length;w=o}a.program=w;w=a.program.attributes;w.position>=0&&j.enableVertexAttribArray(w.position);w.color>=0&&j.enableVertexAttribArray(w.color);w.normal>=0&&j.enableVertexAttribArray(w.normal);
-w.tangent>=0&&j.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(j.enableVertexAttribArray(w.skinVertexA),j.enableVertexAttribArray(w.skinVertexB),j.enableVertexAttribArray(w.skinIndex),j.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(g in a.attributes)w[g]!==void 0&&w[g]>=0&&j.enableVertexAttribArray(w[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)p="morphTarget"+g,w[p]>=0&&(j.enableVertexAttribArray(w[p]),
+0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);L.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),L.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
+L.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),L.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,m,n,p=a.lights,r=a.fog;W=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ea);b.projectionMatrix.flattenToArray(Y);J.multiply(b.projectionMatrix,b.matrixWorldInverse);f(J);F(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);
+u(m,b,!0);var s=g,v=s.object,t=s.buffer,C=void 0,C=C=void 0,C=v.material;if(C instanceof THREE.MeshFaceMaterial){if(C=t.materialIndex,C>=0)C=v.geometry.materials[C],C.transparent?(s.transparent=C,s.opaque=null):(s.opaque=C,s.transparent=null)}else if(C)C.transparent?(s.transparent=C,s.opaque=null):(s.opaque=C,s.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(ba.copy(m.position),J.multiplyVector3(ba),g.z=ba.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;
+d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),u(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(E(a.overrideMaterial.blending),q(a.overrideMaterial.depthTest),A(a.overrideMaterial.depthWrite),w(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,p,r,!0,a.overrideMaterial),
+o(a.__webglObjectsImmediate,"",b,p,r,!1,a.overrideMaterial)):(E(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,p,r,!1),o(a.__webglObjectsImmediate,"opaque",b,p,r,!1),l(a.__webglObjects,!1,"transparent",b,p,r,!0),o(a.__webglObjectsImmediate,"transparent",b,p,r,!0));if(a.__webglSprites.length){m=O.attributes;p=O.uniforms;r=U/wa;d=[];e=wa*0.5;n=U*0.5;g=!0;j.useProgram(O.program);ga=O.program;T=da=ka=-1;ma||(j.enableVertexAttribArray(O.attributes.position),j.enableVertexAttribArray(O.attributes.uv),
+ma=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.uniformMatrix4fv(p.projectionMatrix,!1,Y);j.activeTexture(j.TEXTURE0);j.uniform1i(p.map,0);m=0;for(s=a.__webglSprites.length;m<s;m++)if(v=a.__webglSprites[m],v.visible&&v.opacity!==0)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
+v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(s=a.__webglSprites.length;m<s;m++)v=a.__webglSprites[m],v.visible&&v.opacity!==0&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(j.uniform1i(p.useScreenCoordinates,1),j.uniform3f(p.screenPosition,(v.position.x-e)/e,(n-v.position.y)/n,Math.max(0,Math.min(1,v.position.z)))):(j.uniform1i(p.useScreenCoordinates,0),j.uniform1i(p.affectedByDistance,v.affectedByDistance?1:0),j.uniformMatrix4fv(p.modelViewMatrix,
+!1,v._modelViewMatrixArray)),b=v.map.image.width/(v.scaleByViewport?U:1),d[0]=b*r*v.scale.x,d[1]=b*v.scale.y,j.uniform2f(p.uvScale,v.uvScale.x,v.uvScale.y),j.uniform2f(p.uvOffset,v.uvOffset.x,v.uvOffset.y),j.uniform2f(p.alignment,v.alignment.x,v.alignment.y),j.uniform1f(p.opacity,v.opacity),j.uniform3f(p.color,v.color.r,v.color.g,v.color.b),j.uniform1f(p.rotation,v.rotation),j.uniform2fv(p.scale,d),v.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!v.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),E(v.blending),
+M(v.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(X)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
+[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!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),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,o=void 0,U=void 0,
+v=void 0,J=void 0,s=void 0,q={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)o=i.faces[k],U=o.materialIndex,J=U!==void 0?U:-1,q[J]===void 0&&(q[J]={hash:J,counter:0}),s=q[J].hash+"_"+q[J].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]={faces3:[],faces4:[],materialIndex:U,vertices:0,numMorphTargets:u}),v=o instanceof THREE.Face3?3:4,i.geometryGroups[s].vertices+v>65535&&(q[J].counter+=1,s=q[J].hash+"_"+q[J].counter,i.geometryGroups[s]===void 0&&(i.geometryGroups[s]=
+{faces3:[],faces4:[],materialIndex:U,vertices:0,numMorphTargets:u})),o instanceof THREE.Face3?i.geometryGroups[s].faces3.push(k):i.geometryGroups[s].faces4.push(k),i.geometryGroups[s].vertices+=v;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=ca++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;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){o=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(o=k.numMorphTargets;l<o;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}L.info.memory.geometries++;
+U=e;v=U.geometry;l=i.faces3;J=i.faces4;k=l.length*3+J.length*4;o=l.length*1+J.length*2;J=l.length*3+J.length*4;l=b(U,i);s=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;q=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(q)i.__normalArray=new Float32Array(k*3);if(v.hasTangents)i.__tangentArray=
+new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(s){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(U.geometry.skinWeights.length&&U.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(o*3);
+i.__lineArray=new Uint16Array(J*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];U=0;for(v=i.numMorphTargets;U<v;U++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=q===THREE.SmoothShading;i.__uvType=s;i.__vertexColorType=u;i.__normalType=q;i.__webglFaceCount=o*3;i.__webglLineCount=J*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];o=void 0;for(o in l.attributes){var U=l.attributes[o],v={},t;for(t in U)v[t]=U[t];if(!v.__webglInitialized||
+v.createUniqueBuffers)v.__webglInitialized=!0,J=1,v.type==="v2"?J=2:v.type==="v3"?J=3:v.type==="v4"?J=4:v.type==="c"&&(J=3),v.size=J,v.array=new Float32Array(k*J),v.buffer=j.createBuffer(),v.buffer.belongsToAttribute=o,U.needsUpdate=!0,v.__original=U;i.__webglCustomAttributesList.push(v)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,
+!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),L.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),L.info.memory.geometries++,i=h,k=e,l=i.vertices.length,
+i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),L.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=
+!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],p(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,p(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,
+1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)m(g.__webglObjects,e);else if(e instanceof THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&m(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(t=
+a.__webglObjects[e].object,f=t.geometry,h=o=l=void 0,t instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(t,l),o=h.attributes&&n(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||o)if(o=j.DYNAMIC_DRAW,U=!f.dynamic,l.__inittedArrays){var A=J=v=void 0,C=void 0,Y=void 0,F=void 0,w=void 0,ba=void 0,E=void 0,M=void 0,ka=void 0,H=A=F=void 0,x=void 0,z=void 0,y=void 0,I=C=
+void 0,K=void 0,ea=C=E=ka=void 0,O=void 0,da=y=z=x=w=void 0,D=C=y=z=x=da=y=z=x=da=y=z=x=void 0,Z=void 0,P=F=void 0,W=void 0,X=void 0,ua=void 0,R=void 0,N=H=X=Z=0,fa=0,T=D=A=0,Q=w=I=0,G=0,S=void 0,Q=l.__vertexArray,W=l.__uvArray,G=l.__uv2Array,P=l.__normalArray,Y=l.__tangentArray,K=l.__colorArray,ea=l.__skinVertexAArray,O=l.__skinVertexBArray,ba=l.__skinIndexArray,V=l.__skinWeightArray,da=l.__morphTargetsArrays,s=l.__webglCustomAttributesList,B=void 0,B=l.__faceArray,S=l.__lineArray,$=l.__needsSmoothNormals,
+ka=l.__vertexColorType,M=l.__uvType,F=l.__normalType,E=t.geometry,aa=E.__dirtyElements,oa=E.__dirtyUvs,ja=E.__dirtyNormals,ga=E.__dirtyTangents,xa=E.__dirtyColors,ua=E.__dirtyMorphTargets,R=E.vertices,q=l.faces3,u=l.faces4,ia=E.faces,la=E.faceVertexUvs[0],ta=E.faceVertexUvs[1],sa=E.skinVerticesA,ra=E.skinVerticesB,qa=E.skinIndices,ma=E.skinWeights,pa=E.morphTargets;if(E.__dirtyVertices){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=R[C.a].position,z=R[C.b].position,y=R[C.c].position,Q[X]=x.x,Q[X+1]=x.y,
+Q[X+2]=x.z,Q[X+3]=z.x,Q[X+4]=z.y,Q[X+5]=z.z,Q[X+6]=y.x,Q[X+7]=y.y,Q[X+8]=y.z,X+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=R[C.a].position,z=R[C.b].position,y=R[C.c].position,C=R[C.d].position,Q[X]=x.x,Q[X+1]=x.y,Q[X+2]=x.z,Q[X+3]=z.x,Q[X+4]=z.y,Q[X+5]=z.z,Q[X+6]=y.x,Q[X+7]=y.y,Q[X+8]=y.z,Q[X+9]=C.x,Q[X+10]=C.y,Q[X+11]=C.z,X+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,o)}if(ua){X=0;for(ua=pa.length;X<ua;X++){v=Q=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=pa[X].vertices[C.a].position,
+z=pa[X].vertices[C.b].position,y=pa[X].vertices[C.c].position,R=da[X],R[Q]=x.x,R[Q+1]=x.y,R[Q+2]=x.z,R[Q+3]=z.x,R[Q+4]=z.y,R[Q+5]=z.z,R[Q+6]=y.x,R[Q+7]=y.y,R[Q+8]=y.z,Q+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=pa[X].vertices[C.a].position,z=pa[X].vertices[C.b].position,y=pa[X].vertices[C.c].position,C=pa[X].vertices[C.d].position,R=da[X],R[Q]=x.x,R[Q+1]=x.y,R[Q+2]=x.z,R[Q+3]=z.x,R[Q+4]=z.y,R[Q+5]=z.z,R[Q+6]=y.x,R[Q+7]=y.y,R[Q+8]=y.z,R[Q+9]=C.x,R[Q+10]=C.y,R[Q+11]=C.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,
+l.__webglMorphTargetsBuffers[X]);j.bufferData(j.ARRAY_BUFFER,da[X],o)}}if(ma.length){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=ma[C.a],z=ma[C.b],y=ma[C.c],V[w]=x.x,V[w+1]=x.y,V[w+2]=x.z,V[w+3]=x.w,V[w+4]=z.x,V[w+5]=z.y,V[w+6]=z.z,V[w+7]=z.w,V[w+8]=y.x,V[w+9]=y.y,V[w+10]=y.z,V[w+11]=y.w,x=qa[C.a],z=qa[C.b],y=qa[C.c],ba[w]=x.x,ba[w+1]=x.y,ba[w+2]=x.z,ba[w+3]=x.w,ba[w+4]=z.x,ba[w+5]=z.y,ba[w+6]=z.z,ba[w+7]=z.w,ba[w+8]=y.x,ba[w+9]=y.y,ba[w+10]=y.z,ba[w+11]=y.w,x=sa[C.a],z=sa[C.b],y=sa[C.c],ea[w]=x.x,ea[w+
+1]=x.y,ea[w+2]=x.z,ea[w+3]=1,ea[w+4]=z.x,ea[w+5]=z.y,ea[w+6]=z.z,ea[w+7]=1,ea[w+8]=y.x,ea[w+9]=y.y,ea[w+10]=y.z,ea[w+11]=1,x=ra[C.a],z=ra[C.b],y=ra[C.c],O[w]=x.x,O[w+1]=x.y,O[w+2]=x.z,O[w+3]=1,O[w+4]=z.x,O[w+5]=z.y,O[w+6]=z.z,O[w+7]=1,O[w+8]=y.x,O[w+9]=y.y,O[w+10]=y.z,O[w+11]=1,w+=12;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=ma[C.a],z=ma[C.b],y=ma[C.c],da=ma[C.d],V[w]=x.x,V[w+1]=x.y,V[w+2]=x.z,V[w+3]=x.w,V[w+4]=z.x,V[w+5]=z.y,V[w+6]=z.z,V[w+7]=z.w,V[w+8]=y.x,V[w+9]=y.y,V[w+10]=y.z,V[w+11]=y.w,V[w+12]=
+da.x,V[w+13]=da.y,V[w+14]=da.z,V[w+15]=da.w,x=qa[C.a],z=qa[C.b],y=qa[C.c],da=qa[C.d],ba[w]=x.x,ba[w+1]=x.y,ba[w+2]=x.z,ba[w+3]=x.w,ba[w+4]=z.x,ba[w+5]=z.y,ba[w+6]=z.z,ba[w+7]=z.w,ba[w+8]=y.x,ba[w+9]=y.y,ba[w+10]=y.z,ba[w+11]=y.w,ba[w+12]=da.x,ba[w+13]=da.y,ba[w+14]=da.z,ba[w+15]=da.w,x=sa[C.a],z=sa[C.b],y=sa[C.c],da=sa[C.d],ea[w]=x.x,ea[w+1]=x.y,ea[w+2]=x.z,ea[w+3]=1,ea[w+4]=z.x,ea[w+5]=z.y,ea[w+6]=z.z,ea[w+7]=1,ea[w+8]=y.x,ea[w+9]=y.y,ea[w+10]=y.z,ea[w+11]=1,ea[w+12]=da.x,ea[w+13]=da.y,ea[w+14]=
+da.z,ea[w+15]=1,x=ra[C.a],z=ra[C.b],y=ra[C.c],C=ra[C.d],O[w]=x.x,O[w+1]=x.y,O[w+2]=x.z,O[w+3]=1,O[w+4]=z.x,O[w+5]=z.y,O[w+6]=z.z,O[w+7]=1,O[w+8]=y.x,O[w+9]=y.y,O[w+10]=y.z,O[w+11]=1,O[w+12]=C.x,O[w+13]=C.y,O[w+14]=C.z,O[w+15]=1,w+=16;w>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ea,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,O,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,
+ba,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,V,o))}if(xa&&ka){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],w=C.vertexColors,ba=C.color,w.length===3&&ka===THREE.VertexColors?(C=w[0],ea=w[1],O=w[2]):O=ea=C=ba,K[I]=C.r,K[I+1]=C.g,K[I+2]=C.b,K[I+3]=ea.r,K[I+4]=ea.g,K[I+5]=ea.b,K[I+6]=O.r,K[I+7]=O.g,K[I+8]=O.b,I+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],w=C.vertexColors,ba=C.color,w.length===4&&ka===THREE.VertexColors?(C=w[0],ea=w[1],O=w[2],w=w[3]):w=O=ea=C=ba,K[I]=
+C.r,K[I+1]=C.g,K[I+2]=C.b,K[I+3]=ea.r,K[I+4]=ea.g,K[I+5]=ea.b,K[I+6]=O.r,K[I+7]=O.g,K[I+8]=O.b,K[I+9]=w.r,K[I+10]=w.g,K[I+11]=w.b,I+=12;I>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,K,o))}if(ga&&E.hasTangents){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],E=C.vertexTangents,I=E[0],K=E[1],ka=E[2],Y[D]=I.x,Y[D+1]=I.y,Y[D+2]=I.z,Y[D+3]=I.w,Y[D+4]=K.x,Y[D+5]=K.y,Y[D+6]=K.z,Y[D+7]=K.w,Y[D+8]=ka.x,Y[D+9]=ka.y,Y[D+10]=ka.z,Y[D+11]=ka.w,D+=12;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],
+E=C.vertexTangents,I=E[0],K=E[1],ka=E[2],E=E[3],Y[D]=I.x,Y[D+1]=I.y,Y[D+2]=I.z,Y[D+3]=I.w,Y[D+4]=K.x,Y[D+5]=K.y,Y[D+6]=K.z,Y[D+7]=K.w,Y[D+8]=ka.x,Y[D+9]=ka.y,Y[D+10]=ka.z,Y[D+11]=ka.w,Y[D+12]=E.x,Y[D+13]=E.y,Y[D+14]=E.z,Y[D+15]=E.w,D+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Y,o)}if(ja&&F){v=0;for(J=q.length;v<J;v++)if(C=ia[q[v]],Y=C.vertexNormals,F=C.normal,Y.length===3&&$)for(D=0;D<3;D++)F=Y[D],P[A]=F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;else for(D=0;D<3;D++)P[A]=
+F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;v=0;for(J=u.length;v<J;v++)if(C=ia[u[v]],Y=C.vertexNormals,F=C.normal,Y.length===4&&$)for(D=0;D<4;D++)F=Y[D],P[A]=F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;else for(D=0;D<4;D++)P[A]=F.x,P[A+1]=F.y,P[A+2]=F.z,A+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,P,o)}if(oa&&la&&M){v=0;for(J=q.length;v<J;v++)if(A=q[v],A=la[A],A!==void 0)for(D=0;D<3;D++)P=A[D],W[H]=P.u,W[H+1]=P.v,H+=2;v=0;for(J=u.length;v<J;v++)if(A=u[v],A=la[A],A!==void 0)for(D=0;D<
+4;D++)P=A[D],W[H]=P.u,W[H+1]=P.v,H+=2;H>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,W,o))}if(oa&&ta&&M){v=0;for(J=q.length;v<J;v++)if(A=q[v],H=ta[A],H!==void 0)for(D=0;D<3;D++)W=H[D],G[N]=W.u,G[N+1]=W.v,N+=2;v=0;for(J=u.length;v<J;v++)if(A=u[v],H=ta[A],H!==void 0)for(D=0;D<4;D++)W=H[D],G[N]=W.u,G[N+1]=W.v,N+=2;N>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,G,o))}if(aa){v=0;for(J=q.length;v<J;v++)B[fa]=Z,B[fa+1]=Z+1,B[fa+2]=Z+2,
+fa+=3,S[T]=Z,S[T+1]=Z+1,S[T+2]=Z,S[T+3]=Z+2,S[T+4]=Z+1,S[T+5]=Z+2,T+=6,Z+=3;v=0;for(J=u.length;v<J;v++)B[fa]=Z,B[fa+1]=Z+1,B[fa+2]=Z+3,B[fa+3]=Z+1,B[fa+4]=Z+2,B[fa+5]=Z+3,fa+=6,S[T]=Z,S[T+1]=Z+1,S[T+2]=Z,S[T+3]=Z+3,S[T+4]=Z+1,S[T+5]=Z+2,S[T+6]=Z+2,S[T+7]=Z+3,T+=8,Z+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,B,o);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,S,o)}if(s){D=0;for(Z=s.length;D<Z;D++)if(B=
+s[D],B.__original.needsUpdate){G=0;if(B.size===1)if(B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],B.array[G]=B.value[C.a],B.array[G+1]=B.value[C.b],B.array[G+2]=B.value[C.c],G+=3;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],B.array[G]=B.value[C.a],B.array[G+1]=B.value[C.b],B.array[G+2]=B.value[C.c],B.array[G+3]=B.value[C.d],G+=4}else{if(B.boundTo==="faces"){v=0;for(J=q.length;v<J;v++)S=B.value[q[v]],B.array[G]=S,B.array[G+1]=S,B.array[G+2]=S,G+=3;v=0;for(J=u.length;v<
+J;v++)S=B.value[u[v]],B.array[G]=S,B.array[G+1]=S,B.array[G+2]=S,B.array[G+3]=S,G+=4}}else if(B.size===2)if(B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,B.array[G+4]=y.x,B.array[G+5]=y.y,G+=6;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,
+B.array[G+4]=y.x,B.array[G+5]=y.y,B.array[G+6]=C.x,B.array[G+7]=C.y,G+=8}else{if(B.boundTo==="faces"){v=0;for(J=q.length;v<J;v++)y=z=x=S=B.value[q[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,B.array[G+4]=y.x,B.array[G+5]=y.y,G+=6;v=0;for(J=u.length;v<J;v++)C=y=z=x=S=B.value[u[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=z.x,B.array[G+3]=z.y,B.array[G+4]=y.x,B.array[G+5]=y.y,B.array[G+6]=C.x,B.array[G+7]=C.y,G+=8}}else if(B.size===3)if(N=B.type==="c"?["r","g","b"]:["x",
+"y","z"],B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],B.array[G]=x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],G+=9;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[G]=x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],
+B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],B.array[G+9]=C[N[0]],B.array[G+10]=C[N[1]],B.array[G+11]=C[N[2]],G+=12}else{if(B.boundTo==="faces"){v=0;for(J=q.length;v<J;v++)y=z=x=S=B.value[q[v]],B.array[G]=x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],G+=9;v=0;for(J=u.length;v<J;v++)C=y=z=x=S=B.value[u[v]],B.array[G]=
+x[N[0]],B.array[G+1]=x[N[1]],B.array[G+2]=x[N[2]],B.array[G+3]=z[N[0]],B.array[G+4]=z[N[1]],B.array[G+5]=z[N[2]],B.array[G+6]=y[N[0]],B.array[G+7]=y[N[1]],B.array[G+8]=y[N[2]],B.array[G+9]=C[N[0]],B.array[G+10]=C[N[1]],B.array[G+11]=C[N[2]],G+=12}}else if(B.size===4)if(B.boundTo===void 0||B.boundTo==="vertices"){v=0;for(J=q.length;v<J;v++)C=ia[q[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+
+6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+11]=y.w,G+=12;v=0;for(J=u.length;v<J;v++)C=ia[u[v]],x=B.value[C.a],z=B.value[C.b],y=B.value[C.c],C=B.value[C.d],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+11]=y.w,B.array[G+12]=C.x,B.array[G+13]=C.y,B.array[G+14]=C.z,B.array[G+15]=C.w,G+=16}else if(B.boundTo==="faces"){v=
+0;for(J=q.length;v<J;v++)y=z=x=S=B.value[q[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+11]=y.w,G+=12;v=0;for(J=u.length;v<J;v++)C=y=z=x=S=B.value[u[v]],B.array[G]=x.x,B.array[G+1]=x.y,B.array[G+2]=x.z,B.array[G+3]=x.w,B.array[G+4]=z.x,B.array[G+5]=z.y,B.array[G+6]=z.z,B.array[G+7]=z.w,B.array[G+8]=y.x,B.array[G+9]=y.y,B.array[G+10]=y.z,B.array[G+
+11]=y.w,B.array[G+12]=C.x,B.array[G+13]=C.y,B.array[G+14]=C.z,B.array[G+15]=C.w,G+=16}j.bindBuffer(j.ARRAY_BUFFER,B.buffer);j.bufferData(j.ARRAY_BUFFER,B.array,o)}}U&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=
+!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&r(h)}else if(t instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;t=j.DYNAMIC_DRAW;v=i=v=U=U=void 0;J=h.vertices;k=h.colors;s=J.length;l=k.length;q=h.__vertexArray;o=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(U=0;U<s;U++)v=J[U].position,i=U*3,q[i]=v.x,q[i+1]=v.y,q[i+2]=v.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,
+t)}if(u){for(U=0;U<l;U++)v=k[U],i=U*3,o[i]=v.r,o[i+1]=v.g,o[i+2]=v.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,o,t)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(t instanceof THREE.Line){h=b(t,l);o=h.attributes&&n(h);if(f.__dirtyVertices||f.__dirtyColors||o){t=f;i=j.DYNAMIC_DRAW;s=k=Z=J=ia=void 0;J=t.vertices;l=t.colors;s=J.length;o=l.length;q=t.__vertexArray;U=t.__colorArray;u=t.__dirtyColors;v=t.__webglCustomAttributesList;H=T=fa=N=Z=ia=void 0;if(t.__dirtyVertices){for(ia=
+0;ia<s;ia++)Z=J[ia].position,k=ia*3,q[k]=Z.x,q[k+1]=Z.y,q[k+2]=Z.z;j.bindBuffer(j.ARRAY_BUFFER,t.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,i)}if(u){for(J=0;J<o;J++)s=l[J],k=J*3,U[k]=s.r,U[k+1]=s.g,U[k+2]=s.b;j.bindBuffer(j.ARRAY_BUFFER,t.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,U,i)}if(v){ia=0;for(Z=v.length;ia<Z;ia++)if(H=v[ia],H.needsUpdate&&(H.boundTo===void 0||H.boundTo==="vertices")){k=0;fa=H.value.length;if(H.size===1)for(N=0;N<fa;N++)H.array[N]=H.value[N];else if(H.size===2)for(N=
+0;N<fa;N++)T=H.value[N],H.array[k]=T.x,H.array[k+1]=T.y,k+=2;else if(H.size===3)if(H.type==="c")for(N=0;N<fa;N++)T=H.value[N],H.array[k]=T.r,H.array[k+1]=T.g,H.array[k+2]=T.b,k+=3;else for(N=0;N<fa;N++)T=H.value[N],H.array[k]=T.x,H.array[k+1]=T.y,H.array[k+2]=T.z,k+=3;else if(H.size===4)for(N=0;N<fa;N++)T=H.value[N],H.array[k]=T.x,H.array[k+1]=T.y,H.array[k+2]=T.z,H.array[k+3]=T.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=
+!1;h.attributes&&r(h)}else if(t instanceof THREE.ParticleSystem)h=b(t,l),o=h.attributes&&n(h),(f.__dirtyVertices||f.__dirtyColors||t.sortParticles||o)&&d(f,j.DYNAMIC_DRAW,t),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&r(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?
+h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=z?k=m:(k=Math.ceil(z*m/(i+m)),i=z-k);f={directional:k,point:i};i=m=0;for(k=
+b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,
+shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},v,d=[];h?d.push(h):(d.push(k),d.push(l));for(v in c)d.push(v),d.push(c[v]);h=d.join();v=0;for(d=aa.length;v<d;v++)if(aa[v].code===h){o=aa[v].program;break a}v=j.createProgram();d=[sa?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":
+"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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.perPixel?"#define PHONG_PER_PIXEL":"",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");
+f=["#ifdef GL_ES","precision "+S+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&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.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",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,x("fragment",f+k));j.attachShader(v,
+x("vertex",d+l));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 p,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in i)d.push(p);p=d;d=0;for(i=p.length;d<i;d++)k=p[d],v.uniforms[k]=j.getUniformLocation(v,
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(p=0;p<c.maxMorphTargets;p++)d.push("morphTarget"+p);for(o in b)d.push(o);o=d;p=0;for(b=o.length;p<b;p++)c=o[p],v.attributes[c]=j.getAttribLocation(v,c);v.id=aa.length;aa.push({program:v,code:h});L.info.memory.programs=aa.length;o=v}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
+o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)p="morphTarget"+g,o[p]>=0&&(j.enableVertexAttribArray(o[p]),
 a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
@@ -349,19 +349,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,e=Math.max(Math.max(b,d),g),f=Math.min(Math.min(b,d),g);if(f===e)f=b=0;else{var h=e-f,f=h/e,b=b===e?(d-g)/h:d===e?2+(g-b)/h:4+(b-d)/h;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=f;c.v=e;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,l=e.faces,k=a.faceVertexUvs[0],m=e.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,u=h.length;n<u;n++){var p=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(p.position);f.push(p)}n=
-0;for(u=l.length;n<u;n++){var f=l[n],r,t,x=f.vertexNormals,q=f.vertexColors;f instanceof THREE.Face3?r=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(r=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));r.normal.copy(f.normal);d&&d.multiplyVector3(r.normal);h=0;for(p=x.length;h<p;h++)t=x[h].clone(),d&&d.multiplyVector3(t),r.vertexNormals.push(t);r.color.copy(f.color);h=0;for(p=q.length;h<p;h++)t=q[h],r.vertexColors.push(t.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
-p=o[h.id];if(p===void 0)p=a.materials.length,a.materials.push(h);r.materialIndex=p}r.centroid.copy(f.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}n=0;for(u=m.length;n<u;n++){b=m[n];d=[];h=0;for(p=b.length;h<p;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
-for(b=g.length;a<b;a++){var h=g[a],i,l,k=h.vertexNormals,m=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=k.length;d<f;d++)l=k[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=m.length;d<f;d++)l=m[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],o=e.faceVertexUvs[0],p={},n=0;n<a.materials.length;n++)p[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,r=h.length;n<r;n++){var m=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(m.position);f.push(m)}n=
+0;for(r=k.length;n<r;n++){var f=k[n],s,u,t=f.vertexNormals,q=f.vertexColors;f instanceof THREE.Face3?s=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(s=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));s.normal.copy(f.normal);d&&d.multiplyVector3(s.normal);h=0;for(m=t.length;h<m;h++)u=t[h].clone(),d&&d.multiplyVector3(u),s.vertexNormals.push(u);s.color.copy(f.color);h=0;for(m=q.length;h<m;h++)u=q[h],s.vertexColors.push(u.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
+m=p[h.id];if(m===void 0)m=a.materials.length,a.materials.push(h);s.materialIndex=m}s.centroid.copy(f.centroid);b&&b.multiplyVector3(s.centroid);i.push(s)}n=0;for(r=o.length;n<r;n++){b=o[n];d=[];h=0;for(m=b.length;h<m;h++)d.push(new THREE.UV(b[h].u,b[h].v));l.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
+for(b=g.length;a<b;a++){var h=g[a],i,k,l=h.vertexNormals,o=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=l.length;d<f;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=o.length;d<f;d++)k=o[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
 f;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,e,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);e=1-d-g;f.copy(a);f.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);f.addSelf(h);h.copy(b);h.multiplyScalar(e);f.addSelf(h);return f},randomPointInFace:function(a,c,b){var d,g,e;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 e=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,e);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;e=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c));return THREE.GeometryUtils.random()*(b+
-f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,l=[],k,m,o,n;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)k=f[d.a].position,m=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,m,o);else if(d instanceof
-THREE.Face4)k=f[d.a].position,m=f[d.b].position,o=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,m,n),d._area2=THREE.GeometryUtils.triangleArea(m,o,n),d._area=d._area1+d._area2;i+=d._area;l[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
+f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,k=[],l,o,p,n;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)l=f[d.a].position,o=f[d.b].position,p=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,o,p);else if(d instanceof
+THREE.Face4)l=f[d.a].position,o=f[d.b].position,p=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,p,n),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],e=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)e.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return e},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),l=i.data,k=0;k<d;k++)for(var m=1;m<g;m++){var o=m-1<0?g-1:m-1,n=(m+1)%g,u=k-1<0?d-1:k-1,p=(k+1)%d,r=[],t=[0,0,h[(m*d+k)*4]/255*c];r.push([-1,0,h[(m*d+u)*4]/255*c]);r.push([-1,-1,h[(o*d+u)*4]/255*c]);r.push([0,-1,h[(o*d+k)*4]/255*c]);r.push([1,-1,h[(o*d+p)*4]/255*c]);
-r.push([1,0,h[(m*d+p)*4]/255*c]);r.push([1,1,h[(n*d+p)*4]/255*c]);r.push([0,1,h[(n*d+k)*4]/255*c]);r.push([-1,1,h[(n*d+u)*4]/255*c]);o=[];u=r.length;for(n=0;n<u;n++){var p=r[n],x=r[(n+1)%u],p=[p[0]-t[0],p[1]-t[1],p[2]-t[2]],x=[x[0]-t[0],x[1]-t[1],x[2]-t[2]];o.push(b([p[1]*x[2]-p[2]*x[1],p[2]*x[0]-p[0]*x[2],p[0]*x[1]-p[1]*x[0]]))}r=[0,0,0];for(n=0;n<o.length;n++)r[0]+=o[n][0],r[1]+=o[n][1],r[2]+=o[n][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;t=(m*d+k)*4;l[t]=(r[0]+1)/2*255|0;l[t+1]=(r[1]+0.5)*
-255|0;l[t+2]=r[2]*255|0;l[t+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),k=i.data,l=0;l<d;l++)for(var o=1;o<g;o++){var p=o-1<0?g-1:o-1,n=(o+1)%g,r=l-1<0?d-1:l-1,m=(l+1)%d,s=[],u=[0,0,h[(o*d+l)*4]/255*c];s.push([-1,0,h[(o*d+r)*4]/255*c]);s.push([-1,-1,h[(p*d+r)*4]/255*c]);s.push([0,-1,h[(p*d+l)*4]/255*c]);s.push([1,-1,h[(p*d+m)*4]/255*c]);
+s.push([1,0,h[(o*d+m)*4]/255*c]);s.push([1,1,h[(n*d+m)*4]/255*c]);s.push([0,1,h[(n*d+l)*4]/255*c]);s.push([-1,1,h[(n*d+r)*4]/255*c]);p=[];r=s.length;for(n=0;n<r;n++){var m=s[n],t=s[(n+1)%r],m=[m[0]-u[0],m[1]-u[1],m[2]-u[2]],t=[t[0]-u[0],t[1]-u[1],t[2]-u[2]];p.push(b([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}s=[0,0,0];for(n=0;n<p.length;n++)s[0]+=p[n][0],s[1]+=p[n][1],s[2]+=p[n][2];s[0]/=p.length;s[1]/=p.length;s[2]/=p.length;u=(o*d+l)*4;k[u]=(s[0]+1)/2*255|0;k[u+1]=(s[1]+0.5)*
+255|0;k[u+2]=s[2]*255|0;k[u+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
 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,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -400,37 +400,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,e)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
 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])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,e));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,l,k,m,o,n,u,p;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];m=e[0];o=e[1];b.length>0?(f=b[b.length-1],n=f.x,u=f.y):(f=this.actions[d-1].args,n=f[f.length-2],u=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,n,m,h),p=THREE.Shape.Utils.b2(p,u,o,
-i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];m=e[0];o=e[1];l=e[2];k=e[3];b.length>0?(f=b[b.length-1],n=f.x,u=f.y):(f=this.actions[d-1].args,n=f[f.length-2],u=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,n,m,l,h),p=THREE.Shape.Utils.b3(p,u,o,k,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
-for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];l=e[2];m=e[3];p=e[4];o=!!e[5];k=f[f.length-2];n=f[f.length-1];f.length==0&&(k=n=0);u=p-m;var r=a*2;for(f=1;f<=r;f++)p=f/r,o||(p=1-p),p=m+p*u,e=k+h+l*Math.cos(p),p=n+i+l*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,l,k,m;h=0;for(i=f.length;h<i;h++)l=f[h],k=l.x,m=l.y,l.x=a*k+c*m+b,l.y=d*m+g*k+e;return f};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,k,l,o,p,n,r,m;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];o=e[0];p=e[1];b.length>0?(f=b[b.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,e=THREE.Shape.Utils.b2(m,n,o,h),m=THREE.Shape.Utils.b2(m,r,p,
+i),b.push(new THREE.Vector2(e,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];o=e[0];p=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],n=f.x,r=f.y):(f=this.actions[d-1].args,n=f[f.length-2],r=f[f.length-1]);for(f=1;f<=a;f++)m=f/a,e=THREE.Shape.Utils.b3(m,n,o,k,h),m=THREE.Shape.Utils.b3(m,r,p,l,i),b.push(new THREE.Vector2(e,m));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];m=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
+for(f=1;f<=m;f++)b.push(e.getPointAt(f/m));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];o=e[3];m=e[4];p=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);r=m-o;var s=a*2;for(f=1;f<=s;f++)m=f/s,p||(m=1-m),m=o+m*r,e=l+h+k*Math.cos(m),m=n+i+k*Math.sin(m),b.push(new THREE.Vector2(e,m))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,o;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,o=k.y,k.x=a*l+c*o+b,k.y=d*o+g*l+e;return f};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();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,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],e=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&e.actions.length!=0&&(g.push(e),e=new THREE.Path),e[b].apply(e,d);e.actions.length!=0&&g.push(e);if(g.length==0)return[];var f,e=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&e.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
 d.curves):f.holes.push(d);e.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,e.push(f),f=new THREE.Shape):f.holes.push(d)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,l,k,m,o,n,u=[];for(i=0;i<c.length;i++){l=c[i];Array.prototype.push.apply(d,l);e=Number.POSITIVE_INFINITY;for(g=0;g<l.length;g++){o=l[g];n=[];for(m=0;m<b.length;m++)k=b[m],k=o.distanceToSquared(k),n.push(k),k<e&&(e=k,f=g,h=m)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:l.length-1;var p=[l[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(p);var r=[l[f],l[e],b[h]];o=THREE.FontUtils.Triangulate.area(r);n=h;k=f;h+=1;f+=-1;h<
-0&&(h+=b.length);h%=b.length;f<0&&(f+=l.length);f%=l.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:l.length-1;p=[l[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);r=[l[f],l[e],b[h]];r=THREE.FontUtils.Triangulate.area(r);m+o>p+r&&(h=n,f=k,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=l.length),f%=l.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:l.length-1);m=b.slice(0,h);o=b.slice(h);n=l.slice(f);k=l.slice(0,f);e=[l[f],l[e],b[h]];u.push([l[f],b[h],b[g]]);u.push(e);b=m.concat(n).concat(k).concat(o)}return{shape:b,
-isolatedPts:u,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,l={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,l[i]!==void 0&&console.log("Duplicate point",i),l[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,o,p,n,r=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);e=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){p=k[g];n=[];for(o=0;o<b.length;o++)l=b[o],l=p.distanceToSquared(l),n.push(l),l<e&&(e=l,f=g,h=o)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var m=[k[f],b[h],b[g]];o=THREE.FontUtils.Triangulate.area(m);var s=[k[f],k[e],b[h]];p=THREE.FontUtils.Triangulate.area(s);n=h;l=f;h+=1;f+=-1;h<
+0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;m=[k[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(m);s=[k[f],k[e],b[h]];s=THREE.FontUtils.Triangulate.area(s);o+p>m+s&&(h=n,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);o=b.slice(0,h);p=b.slice(h);n=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];r.push([k[f],b[h],b[g]]);r.push(e);b=o.concat(n).concat(l).concat(p)}return{shape:b,
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},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,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},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,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",e=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=e};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 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 d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
-0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var l=a.hierarchy[b].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
-{};for(l in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===l){k[l]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(k[l]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var l=
+{};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){l[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));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 d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];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 e=g.animationCache.prevKey;g=g.animationCache.nextKey;e.pos=this.data.hierarchy[b].keys[0];e.rot=this.data.hierarchy[b].keys[0];e.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.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,d,g,e,f,h,i,l,k=this.data.JIT.hierarchy,m,o;this.currentTime+=a*this.timeScale;o=this.currentTime;m=this.currentTime%=this.data.length;l=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,u=this.hierarchy.length;n<u;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=k[n][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 p=0;p<3;p++){b=c[p];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(m<o)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<m;)f=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
-m)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,k,l=this.data.JIT.hierarchy,o,p;this.currentTime+=a*this.timeScale;p=this.currentTime;o=this.currentTime%=this.data.length;k=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,r=this.hierarchy.length;n<r;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&l[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=l[n][k],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 m=0;m<3;m++){b=c[m];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=p){if(o<p)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<o;)f=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
+o)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",n,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
-"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&k[0][l]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)k[n][l]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,e,f,h,i,l;g=(a.length-1)*c;e=Math.floor(g);g-=e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>a.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];l=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],l[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],l[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],l[2],g,b,f);return d};
+"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)l[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,e,f,h,i,k;g=(a.length-1)*c;e=Math.floor(g);g-=e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>a.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],k[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],k[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],k[2],g,b,f);return d};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,e,f){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*f+(-3*(c-b)-2*a-d)*e+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=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+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -452,7 +452,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*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,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(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=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};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.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,t=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)t=d*h.chunks[f]/h.total,b.keys[f]={time:t,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),s=g.length,u=0;f=s-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<s-1;f++)u=d*h.chunks[f]/h.total,b.keys[f]={time:u,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
@@ -470,76 +470,76 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};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",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,l=0,k=0,m=0,o=0,n=window.innerWidth/2,u=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*m);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*l);this.object.translateY(c*k);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,k=0,l=0,o=0,p=0,n=window.innerWidth/2,r=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*o);this.rotateVertically(c*p)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){m=(a.clientX-n)/window.innerWidth;o=(a.clientY-u)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){o=(a.clientX-n)/window.innerWidth;p=(a.clientY-r)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,k=new THREE.Vector2,m=new THREE.Vector2,o=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-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,p=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-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(b.object.position).subSelf(b.target);e=b.object.up.clone().setLength(d.y);e.addSelf(b.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(f);
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-l.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?l=k:l.y+=(k.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=o:m.addSelf(a.sub(o,m).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),l=k=b.getMouseOnScreen(a.clientX,a.clientY),m=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
-a.clientY):e===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=p.clone().subSelf(o);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?o=p:o.addSelf(a.sub(p,o).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=b.getMouseOnScreen(a.clientX,a.clientY),o=p=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=b.getMouseOnScreen(a.clientX,
+a.clientY):e===d.PAN&&!b.noPan&&(p=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=l=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,n){var m,o,p=d||1,r=g||1,u=h/2,q=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")m="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")m="y",r=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")m="x",p=e||1;var x=p+1,A=r+1;h/=p;var C=i/r;for(o=0;o<A;o++)for(i=0;i<x;i++){var I=new THREE.Vector3;I[a]=(i*h-u)*c;I[b]=(o*C-q)*f;I[m]=k;l.vertices.push(new THREE.Vertex(I))}for(o=0;o<r;o++)for(i=0;i<p;i++)l.faces.push(new THREE.Face4(i+
-x*o+t,i+x*(o+1)+t,i+1+x*(o+1)+t,i+1+x*o+t,null,null,n)),l.faceVertexUvs[0].push([new THREE.UV(i/p,o/r),new THREE.UV(i/p,(o+1)/r),new THREE.UV((i+1)/p,(o+1)/r),new THREE.UV((i+1)/p,o/r)])}THREE.Geometry.call(this);var l=this,k=a/2,m=c/2,o=b/2,n,u,p,r,t,x;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(f)}n=0;r=1;u=2;t=3;p=4;x=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var q in h)this.sides[q]!=
-void 0&&(this.sides[q]=h[q]);this.sides.px&&i("z","y",-1,-1,b,c,k,n);this.sides.nx&&i("z","y",1,-1,b,c,-k,r);this.sides.py&&i("x","z",1,1,a,b,m,u);this.sides.ny&&i("x","z",1,-1,a,b,-m,t);this.sides.pz&&i("x","y",1,-1,a,c,o,p);this.sides.nz&&i("x","y",-1,-1,a,c,-o,x);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,l=[],k=[];for(i=0;i<=g;i++){var m=[],o=[],n=i/g,u=n*(c-a)+a;for(h=0;h<=d;h++){var p=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(u*Math.sin(p*Math.PI*2),-n*b+f,u*Math.cos(p*Math.PI*2))));m.push(this.vertices.length-1);o.push(new THREE.UV(p,n))}l.push(m);k.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=l[i][h],m=l[i+1][h],o=l[i+1][h+1],n=l[i][h+1],u=
-this.vertices[b].position.clone().setY(0).normalize(),p=this.vertices[m].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),t=this.vertices[n].position.clone().setY(0).normalize(),x=k[i][h].clone(),q=k[i+1][h].clone(),s=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,m,o,n,[u,p,r,t]));this.faceVertexUvs[0].push([x,q,s,v])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=l[0][h],m=l[0][h+
-1],o=this.vertices.length-1,u=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),x=k[0][h].clone(),q=k[0][h+1].clone(),s=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,m,o,[u,p,r])),this.faceVertexUvs[0].push([x,q,s])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=l[i][h+1],m=l[i][h],o=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),x=k[i][h+1].clone(),q=k[i][h].clone(),
-s=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,m,o,[u,p,r])),this.faceVertexUvs[0].push([x,q,s])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,l,m){var n,o,p=d||1,r=g||1,s=h/2,q=i/2,u=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",r=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var t=p+1,H=r+1;h/=p;var z=i/r;for(o=0;o<H;o++)for(i=0;i<t;i++){var L=new THREE.Vector3;L[a]=(i*h-s)*c;L[b]=(o*z-q)*f;L[n]=l;k.vertices.push(new THREE.Vertex(L))}for(o=0;o<r;o++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
+t*o+u,i+t*(o+1)+u,i+1+t*(o+1)+u,i+1+t*o+u,null,null,m)),k.faceVertexUvs[0].push([new THREE.UV(i/p,o/r),new THREE.UV(i/p,(o+1)/r),new THREE.UV((i+1)/p,(o+1)/r),new THREE.UV((i+1)/p,o/r)])}THREE.Geometry.call(this);var k=this,l=a/2,o=c/2,p=b/2,n,r,m,s,u,t;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(f)}n=0;s=1;r=2;u=3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var q in h)this.sides[q]!=
+void 0&&(this.sides[q]=h[q]);this.sides.px&&i("z","y",-1,-1,b,c,l,n);this.sides.nx&&i("z","y",1,-1,b,c,-l,s);this.sides.py&&i("x","z",1,1,a,b,o,r);this.sides.ny&&i("x","z",1,-1,a,b,-o,u);this.sides.pz&&i("x","y",1,-1,a,c,p,m);this.sides.nz&&i("x","y",-1,-1,a,c,-p,t);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,k=[],l=[];for(i=0;i<=g;i++){var o=[],p=[],n=i/g,r=n*(c-a)+a;for(h=0;h<=d;h++){var m=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(r*Math.sin(m*Math.PI*2),-n*b+f,r*Math.cos(m*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(m,n))}k.push(o);l.push(p)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],o=k[i+1][h],p=k[i+1][h+1],n=k[i][h+1],r=
+this.vertices[b].position.clone().setY(0).normalize(),m=this.vertices[o].position.clone().setY(0).normalize(),s=this.vertices[p].position.clone().setY(0).normalize(),u=this.vertices[n].position.clone().setY(0).normalize(),t=l[i][h].clone(),q=l[i+1][h].clone(),A=l[i+1][h+1].clone(),w=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,o,p,n,[r,m,s,u]));this.faceVertexUvs[0].push([t,q,A,w])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=k[0][h],o=k[0][h+
+1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),t=l[0][h].clone(),q=l[0][h+1].clone(),A=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,o,p,[r,m,s])),this.faceVertexUvs[0].push([t,q,A])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=k[i][h+1],o=k[i][h],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),t=l[i][h+1].clone(),q=l[i][h].clone(),
+A=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,o,p,[r,m,s])),this.faceVertexUvs[0].push([t,q,A])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(D=a.length;--D>=0;){j=D;O=D-1;O<0&&(O=a.length-1);for(var b=
-0,c=n+k*2,b=0;b<c;b++){var d=da*b,e=da*(b+1),f=fa+j+d,g=fa+j+e,l=f,d=fa+O+d,e=fa+O+e,m=g;l+=z;d+=z;e+=z;m+=z;F.faces.push(new THREE.Face4(l,d,e,m,null,null,s));s&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(F.vertices[f].position.z+i)/e,g=(F.vertices[g].position.z+i)/e,F.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=z;b+=z;c+=z;F.faces.push(new THREE.Face3(a,b,c,
-null,null,q));if(q){var d=v.maxY,e=v.maxX,f=F.vertices[b].position.x,b=F.vertices[b].position.y,g=F.vertices[c].position.x,c=F.vertices[c].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[a].position.x/e,F.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,m=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
-o=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,u=c.bendPath,p=c.extrudePath,r,t=!1,x=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,s=c.extrudeMaterial,v=this.shapebb;if(p)r=p.getPoints(o),n=r.length,t=!0,m=!1;m||(l=i=k=0);var y,G,K,F=this,z=this.vertices.length;u&&a.addWrapPath(u);o=x?a.extractAllSpacedPoints(o):a.extractAllPoints(o);u=o.shape;o=o.holes;if(p=!THREE.Shape.Utils.isClockWise(u)){u=u.reverse();G=0;for(K=o.length;G<K;G++)y=o[G],THREE.Shape.Utils.isClockWise(y)&&
-(o[G]=y.reverse());p=!1}p=THREE.Shape.Utils.triangulateShape(u,o);x=u;G=0;for(K=o.length;G<K;G++)y=o[G],u=u.concat(y);var D,P,J,$,L,Q,da=u.length,ia=p.length,S=[];D=0;P=x.length;j=P-1;for(O=D+1;D<P;D++,j++,O++)j===P&&(j=0),O===P&&(O=0),S[D]=d(x[D],x[j],x[O]);var A=[],C,I=S.concat();G=0;for(K=o.length;G<K;G++){y=o[G];C=[];D=0;P=y.length;j=P-1;for(O=D+1;D<P;D++,j++,O++)j===P&&(j=0),O===P&&(O=0),C[D]=d(y[D],y[j],y[O]);A.push(C);I=I.concat(C)}for(J=0;J<k;J++){$=J/k;L=i*(1-$);$=l*Math.sin($*Math.PI/2);
-D=0;for(P=x.length;D<P;D++)Q=b(x[D],S[D],$),e(Q.x,Q.y,-L);G=0;for(K=o.length;G<K;G++){y=o[G];C=A[G];D=0;for(P=y.length;D<P;D++)Q=b(y[D],C[D],$),e(Q.x,Q.y,-L)}}$=l;for(D=0;D<da;D++)Q=m?b(u[D],I[D],$):u[D],t?e(Q.x,Q.y+r[0].y,r[0].x):e(Q.x,Q.y,0);for(J=1;J<=n;J++)for(D=0;D<da;D++)Q=m?b(u[D],I[D],$):u[D],t?e(Q.x,Q.y+r[J-1].y,r[J-1].x):e(Q.x,Q.y,h/n*J);for(J=k-1;J>=0;J--){$=J/k;L=i*(1-$);$=l*Math.sin($*Math.PI/2);D=0;for(P=x.length;D<P;D++)Q=b(x[D],S[D],$),e(Q.x,Q.y,h+L);G=0;for(K=o.length;G<K;G++){y=
-o[G];C=A[G];D=0;for(P=y.length;D<P;D++)Q=b(y[D],C[D],$),t?e(Q.x,Q.y+r[n-1].y,r[n-1].x+L):e(Q.x,Q.y,h+L)}}if(m){m=da*0;for(D=0;D<ia;D++)l=p[D],f(l[2]+m,l[1]+m,l[0]+m);m=da*(n+k*2);for(D=0;D<ia;D++)l=p[D],f(l[0]+m,l[1]+m,l[2]+m)}else{for(D=0;D<ia;D++)l=p[D],f(l[2],l[1],l[0]);for(D=0;D<ia;D++)l=p[D],f(l[0]+da*n,l[1]+da*n,l[2]+da*n)}var j,O,fa=0;g(x);fa+=x.length;G=0;for(K=o.length;G<K;G++)y=o[G],g(y),fa+=y.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(F=a.length;--F>=0;){j=F;aa=F-1;aa<0&&(aa=a.length-1);for(var b=
+0,c=n+l*2,b=0;b<c;b++){var d=V*b,e=V*(b+1),f=ga+j+d,g=ga+j+e,k=f,d=ga+aa+d,e=ga+aa+e,m=g;k+=D;d+=D;e+=D;m+=D;M.faces.push(new THREE.Face4(k,d,e,m,null,null,A));A&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(M.vertices[f].position.z+i)/e,g=(M.vertices[g].position.z+i)/e,M.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){M.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=D;b+=D;c+=D;M.faces.push(new THREE.Face3(a,b,c,
+null,null,q));if(q){var d=w.maxY,e=w.maxX,f=M.vertices[b].position.x,b=M.vertices[b].position.y,g=M.vertices[c].position.x,c=M.vertices[c].position.y;M.faceVertexUvs[0].push([new THREE.UV(M.vertices[a].position.x/e,M.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,l=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
+p=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,r=c.bendPath,m=c.extrudePath,s,u=!1,t=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,A=c.extrudeMaterial,w=this.shapebb;if(m)s=m.getPoints(p),n=s.length,u=!0,o=!1;o||(k=i=l=0);var E,x,I,M=this,D=this.vertices.length;r&&a.addWrapPath(r);p=t?a.extractAllSpacedPoints(p):a.extractAllPoints(p);r=p.shape;p=p.holes;if(m=!THREE.Shape.Utils.isClockWise(r)){r=r.reverse();x=0;for(I=p.length;x<I;x++)E=p[x],THREE.Shape.Utils.isClockWise(E)&&
+(p[x]=E.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(r,p);t=r;x=0;for(I=p.length;x<I;x++)E=p[x],r=r.concat(E);var F,P,K,$,S,R,V=r.length,ja=m.length,y=[];F=0;P=t.length;j=P-1;for(aa=F+1;F<P;F++,j++,aa++)j===P&&(j=0),aa===P&&(aa=0),y[F]=d(t[F],t[j],t[aa]);var H=[],z,L=y.concat();x=0;for(I=p.length;x<I;x++){E=p[x];z=[];F=0;P=E.length;j=P-1;for(aa=F+1;F<P;F++,j++,aa++)j===P&&(j=0),aa===P&&(aa=0),z[F]=d(E[F],E[j],E[aa]);H.push(z);L=L.concat(z)}for(K=0;K<l;K++){$=K/l;S=i*(1-$);$=k*Math.sin($*Math.PI/
+2);F=0;for(P=t.length;F<P;F++)R=b(t[F],y[F],$),e(R.x,R.y,-S);x=0;for(I=p.length;x<I;x++){E=p[x];z=H[x];F=0;for(P=E.length;F<P;F++)R=b(E[F],z[F],$),e(R.x,R.y,-S)}}$=k;for(F=0;F<V;F++)R=o?b(r[F],L[F],$):r[F],u?e(R.x,R.y+s[0].y,s[0].x):e(R.x,R.y,0);for(K=1;K<=n;K++)for(F=0;F<V;F++)R=o?b(r[F],L[F],$):r[F],u?e(R.x,R.y+s[K-1].y,s[K-1].x):e(R.x,R.y,h/n*K);for(K=l-1;K>=0;K--){$=K/l;S=i*(1-$);$=k*Math.sin($*Math.PI/2);F=0;for(P=t.length;F<P;F++)R=b(t[F],y[F],$),e(R.x,R.y,h+S);x=0;for(I=p.length;x<I;x++){E=
+p[x];z=H[x];F=0;for(P=E.length;F<P;F++)R=b(E[F],z[F],$),u?e(R.x,R.y+s[n-1].y,s[n-1].x+S):e(R.x,R.y,h+S)}}if(o){o=V*0;for(F=0;F<ja;F++)k=m[F],f(k[2]+o,k[1]+o,k[0]+o);o=V*(n+l*2);for(F=0;F<ja;F++)k=m[F],f(k[0]+o,k[1]+o,k[2]+o)}else{for(F=0;F<ja;F++)k=m[F],f(k[2],k[1],k[0]);for(F=0;F<ja;F++)k=m[F],f(k[0]+V*n,k[1]+V*n,k[2]+V*n)}var j,aa,ga=0;g(t);ga+=t.length;x=0;for(I=p.length;x<I;x++)E=p[x],g(E),ga+=E.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=new THREE.Geometry;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,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),l=d(e.faces[h].b,e.faces[h].c),k=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,k,a);b(e.faces[h].b,l,
-i,a);b(e.faces[h].c,k,l,a);b(i,l,k,a)}e.faces=a.faces}g.faces=e.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-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,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),k=d(e.faces[h].b,e.faces[h].c),l=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,l,a);b(e.faces[h].b,k,
+i,a);b(e.faces[h].c,l,k,a);b(i,k,l,a)}e.faces=a.faces}g.faces=e.faces;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=[],d=[],g=[],e=[],f=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=f.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=e;i==0&&(e=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(a,b,c){c<0&&a.u===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var l=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*l-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var k=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*k-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);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,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),l=[],k=0;for(d=0;d<e;d++){var m=2*d/e,o=i*Math.sin(m*g),m=i*Math.cos(m*g);(b==0||b==f)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,o)))-1);l.push(k)}c.push(l)}for(var n,u,p,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){l=d==e-1;f=c[b][l?0:d+1];h=c[b][l?e-1:d];i=c[b-1][l?
-e-1:d];l=c[b-1][l?0:d+1];o=b/(g-1);n=(b-1)/(g-1);u=(d+1)/e;var m=d/e,k=new THREE.UV(1-u,o),o=new THREE.UV(1-m,o),m=new THREE.UV(1-m,n),r=new THREE.UV(1-u,n);b<c.length-1&&(n=this.vertices[f].position.clone(),u=this.vertices[h].position.clone(),p=this.vertices[i].position.clone(),n.normalize(),u.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([k,o,m]));b>1&&(n=
-this.vertices[f].position.clone(),u=this.vertices[i].position.clone(),p=this.vertices[l].position.clone(),n.normalize(),u.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,l,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([k,m,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],l=0;for(d=0;d<e;d++){var o=2*d/e,p=i*Math.sin(o*g),o=i*Math.cos(o*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,h,p)))-1);k.push(l)}c.push(k)}for(var n,r,m,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){k=d==e-1;f=c[b][k?0:d+1];h=c[b][k?e-1:d];i=c[b-1][k?
+e-1:d];k=c[b-1][k?0:d+1];p=b/(g-1);n=(b-1)/(g-1);r=(d+1)/e;var o=d/e,l=new THREE.UV(1-r,p),p=new THREE.UV(1-o,p),o=new THREE.UV(1-o,n),s=new THREE.UV(1-r,n);b<c.length-1&&(n=this.vertices[f].position.clone(),r=this.vertices[h].position.clone(),m=this.vertices[i].position.clone(),n.normalize(),r.normalize(),m.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([l,p,o]));b>1&&(n=
+this.vertices[f].position.clone(),r=this.vertices[i].position.clone(),m=this.vertices[k].position.clone(),n.normalize(),r.normalize(),m.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(r.x,r.y,r.z),new THREE.Vector3(m.x,m.y,m.z)])),this.faceVertexUvs[0].push([l,o,s]))}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){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,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]},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},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
-0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,l,k,m,o,n,u,p,r,t=c.glyphs[a]||c.glyphs["?"];if(t){if(t.o){c=t._cachedOutline||(t._cachedOutline=t.o.split(" "));l=c.length;for(a=0;a<l;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,k));g.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,
-k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;n=c[a++]*b+d;u=c[a++]*b;g.quadraticCurveTo(n,u,i,k);if(f=e[e.length-1]){m=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var x=f/h,q=THREE.Shape.Utils.b2(x,m,n,i),x=THREE.Shape.Utils.b2(x,o,u,k);e.push(new THREE.Vector2(q,x))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,n=c[a++]*b+d,u=c[a++]*-b,p=c[a++]*b+d,r=c[a++]*-b,g.bezierCurveTo(i,k,n,u,p,r),f=e[e.length-1]){m=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)x=f/h,q=THREE.Shape.Utils.b3(x,m,n,
-p,i),x=THREE.Shape.Utils.b3(x,o,u,r,k),e.push(new THREE.Vector2(q,x))}}}return{offset:t.ha*b,points:e,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var m=2*g;for(l=g-1;g>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var o;a:{o=a;var n=i,u=l,p=k,r=g,t=f,x=void 0,q=void 0,s=void 0,
-v=void 0,y=void 0,G=void 0,K=void 0,F=void 0,z=void 0,q=o[t[n]].x,s=o[t[n]].y,v=o[t[u]].x,y=o[t[u]].y,G=o[t[p]].x,K=o[t[p]].y;if(1.0E-10>(v-q)*(K-s)-(y-s)*(G-q))o=!1;else{for(x=0;x<r;x++)if(!(x==n||x==u||x==p)){var F=o[t[x]].x,z=o[t[x]].y,D=void 0,P=void 0,J=void 0,$=void 0,L=void 0,Q=void 0,da=void 0,ia=void 0,S=void 0,A=void 0,C=void 0,I=void 0,D=J=L=void 0,D=G-v,P=K-y,J=q-G,$=s-K,L=v-q,Q=y-s,da=F-q,ia=z-s,S=F-v,A=z-y,C=F-G,I=z-K,D=D*A-P*S,L=L*ia-Q*da,J=J*I-$*C;if(D>=0&&J>=0&&L>=0){o=!1;break a}}o=
-!0}}if(o){e.push([a[f[i]],a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;m=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,k,l,o,p,n,r,m,s,u=c.glyphs[a]||c.glyphs["?"];if(u){if(u.o){c=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,l));g.moveTo(i,l);break;case "l":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,
+l));g.lineTo(i,l);break;case "q":i=c[a++]*b+d;l=c[a++]*b;n=c[a++]*b+d;r=c[a++]*b;g.quadraticCurveTo(n,r,i,l);if(f=e[e.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var t=f/h,q=THREE.Shape.Utils.b2(t,o,n,i),t=THREE.Shape.Utils.b2(t,p,r,l);e.push(new THREE.Vector2(q,t))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,n=c[a++]*b+d,r=c[a++]*-b,m=c[a++]*b+d,s=c[a++]*-b,g.bezierCurveTo(i,l,n,r,m,s),f=e[e.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)t=f/h,q=THREE.Shape.Utils.b3(t,o,n,
+m,i),t=THREE.Shape.Utils.b3(t,p,r,s,l),e.push(new THREE.Vector2(q,t))}}}return{offset:u.ha*b,points:e,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,k,l;if(c(a)>0)for(k=0;k<g;k++)f[k]=k;else for(k=0;k<g;k++)f[k]=g-1-k;var o=2*g;for(k=g-1;g>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var p;a:{p=a;var n=i,r=k,m=l,s=g,u=f,t=void 0,q=void 0,A=void 0,
+w=void 0,E=void 0,x=void 0,I=void 0,M=void 0,D=void 0,q=p[u[n]].x,A=p[u[n]].y,w=p[u[r]].x,E=p[u[r]].y,x=p[u[m]].x,I=p[u[m]].y;if(1.0E-10>(w-q)*(I-A)-(E-A)*(x-q))p=!1;else{for(t=0;t<s;t++)if(!(t==n||t==r||t==m)){var M=p[u[t]].x,D=p[u[t]].y,F=void 0,P=void 0,K=void 0,$=void 0,S=void 0,R=void 0,V=void 0,ja=void 0,y=void 0,H=void 0,z=void 0,L=void 0,F=K=S=void 0,F=x-w,P=I-E,K=q-x,$=A-I,S=w-q,R=E-A,V=M-q,ja=D-A,y=M-w,H=D-E,z=M-x,L=D-I,F=F*H-P*y,S=S*ja-R*V,K=K*L-$*z;if(F>=0&&K>=0&&S>=0){p=!1;break a}}p=
+!0}}if(p){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l<g;i++,l++)f[i]=f[l];g--;o=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
 this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[g].clone(),a[e].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=e||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,l,k])}this.computeCentroids();
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,k,l])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,n,m=0;m<4;m++){n=i[m];j=new THREE.Color;j.setRGB(0,0,0);for(var p=0;p<n.length;p++)l=h.vertexColors[n[p]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=n.length;j.g/=n.length;j.b/=n.length;k.vertexColors[m]=j}}g.push(k);(!f.supportUVs||o.length!=0)&&e.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},m={},o=[],n,u,p,r,t,x=a.faceVertexUvs[0];n=0;for(u=x.length;n<u;n++){p=0;for(r=x[n].length;p<r;p++)t=d[n]["abcd".charAt(p)],o[t]||(o[t]=x[n][p])}var q;n=0;for(u=d.length;n<u;n++)if(t=d[n],l.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),f.supportUVs&&o.length!=0){q=new THREE.UV;if(t instanceof THREE.Face3)q.u=o[t.a].u+o[t.b].u+o[t.c].u,q.v=o[t.a].v+o[t.b].v+o[t.c].v,q.u/=3,q.v/=3;else if(t instanceof THREE.Face4)q.u=
-o[t.a].u+o[t.b].u+o[t.c].u+o[t.d].u,q.v=o[t.a].v+o[t.b].v+o[t.c].v+o[t.d].v,q.u/=4,q.v/=4;o.push(q)}u=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var s=0,x=h.length,v,y,G={},K={},F=function(a,
-b){G[a]===void 0&&(G[a]=[]);G[a].push(b)},z=function(a,b){K[a]===void 0&&(K[a]={});K[a][b]=null};for(n in u){q=u[n];v=n.split("_");y=v[0];v=v[1];F(y,[y,v]);F(v,[y,v]);p=0;for(r=q.length;p<r;p++)t=q[p],z(y,t,n),z(v,t,n);q.length<2&&(m[n]=!0)}for(n in u)if(q=u[n],t=q[0],q=q[1],v=n.split("_"),y=v[0],v=v[1],r=new THREE.Vector3,m[n]?(r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.5)):(r.addSelf(l[t]),r.addSelf(l[q]),r.addSelf(h[y].position),r.addSelf(h[v].position),r.multiplyScalar(0.25)),
-k[n]=x+d.length+s,i.push(new THREE.Vertex(r)),s++,f.supportUVs&&o.length!=0)q=new THREE.UV,q.u=o[y].u+o[v].u,q.v=o[y].v+o[v].v,q.u/=2,q.v/=2,o.push(q);var D,P;v=["123","12","2","23"];r=["123","23","3","31"];var F=["123","31","1","12"],z=["1234","12","2","23"],J=["1234","23","3","34"],$=["1234","34","4","41"],L=["1234","41","1","12"];n=0;for(u=l.length;n<u;n++)t=d[n],q=x+n,t instanceof THREE.Face3?(s=b(t.a,t.b),y=b(t.b,t.c),D=b(t.c,t.a),c(q,k[s],t.b,k[y],t,v),c(q,k[y],t.c,k[D],t,r),c(q,k[D],t.a,k[s],
-t,F)):t instanceof THREE.Face4?(s=b(t.a,t.b),y=b(t.b,t.c),D=b(t.c,t.d),P=b(t.d,t.a),c(q,k[s],t.b,k[y],t,z),c(q,k[y],t.c,k[D],t,J),c(q,k[D],t.d,k[P],t,$),c(q,k[P],t.a,k[s],t,L)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(u=h.length;n<u;n++)if(G[n]!==void 0){i.set(0,0,0);k.set(0,0,0);t=new THREE.Vector3(0,0,0);q=0;for(p in K[n])i.addSelf(l[p]),q++;s=0;x=G[n].length;for(p=0;p<x;p++)m[b(G[n][p][0],G[n][p][1])]&&s++;if(s!=2){i.divideScalar(q);for(p=0;p<
-x;p++)q=G[n][p],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),k.addSelf(q);k.divideScalar(x);t.addSelf(h[n].position);t.multiplyScalar(x-3);t.addSelf(i);t.addSelf(k.multiplyScalar(2));t.divideScalar(x);d[n].position=t}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)l=h.vertexColors[m[o]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}g.push(k);(!f.supportUVs||p.length!=0)&&e.push([p[a],p[b],p[c],p[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},o={},p=[],n,r,m,s,u,t=a.faceVertexUvs[0];n=0;for(r=t.length;n<r;n++){m=0;for(s=t[n].length;m<s;m++)u=d[n]["abcd".charAt(m)],p[u]||(p[u]=t[n][m])}var q;n=0;for(r=d.length;n<r;n++)if(u=d[n],k.push(u.centroid),i.push(new THREE.Vertex(u.centroid)),f.supportUVs&&p.length!=0){q=new THREE.UV;if(u instanceof THREE.Face3)q.u=p[u.a].u+p[u.b].u+p[u.c].u,q.v=p[u.a].v+p[u.b].v+p[u.c].v,q.u/=3,q.v/=3;else if(u instanceof THREE.Face4)q.u=
+p[u.a].u+p[u.b].u+p[u.c].u+p[u.d].u,q.v=p[u.a].v+p[u.b].v+p[u.c].v+p[u.d].v,q.u/=4,q.v/=4;p.push(q)}r=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var A=0,t=h.length,w,E,x={},I={},M=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},D=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(n in r){q=r[n];w=n.split("_");E=w[0];w=w[1];M(E,[E,w]);M(w,[E,w]);m=0;for(s=q.length;m<s;m++)u=q[m],D(E,u,n),D(w,u,n);q.length<2&&(o[n]=!0)}for(n in r)if(q=r[n],u=q[0],q=q[1],w=n.split("_"),E=w[0],w=w[1],s=new THREE.Vector3,o[n]?(s.addSelf(h[E].position),s.addSelf(h[w].position),s.multiplyScalar(0.5)):(s.addSelf(k[u]),s.addSelf(k[q]),s.addSelf(h[E].position),s.addSelf(h[w].position),s.multiplyScalar(0.25)),
+l[n]=t+d.length+A,i.push(new THREE.Vertex(s)),A++,f.supportUVs&&p.length!=0)q=new THREE.UV,q.u=p[E].u+p[w].u,q.v=p[E].v+p[w].v,q.u/=2,q.v/=2,p.push(q);var F,P;w=["123","12","2","23"];s=["123","23","3","31"];var M=["123","31","1","12"],D=["1234","12","2","23"],K=["1234","23","3","34"],$=["1234","34","4","41"],S=["1234","41","1","12"];n=0;for(r=k.length;n<r;n++)u=d[n],q=t+n,u instanceof THREE.Face3?(A=b(u.a,u.b),E=b(u.b,u.c),F=b(u.c,u.a),c(q,l[A],u.b,l[E],u,w),c(q,l[E],u.c,l[F],u,s),c(q,l[F],u.a,l[A],
+u,M)):u instanceof THREE.Face4?(A=b(u.a,u.b),E=b(u.b,u.c),F=b(u.c,u.d),P=b(u.d,u.a),c(q,l[A],u.b,l[E],u,D),c(q,l[E],u.c,l[F],u,K),c(q,l[F],u.d,l[P],u,$),c(q,l[P],u.a,l[A],u,S)):console.log("face should be a face!",u);d=i;i=new THREE.Vector3;l=new THREE.Vector3;n=0;for(r=h.length;n<r;n++)if(x[n]!==void 0){i.set(0,0,0);l.set(0,0,0);u=new THREE.Vector3(0,0,0);q=0;for(m in I[n])i.addSelf(k[m]),q++;A=0;t=x[n].length;for(m=0;m<t;m++)o[b(x[n][m][0],x[n][m][1])]&&A++;if(A!=2){i.divideScalar(q);for(m=0;m<
+t;m++)q=x[n][m],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),l.addSelf(q);l.divideScalar(t);u.addSelf(h[n].position);u.multiplyScalar(t-3);u.addSelf(i);u.addSelf(l.multiplyScalar(2));u.divideScalar(t);d[n].position=u}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 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={constructor:THREE.Loader,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.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
@@ -547,123 +547,125 @@ a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this
 if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=e(a.colorDiffuse);
 else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=e(a.colorSpecular);if(a.colorAmbient)f.ambient=e(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(l.uniforms),m=f.color;h=f.specular;i=f.ambient;var o=f.shininess;k.tNormal.texture=f.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(f.map)k.tDiffuse.texture=f.map,k.enableDiffuse.value=!0;if(f.specularMap)k.tSpecular.texture=f.specularMap,k.enableSpecular.value=!0;if(f.lightMap)k.tAO.texture=
-f.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=o;if(f.opacity)k.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:k,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(k.uniforms),o=f.color;h=f.specular;i=f.ambient;var p=f.shininess;l.tNormal.texture=f.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(f.map)l.tDiffuse.texture=f.map,l.enableDiffuse.value=!0;if(f.specularMap)l.tSpecular.texture=f.specularMap,l.enableSpecular.value=!0;if(f.lightMap)l.tAO.texture=
+f.lightMap,l.enableAO.value=!0;l.uDiffuseColor.value.setHex(o);l.uSpecularColor.value.setHex(h);l.uAmbientColor.value.setHex(i);l.uShininess.value=p;if(f.opacity)l.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:!0,fog:!0})}else f=new THREE[h](f);return 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,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,e){var f=new XMLHttpRequest;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,e)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
 f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",
 f,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),f=k(a,b+2),g=k(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function l(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function m(b){var c,
-d,e;c=g(a,b);d=g(a,b+y);e=g(a,b+G);b=i(a,b+K);t.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+y);e=g(a,b+G);f=i(a,b+K);j=g(a,b+F);k=g(a,b+z);l=g(a,b+D);var b=s[k*3],m=s[k*3+1];k=s[k*3+2];var n=s[l*3],o=s[l*3+1];l=s[l*3+2];t.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(s[j*3],s[j*3+1],s[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+J);f=g(a,b+$);b=i(a,b+L);t.faces.push(new THREE.Face4(c,
-d,e,f,null,null,b))}function u(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+P);e=g(a,b+J);f=g(a,b+$);j=i(a,b+L);k=g(a,b+Q);l=g(a,b+da);m=g(a,b+ia);n=g(a,b+S);var b=s[l*3],o=s[l*3+1];l=s[l*3+2];var T=s[m*3],w=s[m*3+1];m=s[m*3+2];var H=s[n*3],p=s[n*3+1];n=s[n*3+2];t.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(s[k*3],s[k*3+1],s[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(T,w,m),new THREE.Vector3(H,p,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+A);e=g(a,b+C);b=v[c*2];f=v[c*2+
-1];c=v[d*2];var i=t.faceVertexUvs[0];d=v[d*2+1];var j=v[e*2];e=v[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function r(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+I);e=g(a,b+j);f=g(a,b+O);b=v[c*2];i=v[c*2+1];c=v[d*2];k=v[d*2+1];d=v[e*2];var l=t.faceVertexUvs[0];e=v[e*2+1];var m=v[f*2];f=v[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var t=this,x=0,q,s=[],v=[],y,
-G,K,F,z,D,P,J,$,L,Q,da,ia,S,A,C,I,j,O,fa,Y,R,N,ea,V;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(t,d,b);q={signature:a.substr(x,8),header_bytes:k(a,x+8),vertex_coordinate_bytes:k(a,x+9),normal_coordinate_bytes:k(a,x+10),uv_coordinate_bytes:k(a,x+11),vertex_index_bytes:k(a,x+12),normal_index_bytes:k(a,x+13),uv_index_bytes:k(a,x+14),material_index_bytes:k(a,x+15),nvertices:g(a,x+16),nnormals:g(a,x+16+4),nuvs:g(a,x+16+8),ntri_flat:g(a,x+16+12),ntri_smooth:g(a,x+16+16),ntri_flat_uv:g(a,
-x+16+20),ntri_smooth_uv:g(a,x+16+24),nquad_flat:g(a,x+16+28),nquad_smooth:g(a,x+16+32),nquad_flat_uv:g(a,x+16+36),nquad_smooth_uv:g(a,x+16+40)};x+=q.header_bytes;y=q.vertex_index_bytes;G=q.vertex_index_bytes*2;K=q.vertex_index_bytes*3;F=q.vertex_index_bytes*3+q.material_index_bytes;z=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;J=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;L=q.vertex_index_bytes*
-4;Q=q.vertex_index_bytes*4+q.material_index_bytes;da=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ia=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;S=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;A=q.uv_index_bytes;C=q.uv_index_bytes*2;I=q.uv_index_bytes;j=q.uv_index_bytes*2;O=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;V=q.vertex_index_bytes*4+q.material_index_bytes;fa=q.ntri_flat*b;Y=q.ntri_smooth*(b+q.normal_index_bytes*
-3);R=q.ntri_flat_uv*(b+q.uv_index_bytes*3);N=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ea=q.nquad_flat*V;b=q.nquad_smooth*(V+q.normal_index_bytes*4);V=q.nquad_flat_uv*(V+q.uv_index_bytes*4);x+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+q.vertex_coordinate_bytes),g=c(a,b+q.vertex_coordinate_bytes*2),t.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(x);x+=function(b){for(var c,d,e,f=q.normal_coordinate_bytes*
-3,g=b+q.nnormals*f;b<g;b+=f)c=l(a,b),d=l(a,b+q.normal_coordinate_bytes),e=l(a,b+q.normal_coordinate_bytes*2),s.push(c/127,d/127,e/127);return q.nnormals*f}(x);x+=function(b){for(var d,e,g=q.uv_coordinate_bytes*2,h=b+q.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+q.uv_coordinate_bytes),v.push(d,e);return q.nuvs*g}(x);fa=x+fa;Y=fa+Y;R=Y+R;N=R+N;ea=N+ea;b=ea+b;V=b+V;(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=c+q.uv_index_bytes*3,e=a+q.ntri_flat_uv*d;for(b=a;b<e;b+=d)m(b),p(b+c);return e-
-a})(Y);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=c+q.uv_index_bytes*3,e=a+q.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),p(b+c);return e-a})(R);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=c+q.uv_index_bytes*4,e=a+q.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),r(b+c);return e-a})(b);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,d=c+q.uv_index_bytes*4,e=a+q.nquad_smooth_uv*d;for(b=a;b<e;b+=d)u(b),
-r(b+c);return e-a})(V);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=a+q.ntri_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(x);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=a+q.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(fa);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=a+q.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(N);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*
-4,d=a+q.nquad_smooth*c;for(b=a;b<d;b+=c)u(b);return d-a})(ea);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
-THREE.ColladaLoader=function(){function a(a,d,g){Y=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),ua=a.length<1?"":a.join("/")+"/");ca=c("//dae:library_images/dae:image",f,"image");qa=c("//dae:library_materials/dae:material",K,"material");ma=c("//dae:library_effects/dae:effect",J,"effect");ka=c("//dae:library_geometries/dae:geometry",r,"geometry");X=c("//dae:library_controllers/dae:controller",h,"controller");Z=c("//dae:library_animations/dae:animation",L,"animation");sa=c(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");pa=[];ra=[];(a=Y.evaluate(".//dae:scene/dae:instance_visual_scene",Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),N=sa[a]):N=null;R=new THREE.Object3D;for(a=0;a<N.nodes.length;a++)R.add(e(N.nodes[a]));b();for(var i in Z);i={scene:R,morphs:pa,skins:ra,dae:{images:ca,materials:qa,effects:ma,geometries:ka,controllers:X,animations:Z,visualScenes:sa,scene:N}};d&&d(i);return i}function c(a,b,c){for(var a=Y.evaluate(a,Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in Z)for(var e=Z[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
-THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=X[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=N.getChildById(c.skeleton[0],!0)||N.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=l(a,b),e=l(a,b+1),f=l(a,b+2),g=l(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function o(b){var c,
+d,e;c=g(a,b);d=g(a,b+E);e=g(a,b+x);b=i(a,b+I);u.faces.push(new THREE.Face3(c,d,e,null,null,b))}function p(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+E);e=g(a,b+x);f=i(a,b+I);j=g(a,b+M);k=g(a,b+D);l=g(a,b+F);var b=A[k*3],m=A[k*3+1];k=A[k*3+2];var n=A[l*3],o=A[l*3+1];l=A[l*3+2];u.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(A[j*3],A[j*3+1],A[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+K);f=g(a,b+$);b=i(a,b+S);u.faces.push(new THREE.Face4(c,
+d,e,f,null,null,b))}function r(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+P);e=g(a,b+K);f=g(a,b+$);j=i(a,b+S);k=g(a,b+R);l=g(a,b+V);m=g(a,b+ja);n=g(a,b+y);var b=A[l*3],o=A[l*3+1];l=A[l*3+2];var p=A[m*3],v=A[m*3+1];m=A[m*3+2];var J=A[n*3],r=A[n*3+1];n=A[n*3+2];u.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(A[k*3],A[k*3+1],A[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(p,v,m),new THREE.Vector3(J,r,n)],null,j))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+H);e=g(a,b+z);b=w[c*2];f=w[c*2+1];
+c=w[d*2];var i=u.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function s(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+L);e=g(a,b+j);f=g(a,b+aa);b=w[c*2];i=w[c*2+1];c=w[d*2];k=w[d*2+1];d=w[e*2];var l=u.faceVertexUvs[0];e=w[e*2+1];var m=w[f*2];f=w[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var u=this,t=0,q,A=[],w=[],E,x,
+I,M,D,F,P,K,$,S,R,V,ja,y,H,z,L,j,aa,ga,N,W,T,ca,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(u,d,b);q={signature:a.substr(t,8),header_bytes:l(a,t+8),vertex_coordinate_bytes:l(a,t+9),normal_coordinate_bytes:l(a,t+10),uv_coordinate_bytes:l(a,t+11),vertex_index_bytes:l(a,t+12),normal_index_bytes:l(a,t+13),uv_index_bytes:l(a,t+14),material_index_bytes:l(a,t+15),nvertices:g(a,t+16),nnormals:g(a,t+16+4),nuvs:g(a,t+16+8),ntri_flat:g(a,t+16+12),ntri_smooth:g(a,t+16+16),ntri_flat_uv:g(a,
+t+16+20),ntri_smooth_uv:g(a,t+16+24),nquad_flat:g(a,t+16+28),nquad_smooth:g(a,t+16+32),nquad_flat_uv:g(a,t+16+36),nquad_smooth_uv:g(a,t+16+40)};t+=q.header_bytes;E=q.vertex_index_bytes;x=q.vertex_index_bytes*2;I=q.vertex_index_bytes*3;M=q.vertex_index_bytes*3+q.material_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;F=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;K=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;S=q.vertex_index_bytes*
+4;R=q.vertex_index_bytes*4+q.material_index_bytes;V=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ja=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;y=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;H=q.uv_index_bytes;z=q.uv_index_bytes*2;L=q.uv_index_bytes;j=q.uv_index_bytes*2;aa=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;Q=q.vertex_index_bytes*4+q.material_index_bytes;ga=q.ntri_flat*b;N=q.ntri_smooth*(b+q.normal_index_bytes*
+3);W=q.ntri_flat_uv*(b+q.uv_index_bytes*3);T=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ca=q.nquad_flat*Q;b=q.nquad_smooth*(Q+q.normal_index_bytes*4);Q=q.nquad_flat_uv*(Q+q.uv_index_bytes*4);t+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+q.vertex_coordinate_bytes),g=c(a,b+q.vertex_coordinate_bytes*2),u.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(t);t+=function(b){for(var c,d,e,f=q.normal_coordinate_bytes*
+3,g=b+q.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+q.normal_coordinate_bytes),e=k(a,b+q.normal_coordinate_bytes*2),A.push(c/127,d/127,e/127);return q.nnormals*f}(t);t+=function(b){for(var d,e,g=q.uv_coordinate_bytes*2,h=b+q.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+q.uv_coordinate_bytes),w.push(d,e);return q.nuvs*g}(t);ga=t+ga;N=ga+N;W=N+W;T=W+T;ca=T+ca;b=ca+b;Q=b+Q;(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=c+q.uv_index_bytes*3,e=a+q.ntri_flat_uv*d;for(b=a;b<e;b+=d)o(b),m(b+c);return e-
+a})(N);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=c+q.uv_index_bytes*3,e=a+q.ntri_smooth_uv*d;for(b=a;b<e;b+=d)p(b),m(b+c);return e-a})(W);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=c+q.uv_index_bytes*4,e=a+q.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),s(b+c);return e-a})(b);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,d=c+q.uv_index_bytes*4,e=a+q.nquad_smooth_uv*d;for(b=a;b<e;b+=d)r(b),
+s(b+c);return e-a})(Q);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=a+q.ntri_flat*c;for(b=a;b<d;b+=c)o(b);return d-a})(t);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=a+q.ntri_smooth*c;for(b=a;b<d;b+=c)p(b);return d-a})(ga);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=a+q.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(T);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*
+4,d=a+q.nquad_smooth*c;for(b=a;b<d;b+=c)r(b);return d-a})(ca);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,d,g){N=a;d=d||ca;g!==void 0&&(a=g.split("/"),a.pop(),ta=a.length<1?"":a.join("/")+"/");C=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",I,"material");la=c("//dae:library_effects/dae:effect",K,"effect");X=c("//dae:library_geometries/dae:geometry",s,"geometry");da=c("//dae:library_controllers/dae:controller",h,"controller");ka=c("//dae:library_animations/dae:animation",S,"animation");ra=c(".//dae:library_visual_scenes/dae:visual_scene",
+l,"visual_scene");pa=[];qa=[];(a=N.evaluate(".//dae:scene/dae:instance_visual_scene",N,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),T=ra[a]):T=null;W=new THREE.Object3D;for(a=0;a<T.nodes.length;a++)W.add(e(T.nodes[a]));b();for(var i in ka);i={scene:W,morphs:pa,skins:qa,dae:{images:C,materials:oa,effects:la,geometries:X,controllers:da,animations:ka,visualScenes:ra,scene:T}};d&&d(i);return i}function c(a,b,c){for(var a=N.evaluate(a,N,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in ka)for(var e=ka[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];
+f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=da[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=T.getChildById(c.skeleton[0],!0)||T.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
 for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var r=0;r<i.weights[p].length;r++){var q=i.weights[p][r];q.joint==m&&j.weights.push(q)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=X[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
-new p;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(X[i.skin.source]&&(d=i=X[i.skin.source],i.morph&&ka[i.morph.source]))j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
-0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=0,m;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){m=j[h];var o=ma[qa[m.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;m=k[m.symbol]=o.material;l++}j=m||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
-i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=X[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);else if(d!==void 0){h=i;k=d instanceof n?X[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=ka[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+pa.length;pa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function u(){this.target=this.symbol=""}function p(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function x(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function s(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function y(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function G(a){this.id=a;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function F(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function z(a,b){this.type=a;this.effect=b;this.material=null}function D(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function Q(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function da(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ia(a){var b=a.getAttribute("id");
-if(V[b]!=void 0)return V[b];V[b]=(new G(b)).parse(a);return V[b]}function S(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function A(a){for(var a=I(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function C(a){for(var a=I(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function I(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(a===
-void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function fa(a,b){var c="";c+=O(a.x,b)+",";c+=O(a.y,b)+",";c+=O(a.z,b);return c}var Y=null,R=null,N,ea=null,V={},ca={},Z={},X={},ka={},qa={},ma={},sa,ua,pa,ra,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new G).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new y).parse(d))}}return b};
-l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=A(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new G).parse(f);b[f.id]=f;break;case "joints":c=
-f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new y).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
-a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new y).parse(g));break;case "v":c=C(g.textContent);break;case "vcount":d=C(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=
-function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};m.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
-b);if(d)return d}return null};m.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new p).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=Y.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Y,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Z)for(var e=Z[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=da[a.controllers[f].url];switch(i.type){case "skin":if(X[i.skin.source]){var j=
+new m;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(da[i.skin.source]&&(d=i=da[i.skin.source],i.morph&&X[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(X[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=X[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=la[oa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
+i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=da[c.url],j.skinInstanceController=c,j.name="skin_"+qa.length,qa.push(j);else if(d!==void 0){h=i;k=d instanceof n?da[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=X[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+pa.length;pa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function r(){this.target=this.symbol=""}function m(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function E(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function M(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function D(a,b){this.type=a;this.effect=b;this.material=null}function F(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
+this.source=null}function K(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function R(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function V(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=a.getAttribute("id");
+if(Q[b]!=void 0)return Q[b];Q[b]=(new x(b)).parse(a);return Q[b]}function y(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function H(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function z(a){for(var a=L(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function L(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(a===
+void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ga(a,b){var c="";c+=aa(a.x,b)+",";c+=aa(a.y,b)+",";c+=aa(a.z,b);return c}var N=null,W=null,T,ca=null,Q={},C={},ka={},da={},X={},oa={},la={},ra,ta,pa,qa,wa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new E).parse(d))}}return b};
+k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=H(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
+f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new E).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new E).parse(g));break;case "v":c=z(g.textContent);break;case "vcount":d=z(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new o).parse(c))}}return this};o.prototype.getChannelForTransform=
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};o.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
+b);if(d)return d}return null};o.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};o.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};o.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new o).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=N.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",N,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ka)for(var e=ka[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
 if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
-this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=A(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
+this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=H(a.textContent);this.updateMatrix();return this};p.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=Y.evaluate(".//dae:instance_material",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new u).parse(d)),d=c.iterateNext()}}return this};u.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};p.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=Y.evaluate(".//dae:instance_material",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new u).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=fa(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ia(d);break;case "vertices":this.vertices=(new v).parse(d);break;case "triangles":this.primitives.push((new q).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new x).parse(d))}}var e=
-{};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};t.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],r=[],q={},t=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=fa(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":q[i.set]===void 0&&(q[i.set]=[]);q[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var s;n==3?s=new THREE.Face3(p[0],p[1],p[2],[r[0],r[1],r[2]],t.length?t:new THREE.Color):n==4&&(s=new THREE.Face4(p[0],p[1],p[2],p[3],[r[0],r[1],r[2],r[3]],t.length?t:new THREE.Color));s.daeMaterial=a.material;b.faces.push(s);for(f=0;f<o.length;f++)e=q[o[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=h.length*n}};x.prototype=new q;x.prototype.constructor=x;q.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};q.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new y).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};s.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"input"){var c=(new y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};G.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=I(c.textContent),
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=A(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=C(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new s).parse(c.childNodes[d]);break}}}return this};
-G.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};K.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new $).parse(a.childNodes[b]);break}return this};F.prototype.isColor=function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=A(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
-c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};z.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new F).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=Y.evaluate(".//dae:float",c,S,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};z.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof F)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ca[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(ua+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=N.evaluate(".//dae:instance_material",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new r).parse(d)),d=c.iterateNext()}}return this};r.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=N.evaluate(".//dae:instance_material",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new r).parse(b)),b=a.iterateNext();break}}return this};s.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+(new u(this)).parse(c)}}return this};u.prototype.parse=function(a){function b(a,c){var d=ga(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ja(d);break;case "vertices":this.vertices=(new w).parse(d);break;case "triangles":this.primitives.push((new q).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(d))}}var e=
+{};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
+return this};u.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],r=[],q={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=Q[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ga(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":q[i.set]===void 0&&(q[i.set]=[]);q[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var u;n==3?u=new THREE.Face3(p[0],p[1],p[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color):n==4&&(u=new THREE.Face4(p[0],p[1],p[2],p[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<o.length;f++)e=q[o[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=h.length*n}};t.prototype=new q;t.prototype.constructor=t;q.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};q.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new E).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+z(c.textContent);break;case "p":this.p=z(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"input"){var c=(new E).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};E.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=L(c.textContent),
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=L(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new A).parse(c.childNodes[d]);break}}}return this};
+x.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};I.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new $).parse(a.childNodes[b]);break}return this};M.prototype.isColor=function(){return this.texture==null};M.prototype.isTexture=function(){return this.texture!=null};M.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=H(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
+c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new M).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=N.evaluate(".//dae:float",c,y,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof M)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=C[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(ta+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=wa;return this.material=new THREE.MeshLambertMaterial(a)};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
 if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};P.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new D(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new P(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new z(c.nodeName,this)).parse(c)}}};$.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new G).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new da(this)).parse(c));break;case "channel":this.channel.push((new Q(this)).parse(c))}}return this};Q.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};da.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new y).parse(c))}}return this};
-da.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};K.prototype.create=function(){if(this.shader==null)return null};K.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+K.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new F(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new P(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};K.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};K.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new D(c.nodeName,this)).parse(c)}}};$.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new V(this)).parse(c));break;case "channel":this.channel.push((new R(this)).parse(c))}}return this};R.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};V.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new E).parse(c))}}return this};
+V.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
-200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:g,geometries:ka}};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;
+200))ca=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){wa=a},applySkin:g,geometries:X}};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,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var e=new XMLHttpRequest,f=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+e.status+"]");else e.readyState==3?g&&(f==0&&(f=e.getResponseHeader("Content-Length")),g({total:f,loaded:e.responseText.length})):
 e.readyState==2&&(f=e.getResponseHeader("Content-Length"))};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,l,k,m,o,n,u,p,r,t,x,q,s=a.faces;m=a.vertices;var v=a.normals,y=a.colors,G=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&G++;for(c=0;c<G;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=m.length;l<
-k;)o=new THREE.Vertex,o.position.x=m[l++]*b,o.position.y=m[l++]*b,o.position.z=m[l++]*b,d.vertices.push(o);l=0;for(k=s.length;l<k;){b=s[l++];m=b&1;i=b&2;c=b&4;g=b&8;n=b&16;o=b&32;p=b&64;b&=128;m?(r=new THREE.Face4,r.a=s[l++],r.b=s[l++],r.c=s[l++],r.d=s[l++],m=4):(r=new THREE.Face3,r.a=s[l++],r.b=s[l++],r.c=s[l++],m=3);if(i)i=s[l++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<G;c++)t=a.uvs[c],u=s[l++],q=t[u*2],u=t[u*2+1],d.faceUvs[c][i]=new THREE.UV(q,u);if(g)for(c=0;c<G;c++){t=a.uvs[c];x=[];
-for(g=0;g<m;g++)u=s[l++],q=t[u*2],u=t[u*2+1],x[g]=new THREE.UV(q,u);d.faceVertexUvs[c][i]=x}if(n)n=s[l++]*3,g=new THREE.Vector3,g.x=v[n++],g.y=v[n++],g.z=v[n],r.normal=g;if(o)for(c=0;c<m;c++)n=s[l++]*3,g=new THREE.Vector3,g.x=v[n++],g.y=v[n++],g.z=v[n],r.vertexNormals.push(g);if(p)o=s[l++],o=new THREE.Color(y[o]),r.color=o;if(b)for(c=0;c<m;c++)o=s[l++],o=new THREE.Color(y[o]),r.vertexColors.push(o);d.faces.push(r)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,l,k,m,o,n,u;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
-u=a.morphTargets[c].vertices;i=0;for(l=u.length;i<l;i+=3)k=u[i]*b,m=u[i+1]*b,o=u[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,m,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(k[b],k[b+1],k[b+2]),l.push(m)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
-d.computeTangents();c(d)};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,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(n in L.objects)if(!C.objects[n])if(x=L.objects[n],x.geometry!==void 0){if(z=C.geometries[x.geometry]){a=!1;for(j=0;j<x.materials.length;j++)$=C.materials[x.materials[j]],a=$ instanceof THREE.ShaderMaterial;a&&z.computeTangents();v=x.position;y=x.rotation;G=x.quaternion;
-K=x.scale;G=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);a=new THREE.Mesh(z,$);a.name=n;a.position.set(v[0],v[1],v[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(K[0],K[1],K[2]);a.visible=x.visible;C.scene.add(a);C.objects[n]=a;if(x.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(x.castsShadow)b=new THREE.ShadowVolume(z),C.scene.add(b),b.position=
-a.position,b.rotation=a.rotation,b.scale=a.scale;x.trigger&&x.trigger.toLowerCase()!="none"&&(b={type:x.trigger,object:x},C.triggers[a.name]=b)}}else v=x.position,y=x.rotation,G=x.quaternion,K=x.scale,G=0,a=new THREE.Object3D,a.name=n,a.position.set(v[0],v[1],v[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(K[0],K[1],K[2]),a.visible=x.visible!==void 0?x.visible:!1,C.scene.add(a),C.objects[n]=a,C.empties[n]=a,x.trigger&&x.trigger.toLowerCase()!=
-"none"&&(b={type:x.trigger,object:x},C.triggers[a.name]=b)}function i(a){return function(c){C.geometries[a]=c;h();da-=1;b.onLoadComplete();k()}}function l(a){return function(b){C.geometries[a]=b}}function k(){b.callbackProgress({totalModels:S,totalTextures:A,loadedModels:S-da,loadedTextures:A-ia},C);b.onLoadProgress();da==0&&ia==0&&c(C)}var m,o,n,u,p,r,t,x,q,s,v,y,G,K,F,z,D,P,J,$,L,Q,da,ia,S,A,C;L=a.data;J=new THREE.BinaryLoader;Q=new THREE.JSONLoader;ia=da=0;C={scene:new THREE.Scene,geometries:{},
-materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in L.objects)if(x=L.objects[n],x.meshCollider){a=!0;break}if(a)C.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;q=L.transform.rotation;var I=L.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);q&&C.scene.rotation.set(q[0],q[1],q[2]);I&&C.scene.scale.set(I[0],I[1],I[2]);(a||q||I)&&C.scene.updateMatrix()}a=function(){ia-=1;k();b.onLoadComplete()};for(p in L.cameras)q=
-L.cameras[p],q.type=="perspective"?D=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):q.type=="ortho"&&(D=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),v=q.position,q=q.target,D.position.set(v[0],v[1],v[2]),D.target=new THREE.Vector3(q[0],q[1],q[2]),C.cameras[p]=D;for(u in L.lights)q=L.lights[u],p=q.color!==void 0?q.color:16777215,D=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(v=q.direction,s=new THREE.DirectionalLight(p,D),s.position.set(v[0],v[1],
-v[2]),s.position.normalize()):q.type=="point"?(v=q.position,s=q.distance,s=new THREE.PointLight(p,D,s),s.position.set(v[0],v[1],v[2])):q.type=="ambient"&&(s=new THREE.AmbientLight(p)),C.scene.add(s),C.lights[u]=s;for(r in L.fogs)u=L.fogs[r],u.type=="linear"?P=new THREE.Fog(0,u.near,u.far):u.type=="exp2"&&(P=new THREE.FogExp2(0,u.density)),q=u.color,P.color.setRGB(q[0],q[1],q[2]),C.fogs[r]=P;if(C.cameras&&L.defaults.camera)C.currentCamera=C.cameras[L.defaults.camera];if(C.fogs&&L.defaults.fog)C.scene.fog=
-C.fogs[L.defaults.fog];q=L.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(q[0],q[1],q[2]);C.bgColorAlpha=L.defaults.bgalpha;for(m in L.geometries)if(r=L.geometries[m],r.type=="bin_mesh"||r.type=="ascii_mesh")da+=1,b.onLoadStart();S=da;for(m in L.geometries)r=L.geometries[m],r.type=="cube"?(z=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),C.geometries[m]=z):r.type=="plane"?(z=new THREE.PlaneGeometry(r.width,r.height,
-r.segmentsWidth,r.segmentsHeight),C.geometries[m]=z):r.type=="sphere"?(z=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),C.geometries[m]=z):r.type=="cylinder"?(z=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),C.geometries[m]=z):r.type=="torus"?(z=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),C.geometries[m]=z):r.type=="icosahedron"?(z=new THREE.IcosahedronGeometry(r.subdivisions),C.geometries[m]=z):r.type=="bin_mesh"?J.load(d(r.url,
-L.urlBaseType),i(m)):r.type=="ascii_mesh"?Q.load(d(r.url,L.urlBaseType),i(m)):r.type=="embedded_mesh"&&(r=L.embeds[r.id])&&Q.createModel(r,l(m),"");for(t in L.textures)if(m=L.textures[t],m.url instanceof Array){ia+=m.url.length;for(J=0;J<m.url.length;J++)b.onLoadStart()}else ia+=1,b.onLoadStart();A=ia;for(t in L.textures){m=L.textures[t];if(m.mapping!=void 0&&THREE[m.mapping]!=void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){J=[];for(var j=0;j<m.url.length;j++)J[j]=d(m.url[j],L.urlBaseType);
-J=THREE.ImageUtils.loadTextureCube(J,m.mapping,a)}else{J=THREE.ImageUtils.loadTexture(d(m.url,L.urlBaseType),m.mapping,a);if(THREE[m.minFilter]!=void 0)J.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=void 0)J.magFilter=THREE[m.magFilter];if(m.repeat){J.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!=1)J.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!=1)J.wrapT=THREE.RepeatWrapping}m.offset&&J.offset.set(m.offset[0],m.offset[1]);if(m.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
-if(Q[m.wrap[0]]!==void 0)J.wrapS=Q[m.wrap[0]];if(Q[m.wrap[1]]!==void 0)J.wrapT=Q[m.wrap[1]]}}C.textures[t]=J}for(o in L.materials){t=L.materials[o];for(F in t.parameters)if(F=="envMap"||F=="map"||F=="lightMap")t.parameters[F]=C.textures[t.parameters[F]];else if(F=="shading")t.parameters[F]=t.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")t.parameters[F]=THREE[t.parameters[F]]?THREE[t.parameters[F]]:THREE.NormalBlending;else if(F=="combine")t.parameters[F]=t.parameters[F]==
-"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(F=="vertexColors")if(t.parameters[F]=="face")t.parameters[F]=THREE.FaceColors;else if(t.parameters[F])t.parameters[F]=THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=!0;if(t.parameters.normalMap){m=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(m.uniforms);J=t.parameters.color;Q=t.parameters.specular;r=t.parameters.ambient;P=t.parameters.shininess;a.tNormal.texture=C.textures[t.parameters.normalMap];
-if(t.parameters.normalMapFactor)a.uNormalScale.value=t.parameters.normalMapFactor;if(t.parameters.map)a.tDiffuse.texture=t.parameters.map,a.enableDiffuse.value=!0;if(t.parameters.lightMap)a.tAO.texture=t.parameters.lightMap,a.enableAO.value=!0;if(t.parameters.specularMap)a.tSpecular.texture=C.textures[t.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(J);a.uSpecularColor.value.setHex(Q);a.uAmbientColor.value.setHex(r);a.uShininess.value=P;if(t.parameters.opacity)a.uOpacity.value=
-t.parameters.opacity;t=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:a,lights:!0,fog:!0})}else t=new THREE[t.type](t.parameters);C.materials[o]=t}h();b.callbackSync(C);k()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,l,o,p,n,r,m,s,u,t,q,A=a.faces;o=a.vertices;var w=a.normals,E=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=o.length;k<
+l;)p=new THREE.Vertex,p.position.x=o[k++]*b,p.position.y=o[k++]*b,p.position.z=o[k++]*b,d.vertices.push(p);k=0;for(l=A.length;k<l;){b=A[k++];o=b&1;i=b&2;c=b&4;g=b&8;n=b&16;p=b&32;m=b&64;b&=128;o?(s=new THREE.Face4,s.a=A[k++],s.b=A[k++],s.c=A[k++],s.d=A[k++],o=4):(s=new THREE.Face3,s.a=A[k++],s.b=A[k++],s.c=A[k++],o=3);if(i)i=A[k++],s.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)u=a.uvs[c],r=A[k++],q=u[r*2],r=u[r*2+1],d.faceUvs[c][i]=new THREE.UV(q,r);if(g)for(c=0;c<x;c++){u=a.uvs[c];t=[];
+for(g=0;g<o;g++)r=A[k++],q=u[r*2],r=u[r*2+1],t[g]=new THREE.UV(q,r);d.faceVertexUvs[c][i]=t}if(n)n=A[k++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],s.normal=g;if(p)for(c=0;c<o;c++)n=A[k++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],s.vertexNormals.push(g);if(m)p=A[k++],p=new THREE.Color(E[p]),s.color=p;if(b)for(c=0;c<o;c++)p=A[k++],p=new THREE.Color(E[p]),s.vertexColors.push(p);d.faces.push(s)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,l,o,p,n,r;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
+r=a.morphTargets[c].vertices;i=0;for(k=r.length;i<k;i+=3)l=r[i]*b,o=r[i+1]*b,p=r[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(l,o,p)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(l[b],l[b+1],l[b+2]),k.push(o)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
+THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(e){console.error(e),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
+d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(p in K.objects)if(!y.objects[p])if(u=K.objects[p],u.geometry!==void 0){if(M=y.geometries[u.geometry]){a=!1;for(z=0;z<u.materials.length;z++)P=y.materials[u.materials[z]],a=P instanceof THREE.ShaderMaterial;a&&M.computeTangents();A=u.position;w=u.rotation;E=u.quaternion;x=u.scale;E=0;P.length==0&&(P=new THREE.MeshFaceMaterial);P.length>1&&(P=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(M,P);a.name=p;a.position.set(A[0],A[1],A[2]);E?(a.quaternion.set(E[0],E[1],E[2],E[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(x[0],x[1],x[2]);a.visible=u.visible;y.scene.add(a);y.objects[p]=a;if(u.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(u.castsShadow)b=new THREE.ShadowVolume(M),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;u.trigger&&u.trigger.toLowerCase()!="none"&&(b=
+{type:u.trigger,object:u},y.triggers[a.name]=b)}}else A=u.position,w=u.rotation,E=u.quaternion,x=u.scale,E=0,a=new THREE.Object3D,a.name=p,a.position.set(A[0],A[1],A[2]),E?(a.quaternion.set(E[0],E[1],E[2],E[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(x[0],x[1],x[2]),a.visible=u.visible!==void 0?u.visible:!1,y.scene.add(a),y.objects[p]=a,y.empties[p]=a,u.trigger&&u.trigger.toLowerCase()!="none"&&(b={type:u.trigger,object:u},y.triggers[a.name]=b)}function e(a){return function(b){y.geometries[a]=
+b;g();S-=1;i.onLoadComplete();h()}}function f(a){return function(b){y.geometries[a]=b}}function h(){i.callbackProgress({totalModels:V,totalTextures:ja,loadedModels:V-S,loadedTextures:ja-R},y);i.onLoadProgress();S==0&&R==0&&c(y)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),l,o,p,n,r,m,s,u,t,q,A,w,E,x,I,M,D,F,P,K,$,S,R,V,ja,y;K=a;b=new THREE.BinaryLoader;$=new THREE.JSONLoader;R=S=0;y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(p in K.objects)if(u=K.objects[p],u.meshCollider){a=!0;break}if(a)y.scene.collisions=new THREE.CollisionSystem;if(K.transform){a=K.transform.position;t=K.transform.rotation;var H=K.transform.scale;a&&y.scene.position.set(a[0],a[1],a[2]);t&&y.scene.rotation.set(t[0],t[1],t[2]);H&&y.scene.scale.set(H[0],H[1],H[2]);(a||t||H)&&y.scene.updateMatrix()}a=function(){R-=1;h();i.onLoadComplete()};for(r in K.cameras)t=K.cameras[r],t.type=="perspective"?D=new THREE.PerspectiveCamera(t.fov,
+t.aspect,t.near,t.far):t.type=="ortho"&&(D=new THREE.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far)),A=t.position,t=t.target,D.position.set(A[0],A[1],A[2]),D.target=new THREE.Vector3(t[0],t[1],t[2]),y.cameras[r]=D;for(n in K.lights)t=K.lights[n],r=t.color!==void 0?t.color:16777215,D=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(A=t.direction,q=new THREE.DirectionalLight(r,D),q.position.set(A[0],A[1],A[2]),q.position.normalize()):t.type=="point"?(A=t.position,q=t.distance,
+q=new THREE.PointLight(r,D,q),q.position.set(A[0],A[1],A[2])):t.type=="ambient"&&(q=new THREE.AmbientLight(r)),y.scene.add(q),y.lights[n]=q;for(m in K.fogs)n=K.fogs[m],n.type=="linear"?F=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(F=new THREE.FogExp2(0,n.density)),t=n.color,F.color.setRGB(t[0],t[1],t[2]),y.fogs[m]=F;if(y.cameras&&K.defaults.camera)y.currentCamera=y.cameras[K.defaults.camera];if(y.fogs&&K.defaults.fog)y.scene.fog=y.fogs[K.defaults.fog];t=K.defaults.bgcolor;y.bgColor=new THREE.Color;
+y.bgColor.setRGB(t[0],t[1],t[2]);y.bgColorAlpha=K.defaults.bgalpha;for(l in K.geometries)if(m=K.geometries[l],m.type=="bin_mesh"||m.type=="ascii_mesh")S+=1,i.onLoadStart();V=S;for(l in K.geometries)m=K.geometries[l],m.type=="cube"?(M=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),y.geometries[l]=M):m.type=="plane"?(M=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),y.geometries[l]=M):m.type=="sphere"?
+(M=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),y.geometries[l]=M):m.type=="cylinder"?(M=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),y.geometries[l]=M):m.type=="torus"?(M=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),y.geometries[l]=M):m.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(m.subdivisions),y.geometries[l]=M):m.type=="bin_mesh"?b.load(d(m.url,K.urlBaseType),e(l)):m.type=="ascii_mesh"?$.load(d(m.url,K.urlBaseType),
+e(l)):m.type=="embedded_mesh"&&(m=K.embeds[m.id])&&$.createModel(m,f(l),"");for(s in K.textures)if(l=K.textures[s],l.url instanceof Array){R+=l.url.length;for(m=0;m<l.url.length;m++)i.onLoadStart()}else R+=1,i.onLoadStart();ja=R;for(s in K.textures){l=K.textures[s];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){m=[];for(var z=0;z<l.url.length;z++)m[z]=d(l.url[z],K.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,l.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(l.url,
+K.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)m.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!=void 0)m.magFilter=THREE[l.magFilter];if(l.repeat){m.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}l.offset&&m.offset.set(l.offset[0],l.offset[1]);if(l.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[l.wrap[0]]!==void 0)m.wrapS=F[l.wrap[0]];if(F[l.wrap[1]]!==void 0)m.wrapT=
+F[l.wrap[1]]}}y.textures[s]=m}for(o in K.materials){s=K.materials[o];for(I in s.parameters)if(I=="envMap"||I=="map"||I=="lightMap")s.parameters[I]=y.textures[s.parameters[I]];else if(I=="shading")s.parameters[I]=s.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")s.parameters[I]=THREE[s.parameters[I]]?THREE[s.parameters[I]]:THREE.NormalBlending;else if(I=="combine")s.parameters[I]=s.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I==
+"vertexColors")if(s.parameters[I]=="face")s.parameters[I]=THREE.FaceColors;else if(s.parameters[I])s.parameters[I]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);m=s.parameters.color;F=s.parameters.specular;b=s.parameters.ambient;$=s.parameters.shininess;a.tNormal.texture=y.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
+s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=y.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(m);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(b);a.uShininess.value=$;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,
+vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else s=new THREE[s.type](s.parameters);y.materials[o]=s}g();i.callbackSync(y);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var k,l,r,t=a.length;i<t;i+=f)k=a[i],l=a[i+1],r=a[i+2],k=k/16383*b,l=l/16383*b,r=r/16383*b,k+=d,l+=g,r+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,r)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,x,q,s,v=a.length;for(b=0;b<v;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;s=e;i=f;x=d;var y=e,G=f,K=g.materials[0],F=l[y*3],z=l[y*3+1],y=l[y*3+2],D=l[G*3],P=l[G*3+1],G=l[G*3+2];x=new THREE.Vector3(l[x*3],l[x*3+1],l[x*3+2]);y=new THREE.Vector3(F,z,y);G=new THREE.Vector3(D,P,G);g.faces.push(new THREE.Face3(q,s,i,[x,y,G],null,K));g=k[d*2];d=k[d*2+
-1];i=k[e*2];x=k[e*2+1];q=k[f*2];s=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=x;x=[];x.push(new THREE.UV(g,d));x.push(new THREE.UV(e,i));x.push(new THREE.UV(q,s));f.push(x)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,f,i){for(var k,l,s,u=a.length;i<u;i+=f)k=a[i],l=a[i+1],s=a[i+2],k=k/16383*b,l=l/16383*b,s=s/16383*b,k+=d,l+=g,s+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,s)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(f[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,t,q,A,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;A=e;i=f;t=d;var E=e,x=f,I=g.materials[0],M=k[E*3],D=k[E*3+1],E=k[E*3+2],F=k[x*3],P=k[x*3+1],x=k[x*3+2];t=new THREE.Vector3(k[t*3],k[t*3+1],k[t*3+2]);E=new THREE.Vector3(M,D,E);x=new THREE.Vector3(F,P,x);g.faces.push(new THREE.Face3(q,A,i,[t,E,x],null,I));g=l[d*2];d=l[d*2+
+1];i=l[e*2];t=l[e*2+1];q=l[f*2];A=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(q,A));f.push(t)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 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,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,l,k,m){f=(f-k)/(m-k);k=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=l;g[e]=this.lerp(k[a],k[a+3],f);g[e+1]=this.lerp(k[a+1],k[a+4],f);g[e+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,l,k,m){f=(f-k)/(m-k);k=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
-2]=l;c=a+this.yd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,l,k,m){f=(f-k)/(m-k);k=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=l+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[c+2],f)};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,g,e,f,h){var i=e+1,l=e+this.yd,k=e+this.zd,m=i+this.yd,o=i+this.zd,n=e+this.yd+this.zd,u=i+this.yd+this.zd,p=0,r=this.field[e],t=this.field[i],x=this.field[l],q=this.field[m],s=this.field[k],v=this.field[o],y=this.field[n],G=this.field[u];r<f&&(p|=1);t<f&&(p|=2);x<f&&(p|=8);q<f&&(p|=4);s<f&&(p|=16);v<f&&(p|=32);y<f&&(p|=128);G<f&&(p|=64);var K=THREE.edgeTable[p];if(K===0)return 0;
-var F=this.delta,z=a+F,D=c+F,F=g+F;K&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,r,t));K&2&&(this.compNorm(i),this.compNorm(m),this.VIntY(i*3,this.vlist,this.nlist,3,f,z,c,g,t,q));K&4&&(this.compNorm(l),this.compNorm(m),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,D,g,x,q));K&8&&(this.compNorm(e),this.compNorm(l),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,r,x));K&16&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,c,F,s,v));
-K&32&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,15,f,z,c,F,v,G));K&64&&(this.compNorm(n),this.compNorm(u),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,D,F,y,G));K&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,c,F,s,y));K&256&&(this.compNorm(e),this.compNorm(k),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,r,s));K&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,z,c,g,t,v));K&1024&&(this.compNorm(m),
-this.compNorm(u),this.VIntZ(m*3,this.vlist,this.nlist,30,f,z,D,g,q,G));K&2048&&(this.compNorm(l),this.compNorm(n),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,D,g,x,y));p<<=4;for(f=e=0;THREE.triTable[p+f]!=-1;)a=p+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+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,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,k,l,o){f=(f-l)/(o-l);l=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=k;g[e]=this.lerp(l[a],l[a+3],f);g[e+1]=this.lerp(l[a+1],l[a+4],f);g[e+2]=this.lerp(l[a+2],l[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,k,l,o){f=(f-l)/(o-l);l=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
+2]=k;c=a+this.yd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,k,l,o){f=(f-l)/(o-l);l=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=k+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};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,g,e,f,h){var i=e+1,k=e+this.yd,l=e+this.zd,o=i+this.yd,p=i+this.zd,n=e+this.yd+this.zd,r=i+this.yd+this.zd,m=0,s=this.field[e],u=this.field[i],t=this.field[k],q=this.field[o],A=this.field[l],w=this.field[p],E=this.field[n],x=this.field[r];s<f&&(m|=1);u<f&&(m|=2);t<f&&(m|=8);q<f&&(m|=4);A<f&&(m|=16);w<f&&(m|=32);E<f&&(m|=128);x<f&&(m|=64);var I=THREE.edgeTable[m];if(I===0)return 0;
+var M=this.delta,D=a+M,F=c+M,M=g+M;I&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,s,u));I&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,D,c,g,u,q));I&4&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,F,g,t,q));I&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,s,t));I&16&&(this.compNorm(l),this.compNorm(p),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,M,A,w));
+I&32&&(this.compNorm(p),this.compNorm(r),this.VIntY(p*3,this.vlist,this.nlist,15,f,D,c,M,w,x));I&64&&(this.compNorm(n),this.compNorm(r),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,F,M,E,x));I&128&&(this.compNorm(l),this.compNorm(n),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,M,A,E));I&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,s,A));I&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,D,c,g,u,w));I&1024&&(this.compNorm(o),
+this.compNorm(r),this.VIntZ(o*3,this.vlist,this.nlist,30,f,D,F,g,q,x));I&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,F,g,t,E));m<<=4;for(f=e=0;THREE.triTable[m+f]!=-1;)a=m+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
 3]=a[e];this.positionArray[i+4]=a[e+1];this.positionArray[i+5]=a[e+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[e];this.normalArray[i+4]=c[e+1];this.normalArray[i+5]=c[e+2];this.normalArray[i+6]=c[f];this.normalArray[i+7]=c[f+1];this.normalArray[i+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(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,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,l=c*this.size,k=a*this.size,m=Math.floor(i-h);m<1&&(m=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(l-h);o<1&&(o=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var u,p,r,t,x,q;m<i;m++){k=this.size2*m;p=m/this.size-g;x=p*p;for(p=o;p<l;p++){r=k+this.size*p;u=p/this.size-c;q=u*u;for(u=n;u<h;u++)t=u/this.size-a,t=e/(1.0E-6+t*t+q+x)-f,t>0&&(this.field[r+u]+=t)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,l=this.size,k=this.yd,m=this.zd,o=this.field,n=l*Math.sqrt(a/c);n>l&&(n=l);for(g=0;g<n;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<l;e++){i=g+e*k;for(f=0;f<l;f++)o[m*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
-i,l,k=this.size,m=this.yd,o=this.zd,n=this.field,u=k*Math.sqrt(a/c);u>k&&(u=k);for(e=0;e<u;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*m;for(g=0;g<k;g++){l=i+g;for(f=0;f<k;f++)n[o*f+l]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,l,k=this.size,m=this.yd,o=this.zd,n=this.field,u=k*Math.sqrt(a/c);u>k&&(u=k);for(f=0;f<u;f++)if(g=f/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*f;for(e=0;e<k;e++){l=i+e*m;for(g=0;g<k;g++)n[l+g]+=h}}};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,g,e,f,h,i,l,k,m,o=this.size-2;for(f=1;f<o;f++){m=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(e=1;e<o;e++){k=m+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=k+g,this.polygonize(h,i,l,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,l,k,m,o,n;for(f=0;f<e.count;f++)o=f*3,k=o+1,n=o+2,h=e.positionArray[o],
-i=e.positionArray[k],l=e.positionArray[n],m=new THREE.Vector3(h,i,l),h=e.normalArray[o],i=e.normalArray[k],l=e.normalArray[n],o=new THREE.Vector3(h,i,l),o.normalize(),k=new THREE.Vertex(m),c.vertices.push(k),g.push(o);m=e.count/3;for(f=0;f<m;f++)o=(a+f)*3,k=o+1,n=o+2,h=g[o],i=g[k],l=g[n],o=new THREE.Face3(o,k,n,[h,i,l]),c.faces.push(o);a+=m;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,k=c*this.size,l=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(k-h);p<1&&(p=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-h);n<1&&(n=1);h=Math.floor(l+h);
+h>this.size-1&&(h=this.size-1);for(var r,m,s,u,t,q;o<i;o++){l=this.size2*o;m=o/this.size-g;t=m*m;for(m=p;m<k;m++){s=l+this.size*m;r=m/this.size-c;q=r*r;for(r=n;r<h;r++)u=r/this.size-a,u=e/(1.0E-6+u*u+q+t)-f,u>0&&(this.field[s+r]+=u)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,o=this.zd,p=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<k;e++){i=g+e*l;for(f=0;f<k;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
+i,k,l=this.size,o=this.yd,p=this.zd,n=this.field,r=l*Math.sqrt(a/c);r>l&&(r=l);for(e=0;e<r;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*o;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)n[p*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,o=this.yd,p=this.zd,n=this.field,r=l*Math.sqrt(a/c);r>l&&(r=l);for(f=0;f<r;f++)if(g=f/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=p*f;for(e=0;e<l;e++){k=i+e*o;for(g=0;g<l;g++)n[k+g]+=h}}};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,g,e,f,h,i,k,l,o,p=this.size-2;for(f=1;f<p;f++){o=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<p;e++){l=o+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<p;g++)h=(g-this.halfsize)/this.halfsize,c=l+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,k,l,o,p,n;for(f=0;f<e.count;f++)p=f*3,l=p+1,n=p+2,h=e.positionArray[p],
+i=e.positionArray[l],k=e.positionArray[n],o=new THREE.Vector3(h,i,k),h=e.normalArray[p],i=e.normalArray[l],k=e.normalArray[n],p=new THREE.Vector3(h,i,k),p.normalize(),l=new THREE.Vertex(o),c.vertices.push(l),g.push(p);o=e.count/3;for(f=0;f<o;f++)p=(a+f)*3,l=p+1,n=p+2,h=g[p],i=g[l],k=g[n],p=new THREE.Face3(p,l,n,[h,i,k]),c.faces.push(p);a+=o;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 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]);
@@ -692,20 +694,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,g,e=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>e?this.hits.push(g):this.hits.unshift(g),e=d;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 d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.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),d=Number.MAX_VALUE,g,e=0;e<c.numFaces;e++){var f=c.mesh.geometry.faces[e],h=c.mesh.geometry.vertices[f.a].position,i=c.mesh.geometry.vertices[f.b].position,l=c.mesh.geometry.vertices[f.c].position,k=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,h,i,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,i,l,k,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,e=0;e<c.numFaces;e++){var f=c.mesh.geometry.faces[e],h=c.mesh.geometry.vertices[f.a].position,i=c.mesh.geometry.vertices[f.b].position,k=c.mesh.geometry.vertices[f.c].position,l=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,h,i,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,i,k,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,e,f){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;e.set(0,0,0);h.sub(b,c);i.sub(d,b);e.cross(h,i);h=e.dot(a.direction);if(!(h<0))if(f.doubleSided||f.flipSided)e.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;f=e.dot(c)-e.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=h*g))return Number.MAX_VALUE;f/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(f);h.addSelf(a.origin);Math.abs(e.x)>
 Math.abs(e.y)?Math.abs(e.x)>Math.abs(e.z)?(a=h.y-c.y,e=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(e.y)>Math.abs(e.z)?(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=e*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=e*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return f};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
-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 d=0,g=0,e=0,f=0,h=0,i=0,l=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,l=!1,f=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,l=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,l=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
-l=!1,h=1);b.origin.z<c.min.z?(e=c.min.z-b.origin.z,e/=b.direction.z,l=!1,i=-1):b.origin.z>c.max.z&&(e=c.max.z-b.origin.z,e/=b.direction.z,l=!1,i=1);if(l)return-1;l=0;g>d&&(l=1,d=g);e>d&&(l=2,d=e);switch(l){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+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 d=0,g=0,e=0,f=0,h=0,i=0,k=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,k=!1,f=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,k=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
+k=!1,h=1);b.origin.z<c.min.z?(e=c.min.z-b.origin.z,e/=b.direction.z,k=!1,i=-1):b.origin.z>c.max.z&&(e=c.max.z-b.origin.z,e/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;g>d&&(k=1,d=g);e>d&&(k=2,d=e);switch(k){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
 d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-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 d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,m;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.PerspectiveCamera(53,
-1,1,1E4);u.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},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}"}),
-p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(u);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||k!==b.far||m!==b.fov){i=b.aspect;l=b.near;k=b.far;m=b.fov;var x=b.projectionMatrix.clone(),q=125/30*0.5,s=q*l/125,v=l*Math.tan(m*Math.PI/360),y;f.n14=q;h.n14=-q;q=-v*i+s;y=v*i+s;x.n11=2*l/(y-q);x.n13=(y+q)/(y-q);g.projectionMatrix.copy(x);q=-v*i-s;y=v*i-s;x.n11=
-2*l/(y-q);x.n13=(y+q)/(y-q);e.projectionMatrix.copy(x)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,n,!0);p.updateMatrixWorld();d.call(c,p,u)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,o;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),r=new THREE.PerspectiveCamera(53,
+1,1,1E4);r.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:n}},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}"}),
+m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(r);this.setSize=function(a,d){b.call(c,a,d);p.width=a;p.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||o!==b.fov){i=b.aspect;k=b.near;l=b.far;o=b.fov;var t=b.projectionMatrix.clone(),q=125/30*0.5,A=q*k/125,w=k*Math.tan(o*Math.PI/360),E;f.n14=q;h.n14=-q;q=-w*i+A;E=w*i+A;t.n11=2*k/(E-q);t.n13=(E+q)/(E-q);g.projectionMatrix.copy(t);q=-w*i-A;E=w*i-A;t.n11=
+2*k/(E-q);t.n13=(E+q)/(E-q);e.projectionMatrix.copy(t)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,p,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,n,!0);m.updateMatrixWorld();d.call(c,m,r)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
 b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}};

+ 176 - 174
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r46dev - http://github.com/mrdoob/three.js
 THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,f=Math.max(Math.max(b,d),g),e=Math.min(Math.min(b,d),g);if(e===f)e=b=0;else{var h=f-e,e=h/f,b=b===f?(d-g)/h:d===f?2+(g-b)/h:4+(b-d)/h;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=f;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,j=f.faces,k=a.faceVertexUvs[0],l=f.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var q=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(q.position);e.push(q)}n=
-0;for(t=j.length;n<t;n++){var e=j[n],r,p,s=e.vertexNormals,m=e.vertexColors;e instanceof THREE.Face3?r=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(r=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));r.normal.copy(e.normal);d&&d.multiplyVector3(r.normal);h=0;for(q=s.length;h<q;h++)p=s[h].clone(),d&&d.multiplyVector3(p),r.vertexNormals.push(p);r.color.copy(e.color);h=0;for(q=m.length;h<q;h++)p=m[h],r.vertexColors.push(p.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
-q=o[h.id];if(q===void 0)q=a.materials.length,a.materials.push(h);r.materialIndex=q}r.centroid.copy(e.centroid);b&&b.multiplyVector3(r.centroid);i.push(r)}n=0;for(t=l.length;n<t;n++){b=l[n];d=[];h=0;for(q=b.length;h<q;h++)d.push(new THREE.UV(b[h].u,b[h].v));k.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
-for(b=g.length;a<b;a++){var h=g[a],i,j,k=h.vertexNormals,l=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=k.length;d<e;d++)j=k[d],i.vertexNormals.push(j.clone());i.color.copy(h.color);d=0;for(e=l.length;d<e;d++)j=l[d],i.vertexColors.push(j.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,e=a.vertices,h=f.vertices,i=a.faces,k=f.faces,j=a.faceVertexUvs[0],p=f.faceVertexUvs[0],m={},n=0;n<a.materials.length;n++)m[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,t=h.length;n<t;n++){var l=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(l.position);e.push(l)}n=
+0;for(t=k.length;n<t;n++){var e=k[n],s,q,r=e.vertexNormals,o=e.vertexColors;e instanceof THREE.Face3?s=new THREE.Face3(e.a+g,e.b+g,e.c+g):e instanceof THREE.Face4&&(s=new THREE.Face4(e.a+g,e.b+g,e.c+g,e.d+g));s.normal.copy(e.normal);d&&d.multiplyVector3(s.normal);h=0;for(l=r.length;h<l;h++)q=r[h].clone(),d&&d.multiplyVector3(q),s.vertexNormals.push(q);s.color.copy(e.color);h=0;for(l=o.length;h<l;h++)q=o[h],s.vertexColors.push(q.clone());if(e.materialIndex!==void 0){h=f.materials[e.materialIndex];
+l=m[h.id];if(l===void 0)l=a.materials.length,a.materials.push(h);s.materialIndex=l}s.centroid.copy(e.centroid);b&&b.multiplyVector3(s.centroid);i.push(s)}n=0;for(t=p.length;n<t;n++){b=p[n];d=[];h=0;for(l=b.length;h<l;h++)d.push(new THREE.UV(b[h].u,b[h].v));j.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var e=new THREE.Vertex(d[a].position.clone());c.vertices.push(e)}a=0;
+for(b=g.length;a<b;a++){var h=g[a],i,k,j=h.vertexNormals,p=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(e=j.length;d<e;d++)k=j[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(e=p.length;d<e;d++)k=p[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=f.length;a<b;a++){g=f[a];i=[];d=0;for(e=g.length;d<
 e;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,f,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);f=1-d-g;e.copy(a);e.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);e.addSelf(h);h.copy(b);h.multiplyScalar(f);e.addSelf(h);return e},randomPointInFace:function(a,c,b){var d,g,f;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
 f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,f);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,e;b?a._area1&&a._area2?(b=a._area1,e=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c),a._area1=b,a._area2=e):(b=THREE.GeometryUtils.triangleArea(d,g,c),e=THREE.GeometryUtils.triangleArea(g,f,c));return THREE.GeometryUtils.random()*(b+
-e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return j[e]>a?b(d,e-1):j[e]<a?b(e+1,c):e}return b(0,j.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,j=[],k,l,o,n;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)k=e[d.a].position,l=e[d.b].position,o=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,l,o);else if(d instanceof
-THREE.Face4)k=e[d.a].position,l=e[d.b].position,o=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,l,n),d._area2=THREE.GeometryUtils.triangleArea(l,o,n),d._area=d._area1+d._area2;i+=d._area;j[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
+e)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(d,c){if(c<d)return d;var e=d+Math.floor((c-d)/2);return k[e]>a?b(d,e-1):k[e]<a?b(e+1,c):e}return b(0,k.length-1)}var d,g,f=a.faces,e=a.vertices,h=f.length,i=0,k=[],j,p,m,n;for(g=0;g<h;g++){d=f[g];if(d instanceof THREE.Face3)j=e[d.a].position,p=e[d.b].position,m=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(j,p,m);else if(d instanceof
+THREE.Face4)j=e[d.a].position,p=e[d.b].position,m=e[d.c].position,n=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(j,p,n),d._area2=THREE.GeometryUtils.triangleArea(p,m,n),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];e={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
 c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],f=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)f.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),j=i.data,k=0;k<d;k++)for(var l=1;l<g;l++){var o=l-1<0?g-1:l-1,n=(l+1)%g,t=k-1<0?d-1:k-1,q=(k+1)%d,r=[],p=[0,0,h[(l*d+k)*4]/255*c];r.push([-1,0,h[(l*d+t)*4]/255*c]);r.push([-1,-1,h[(o*d+t)*4]/255*c]);r.push([0,-1,h[(o*d+k)*4]/255*c]);r.push([1,-1,h[(o*d+q)*4]/255*c]);
-r.push([1,0,h[(l*d+q)*4]/255*c]);r.push([1,1,h[(n*d+q)*4]/255*c]);r.push([0,1,h[(n*d+k)*4]/255*c]);r.push([-1,1,h[(n*d+t)*4]/255*c]);o=[];t=r.length;for(n=0;n<t;n++){var q=r[n],s=r[(n+1)%t],q=[q[0]-p[0],q[1]-p[1],q[2]-p[2]],s=[s[0]-p[0],s[1]-p[1],s[2]-p[2]];o.push(b([q[1]*s[2]-q[2]*s[1],q[2]*s[0]-q[0]*s[2],q[0]*s[1]-q[1]*s[0]]))}r=[0,0,0];for(n=0;n<o.length;n++)r[0]+=o[n][0],r[1]+=o[n][1],r[2]+=o[n][2];r[0]/=o.length;r[1]/=o.length;r[2]/=o.length;p=(l*d+k)*4;j[p]=(r[0]+1)/2*255|0;j[p+1]=(r[1]+0.5)*
-255|0;j[p+2]=r[2]*255|0;j[p+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var e=f.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,g).data,i=e.createImageData(d,g),k=i.data,j=0;j<d;j++)for(var p=1;p<g;p++){var m=p-1<0?g-1:p-1,n=(p+1)%g,t=j-1<0?d-1:j-1,l=(j+1)%d,s=[],q=[0,0,h[(p*d+j)*4]/255*c];s.push([-1,0,h[(p*d+t)*4]/255*c]);s.push([-1,-1,h[(m*d+t)*4]/255*c]);s.push([0,-1,h[(m*d+j)*4]/255*c]);s.push([1,-1,h[(m*d+l)*4]/255*c]);
+s.push([1,0,h[(p*d+l)*4]/255*c]);s.push([1,1,h[(n*d+l)*4]/255*c]);s.push([0,1,h[(n*d+j)*4]/255*c]);s.push([-1,1,h[(n*d+t)*4]/255*c]);m=[];t=s.length;for(n=0;n<t;n++){var l=s[n],r=s[(n+1)%t],l=[l[0]-q[0],l[1]-q[1],l[2]-q[2]],r=[r[0]-q[0],r[1]-q[1],r[2]-q[2]];m.push(b([l[1]*r[2]-l[2]*r[1],l[2]*r[0]-l[0]*r[2],l[0]*r[1]-l[1]*r[0]]))}s=[0,0,0];for(n=0;n<m.length;n++)s[0]+=m[n][0],s[1]+=m[n][1],s[2]+=m[n][2];s[0]/=m.length;s[1]/=m.length;s[2]/=m.length;q=(p*d+j)*4;k[q]=(s[0]+1)/2*255|0;k[q+1]=(s[1]+0.5)*
+255|0;k[q+2]=s[2]*255|0;k[q+3]=255}e.putImageData(i,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var f=new THREE.Mesh(a,c[b]);g.add(f)}return g}};
 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,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -52,37 +52,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
 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])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,d,g,f){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,f));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,f,e,h,i,j,k,l,o,n,t,q;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];l=f[0];o=f[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,f=THREE.Shape.Utils.b2(q,n,l,h),q=THREE.Shape.Utils.b2(q,t,o,
-i),b.push(new THREE.Vector2(f,q));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];l=f[0];o=f[1];j=f[2];k=f[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)q=e/a,f=THREE.Shape.Utils.b3(q,n,l,j,h),q=THREE.Shape.Utils.b3(q,t,o,k,i),b.push(new THREE.Vector2(f,q));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];q=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
-for(e=1;e<=q;e++)b.push(f.getPointAt(e/q));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];j=f[2];l=f[3];q=f[4];o=!!f[5];k=e[e.length-2];n=e[e.length-1];e.length==0&&(k=n=0);t=q-l;var r=a*2;for(e=1;e<=r;e++)q=e/r,o||(q=1-q),q=l+q*t,f=k+h+j*Math.cos(q),q=n+i+j*Math.sin(q),b.push(new THREE.Vector2(f,q))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,d,g,f){var e=this.getPoints(),h,i,j,k,l;h=0;for(i=e.length;h<i;h++)j=e[h],k=j.x,l=j.y,j.x=a*k+c*l+b,j.y=d*l+g*k+f;return e};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,f,e,h,i,k,j,p,m,n,t,l;d=0;for(g=this.actions.length;d<g;d++)switch(f=this.actions[d],e=f.action,f=f.args,e){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];p=f[0];m=f[1];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)l=e/a,f=THREE.Shape.Utils.b2(l,n,p,h),l=THREE.Shape.Utils.b2(l,t,m,
+i),b.push(new THREE.Vector2(f,l));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];p=f[0];m=f[1];k=f[2];j=f[3];b.length>0?(e=b[b.length-1],n=e.x,t=e.y):(e=this.actions[d-1].args,n=e[e.length-2],t=e[e.length-1]);for(e=1;e<=a;e++)l=e/a,f=THREE.Shape.Utils.b3(l,n,p,k,h),l=THREE.Shape.Utils.b3(l,t,m,j,i),b.push(new THREE.Vector2(f,l));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];l=a*f[0].length;e=e.concat(f[0]);f=new THREE.SplineCurve(e);
+for(e=1;e<=l;e++)b.push(f.getPointAt(e/l));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=f[0];i=f[1];k=f[2];p=f[3];l=f[4];m=!!f[5];j=e[e.length-2];n=e[e.length-1];e.length==0&&(j=n=0);t=l-p;var s=a*2;for(e=1;e<=s;e++)l=e/s,m||(l=1-l),l=p+l*t,f=j+h+k*Math.cos(l),l=n+i+k*Math.sin(l),b.push(new THREE.Vector2(f,l))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,d,g,f){var e=this.getPoints(),h,i,k,j,p;h=0;for(i=e.length;h<i;h++)k=e[h],j=k.x,p=k.y,k.x=a*j+c*p+b,k.y=d*p+g*j+f;return e};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();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,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
 this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(g.push(f),f=new THREE.Path),f[b].apply(f,d);f.actions.length!=0&&g.push(f);if(g.length==0)return[];var e,f=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e&&f.push(e),e=new THREE.Shape,e.actions=d.actions,e.curves=
 d.curves):e.holes.push(d);f.push(e)}else{e=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(e.actions=d.actions,e.curves=d.curves,f.push(e),e=new THREE.Shape):e.holes.push(d)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,f,e,h,i,j,k,l,o,n,t=[];for(i=0;i<c.length;i++){j=c[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(g=0;g<j.length;g++){o=j[g];n=[];for(l=0;l<b.length;l++)k=b[l],k=o.distanceToSquared(k),n.push(k),k<f&&(f=k,e=g,h=l)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:j.length-1;var q=[j[e],b[h],b[g]];l=THREE.FontUtils.Triangulate.area(q);var r=[j[e],j[f],b[h]];o=THREE.FontUtils.Triangulate.area(r);n=h;k=e;h+=1;e+=-1;h<
-0&&(h+=b.length);h%=b.length;e<0&&(e+=j.length);e%=j.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:j.length-1;q=[j[e],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(q);r=[j[e],j[f],b[h]];r=THREE.FontUtils.Triangulate.area(r);l+o>q+r&&(h=n,e=k,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=j.length),e%=j.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:j.length-1);l=b.slice(0,h);o=b.slice(h);n=j.slice(e);k=j.slice(0,e);f=[j[e],j[f],b[h]];t.push([j[e],b[h],b[g]]);t.push(f);b=l.concat(n).concat(k).concat(o)}return{shape:b,
-isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,j={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,f,e,h,i,k,j,p,m,n,t=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){m=k[g];n=[];for(p=0;p<b.length;p++)j=b[p],j=m.distanceToSquared(j),n.push(j),j<f&&(f=j,e=g,h=p)}g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;var l=[k[e],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(l);var s=[k[e],k[f],b[h]];m=THREE.FontUtils.Triangulate.area(s);n=h;j=e;h+=1;e+=-1;h<
+0&&(h+=b.length);h%=b.length;e<0&&(e+=k.length);e%=k.length;g=h-1>=0?h-1:b.length-1;f=e-1>=0?e-1:k.length-1;l=[k[e],b[h],b[g]];l=THREE.FontUtils.Triangulate.area(l);s=[k[e],k[f],b[h]];s=THREE.FontUtils.Triangulate.area(s);p+m>l+s&&(h=n,e=j,h<0&&(h+=b.length),h%=b.length,e<0&&(e+=k.length),e%=k.length,g=h-1>=0?h-1:b.length-1,f=e-1>=0?e-1:k.length-1);p=b.slice(0,h);m=b.slice(h);n=k.slice(e);j=k.slice(0,e);f=[k[e],k[f],b[h]];t.push([k[e],b[h],b[g]]);t.push(f);b=p.concat(n).concat(j).concat(m)}return{shape:b,
+isolatedPts:t,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,e,h,i,k={};f=0;for(e=d.length;f<e;f++)i=d[f].x+":"+d[f].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=f;f=0;for(e=b.length;f<e;f++){h=b[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}f=0;for(e=g.length;f<e;f++){h=g[f];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},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,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},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,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
 this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var d=0;d<a.length;d++)a[d].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 d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
-0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var j=a.hierarchy[b].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var k=
-{};for(j in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var j=
+{};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){j[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(j[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=j}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));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 d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];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 f=g.animationCache.prevKey;g=g.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.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,d,g,f,e,h,i,j,k=this.data.JIT.hierarchy,l,o;this.currentTime+=a*this.timeScale;o=this.currentTime;l=this.currentTime%=this.data.length;j=parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&k[n][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[n][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=k[n][j],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 q=0;q<3;q++){b=c[q];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(l<o)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<l;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
-l)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(l-e.time)/(h.time-e.time);g=e[b];f=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,f,e,h,i,k,j=this.data.JIT.hierarchy,p,m;this.currentTime+=a*this.timeScale;m=this.currentTime;p=this.currentTime%=this.data.length;k=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,t=this.hierarchy.length;n<t;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&j[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=j[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=j[n][k],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 l=0;l<3;l++){b=c[l];e=i.prevKey[b];h=i.nextKey[b];if(h.time<=m){if(p<m)if(this.loop){e=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<p;)e=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
+p)}i.prevKey[b]=e;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(p-e.time)/(h.time-e.time);g=e[b];f=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
 this.getPrevKeyWith("pos",n,e.index-1).pos,this.points[1]=g,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
-"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)k[n][j]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,j;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];j=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],j[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],j[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],j[2],g,b,e);return d};
+"rot")THREE.Quaternion.slerp(g,f,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(f[0]-g[0])*d,b.y=g[1]+(f[1]-g[1])*d,b.z=g[2]+(f[2]-g[2])*d}}if(this.JITCompile&&j[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)j[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,f,e,h,i,k;g=(a.length-1)*c;f=Math.floor(g);g-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;e=g*b;d[0]=this.interpolate(f[0],h[0],i[0],k[0],g,b,e);d[1]=this.interpolate(f[1],h[1],i[1],k[1],g,b,e);d[2]=this.interpolate(f[2],h[2],i[2],k[2],g,b,e);return d};
 THREE.Animation.prototype.interpolate=function(a,c,b,d,g,f,e){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*e+(-3*(c-b)-2*a-d)*f+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=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+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
 THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -104,7 +104,7 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*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,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(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=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};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.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),r=g.length,p=0;f=r-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<r-1;f++)p=c*h.chunks[f]/h.total,b.keys[f]={time:p,pos:g[f]};e.hierarchy[0]=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,d,c){var e={name:d,fps:0.6,length:c,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),s=g.length,q=0;f=s-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:c,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<s-1;f++)q=c*h.chunks[f]/h.total,b.keys[f]={time:q,pos:g[f]};e.hierarchy[0]=
 b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,d,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var d,c,e=new THREE.Geometry;for(d=0;d<a.points.length*b;d++)c=d/(a.points.length*b),c=a.getPoint(c),e.vertices[d]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var d;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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;a=this.phi%e;this.phi=a>=0?a:a+e;d=this.verticalAngleMap.srcRange;
@@ -122,200 +122,202 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};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",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,l=0,o=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*l);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*j);this.object.translateY(c*k);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Matrix4,e=!1,h=1,i=0,k=0,j=0,p=0,m=0,n=window.innerWidth/2,t=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*p);this.rotateVertically(c*m)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*j);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
 g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){l=(a.clientX-n)/window.innerWidth;o=(a.clientY-t)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-n)/window.innerWidth;m=(a.clientY-t)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:j=1;break;case 70:j=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:j=0;break;case 70:j=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var g=!1,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,l=new THREE.Vector2,o=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-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var g=!1,f=d.NONE,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,j=new THREE.Vector2,p=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-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),f=d.length();f>1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(d.y);f.addSelf(b.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(e);
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(l);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?l=o:l.addSelf(a.sub(o,l).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=b.getMouseOnScreen(a.clientX,a.clientY),l=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
-a.clientY):f===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(l=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(j.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),b.staticMoving?k=j:k.y+=(j.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=m.clone().subSelf(p);if(a.lengthSq()){a.multiplyScalar(e.length()*b.panSpeed);var c=e.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=m:p.addSelf(a.sub(m,p).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),e.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,e.setLength(b.minDistance))};this.update=function(){e.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,e);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=j=b.getMouseOnScreen(a.clientX,a.clientY),p=m=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),f!==d.NONE&&(f===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?j=b.getMouseOnScreen(a.clientX,
+a.clientY):f===d.PAN&&!b.noPan&&(m=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===d.NONE))f=a.button,f===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===d.ZOOM&&!b.noZoom?k=j=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=m=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 f=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===d.NONE){if(a.keyCode===b.keys[d.ROTATE])f=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)f=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)f=d.PAN;f!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==d.NONE)f=d.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,k,n){var l,o,m=d||1,p=g||1,r=h/2,q=i/2,t=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")l="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")l="y",p=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",m=f||1;var s=m+1,O=p+1;h/=m;var z=i/p;for(o=0;o<O;o++)for(i=0;i<s;i++){var K=new THREE.Vector3;K[a]=(i*h-r)*c;K[b]=(o*z-q)*e;K[l]=k;j.vertices.push(new THREE.Vertex(K))}for(o=0;o<p;o++)for(i=0;i<m;i++)j.faces.push(new THREE.Face4(i+
-s*o+t,i+s*(o+1)+t,i+1+s*(o+1)+t,i+1+s*o+t,null,null,n)),j.faceVertexUvs[0].push([new THREE.UV(i/m,o/p),new THREE.UV(i/m,(o+1)/p),new THREE.UV((i+1)/m,(o+1)/p),new THREE.UV((i+1)/m,o/p)])}THREE.Geometry.call(this);var j=this,k=a/2,l=c/2,o=b/2,n,t,q,r,p,s;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;r=1;t=2;p=3;q=4;s=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var m in h)this.sides[m]!=
-void 0&&(this.sides[m]=h[m]);this.sides.px&&i("z","y",-1,-1,b,c,k,n);this.sides.nx&&i("z","y",1,-1,b,c,-k,r);this.sides.py&&i("x","z",1,1,a,b,l,t);this.sides.ny&&i("x","z",1,-1,a,b,-l,p);this.sides.pz&&i("x","y",1,-1,a,c,o,q);this.sides.nz&&i("x","y",-1,-1,a,c,-o,s);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,j=[],k=[];for(i=0;i<=g;i++){var l=[],o=[],n=i/g,t=n*(c-a)+a;for(h=0;h<=d;h++){var q=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(q*Math.PI*2),-n*b+e,t*Math.cos(q*Math.PI*2))));l.push(this.vertices.length-1);o.push(new THREE.UV(q,n))}j.push(l);k.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=j[i][h],l=j[i+1][h],o=j[i+1][h+1],n=j[i][h+1],t=
-this.vertices[b].position.clone().setY(0).normalize(),q=this.vertices[l].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),s=k[i][h].clone(),m=k[i+1][h].clone(),v=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,l,o,n,[t,q,r,p]));this.faceVertexUvs[0].push([s,m,v,w])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=j[0][h],l=j[0][h+
-1],o=this.vertices.length-1,t=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),s=k[0][h].clone(),m=k[0][h+1].clone(),v=new THREE.UV(m.u,0),this.faces.push(new THREE.Face3(b,l,o,[t,q,r])),this.faceVertexUvs[0].push([s,m,v])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=j[i][h+1],l=j[i][h],o=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),s=k[i][h+1].clone(),m=k[i][h].clone(),
-v=new THREE.UV(m.u,1),this.faces.push(new THREE.Face3(b,l,o,[t,q,r])),this.faceVertexUvs[0].push([s,m,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,d,g,f,e,h){function i(a,b,c,e,h,i,j,n){var l,m,p=d||1,o=g||1,q=h/2,s=i/2,t=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")l="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")l="y",o=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")l="x",p=f||1;var r=p+1,K=o+1;h/=p;var H=i/o;for(m=0;m<K;m++)for(i=0;i<r;i++){var N=new THREE.Vector3;N[a]=(i*h-q)*c;N[b]=(m*H-s)*e;N[l]=j;k.vertices.push(new THREE.Vertex(N))}for(m=0;m<o;m++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
+r*m+t,i+r*(m+1)+t,i+1+r*(m+1)+t,i+1+r*m+t,null,null,n)),k.faceVertexUvs[0].push([new THREE.UV(i/p,m/o),new THREE.UV(i/p,(m+1)/o),new THREE.UV((i+1)/p,(m+1)/o),new THREE.UV((i+1)/p,m/o)])}THREE.Geometry.call(this);var k=this,j=a/2,p=c/2,m=b/2,n,t,l,s,q,r;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(e)}n=0;s=1;t=2;q=3;l=4;r=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var o in h)this.sides[o]!=
+void 0&&(this.sides[o]=h[o]);this.sides.px&&i("z","y",-1,-1,b,c,j,n);this.sides.nx&&i("z","y",1,-1,b,c,-j,s);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,q);this.sides.pz&&i("x","y",1,-1,a,c,m,l);this.sides.nz&&i("x","y",-1,-1,a,c,-m,r);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,d,g,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,e=b/2,d=d||8,g=g||1,h,i,k=[],j=[];for(i=0;i<=g;i++){var p=[],m=[],n=i/g,t=n*(c-a)+a;for(h=0;h<=d;h++){var l=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(l*Math.PI*2),-n*b+e,t*Math.cos(l*Math.PI*2))));p.push(this.vertices.length-1);m.push(new THREE.UV(l,n))}k.push(p);j.push(m)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],p=k[i+1][h],m=k[i+1][h+1],n=k[i][h+1],t=
+this.vertices[b].position.clone().setY(0).normalize(),l=this.vertices[p].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),q=this.vertices[n].position.clone().setY(0).normalize(),r=j[i][h].clone(),o=j[i+1][h].clone(),u=j[i+1][h+1].clone(),y=j[i][h+1].clone();this.faces.push(new THREE.Face4(b,p,m,n,[t,l,s,q]));this.faceVertexUvs[0].push([r,o,u,y])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=0;h<d;h++)b=k[0][h],p=k[0][h+
+1],m=this.vertices.length-1,t=new THREE.Vector3(0,1,0),l=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),r=j[0][h].clone(),o=j[0][h+1].clone(),u=new THREE.UV(o.u,0),this.faces.push(new THREE.Face3(b,p,m,[t,l,s])),this.faceVertexUvs[0].push([r,o,u])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)b=k[i][h+1],p=k[i][h],m=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),l=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),r=j[i][h+1].clone(),o=j[i][h].clone(),
+u=new THREE.UV(o.u,1),this.faces.push(new THREE.Face3(b,p,m,[t,l,s])),this.faceVertexUvs[0].push([r,o,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(u=a.length;--u>=0;){I=u;L=u-1;L<0&&(L=a.length-1);for(var b=
-0,c=n+k*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),f=R+I+d,g=R+I+e,j=f,d=R+L+d,e=R+L+e,l=g;j+=E;d+=E;e+=E;l+=E;A.faces.push(new THREE.Face4(j,d,e,l,null,null,v));v&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(A.vertices[f].position.z+i)/e,g=(A.vertices[g].position.z+i)/e,A.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){A.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=E;b+=E;c+=E;A.faces.push(new THREE.Face3(a,b,c,null,
-null,m));if(m){var d=w.maxY,e=w.maxX,f=A.vertices[b].position.x,b=A.vertices[b].position.y,g=A.vertices[c].position.x,c=A.vertices[c].position.y;A.faceVertexUvs[0].push([new THREE.UV(A.vertices[a].position.x/e,A.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,j=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,l=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
-void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,q=c.extrudePath,r,p=!1,s=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,m=c.material,v=c.extrudeMaterial,w=this.shapebb;if(q)r=q.getPoints(o),n=r.length,p=!0,l=!1;l||(j=i=k=0);var x,y,C,A=this,E=this.vertices.length;t&&a.addWrapPath(t);o=s?a.extractAllSpacedPoints(o):a.extractAllPoints(o);t=o.shape;o=o.holes;if(q=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();y=0;for(C=o.length;y<C;y++)x=o[y],THREE.Shape.Utils.isClockWise(x)&&
-(o[y]=x.reverse());q=!1}q=THREE.Shape.Utils.triangulateShape(t,o);s=t;y=0;for(C=o.length;y<C;y++)x=o[y],t=t.concat(x);var u,G,D,H,B,F,J=t.length,N=q.length,M=[];u=0;G=s.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),M[u]=d(s[u],s[I],s[L]);var O=[],z,K=M.concat();y=0;for(C=o.length;y<C;y++){x=o[y];z=[];u=0;G=x.length;I=G-1;for(L=u+1;u<G;u++,I++,L++)I===G&&(I=0),L===G&&(L=0),z[u]=d(x[u],x[I],x[L]);O.push(z);K=K.concat(z)}for(D=0;D<k;D++){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=
-0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),f(F.x,F.y,-B);y=0;for(C=o.length;y<C;y++){x=o[y];z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),f(F.x,F.y,-B)}}H=j;for(u=0;u<J;u++)F=l?b(t[u],K[u],H):t[u],p?f(F.x,F.y+r[0].y,r[0].x):f(F.x,F.y,0);for(D=1;D<=n;D++)for(u=0;u<J;u++)F=l?b(t[u],K[u],H):t[u],p?f(F.x,F.y+r[D-1].y,r[D-1].x):f(F.x,F.y,h/n*D);for(D=k-1;D>=0;D--){H=D/k;B=i*(1-H);H=j*Math.sin(H*Math.PI/2);u=0;for(G=s.length;u<G;u++)F=b(s[u],M[u],H),f(F.x,F.y,h+B);y=0;for(C=o.length;y<C;y++){x=o[y];
-z=O[y];u=0;for(G=x.length;u<G;u++)F=b(x[u],z[u],H),p?f(F.x,F.y+r[n-1].y,r[n-1].x+B):f(F.x,F.y,h+B)}}if(l){l=J*0;for(u=0;u<N;u++)j=q[u],e(j[2]+l,j[1]+l,j[0]+l);l=J*(n+k*2);for(u=0;u<N;u++)j=q[u],e(j[0]+l,j[1]+l,j[2]+l)}else{for(u=0;u<N;u++)j=q[u],e(j[2],j[1],j[0]);for(u=0;u<N;u++)j=q[u],e(j[0]+J*n,j[1]+J*n,j[2]+J*n)}var I,L,R=0;g(s);R+=s.length;y=0;for(C=o.length;y<C;y++)x=o[y],g(x),R+=x.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(v=a.length;--v>=0;){L=v;M=v-1;M<0&&(M=a.length-1);for(var b=
+0,c=n+j*2,b=0;b<c;b++){var d=J*b,e=J*(b+1),f=R+L+d,g=R+L+e,k=f,d=R+M+d,e=R+M+e,m=g;k+=F;d+=F;e+=F;m+=F;C.faces.push(new THREE.Face4(k,d,e,m,null,null,u));u&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function f(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,b,c,null,
+null,o));if(o){var d=y.maxY,e=y.maxX,f=C.vertices[b].position.x,b=C.vertices[b].position.y,g=C.vertices[c].position.x,c=C.vertices[c].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[a].position.x/e,C.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,j=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,m=c.curveSegments!==
+void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,t=c.bendPath,l=c.extrudePath,s,q=!1,r=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,o=c.material,u=c.extrudeMaterial,y=this.shapebb;if(l)s=l.getPoints(m),n=s.length,q=!0,p=!1;p||(k=i=j=0);var w,x,A,C=this,F=this.vertices.length;t&&a.addWrapPath(t);m=r?a.extractAllSpacedPoints(m):a.extractAllPoints(m);t=m.shape;m=m.holes;if(l=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();x=0;for(A=m.length;x<A;x++)w=m[x],THREE.Shape.Utils.isClockWise(w)&&
+(m[x]=w.reverse());l=!1}l=THREE.Shape.Utils.triangulateShape(t,m);r=t;x=0;for(A=m.length;x<A;x++)w=m[x],t=t.concat(w);var v,D,z,G,I,E,J=t.length,O=l.length,B=[];v=0;D=r.length;L=D-1;for(M=v+1;v<D;v++,L++,M++)L===D&&(L=0),M===D&&(M=0),B[v]=d(r[v],r[L],r[M]);var K=[],H,N=B.concat();x=0;for(A=m.length;x<A;x++){w=m[x];H=[];v=0;D=w.length;L=D-1;for(M=v+1;v<D;v++,L++,M++)L===D&&(L=0),M===D&&(M=0),H[v]=d(w[v],w[L],w[M]);K.push(H);N=N.concat(H)}for(z=0;z<j;z++){G=z/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=
+0;for(D=r.length;v<D;v++)E=b(r[v],B[v],G),f(E.x,E.y,-I);x=0;for(A=m.length;x<A;x++){w=m[x];H=K[x];v=0;for(D=w.length;v<D;v++)E=b(w[v],H[v],G),f(E.x,E.y,-I)}}G=k;for(v=0;v<J;v++)E=p?b(t[v],N[v],G):t[v],q?f(E.x,E.y+s[0].y,s[0].x):f(E.x,E.y,0);for(z=1;z<=n;z++)for(v=0;v<J;v++)E=p?b(t[v],N[v],G):t[v],q?f(E.x,E.y+s[z-1].y,s[z-1].x):f(E.x,E.y,h/n*z);for(z=j-1;z>=0;z--){G=z/j;I=i*(1-G);G=k*Math.sin(G*Math.PI/2);v=0;for(D=r.length;v<D;v++)E=b(r[v],B[v],G),f(E.x,E.y,h+I);x=0;for(A=m.length;x<A;x++){w=m[x];
+H=K[x];v=0;for(D=w.length;v<D;v++)E=b(w[v],H[v],G),q?f(E.x,E.y+s[n-1].y,s[n-1].x+I):f(E.x,E.y,h+I)}}if(p){p=J*0;for(v=0;v<O;v++)k=l[v],e(k[2]+p,k[1]+p,k[0]+p);p=J*(n+j*2);for(v=0;v<O;v++)k=l[v],e(k[0]+p,k[1]+p,k[2]+p)}else{for(v=0;v<O;v++)k=l[v],e(k[2],k[1],k[0]);for(v=0;v<O;v++)k=l[v],e(k[0]+J*n,k[1]+J*n,k[2]+J*n)}var L,M,R=0;g(r);R+=r.length;x=0;for(A=m.length;x<A;x++)w=m[x],g(w),R+=w.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,f=new THREE.Geometry;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,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),j=d(f.faces[h].b,f.faces[h].c),k=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,k,a);b(f.faces[h].b,j,
-i,a);b(f.faces[h].c,k,j,a);b(i,j,k,a)}f.faces=a.faces}g.faces=f.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+-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,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var e=0;e<this.subdivisions;e++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,i,j,a);b(f.faces[h].b,k,
+i,a);b(f.faces[h].c,j,k,a);b(i,k,j,a)}f.faces=a.faces}g.faces=f.faces;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=[],d=[],g=[],f=[],e=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=e.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=f;i==0&&(f=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=e.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
 e.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),e.faceVertexUvs[0].push([f(a.uv,a.position,h),f(b.uv,b.position,h),f(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function f(a,b,c){c<0&&a.u===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,e=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,f=a/2,e=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var j=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(g*j-e),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,f=a/2,e=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var k=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(g*k-e),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);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,d,g=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),j=[],k=0;for(d=0;d<f;d++){var l=2*d/f,o=i*Math.sin(l*g),l=i*Math.cos(l*g);(b==0||b==e)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l,h,o)))-1);j.push(k)}c.push(j)}for(var n,t,q,g=c.length,b=0;b<g;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){j=d==f-1;e=c[b][j?0:d+1];h=c[b][j?f-1:d];i=c[b-1][j?
-f-1:d];j=c[b-1][j?0:d+1];o=b/(g-1);n=(b-1)/(g-1);t=(d+1)/f;var l=d/f,k=new THREE.UV(1-t,o),o=new THREE.UV(1-l,o),l=new THREE.UV(1-l,n),r=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[h].position.clone(),q=this.vertices[i].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,o,l]));b>1&&(n=
-this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),q=this.vertices[j].position.clone(),n.normalize(),t.normalize(),q.normalize(),this.faces.push(new THREE.Face3(e,i,j,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([k,l,r]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,f=Math.max(3,c||8),e=Math.max(2,b||6),c=[],b=0;b<e+1;b++){d=b/e;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],j=0;for(d=0;d<f;d++){var p=2*d/f,m=i*Math.sin(p*g),p=i*Math.cos(p*g);(b==0||b==e)&&d>0||(j=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,h,m)))-1);k.push(j)}c.push(k)}for(var n,t,l,g=c.length,b=0;b<g;b++)if(f=c[b].length,b>0)for(d=0;d<f;d++){k=d==f-1;e=c[b][k?0:d+1];h=c[b][k?f-1:d];i=c[b-1][k?
+f-1:d];k=c[b-1][k?0:d+1];m=b/(g-1);n=(b-1)/(g-1);t=(d+1)/f;var p=d/f,j=new THREE.UV(1-t,m),m=new THREE.UV(1-p,m),p=new THREE.UV(1-p,n),s=new THREE.UV(1-t,n);b<c.length-1&&(n=this.vertices[e].position.clone(),t=this.vertices[h].position.clone(),l=this.vertices[i].position.clone(),n.normalize(),t.normalize(),l.normalize(),this.faces.push(new THREE.Face3(e,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(l.x,l.y,l.z)])),this.faceVertexUvs[0].push([j,m,p]));b>1&&(n=
+this.vertices[e].position.clone(),t=this.vertices[i].position.clone(),l=this.vertices[k].position.clone(),n.normalize(),t.normalize(),l.normalize(),this.faces.push(new THREE.Face3(e,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(l.x,l.y,l.z)])),this.faceVertexUvs[0].push([j,p,s]))}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){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,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]},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},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
-0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,j,k,l,o,n,t,q,r,p=c.glyphs[a]||c.glyphs["?"];if(p){if(p.o){c=p._cachedOutline||(p._cachedOutline=p.o.split(" "));j=c.length;for(a=0;a<j;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;f.push(new THREE.Vector2(i,k));g.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;f.push(new THREE.Vector2(i,
-k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(n,t,i,k);if(e=f[f.length-1]){l=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++){var s=e/h,m=THREE.Shape.Utils.b2(s,l,n,i),s=THREE.Shape.Utils.b2(s,o,t,k);f.push(new THREE.Vector2(m,s))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,q=c[a++]*b+d,r=c[a++]*-b,g.bezierCurveTo(i,k,n,t,q,r),e=f[f.length-1]){l=e.x;o=e.y;e=1;for(h=this.divisions;e<=h;e++)s=e/h,m=THREE.Shape.Utils.b3(s,l,n,
-q,i),s=THREE.Shape.Utils.b3(s,o,t,r,k),f.push(new THREE.Vector2(m,s))}}}return{offset:p.ha*b,points:f,path:g}}}};
-(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,j,k;if(c(a)>0)for(j=0;j<g;j++)e[j]=j;else for(j=0;j<g;j++)e[j]=g-1-j;var l=2*g;for(j=g-1;g>2;){if(l--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=j;g<=i&&(i=0);j=i+1;g<=j&&(j=0);k=j+1;g<=k&&(k=0);var o;a:{o=a;var n=i,t=j,q=k,r=g,p=e,s=void 0,m=void 0,v=void 0,
-w=void 0,x=void 0,y=void 0,C=void 0,A=void 0,E=void 0,m=o[p[n]].x,v=o[p[n]].y,w=o[p[t]].x,x=o[p[t]].y,y=o[p[q]].x,C=o[p[q]].y;if(1.0E-10>(w-m)*(C-v)-(x-v)*(y-m))o=!1;else{for(s=0;s<r;s++)if(!(s==n||s==t||s==q)){var A=o[p[s]].x,E=o[p[s]].y,u=void 0,G=void 0,D=void 0,H=void 0,B=void 0,F=void 0,J=void 0,N=void 0,M=void 0,O=void 0,z=void 0,K=void 0,u=D=B=void 0,u=y-w,G=C-x,D=m-y,H=v-C,B=w-m,F=x-v,J=A-m,N=E-v,M=A-w,O=E-x,z=A-y,K=E-C,u=u*O-G*M,B=B*N-F*J,D=D*K-H*z;if(u>=0&&D>=0&&B>=0){o=!1;break a}}o=!0}}if(o){f.push([a[e[i]],
-a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);i=j;for(k=j+1;k<g;i++,k++)e[i]=e[k];g--;l=2*g}}if(d)return h;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+0,g=String(a).split(""),f=g.length,e=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var f=[],e,h,i,k,j,p,m,n,t,l,s,q=c.glyphs[a]||c.glyphs["?"];if(q){if(q.o){c=q._cachedOutline||(q._cachedOutline=q.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,j));g.moveTo(i,j);break;case "l":i=c[a++]*b+d;j=c[a++]*b;f.push(new THREE.Vector2(i,
+j));g.lineTo(i,j);break;case "q":i=c[a++]*b+d;j=c[a++]*b;n=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(n,t,i,j);if(e=f[f.length-1]){p=e.x;m=e.y;e=1;for(h=this.divisions;e<=h;e++){var r=e/h,o=THREE.Shape.Utils.b2(r,p,n,i),r=THREE.Shape.Utils.b2(r,m,t,j);f.push(new THREE.Vector2(o,r))}}break;case "b":if(i=c[a++]*b+d,j=c[a++]*b,n=c[a++]*b+d,t=c[a++]*-b,l=c[a++]*b+d,s=c[a++]*-b,g.bezierCurveTo(i,j,n,t,l,s),e=f[f.length-1]){p=e.x;m=e.y;e=1;for(h=this.divisions;e<=h;e++)r=e/h,o=THREE.Shape.Utils.b3(r,p,n,
+l,i),r=THREE.Shape.Utils.b3(r,m,t,s,j),f.push(new THREE.Vector2(o,r))}}}return{offset:q.ha*b,points:f,path:g}}}};
+(function(a){var c=function(a){for(var c=a.length,g=0,f=c-1,e=0;e<c;f=e++)g+=a[f].x*a[e].y-a[e].x*a[f].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var f=[],e=[],h=[],i,k,j;if(c(a)>0)for(k=0;k<g;k++)e[k]=k;else for(k=0;k<g;k++)e[k]=g-1-k;var p=2*g;for(k=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return f}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);j=k+1;g<=j&&(j=0);var m;a:{m=a;var n=i,t=k,l=j,s=g,q=e,r=void 0,o=void 0,u=void 0,
+y=void 0,w=void 0,x=void 0,A=void 0,C=void 0,F=void 0,o=m[q[n]].x,u=m[q[n]].y,y=m[q[t]].x,w=m[q[t]].y,x=m[q[l]].x,A=m[q[l]].y;if(1.0E-10>(y-o)*(A-u)-(w-u)*(x-o))m=!1;else{for(r=0;r<s;r++)if(!(r==n||r==t||r==l)){var C=m[q[r]].x,F=m[q[r]].y,v=void 0,D=void 0,z=void 0,G=void 0,I=void 0,E=void 0,J=void 0,O=void 0,B=void 0,K=void 0,H=void 0,N=void 0,v=z=I=void 0,v=x-y,D=A-w,z=o-x,G=u-A,I=y-o,E=w-u,J=C-o,O=F-u,B=C-y,K=F-w,H=C-x,N=F-A,v=v*K-D*B,I=I*O-E*J,z=z*N-G*H;if(v>=0&&z>=0&&I>=0){m=!1;break a}}m=!0}}if(m){f.push([a[e[i]],
+a[e[k]],a[e[j]]]);h.push([e[i],e[k],e[j]]);i=k;for(j=k+1;j<g;i++,j++)e[i]=e[j];g--;p=2*g}}if(d)return h;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var f=d/this.segmentsT*this.arc,e=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(f);g.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(f);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(f);h.z=
 this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,f=(this.segmentsT+1)*(b-1)+d-1,e=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,f,e,h,[c[g],c[f],c[e],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[f]);i.normal.addSelf(c[e]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
 this.faceVertexUvs[0].push([a[g].clone(),a[f].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
 THREE.TorusKnotGeometry=function(a,c,b,d,g,f,e){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,e=c/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;f.cross(b,d);d.cross(f,b);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][f],f=this.grid[a][f],e=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),j=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,f));this.faceVertexUvs[0].push([e,i,k,j])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,l,m=0;m<4;m++){l=i[m];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<l.length;p++)n=h.vertexColors[l[p]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[m]=k}}g.push(j);(!e.supportUVs||o.length!=0)&&f.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},l={},o=[],n,t,q,r,p,s=a.faceVertexUvs[0];n=0;for(t=s.length;n<t;n++){q=0;for(r=s[n].length;q<r;q++)p=d[n]["abcd".charAt(q)],o[p]||(o[p]=s[n][q])}var m;n=0;for(t=d.length;n<t;n++)if(p=d[n],j.push(p.centroid),i.push(new THREE.Vertex(p.centroid)),e.supportUVs&&o.length!=0){m=new THREE.UV;if(p instanceof THREE.Face3)m.u=o[p.a].u+o[p.b].u+o[p.c].u,m.v=o[p.a].v+o[p.b].v+o[p.c].v,m.u/=3,m.v/=3;else if(p instanceof THREE.Face4)m.u=
-o[p.a].u+o[p.b].u+o[p.c].u+o[p.d].u,m.v=o[p.a].v+o[p.b].v+o[p.c].v+o[p.d].v,m.u/=4,m.v/=4;o.push(m)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,h,g={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(h=b(f.a,f.b),c(g,h,d),h=b(f.b,f.c),c(g,h,d),h=b(f.c,f.a),c(g,h,d)):f instanceof THREE.Face4&&(h=b(f.a,f.b),c(g,h,d),h=b(f.b,f.c),c(g,h,d),h=b(f.c,f.d),c(g,h,d),h=b(f.d,f.a),c(g,h,d));return g}(a);var v=0,s=h.length,w,x,y={},C={},A=function(a,
-b){y[a]===void 0&&(y[a]=[]);y[a].push(b)},E=function(a,b){C[a]===void 0&&(C[a]={});C[a][b]=null};for(n in t){m=t[n];w=n.split("_");x=w[0];w=w[1];A(x,[x,w]);A(w,[x,w]);q=0;for(r=m.length;q<r;q++)p=m[q],E(x,p,n),E(w,p,n);m.length<2&&(l[n]=!0)}for(n in t)if(m=t[n],p=m[0],m=m[1],w=n.split("_"),x=w[0],w=w[1],r=new THREE.Vector3,l[n]?(r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.5)):(r.addSelf(j[p]),r.addSelf(j[m]),r.addSelf(h[x].position),r.addSelf(h[w].position),r.multiplyScalar(0.25)),
-k[n]=s+d.length+v,i.push(new THREE.Vertex(r)),v++,e.supportUVs&&o.length!=0)m=new THREE.UV,m.u=o[x].u+o[w].u,m.v=o[x].v+o[w].v,m.u/=2,m.v/=2,o.push(m);var u,G;w=["123","12","2","23"];r=["123","23","3","31"];var A=["123","31","1","12"],E=["1234","12","2","23"],D=["1234","23","3","34"],H=["1234","34","4","41"],B=["1234","41","1","12"];n=0;for(t=j.length;n<t;n++)p=d[n],m=s+n,p instanceof THREE.Face3?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.a),c(m,k[v],p.b,k[x],p,w),c(m,k[x],p.c,k[u],p,r),c(m,k[u],p.a,k[v],
-p,A)):p instanceof THREE.Face4?(v=b(p.a,p.b),x=b(p.b,p.c),u=b(p.c,p.d),G=b(p.d,p.a),c(m,k[v],p.b,k[x],p,E),c(m,k[x],p.c,k[u],p,D),c(m,k[u],p.d,k[G],p,H),c(m,k[G],p.a,k[v],p,B)):console.log("face should be a face!",p);d=i;i=new THREE.Vector3;k=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(y[n]!==void 0){i.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);m=0;for(q in C[n])i.addSelf(j[q]),m++;v=0;s=y[n].length;for(q=0;q<s;q++)l[b(y[n][q][0],y[n][q][1])]&&v++;if(v!=2){i.divideScalar(m);for(q=0;q<
-s;q++)m=y[n][q],m=h[m[0]].position.clone().addSelf(h[m[1]].position).divideScalar(2),k.addSelf(m);k.divideScalar(s);p.addSelf(h[n].position);p.multiplyScalar(s-3);p.addSelf(i);p.addSelf(k.multiplyScalar(2));p.divideScalar(s);d[n].position=p}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,n,l,o=0;o<4;o++){l=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var q=0;q<l.length;q++)n=h.vertexColors[l[q]-1],k.r+=n.r,k.g+=n.g,k.b+=n.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[o]=k}}g.push(j);(!e.supportUVs||m.length!=0)&&f.push([m[a],m[b],m[c],m[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var d=[],g=[],f=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],j={},p={},m=[],n,t,l,s,q,r=a.faceVertexUvs[0];n=0;for(t=r.length;n<t;n++){l=0;for(s=r[n].length;l<s;l++)q=d[n]["abcd".charAt(l)],m[q]||(m[q]=r[n][l])}var o;n=0;for(t=d.length;n<t;n++)if(q=d[n],k.push(q.centroid),i.push(new THREE.Vertex(q.centroid)),e.supportUVs&&m.length!=0){o=new THREE.UV;if(q instanceof THREE.Face3)o.u=m[q.a].u+m[q.b].u+m[q.c].u,o.v=m[q.a].v+m[q.b].v+m[q.c].v,o.u/=3,o.v/=3;else if(q instanceof THREE.Face4)o.u=
+m[q.a].u+m[q.b].u+m[q.c].u+m[q.d].u,o.v=m[q.a].v+m[q.b].v+m[q.c].v+m[q.d].v,o.u/=4,o.v/=4;m.push(o)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var u=0,r=h.length,y,w,x={},A={},C=function(a,
+b){x[a]===void 0&&(x[a]=[]);x[a].push(b)},F=function(a,b){A[a]===void 0&&(A[a]={});A[a][b]=null};for(n in t){o=t[n];y=n.split("_");w=y[0];y=y[1];C(w,[w,y]);C(y,[w,y]);l=0;for(s=o.length;l<s;l++)q=o[l],F(w,q,n),F(y,q,n);o.length<2&&(p[n]=!0)}for(n in t)if(o=t[n],q=o[0],o=o[1],y=n.split("_"),w=y[0],y=y[1],s=new THREE.Vector3,p[n]?(s.addSelf(h[w].position),s.addSelf(h[y].position),s.multiplyScalar(0.5)):(s.addSelf(k[q]),s.addSelf(k[o]),s.addSelf(h[w].position),s.addSelf(h[y].position),s.multiplyScalar(0.25)),
+j[n]=r+d.length+u,i.push(new THREE.Vertex(s)),u++,e.supportUVs&&m.length!=0)o=new THREE.UV,o.u=m[w].u+m[y].u,o.v=m[w].v+m[y].v,o.u/=2,o.v/=2,m.push(o);var v,D;y=["123","12","2","23"];s=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],z=["1234","23","3","34"],G=["1234","34","4","41"],I=["1234","41","1","12"];n=0;for(t=k.length;n<t;n++)q=d[n],o=r+n,q instanceof THREE.Face3?(u=b(q.a,q.b),w=b(q.b,q.c),v=b(q.c,q.a),c(o,j[u],q.b,j[w],q,y),c(o,j[w],q.c,j[v],q,s),c(o,j[v],q.a,j[u],
+q,C)):q instanceof THREE.Face4?(u=b(q.a,q.b),w=b(q.b,q.c),v=b(q.c,q.d),D=b(q.d,q.a),c(o,j[u],q.b,j[w],q,F),c(o,j[w],q.c,j[v],q,z),c(o,j[v],q.d,j[D],q,G),c(o,j[D],q.a,j[u],q,I)):console.log("face should be a face!",q);d=i;i=new THREE.Vector3;j=new THREE.Vector3;n=0;for(t=h.length;n<t;n++)if(x[n]!==void 0){i.set(0,0,0);j.set(0,0,0);q=new THREE.Vector3(0,0,0);o=0;for(l in A[n])i.addSelf(k[l]),o++;u=0;r=x[n].length;for(l=0;l<r;l++)p[b(x[n][l][0],x[n][l][1])]&&u++;if(u!=2){i.divideScalar(o);for(l=0;l<
+r;l++)o=x[n][l],o=h[o[0]].position.clone().addSelf(h[o[1]].position).divideScalar(2),j.addSelf(o);j.divideScalar(r);q.addSelf(h[n].position);q.multiplyScalar(r-3);q.addSelf(i);q.addSelf(j.multiplyScalar(2));q.divideScalar(r);d[n].position=q}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 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={constructor:THREE.Loader,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.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function g(a,b,e,f,h,g){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
-if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}h&&a[b].offset.set(h[0],h[1]);if(g){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[g[0]]!==void 0)a[b].wrapS=f[g[0]];if(f[g[1]]!==void 0)a[b].wrapT=f[g[1]]}d(a[b],c+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
+a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),d=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=c;a.image.height=d;a.image.getContext("2d").drawImage(this,0,0,c,d)}else a.image=this;a.needsUpdate=!0};d.src=c}function g(a,b,e,f,g,h){var i=document.createElement("canvas");a[b]=new THREE.Texture(i);a[b].sourceFile=e;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
+if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var e,h,i;h="MeshLambertMaterial";e={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="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=f(a.colorDiffuse);
 else if(a.DbgColor)e.color=a.DbgColor;if(a.colorSpecular)e.specular=f(a.colorSpecular);if(a.colorAmbient)e.ambient=f(a.colorAmbient);if(a.transparency)e.opacity=a.transparency;if(a.specularCoef)e.shininess=a.specularCoef;a.mapDiffuse&&c&&g(e,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(e,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(e,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var j=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(j.uniforms),l=e.color;h=e.specular;i=e.ambient;var o=e.shininess;k.tNormal.texture=e.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(e.map)k.tDiffuse.texture=e.map,k.enableDiffuse.value=!0;if(e.specularMap)k.tSpecular.texture=e.specularMap,k.enableSpecular.value=!0;if(e.lightMap)k.tAO.texture=
-e.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(l);k.uSpecularColor.value.setHex(h);k.uAmbientColor.value.setHex(i);k.uShininess.value=o;if(e.opacity)k.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:k,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&g(e,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,j=THREE.UniformsUtils.clone(k.uniforms),p=e.color;h=e.specular;i=e.ambient;var m=e.shininess;j.tNormal.texture=e.normalMap;if(a.mapNormalFactor)j.uNormalScale.value=a.mapNormalFactor;if(e.map)j.tDiffuse.texture=e.map,j.enableDiffuse.value=!0;if(e.specularMap)j.tSpecular.texture=e.specularMap,j.enableSpecular.value=!0;if(e.lightMap)j.tAO.texture=
+e.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(p);j.uSpecularColor.value.setHex(h);j.uAmbientColor.value.setHex(i);j.uShininess.value=m;if(e.opacity)j.uOpacity.value=e.opacity;e=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:j,lights:!0,fog:!0})}else e=new THREE[h](e);return e}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,c=d.callback,b=d.texture_path,d=d.bin_path;var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,c,b,d,g)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,f){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);h.metadata===void 0||h.metadata.formatVersion===void 0||h.metadata.formatVersion!==3?console.error("Deprecated file format."):a.loadAjaxBuffers(h,b,g,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+
 e.status+"]")};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var f=new XMLHttpRequest,e=b+"/"+a.buffers,h=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,c,d,a.materials):console.error("Couldn't load ["+e+"] ["+f.status+"]"):f.readyState==3?g&&(h==0&&(h=f.getResponseHeader("Content-Length")),g({total:h,loaded:f.responseText.length})):f.readyState==2&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",
 e,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=k(a,b),e=k(a,b+1),f=k(a,b+2),g=k(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function h(a,b){var c=k(a,b),d=k(a,b+1),e=k(a,b+2);return(k(a,b+3)<<24)+(e<<16)+(d<<8)+c}function g(a,b){var c=k(a,b);return(k(a,b+1)<<8)+c}function j(a,b){var c=k(a,b);return c>127?c-256:c}function k(a,b){return a.charCodeAt(b)&255}function l(b){var c,
-d,e;c=h(a,b);d=h(a,b+x);e=h(a,b+y);b=g(a,b+C);p.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=h(a,b);d=h(a,b+x);e=h(a,b+y);f=g(a,b+C);j=h(a,b+A);k=h(a,b+E);l=h(a,b+u);var b=v[k*3],m=v[k*3+1];k=v[k*3+2];var n=v[l*3],o=v[l*3+1];l=v[l*3+2];p.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(v[j*3],v[j*3+1],v[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=h(a,b);d=h(a,b+G);e=h(a,b+D);f=h(a,b+H);b=g(a,b+B);p.faces.push(new THREE.Face4(c,
-d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,m,n;c=h(a,b);d=h(a,b+G);e=h(a,b+D);f=h(a,b+H);j=g(a,b+B);k=h(a,b+F);l=h(a,b+J);m=h(a,b+N);n=h(a,b+M);var b=v[l*3],o=v[l*3+1];l=v[l*3+2];var fa=v[m*3],ga=v[m*3+1];m=v[m*3+2];var ha=v[n*3],q=v[n*3+1];n=v[n*3+2];p.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(v[k*3],v[k*3+1],v[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(fa,ga,m),new THREE.Vector3(ha,q,n)],null,j))}function q(b){var c,d,e,f;c=h(a,b);d=h(a,b+O);e=h(a,b+z);b=w[c*2];f=w[c*
-2+1];c=w[d*2];var g=p.faceVertexUvs[0];d=w[d*2+1];var i=w[e*2];e=w[e*2+1];var j=[];j.push(new THREE.UV(b,f));j.push(new THREE.UV(c,d));j.push(new THREE.UV(i,e));g.push(j)}function r(b){var c,d,e,f,g,i;c=h(a,b);d=h(a,b+K);e=h(a,b+I);f=h(a,b+L);b=w[c*2];g=w[c*2+1];c=w[d*2];i=w[d*2+1];d=w[e*2];var j=p.faceVertexUvs[0];e=w[e*2+1];var k=w[f*2];f=w[f*2+1];var l=[];l.push(new THREE.UV(b,g));l.push(new THREE.UV(c,i));l.push(new THREE.UV(d,e));l.push(new THREE.UV(k,f));j.push(l)}var p=this,s=0,m,v=[],w=[],
-x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z,K,I,L,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(p,d,b);m={signature:a.substr(s,8),header_bytes:k(a,s+8),vertex_coordinate_bytes:k(a,s+9),normal_coordinate_bytes:k(a,s+10),uv_coordinate_bytes:k(a,s+11),vertex_index_bytes:k(a,s+12),normal_index_bytes:k(a,s+13),uv_index_bytes:k(a,s+14),material_index_bytes:k(a,s+15),nvertices:h(a,s+16),nnormals:h(a,s+16+4),nuvs:h(a,s+16+8),ntri_flat:h(a,s+16+12),ntri_smooth:h(a,s+16+16),ntri_flat_uv:h(a,
-s+16+20),ntri_smooth_uv:h(a,s+16+24),nquad_flat:h(a,s+16+28),nquad_smooth:h(a,s+16+32),nquad_flat_uv:h(a,s+16+36),nquad_smooth_uv:h(a,s+16+40)};s+=m.header_bytes;x=m.vertex_index_bytes;y=m.vertex_index_bytes*2;C=m.vertex_index_bytes*3;A=m.vertex_index_bytes*3+m.material_index_bytes;E=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;u=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;G=m.vertex_index_bytes;D=m.vertex_index_bytes*2;H=m.vertex_index_bytes*3;B=m.vertex_index_bytes*
-4;F=m.vertex_index_bytes*4+m.material_index_bytes;J=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;N=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;M=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;O=m.uv_index_bytes;z=m.uv_index_bytes*2;K=m.uv_index_bytes;I=m.uv_index_bytes*2;L=m.uv_index_bytes*3;b=m.vertex_index_bytes*3+m.material_index_bytes;Q=m.vertex_index_bytes*4+m.material_index_bytes;R=m.ntri_flat*b;P=m.ntri_smooth*(b+m.normal_index_bytes*
-3);T=m.ntri_flat_uv*(b+m.uv_index_bytes*3);S=m.ntri_smooth_uv*(b+m.normal_index_bytes*3+m.uv_index_bytes*3);U=m.nquad_flat*Q;b=m.nquad_smooth*(Q+m.normal_index_bytes*4);Q=m.nquad_flat_uv*(Q+m.uv_index_bytes*4);s+=function(b){for(var d,f,g,h=m.vertex_coordinate_bytes*3,i=b+m.nvertices*h;b<i;b+=h)d=c(a,b),f=c(a,b+m.vertex_coordinate_bytes),g=c(a,b+m.vertex_coordinate_bytes*2),p.vertices.push(new THREE.Vertex(new THREE.Vector3(d,f,g)));return m.nvertices*h}(s);s+=function(b){for(var c,d,e,f=m.normal_coordinate_bytes*
-3,g=b+m.nnormals*f;b<g;b+=f)c=j(a,b),d=j(a,b+m.normal_coordinate_bytes),e=j(a,b+m.normal_coordinate_bytes*2),v.push(c/127,d/127,e/127);return m.nnormals*f}(s);s+=function(b){for(var d,f,g=m.uv_coordinate_bytes*2,h=b+m.nuvs*g;b<h;b+=g)d=c(a,b),f=c(a,b+m.uv_coordinate_bytes),w.push(d,f);return m.nuvs*g}(s);R=s+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes,d=c+m.uv_index_bytes*3,e=a+m.ntri_flat_uv*d;for(b=a;b<e;b+=d)l(b),q(b+c);return e-a})(P);
-(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,d=c+m.uv_index_bytes*3,e=a+m.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),q(b+c);return e-a})(T);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes,d=c+m.uv_index_bytes*4,e=a+m.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),r(b+c);return e-a})(b);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,d=c+m.uv_index_bytes*4,e=a+m.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),r(b+
-c);return e-a})(Q);(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes,d=a+m.ntri_flat*c;for(b=a;b<d;b+=c)l(b);return d-a})(s);(function(a){var b,c=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,d=a+m.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(R);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes,d=a+m.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*
-4,d=a+m.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
-THREE.ColladaLoader=function(){function a(a,d,g){P=a;d=d||U;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",C,"material");ba=c("//dae:library_effects/dae:effect",D,"effect");W=c("//dae:library_geometries/dae:geometry",r,"geometry");V=c("//dae:library_controllers/dae:controller",h,"controller");X=c("//dae:library_animations/dae:animation",B,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
-k,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(f(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=j(a,b),e=j(a,b+1),f=j(a,b+2),g=j(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=j(a,b),d=j(a,b+1),e=j(a,b+2);return(j(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=j(a,b);return(j(a,b+1)<<8)+c}function k(a,b){var c=j(a,b);return c>127?c-256:c}function j(a,b){return a.charCodeAt(b)&255}function p(b){var c,
+d,e;c=g(a,b);d=g(a,b+w);e=g(a,b+x);b=i(a,b+A);q.faces.push(new THREE.Face3(c,d,e,null,null,b))}function m(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+w);e=g(a,b+x);f=i(a,b+A);j=g(a,b+C);k=g(a,b+F);l=g(a,b+v);var b=u[k*3],n=u[k*3+1];k=u[k*3+2];var m=u[l*3],o=u[l*3+1];l=u[l*3+2];q.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(b,n,k),new THREE.Vector3(m,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+D);e=g(a,b+z);f=g(a,b+G);b=i(a,b+I);q.faces.push(new THREE.Face4(c,
+d,e,f,null,null,b))}function t(b){var c,d,e,f,j,k,l,n,m;c=g(a,b);d=g(a,b+D);e=g(a,b+z);f=g(a,b+G);j=i(a,b+I);k=g(a,b+E);l=g(a,b+J);n=g(a,b+O);m=g(a,b+B);var b=u[l*3],o=u[l*3+1];l=u[l*3+2];var fa=u[n*3],ga=u[n*3+1];n=u[n*3+2];var ha=u[m*3],p=u[m*3+1];m=u[m*3+2];q.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(u[k*3],u[k*3+1],u[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(fa,ga,n),new THREE.Vector3(ha,p,m)],null,j))}function l(b){var c,d,e,f;c=g(a,b);d=g(a,b+K);e=g(a,b+H);b=y[c*2];f=y[c*
+2+1];c=y[d*2];var i=q.faceVertexUvs[0];d=y[d*2+1];var j=y[e*2];e=y[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function s(b){var c,d,e,f,i,j;c=g(a,b);d=g(a,b+N);e=g(a,b+L);f=g(a,b+M);b=y[c*2];i=y[c*2+1];c=y[d*2];j=y[d*2+1];d=y[e*2];var k=q.faceVertexUvs[0];e=y[e*2+1];var l=y[f*2];f=y[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,j));n.push(new THREE.UV(d,e));n.push(new THREE.UV(l,f));k.push(n)}var q=this,r=0,o,u=[],y=[],
+w,x,A,C,F,v,D,z,G,I,E,J,O,B,K,H,N,L,M,R,P,T,S,U,Q;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(q,d,b);o={signature:a.substr(r,8),header_bytes:j(a,r+8),vertex_coordinate_bytes:j(a,r+9),normal_coordinate_bytes:j(a,r+10),uv_coordinate_bytes:j(a,r+11),vertex_index_bytes:j(a,r+12),normal_index_bytes:j(a,r+13),uv_index_bytes:j(a,r+14),material_index_bytes:j(a,r+15),nvertices:g(a,r+16),nnormals:g(a,r+16+4),nuvs:g(a,r+16+8),ntri_flat:g(a,r+16+12),ntri_smooth:g(a,r+16+16),ntri_flat_uv:g(a,
+r+16+20),ntri_smooth_uv:g(a,r+16+24),nquad_flat:g(a,r+16+28),nquad_smooth:g(a,r+16+32),nquad_flat_uv:g(a,r+16+36),nquad_smooth_uv:g(a,r+16+40)};r+=o.header_bytes;w=o.vertex_index_bytes;x=o.vertex_index_bytes*2;A=o.vertex_index_bytes*3;C=o.vertex_index_bytes*3+o.material_index_bytes;F=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;v=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;D=o.vertex_index_bytes;z=o.vertex_index_bytes*2;G=o.vertex_index_bytes*3;I=o.vertex_index_bytes*
+4;E=o.vertex_index_bytes*4+o.material_index_bytes;J=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes;O=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;B=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;K=o.uv_index_bytes;H=o.uv_index_bytes*2;N=o.uv_index_bytes;L=o.uv_index_bytes*2;M=o.uv_index_bytes*3;b=o.vertex_index_bytes*3+o.material_index_bytes;Q=o.vertex_index_bytes*4+o.material_index_bytes;R=o.ntri_flat*b;P=o.ntri_smooth*(b+o.normal_index_bytes*
+3);T=o.ntri_flat_uv*(b+o.uv_index_bytes*3);S=o.ntri_smooth_uv*(b+o.normal_index_bytes*3+o.uv_index_bytes*3);U=o.nquad_flat*Q;b=o.nquad_smooth*(Q+o.normal_index_bytes*4);Q=o.nquad_flat_uv*(Q+o.uv_index_bytes*4);r+=function(b){for(var d,f,g,h=o.vertex_coordinate_bytes*3,i=b+o.nvertices*h;b<i;b+=h)d=c(a,b),f=c(a,b+o.vertex_coordinate_bytes),g=c(a,b+o.vertex_coordinate_bytes*2),q.vertices.push(new THREE.Vertex(new THREE.Vector3(d,f,g)));return o.nvertices*h}(r);r+=function(b){for(var c,d,e,f=o.normal_coordinate_bytes*
+3,g=b+o.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+o.normal_coordinate_bytes),e=k(a,b+o.normal_coordinate_bytes*2),u.push(c/127,d/127,e/127);return o.nnormals*f}(r);r+=function(b){for(var d,f,g=o.uv_coordinate_bytes*2,h=b+o.nuvs*g;b<h;b+=g)d=c(a,b),f=c(a,b+o.uv_coordinate_bytes),y.push(d,f);return o.nuvs*g}(r);R=r+R;P=R+P;T=P+T;S=T+S;U=S+U;b=U+b;Q=b+Q;(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes,d=c+o.uv_index_bytes*3,e=a+o.ntri_flat_uv*d;for(b=a;b<e;b+=d)p(b),l(b+c);return e-a})(P);
+(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,d=c+o.uv_index_bytes*3,e=a+o.ntri_smooth_uv*d;for(b=a;b<e;b+=d)m(b),l(b+c);return e-a})(T);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes,d=c+o.uv_index_bytes*4,e=a+o.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),s(b+c);return e-a})(b);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,d=c+o.uv_index_bytes*4,e=a+o.nquad_smooth_uv*d;for(b=a;b<e;b+=d)t(b),s(b+
+c);return e-a})(Q);(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes,d=a+o.ntri_flat*c;for(b=a;b<d;b+=c)p(b);return d-a})(r);(function(a){var b,c=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,d=a+o.ntri_smooth*c;for(b=a;b<d;b+=c)m(b);return d-a})(R);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes,d=a+o.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(S);(function(a){var b,c=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*
+4,d=a+o.nquad_smooth*c;for(b=a;b<d;b+=c)t(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
+THREE.ColladaLoader=function(){function a(a,d,g){P=a;d=d||U;g!==void 0&&(a=g.split("/"),a.pop(),da=a.length<1?"":a.join("/")+"/");$=c("//dae:library_images/dae:image",e,"image");aa=c("//dae:library_materials/dae:material",A,"material");ba=c("//dae:library_effects/dae:effect",z,"effect");W=c("//dae:library_geometries/dae:geometry",s,"geometry");V=c("//dae:library_controllers/dae:controller",h,"controller");X=c("//dae:library_animations/dae:animation",I,"animation");ca=c(".//dae:library_visual_scenes/dae:visual_scene",
+j,"visual_scene");Y=[];Z=[];(a=P.evaluate(".//dae:scene/dae:instance_visual_scene",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=ca[a]):S=null;T=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)T.add(f(S.nodes[a]));b();for(var i in X);i={scene:T,morphs:Y,skins:Z,dae:{images:$,materials:aa,effects:ba,geometries:W,controllers:V,animations:X,visualScenes:ca,scene:S}};d&&d(i);return i}function c(a,b,c){for(var a=P.evaluate(a,P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
 null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in X)for(var e=X[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof
-THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=V[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
-for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}else throw"ColladaLoader: Could not find joint '"+
-j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
-new q;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new q,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
-0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},l=0,m;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){m=j[h];var o=ba[aa[m.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;m=k[m.symbol]=o.material;l++}j=m||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
-i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){h=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=W[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===
-h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
-null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function l(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
-"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function q(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function p(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function s(){}function m(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function x(){this.semantic=
-"";this.offset=0;this.source="";this.set=0}function y(a){this.id=a;this.type=null}function C(){this.name=this.id="";this.instance_effect=null}function A(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function E(a,b){this.type=a;this.effect=b;this.material=null}function u(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
-this.source=null}function D(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function H(){this.url=""}function B(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function F(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function N(a){var b=a.getAttribute("id");
-if(Q[b]!=void 0)return Q[b];Q[b]=(new y(b)).parse(a);return Q[b]}function M(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function O(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function z(a){for(var a=K(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function K(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function I(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function L(a,
-b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function R(a,b){var c="";c+=L(a.x,b)+",";c+=L(a.y,b)+",";c+=L(a.z,b);return c}var P=null,T=null,S,U=null,Q={},$={},X={},V={},W={},aa={},ba={},ca,da,Y,Z,ea=THREE.SmoothShading;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
-c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
-0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new y).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new x).parse(d))}}return b};
-j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=O(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new y).parse(f);b[f.id]=f;break;case "joints":c=
-f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new x).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var h=
-a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "input":e.push((new x).parse(h));break;case "v":c=z(h.textContent);break;case "vcount":d=z(h.textContent)}}for(f=h=0;f<d.length;f++){for(var g=d[f],i=[],j=0;j<g;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[h+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);h+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
-0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new l).parse(c))}}return this};l.prototype.getChannelForTransform=
-function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,h=e.indexOf("(")>=0,g;if(f)d=e.split("."),e=d.shift(),d.shift();else if(h){g=e.split("(");e=g.shift();for(d=0;d<g.length;d++)g[d]=parseInt(g[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:h,arrIndices:g},c}return null};l.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
-b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};l.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
-this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new l).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new q).parse(b));break;case "instance_light":break;case "instance_node":b=
-b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new l).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],f=0;f<e.channel.length;f++){var h=e.channel[f],g=e.sampler[f];d=h.target.split("/")[0];
-if(d==this.id)g.create(),h.sampler=g,c=Math.min(c,g.startTime),b=Math.max(b,g.endTime),a.push(h)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;h=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(g=
-this.transforms[f],i=e[g.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}h=k!==void 0?k instanceof THREE.Matrix4?h.multiply(h,k):h.multiply(h,g.matrix):h.multiply(h,g.matrix)}else h=h.multiply(h,g.matrix);b=h;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};l.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
-this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=O(a.textContent);this.updateMatrix();return this};o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
+THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=V[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=S.getChildById(c.skeleton[0],!0)||S.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,n;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
+for(e=0;e<g.frames;e++){var m=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,m,e);h=m;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],n=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){n=p;break}if(n>=0){p=i.invBindMatrices[n];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==n&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
+j.sid+"'.";}for(h=0;h<m.length;h++)if(m[h].type=="JOINT")for(i=0;i<m[h].weights.length;i++)j=m[h].weights[i],k=j.index,j=j.weight,n=a.vertices[k],k=o[k],l.x=n.position.x,l.y=n.position.y,l.z=n.position.z,m[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function f(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=V[a.controllers[e].url];switch(i.type){case "skin":if(W[i.skin.source]){var j=
+new l;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(V[i.skin.source]&&(d=i=V[i.skin.source],i.morph&&W[i.morph.source]))j=new l,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(W[i.morph.source])j=new l,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
+0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=W[i.url],k={},m=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=ba[aa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;m++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(m>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)m=
+i.faces[h],m.materials=[k[m.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=V[c.url],j.skinInstanceController=c,j.name="skin_"+Z.length,Z.push(j);else if(d!==void 0){h=i;k=d instanceof n?V[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(m=0;m<k.targets.length;m++)if(p=W[k.targets[m]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+Y.length;Y.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(e=0;e<a.nodes.length;e++)b.add(f(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
+null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function j(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function m(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url=
+"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function l(){this.url="";this.instance_material=[]}function s(){this.id="";this.mesh=null}function q(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function r(){}function o(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function y(){this.input={}}function w(){this.semantic=
+"";this.offset=0;this.source="";this.set=0}function x(a){this.id=a;this.type=null}function A(){this.name=this.id="";this.instance_effect=null}function C(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function F(a,b){this.type=a;this.effect=b;this.material=null}function v(a){this.effect=a;this.format=this.init_from=null}function D(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
+this.source=null}function z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function G(){this.url=""}function I(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function E(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function J(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function O(a){var b=a.getAttribute("id");
+if(Q[b]!=void 0)return Q[b];Q[b]=(new x(b)).parse(a);return Q[b]}function B(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function K(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=N(a).split(/\s+/),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function N(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function L(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function M(a,
+b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function R(a,b){var c="";c+=M(a.x,b)+",";c+=M(a.y,b)+",";c+=M(a.z,b);return c}var P=null,T=null,S,U=null,Q={},$={},X={},V={},W={},aa={},ba={},ca,da,Y,Z,ea=THREE.SmoothShading;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new x).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new w).parse(d))}}return b};
+k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=K(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new x).parse(f);b[f.id]=f;break;case "joints":c=
+f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new w).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new w).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var n=e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};j.prototype.getChildById=function(a,b){for(var c=
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};j.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
+b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");
+this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new l).parse(b));break;case "instance_light":break;case "instance_node":b=
+b.getAttribute("url").replace(/^#/,"");(b=P.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",P,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new m).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in X)for(var e=X[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
+if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
+this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};p.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
+this.transforms[a].matrix)};m.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=K(a.textContent);this.updateMatrix();return this};m.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;
 case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};q.prototype.parse=function(a){this.url=
-a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};r.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
-(new p(this)).parse(c)}}return this};p.prototype.parse=function(a){function b(a,c){var d=R(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":N(d);break;case "vertices":this.vertices=(new w).parse(d);break;case "triangles":this.primitives.push((new m).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new s).parse(d))}}var e=
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=P.evaluate(".//dae:instance_material",c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};l.prototype.parse=function(a){this.url=
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=P.evaluate(".//dae:instance_material",c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};s.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
+(new q(this)).parse(c)}}return this};q.prototype.parse=function(a){function b(a,c){var d=R(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":O(d);break;case "vertices":this.vertices=(new y).parse(d);break;case "triangles":this.primitives.push((new o).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new r).parse(d))}}var e=
 {};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
-return this};p.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,h=a.p,g=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<g.length;e++)switch(i=g[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<h.length;){var p=[],q=[],r={},t=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<g.length;f++)switch(i=g[f],l=Q[i.source],j=h[d+e*g.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
-l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":t.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var s;n==3?s=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],t.length?t:new THREE.Color):n==4&&(s=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],t.length?t:new THREE.Color));s.daeMaterial=a.material;b.faces.push(s);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
-e[1],e[2]]);d+=g.length*n}};s.prototype=new m;s.prototype.constructor=s;m.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};m.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=I(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new x).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-z(c.textContent);break;case "p":this.p=z(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=I(a,"count",0);this.stride=I(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
-"input"){var c=(new x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=I(a,"set",-1);this.offset=I(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=K(c.textContent).split(/\s+/),
-e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=K(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new v).parse(c.childNodes[d]);break}}}return this};
-y.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};C.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new H).parse(a.childNodes[b]);break}return this};A.prototype.isColor=function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=O(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
-c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};E.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new A).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,M,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};E.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof A)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};u.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};D.prototype.create=function(){if(this.shader==null)return null};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-D.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new u(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};D.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
-break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};D.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new E(c.nodeName,this)).parse(c)}}};H.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new y).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new F(this)).parse(c))}}return this};F.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new x).parse(c))}}return this};
+return this};q.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=3,p=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":p.push(i.set)}for(;d<g.length;){var o=[],q=[],s={},r=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=Q[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=R(b.vertices[j].position);o.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;m==3?t=new THREE.Face3(o[0],o[1],o[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):m==4&&(t=new THREE.Face4(o[0],o[1],o[2],o[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<p.length;f++)e=s[p[f]],b.faceVertexUvs[f].push([e[0],
+e[1],e[2]]);d+=h.length*m}};r.prototype=new o;r.prototype.constructor=r;o.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};o.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=L(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new w).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=L(a,"count",0);this.stride=L(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};y.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"input"){var c=(new w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=L(a,"set",-1);this.offset=L(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};x.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=N(c.textContent).split(/\s+/),
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=K(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=N(c.textContent).split(/\s+/);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};
+x.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};A.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new G).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=K(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
+c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=P.evaluate(".//dae:float",c,B,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=$[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(da+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ea;return this.material=new THREE.MeshLambertMaterial(a)};v.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
+if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
+c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};z.prototype.create=function(){if(this.shader==null)return null};z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
+z.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new v(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new D(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};G.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};I.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new x).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new J(this)).parse(c));break;case "channel":this.channel.push((new E(this)).parse(c))}}return this};E.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new w).parse(c))}}return this};
 J.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
 200))U=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ea=a},applySkin:g,geometries:W}};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,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var f=new XMLHttpRequest,e=0;f.onreadystatechange=function(){if(f.readyState==4)if(f.status==200||f.status==0)try{var h=JSON.parse(f.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+f.status+"]");else f.readyState==3?g&&(e==0&&(e=f.getResponseHeader("Content-Length")),g({total:e,loaded:f.responseText.length})):
 f.readyState==2&&(e=f.getResponseHeader("Content-Length"))};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,h,g,j,k,l,o,n,t,q,r,p,s,m,v=a.faces;l=a.vertices;var w=a.normals,x=a.colors,y=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&y++;for(c=0;c<y;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=l.length;j<
-k;)o=new THREE.Vertex,o.position.x=l[j++]*b,o.position.y=l[j++]*b,o.position.z=l[j++]*b,d.vertices.push(o);j=0;for(k=v.length;j<k;){b=v[j++];l=b&1;g=b&2;c=b&4;h=b&8;n=b&16;o=b&32;q=b&64;b&=128;l?(r=new THREE.Face4,r.a=v[j++],r.b=v[j++],r.c=v[j++],r.d=v[j++],l=4):(r=new THREE.Face3,r.a=v[j++],r.b=v[j++],r.c=v[j++],l=3);if(g)g=v[j++],r.materialIndex=g;g=d.faces.length;if(c)for(c=0;c<y;c++)p=a.uvs[c],t=v[j++],m=p[t*2],t=p[t*2+1],d.faceUvs[c][g]=new THREE.UV(m,t);if(h)for(c=0;c<y;c++){p=a.uvs[c];s=[];
-for(h=0;h<l;h++)t=v[j++],m=p[t*2],t=p[t*2+1],s[h]=new THREE.UV(m,t);d.faceVertexUvs[c][g]=s}if(n)n=v[j++]*3,h=new THREE.Vector3,h.x=w[n++],h.y=w[n++],h.z=w[n],r.normal=h;if(o)for(c=0;c<l;c++)n=v[j++]*3,h=new THREE.Vector3,h.x=w[n++],h.y=w[n++],h.z=w[n],r.vertexNormals.push(h);if(q)o=v[j++],o=new THREE.Color(x[o]),r.color=o;if(b)for(c=0;c<l;c++)o=v[j++],o=new THREE.Color(x[o]),r.vertexColors.push(o);d.faces.push(r)}}})(g);(function(){var b,c,h,g;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
-2)h=a.skinWeights[b],g=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(h,g,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)h=a.skinIndices[b],g=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(h,g,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,h,g,j,k,l,o,n,t;c=0;for(h=a.morphTargets.length;c<h;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
-t=a.morphTargets[c].vertices;g=0;for(j=t.length;g<j;g+=3)k=t[g]*b,l=t[g+1]*b,o=t[g+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(k,l,o)))}}if(a.morphColors!==void 0){c=0;for(h=a.morphColors.length;c<h;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(g=k.length;b<g;b+=3)l=new THREE.Color(16755200),l.setRGB(k[b],k[b+1],k[b+2]),j.push(l)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
-d.computeTangents();c(d)};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,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(n in B.objects)if(!z.objects[n])if(s=B.objects[n],s.geometry!==void 0){if(E=z.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)H=z.materials[s.materials[I]],a=H instanceof THREE.ShaderMaterial;a&&E.computeTangents();w=s.position;x=s.rotation;y=s.quaternion;
-C=s.scale;y=0;H.length==0&&(H=new THREE.MeshFaceMaterial);H.length>1&&(H=new THREE.MeshFaceMaterial);a=new THREE.Mesh(E,H);a.name=n;a.position.set(w[0],w[1],w[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(C[0],C[1],C[2]);a.visible=s.visible;z.scene.add(a);z.objects[n]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);z.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(E),z.scene.add(b),b.position=
-a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}}else w=s.position,x=s.rotation,y=s.quaternion,C=s.scale,y=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(C[0],C[1],C[2]),a.visible=s.visible!==void 0?s.visible:!1,z.scene.add(a),z.objects[n]=a,z.empties[n]=a,s.trigger&&s.trigger.toLowerCase()!=
-"none"&&(b={type:s.trigger,object:s},z.triggers[a.name]=b)}function i(a){return function(c){z.geometries[a]=c;h();J-=1;b.onLoadComplete();k()}}function j(a){return function(b){z.geometries[a]=b}}function k(){b.callbackProgress({totalModels:M,totalTextures:O,loadedModels:M-J,loadedTextures:O-N},z);b.onLoadProgress();J==0&&N==0&&c(z)}var l,o,n,t,q,r,p,s,m,v,w,x,y,C,A,E,u,G,D,H,B,F,J,N,M,O,z;B=a.data;D=new THREE.BinaryLoader;F=new THREE.JSONLoader;N=J=0;z={scene:new THREE.Scene,geometries:{},materials:{},
-textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in B.objects)if(s=B.objects[n],s.meshCollider){a=!0;break}if(a)z.scene.collisions=new THREE.CollisionSystem;if(B.transform){a=B.transform.position;m=B.transform.rotation;var K=B.transform.scale;a&&z.scene.position.set(a[0],a[1],a[2]);m&&z.scene.rotation.set(m[0],m[1],m[2]);K&&z.scene.scale.set(K[0],K[1],K[2]);(a||m||K)&&z.scene.updateMatrix()}a=function(){N-=1;k();b.onLoadComplete()};for(q in B.cameras)m=B.cameras[q],
-m.type=="perspective"?u=new THREE.PerspectiveCamera(m.fov,m.aspect,m.near,m.far):m.type=="ortho"&&(u=new THREE.OrthographicCamera(m.left,m.right,m.top,m.bottom,m.near,m.far)),w=m.position,m=m.target,u.position.set(w[0],w[1],w[2]),u.target=new THREE.Vector3(m[0],m[1],m[2]),z.cameras[q]=u;for(t in B.lights)m=B.lights[t],q=m.color!==void 0?m.color:16777215,u=m.intensity!==void 0?m.intensity:1,m.type=="directional"?(w=m.direction,v=new THREE.DirectionalLight(q,u),v.position.set(w[0],w[1],w[2]),v.position.normalize()):
-m.type=="point"?(w=m.position,v=m.distance,v=new THREE.PointLight(q,u,v),v.position.set(w[0],w[1],w[2])):m.type=="ambient"&&(v=new THREE.AmbientLight(q)),z.scene.add(v),z.lights[t]=v;for(r in B.fogs)t=B.fogs[r],t.type=="linear"?G=new THREE.Fog(0,t.near,t.far):t.type=="exp2"&&(G=new THREE.FogExp2(0,t.density)),m=t.color,G.color.setRGB(m[0],m[1],m[2]),z.fogs[r]=G;if(z.cameras&&B.defaults.camera)z.currentCamera=z.cameras[B.defaults.camera];if(z.fogs&&B.defaults.fog)z.scene.fog=z.fogs[B.defaults.fog];
-m=B.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(m[0],m[1],m[2]);z.bgColorAlpha=B.defaults.bgalpha;for(l in B.geometries)if(r=B.geometries[l],r.type=="bin_mesh"||r.type=="ascii_mesh")J+=1,b.onLoadStart();M=J;for(l in B.geometries)r=B.geometries[l],r.type=="cube"?(E=new THREE.CubeGeometry(r.width,r.height,r.depth,r.segmentsWidth,r.segmentsHeight,r.segmentsDepth,null,r.flipped,r.sides),z.geometries[l]=E):r.type=="plane"?(E=new THREE.PlaneGeometry(r.width,r.height,r.segmentsWidth,r.segmentsHeight),
-z.geometries[l]=E):r.type=="sphere"?(E=new THREE.SphereGeometry(r.radius,r.segmentsWidth,r.segmentsHeight),z.geometries[l]=E):r.type=="cylinder"?(E=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),z.geometries[l]=E):r.type=="torus"?(E=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),z.geometries[l]=E):r.type=="icosahedron"?(E=new THREE.IcosahedronGeometry(r.subdivisions),z.geometries[l]=E):r.type=="bin_mesh"?D.load(d(r.url,B.urlBaseType),i(l)):r.type==
-"ascii_mesh"?F.load(d(r.url,B.urlBaseType),i(l)):r.type=="embedded_mesh"&&(r=B.embeds[r.id])&&F.createModel(r,j(l),"");for(p in B.textures)if(l=B.textures[p],l.url instanceof Array){N+=l.url.length;for(D=0;D<l.url.length;D++)b.onLoadStart()}else N+=1,b.onLoadStart();O=N;for(p in B.textures){l=B.textures[p];if(l.mapping!=void 0&&THREE[l.mapping]!=void 0)l.mapping=new THREE[l.mapping];if(l.url instanceof Array){D=[];for(var I=0;I<l.url.length;I++)D[I]=d(l.url[I],B.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,
-l.mapping,a)}else{D=THREE.ImageUtils.loadTexture(d(l.url,B.urlBaseType),l.mapping,a);if(THREE[l.minFilter]!=void 0)D.minFilter=THREE[l.minFilter];if(THREE[l.magFilter]!=void 0)D.magFilter=THREE[l.magFilter];if(l.repeat){D.repeat.set(l.repeat[0],l.repeat[1]);if(l.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(l.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}l.offset&&D.offset.set(l.offset[0],l.offset[1]);if(l.wrap){F={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(F[l.wrap[0]]!==void 0)D.wrapS=
-F[l.wrap[0]];if(F[l.wrap[1]]!==void 0)D.wrapT=F[l.wrap[1]]}}z.textures[p]=D}for(o in B.materials){p=B.materials[o];for(A in p.parameters)if(A=="envMap"||A=="map"||A=="lightMap")p.parameters[A]=z.textures[p.parameters[A]];else if(A=="shading")p.parameters[A]=p.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")p.parameters[A]=THREE[p.parameters[A]]?THREE[p.parameters[A]]:THREE.NormalBlending;else if(A=="combine")p.parameters[A]=p.parameters[A]=="MixOperation"?THREE.MixOperation:
-THREE.MultiplyOperation;else if(A=="vertexColors")if(p.parameters[A]=="face")p.parameters[A]=THREE.FaceColors;else if(p.parameters[A])p.parameters[A]=THREE.VertexColors;if(p.parameters.opacity!==void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){l=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(l.uniforms);D=p.parameters.color;F=p.parameters.specular;r=p.parameters.ambient;G=p.parameters.shininess;a.tNormal.texture=z.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)a.uNormalScale.value=
-p.parameters.normalMapFactor;if(p.parameters.map)a.tDiffuse.texture=p.parameters.map,a.enableDiffuse.value=!0;if(p.parameters.lightMap)a.tAO.texture=p.parameters.lightMap,a.enableAO.value=!0;if(p.parameters.specularMap)a.tSpecular.texture=z.textures[p.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(D);a.uSpecularColor.value.setHex(F);a.uAmbientColor.value.setHex(r);a.uShininess.value=G;if(p.parameters.opacity)a.uOpacity.value=p.parameters.opacity;p=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,
-vertexShader:l.vertexShader,uniforms:a,lights:!0,fog:!0})}else p=new THREE[p.type](p.parameters);z.materials[o]=p}h();b.callbackSync(z);k()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,k,j,p,m,n,t,l,s,q,r,o,u=a.faces;p=a.vertices;var y=a.normals,w=a.colors,x=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&x++;for(c=0;c<x;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=p.length;k<
+j;)m=new THREE.Vertex,m.position.x=p[k++]*b,m.position.y=p[k++]*b,m.position.z=p[k++]*b,d.vertices.push(m);k=0;for(j=u.length;k<j;){b=u[k++];p=b&1;i=b&2;c=b&4;g=b&8;n=b&16;m=b&32;l=b&64;b&=128;p?(s=new THREE.Face4,s.a=u[k++],s.b=u[k++],s.c=u[k++],s.d=u[k++],p=4):(s=new THREE.Face3,s.a=u[k++],s.b=u[k++],s.c=u[k++],p=3);if(i)i=u[k++],s.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<x;c++)q=a.uvs[c],t=u[k++],o=q[t*2],t=q[t*2+1],d.faceUvs[c][i]=new THREE.UV(o,t);if(g)for(c=0;c<x;c++){q=a.uvs[c];r=[];
+for(g=0;g<p;g++)t=u[k++],o=q[t*2],t=q[t*2+1],r[g]=new THREE.UV(o,t);d.faceVertexUvs[c][i]=r}if(n)n=u[k++]*3,g=new THREE.Vector3,g.x=y[n++],g.y=y[n++],g.z=y[n],s.normal=g;if(m)for(c=0;c<p;c++)n=u[k++]*3,g=new THREE.Vector3,g.x=y[n++],g.y=y[n++],g.z=y[n],s.vertexNormals.push(g);if(l)m=u[k++],m=new THREE.Color(w[m]),s.color=m;if(b)for(c=0;c<p;c++)m=u[k++],m=new THREE.Color(w[m]),s.vertexColors.push(m);d.faces.push(s)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
+2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,j,p,m,n,t;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;
+t=a.morphTargets[c].vertices;i=0;for(k=t.length;i<k;i+=3)j=t[i]*b,p=t[i+1]*b,m=t[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,p,m)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;b=0;for(i=j.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(j[b],j[b+1],j[b+2]),k.push(p)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
+d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
+THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
+d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:k+"/"+a}function g(){var a;for(m in z.objects)if(!B.objects[m])if(q=z.objects[m],q.geometry!==void 0){if(C=B.geometries[q.geometry]){a=!1;for(H=0;H<q.materials.length;H++)D=B.materials[q.materials[H]],a=D instanceof THREE.ShaderMaterial;a&&C.computeTangents();u=q.position;y=q.rotation;w=q.quaternion;x=q.scale;w=0;D.length==0&&(D=new THREE.MeshFaceMaterial);D.length>1&&(D=new THREE.MeshFaceMaterial);
+a=new THREE.Mesh(C,D);a.name=m;a.position.set(u[0],u[1],u[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]);a.scale.set(x[0],x[1],x[2]);a.visible=q.visible;B.scene.add(a);B.objects[m]=a;if(q.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(q.castsShadow)b=new THREE.ShadowVolume(C),B.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;q.trigger&&q.trigger.toLowerCase()!="none"&&(b=
+{type:q.trigger,object:q},B.triggers[a.name]=b)}}else u=q.position,y=q.rotation,w=q.quaternion,x=q.scale,w=0,a=new THREE.Object3D,a.name=m,a.position.set(u[0],u[1],u[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(y[0],y[1],y[2]),a.scale.set(x[0],x[1],x[2]),a.visible=q.visible!==void 0?q.visible:!1,B.scene.add(a),B.objects[m]=a,B.empties[m]=a,q.trigger&&q.trigger.toLowerCase()!="none"&&(b={type:q.trigger,object:q},B.triggers[a.name]=b)}function f(a){return function(b){B.geometries[a]=
+b;g();I-=1;i.onLoadComplete();h()}}function e(a){return function(b){B.geometries[a]=b}}function h(){i.callbackProgress({totalModels:J,totalTextures:O,loadedModels:J-I,loadedTextures:O-E},B);i.onLoadProgress();I==0&&E==0&&c(B)}var i=this,k=THREE.Loader.prototype.extractUrlbase(b),j,p,m,n,t,l,s,q,r,o,u,y,w,x,A,C,F,v,D,z,G,I,E,J,O,B;z=a;b=new THREE.BinaryLoader;G=new THREE.JSONLoader;E=I=0;B={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
+empties:{}};a=!1;for(m in z.objects)if(q=z.objects[m],q.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(z.transform){a=z.transform.position;r=z.transform.rotation;var K=z.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);r&&B.scene.rotation.set(r[0],r[1],r[2]);K&&B.scene.scale.set(K[0],K[1],K[2]);(a||r||K)&&B.scene.updateMatrix()}a=function(){E-=1;h();i.onLoadComplete()};for(t in z.cameras)r=z.cameras[t],r.type=="perspective"?F=new THREE.PerspectiveCamera(r.fov,
+r.aspect,r.near,r.far):r.type=="ortho"&&(F=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),u=r.position,r=r.target,F.position.set(u[0],u[1],u[2]),F.target=new THREE.Vector3(r[0],r[1],r[2]),B.cameras[t]=F;for(n in z.lights)r=z.lights[n],t=r.color!==void 0?r.color:16777215,F=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(u=r.direction,o=new THREE.DirectionalLight(t,F),o.position.set(u[0],u[1],u[2]),o.position.normalize()):r.type=="point"?(u=r.position,o=r.distance,
+o=new THREE.PointLight(t,F,o),o.position.set(u[0],u[1],u[2])):r.type=="ambient"&&(o=new THREE.AmbientLight(t)),B.scene.add(o),B.lights[n]=o;for(l in z.fogs)n=z.fogs[l],n.type=="linear"?v=new THREE.Fog(0,n.near,n.far):n.type=="exp2"&&(v=new THREE.FogExp2(0,n.density)),r=n.color,v.color.setRGB(r[0],r[1],r[2]),B.fogs[l]=v;if(B.cameras&&z.defaults.camera)B.currentCamera=B.cameras[z.defaults.camera];if(B.fogs&&z.defaults.fog)B.scene.fog=B.fogs[z.defaults.fog];r=z.defaults.bgcolor;B.bgColor=new THREE.Color;
+B.bgColor.setRGB(r[0],r[1],r[2]);B.bgColorAlpha=z.defaults.bgalpha;for(j in z.geometries)if(l=z.geometries[j],l.type=="bin_mesh"||l.type=="ascii_mesh")I+=1,i.onLoadStart();J=I;for(j in z.geometries)l=z.geometries[j],l.type=="cube"?(C=new THREE.CubeGeometry(l.width,l.height,l.depth,l.segmentsWidth,l.segmentsHeight,l.segmentsDepth,null,l.flipped,l.sides),B.geometries[j]=C):l.type=="plane"?(C=new THREE.PlaneGeometry(l.width,l.height,l.segmentsWidth,l.segmentsHeight),B.geometries[j]=C):l.type=="sphere"?
+(C=new THREE.SphereGeometry(l.radius,l.segmentsWidth,l.segmentsHeight),B.geometries[j]=C):l.type=="cylinder"?(C=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),B.geometries[j]=C):l.type=="torus"?(C=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),B.geometries[j]=C):l.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(l.subdivisions),B.geometries[j]=C):l.type=="bin_mesh"?b.load(d(l.url,z.urlBaseType),f(j)):l.type=="ascii_mesh"?G.load(d(l.url,z.urlBaseType),
+f(j)):l.type=="embedded_mesh"&&(l=z.embeds[l.id])&&G.createModel(l,e(j),"");for(s in z.textures)if(j=z.textures[s],j.url instanceof Array){E+=j.url.length;for(l=0;l<j.url.length;l++)i.onLoadStart()}else E+=1,i.onLoadStart();O=E;for(s in z.textures){j=z.textures[s];if(j.mapping!=void 0&&THREE[j.mapping]!=void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){l=[];for(var H=0;H<j.url.length;H++)l[H]=d(j.url[H],z.urlBaseType);l=THREE.ImageUtils.loadTextureCube(l,j.mapping,a)}else{l=THREE.ImageUtils.loadTexture(d(j.url,
+z.urlBaseType),j.mapping,a);if(THREE[j.minFilter]!=void 0)l.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=void 0)l.magFilter=THREE[j.magFilter];if(j.repeat){l.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!=1)l.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!=1)l.wrapT=THREE.RepeatWrapping}j.offset&&l.offset.set(j.offset[0],j.offset[1]);if(j.wrap){v={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(v[j.wrap[0]]!==void 0)l.wrapS=v[j.wrap[0]];if(v[j.wrap[1]]!==void 0)l.wrapT=
+v[j.wrap[1]]}}B.textures[s]=l}for(p in z.materials){s=z.materials[p];for(A in s.parameters)if(A=="envMap"||A=="map"||A=="lightMap")s.parameters[A]=B.textures[s.parameters[A]];else if(A=="shading")s.parameters[A]=s.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")s.parameters[A]=THREE[s.parameters[A]]?THREE[s.parameters[A]]:THREE.NormalBlending;else if(A=="combine")s.parameters[A]=s.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A==
+"vertexColors")if(s.parameters[A]=="face")s.parameters[A]=THREE.FaceColors;else if(s.parameters[A])s.parameters[A]=THREE.VertexColors;if(s.parameters.opacity!==void 0&&s.parameters.opacity<1)s.parameters.transparent=!0;if(s.parameters.normalMap){j=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(j.uniforms);l=s.parameters.color;v=s.parameters.specular;b=s.parameters.ambient;G=s.parameters.shininess;a.tNormal.texture=B.textures[s.parameters.normalMap];if(s.parameters.normalMapFactor)a.uNormalScale.value=
+s.parameters.normalMapFactor;if(s.parameters.map)a.tDiffuse.texture=s.parameters.map,a.enableDiffuse.value=!0;if(s.parameters.lightMap)a.tAO.texture=s.parameters.lightMap,a.enableAO.value=!0;if(s.parameters.specularMap)a.tSpecular.texture=B.textures[s.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(l);a.uSpecularColor.value.setHex(v);a.uAmbientColor.value.setHex(b);a.uShininess.value=G;if(s.parameters.opacity)a.uOpacity.value=s.parameters.opacity;s=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,
+vertexShader:j.vertexShader,uniforms:a,lights:!0,fog:!0})}else s=new THREE[s.type](s.parameters);B.materials[p]=s}g();i.callbackSync(B);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,e=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
 c,g,f,e,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var f=0,e=0;e<c;++e){var h=a.charCodeAt(e+d);f+=h>>1^-(h&1);b[8*e+g]=f}d+=c}c=a.length-d;f=new Uint16Array(c);for(g=e=0;g<c;g++)h=a.charCodeAt(g+d),f[g]=e-h,h==0&&e++;return[b,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,r,p=a.length;i<p;i+=e)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*b,k=k/16383*b,r=r/16383*b,j+=d,k+=g,r+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(e[0],8,3);(function(a,
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,s,m,v,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;m=d;v=e;i=f;s=d;var x=e,y=f,C=g.materials[0],A=j[x*3],E=j[x*3+1],x=j[x*3+2],u=j[y*3],G=j[y*3+1],y=j[y*3+2];s=new THREE.Vector3(j[s*3],j[s*3+1],j[s*3+2]);x=new THREE.Vector3(A,E,x);y=new THREE.Vector3(u,G,y);g.faces.push(new THREE.Face3(m,v,i,[s,x,y],null,C));g=k[d*2];d=k[d*2+
-1];i=k[e*2];s=k[e*2+1];m=k[f*2];v=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=s;s=[];s.push(new THREE.UV(g,d));s.push(new THREE.UV(e,i));s.push(new THREE.UV(m,v));f.push(s)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,f){var e=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],j=[];(function(a,e,i){for(var j,k,s,q=a.length;i<q;i+=e)j=a[i],k=a[i+1],s=a[i+2],j=j/16383*b,k=k/16383*b,s=s/16383*b,j+=d,k+=g,s+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,s)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,j.push(d,1-e)})(e[0],8,3);(function(a,
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(e[0],8,5);(function(a){var b,d,e,f,g,i,r,o,u,y=a.length;for(b=0;b<y;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;o=d;u=e;i=f;r=d;var w=e,x=f,A=g.materials[0],C=k[w*3],F=k[w*3+1],w=k[w*3+2],v=k[x*3],D=k[x*3+1],x=k[x*3+2];r=new THREE.Vector3(k[r*3],k[r*3+1],k[r*3+2]);w=new THREE.Vector3(C,F,w);x=new THREE.Vector3(v,D,x);g.faces.push(new THREE.Face3(o,u,i,[r,w,x],null,A));g=j[d*2];d=j[d*2+
+1];i=j[e*2];r=j[e*2+1];o=j[f*2];u=j[f*2+1];f=c.faceVertexUvs[0];e=i;i=r;r=[];r.push(new THREE.UV(g,d));r.push(new THREE.UV(e,i));r.push(new THREE.UV(o,u));f.push(r)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 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,g){return a+(c-a)*g};this.VIntX=function(a,c,g,f,e,h,i,j,k,l){e=(e-k)/(l-k);k=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=j;g[f]=this.lerp(k[a],k[a+3],e);g[f+1]=this.lerp(k[a+1],k[a+4],e);g[f+2]=this.lerp(k[a+2],k[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,j,k,l){e=(e-k)/(l-k);k=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
-2]=j;c=a+this.yd*3;g[f]=this.lerp(k[a],k[c],e);g[f+1]=this.lerp(k[a+1],k[c+1],e);g[f+2]=this.lerp(k[a+2],k[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,j,k,l){e=(e-k)/(l-k);k=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=j+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(k[a],k[c],e);g[f+1]=this.lerp(k[a+1],k[c+1],e);g[f+2]=this.lerp(k[a+2],k[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,g,f,e,h){var i=f+1,j=f+this.yd,k=f+this.zd,l=i+this.yd,o=i+this.zd,n=f+this.yd+this.zd,t=i+this.yd+this.zd,q=0,r=this.field[f],p=this.field[i],s=this.field[j],m=this.field[l],v=this.field[k],w=this.field[o],x=this.field[n],y=this.field[t];r<e&&(q|=1);p<e&&(q|=2);s<e&&(q|=8);m<e&&(q|=4);v<e&&(q|=16);w<e&&(q|=32);x<e&&(q|=128);y<e&&(q|=64);var C=THREE.edgeTable[q];if(C===0)return 0;
-var A=this.delta,E=a+A,u=c+A,A=g+A;C&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,r,p));C&2&&(this.compNorm(i),this.compNorm(l),this.VIntY(i*3,this.vlist,this.nlist,3,e,E,c,g,p,m));C&4&&(this.compNorm(j),this.compNorm(l),this.VIntX(j*3,this.vlist,this.nlist,6,e,a,u,g,s,m));C&8&&(this.compNorm(f),this.compNorm(j),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,r,s));C&16&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,12,e,a,c,A,v,w));
-C&32&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,15,e,E,c,A,w,y));C&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,u,A,x,y));C&128&&(this.compNorm(k),this.compNorm(n),this.VIntY(k*3,this.vlist,this.nlist,21,e,a,c,A,v,x));C&256&&(this.compNorm(f),this.compNorm(k),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,r,v));C&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,e,E,c,g,p,w));C&1024&&(this.compNorm(l),
-this.compNorm(t),this.VIntZ(l*3,this.vlist,this.nlist,30,e,E,u,g,m,y));C&2048&&(this.compNorm(j),this.compNorm(n),this.VIntZ(j*3,this.vlist,this.nlist,33,e,a,u,g,s,x));q<<=4;for(e=f=0;THREE.triTable[q+e]!=-1;)a=q+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
+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,g){return a+(c-a)*g};this.VIntX=function(a,c,g,f,e,h,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=i;c[f+2]=k;g[f]=this.lerp(j[a],j[a+3],e);g[f+1]=this.lerp(j[a+1],j[a+4],e);g[f+2]=this.lerp(j[a+2],j[a+5],e)};this.VIntY=function(a,c,g,f,e,h,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=h;c[f+1]=i+e*this.delta;c[f+
+2]=k;c=a+this.yd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[c+2],e)};this.VIntZ=function(a,c,g,f,e,h,i,k,j,p){e=(e-j)/(p-j);j=this.normal_cache;c[f]=h;c[f+1]=i;c[f+2]=k+e*this.delta;c=a+this.zd*3;g[f]=this.lerp(j[a],j[c],e);g[f+1]=this.lerp(j[a+1],j[c+1],e);g[f+2]=this.lerp(j[a+2],j[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,g,f,e,h){var i=f+1,k=f+this.yd,j=f+this.zd,p=i+this.yd,m=i+this.zd,n=f+this.yd+this.zd,t=i+this.yd+this.zd,l=0,s=this.field[f],q=this.field[i],r=this.field[k],o=this.field[p],u=this.field[j],y=this.field[m],w=this.field[n],x=this.field[t];s<e&&(l|=1);q<e&&(l|=2);r<e&&(l|=8);o<e&&(l|=4);u<e&&(l|=16);y<e&&(l|=32);w<e&&(l|=128);x<e&&(l|=64);var A=THREE.edgeTable[l];if(A===0)return 0;
+var C=this.delta,F=a+C,v=c+C,C=g+C;A&1&&(this.compNorm(f),this.compNorm(i),this.VIntX(f*3,this.vlist,this.nlist,0,e,a,c,g,s,q));A&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,e,F,c,g,q,o));A&4&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,6,e,a,v,g,r,o));A&8&&(this.compNorm(f),this.compNorm(k),this.VIntY(f*3,this.vlist,this.nlist,9,e,a,c,g,s,r));A&16&&(this.compNorm(j),this.compNorm(m),this.VIntX(j*3,this.vlist,this.nlist,12,e,a,c,C,u,y));
+A&32&&(this.compNorm(m),this.compNorm(t),this.VIntY(m*3,this.vlist,this.nlist,15,e,F,c,C,y,x));A&64&&(this.compNorm(n),this.compNorm(t),this.VIntX(n*3,this.vlist,this.nlist,18,e,a,v,C,w,x));A&128&&(this.compNorm(j),this.compNorm(n),this.VIntY(j*3,this.vlist,this.nlist,21,e,a,c,C,u,w));A&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(f*3,this.vlist,this.nlist,24,e,a,c,g,s,u));A&512&&(this.compNorm(i),this.compNorm(m),this.VIntZ(i*3,this.vlist,this.nlist,27,e,F,c,g,q,y));A&1024&&(this.compNorm(p),
+this.compNorm(t),this.VIntZ(p*3,this.vlist,this.nlist,30,e,F,v,g,o,x));A&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,e,a,v,g,r,w));l<<=4;for(e=f=0;THREE.triTable[l+e]!=-1;)a=l+e,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),e+=3,f++;return f};this.posnormtriv=function(a,c,g,f,e,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
 3]=a[f];this.positionArray[i+4]=a[f+1];this.positionArray[i+5]=a[f+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[f];this.normalArray[i+4]=c[f+1];this.normalArray[i+5]=c[f+2];this.normalArray[i+6]=c[e];this.normalArray[i+7]=c[e+1];this.normalArray[i+8]=c[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(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,g,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,j=c*this.size,k=a*this.size,l=Math.floor(i-h);l<1&&(l=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(j-h);o<1&&(o=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var n=Math.floor(k-h);n<1&&(n=1);h=Math.floor(k+h);
-h>this.size-1&&(h=this.size-1);for(var t,q,r,p,s,m;l<i;l++){k=this.size2*l;q=l/this.size-g;s=q*q;for(q=o;q<j;q++){r=k+this.size*q;t=q/this.size-c;m=t*t;for(t=n;t<h;t++)p=t/this.size-a,p=f/(1.0E-6+p*p+m+s)-e,p>0&&(this.field[r+t]+=p)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,j=this.size,k=this.yd,l=this.zd,o=this.field,n=j*Math.sqrt(a/c);n>j&&(n=j);for(g=0;g<n;g++)if(f=g/j,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<j;f++){i=g+f*k;for(e=0;e<j;e++)o[l*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
-i,j,k=this.size,l=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(f=0;f<t;f++)if(g=f/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*l;for(g=0;g<k;g++){j=i+g;for(e=0;e<k;e++)n[o*e+j]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,j,k=this.size,l=this.yd,o=this.zd,n=this.field,t=k*Math.sqrt(a/c);t>k&&(t=k);for(e=0;e<t;e++)if(g=e/k,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*e;for(f=0;f<k;f++){j=i+f*l;for(g=0;g<k;g++)n[j+g]+=h}}};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,g,f,e,h,i,j,k,l,o=this.size-2;for(e=1;e<o;e++){l=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(f=1;f<o;f++){k=l+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=k+g,this.polygonize(h,i,j,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(f){var e,h,i,j,k,l,o,n;for(e=0;e<f.count;e++)o=e*3,k=o+1,n=o+2,h=f.positionArray[o],
-i=f.positionArray[k],j=f.positionArray[n],l=new THREE.Vector3(h,i,j),h=f.normalArray[o],i=f.normalArray[k],j=f.normalArray[n],o=new THREE.Vector3(h,i,j),o.normalize(),k=new THREE.Vertex(l),c.vertices.push(k),g.push(o);l=f.count/3;for(e=0;e<l;e++)o=(a+e)*3,k=o+1,n=o+2,h=g[o],i=g[k],j=g[n],o=new THREE.Face3(o,k,n,[h,i,j]),c.faces.push(o);a+=l;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,g,f,e){var h=this.size*Math.sqrt(f/e),i=g*this.size,k=c*this.size,j=a*this.size,p=Math.floor(i-h);p<1&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);h=Math.floor(j+h);
+h>this.size-1&&(h=this.size-1);for(var t,l,s,q,r,o;p<i;p++){j=this.size2*p;l=p/this.size-g;r=l*l;for(l=m;l<k;l++){s=j+this.size*l;t=l/this.size-c;o=t*t;for(t=n;t<h;t++)q=t/this.size-a,q=f/(1.0E-6+q*q+o+r)-e,q>0&&(this.field[s+t]+=q)}}};this.addPlaneX=function(a,c){var g,f,e,h,i,k=this.size,j=this.yd,p=this.zd,m=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-c,h>0)for(f=0;f<k;f++){i=g+f*j;for(e=0;e<k;e++)m[p*e+i]+=h}};this.addPlaneY=function(a,c){var g,f,e,h,
+i,k,j=this.size,p=this.yd,m=this.zd,n=this.field,t=j*Math.sqrt(a/c);t>j&&(t=j);for(f=0;f<t;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=f*p;for(g=0;g<j;g++){k=i+g;for(e=0;e<j;e++)n[m*e+k]+=h}}};this.addPlaneZ=function(a,c){var g,f,e,h,i,k,j=this.size,p=this.yd,m=this.zd,n=this.field,t=j*Math.sqrt(a/c);t>j&&(t=j);for(e=0;e<t;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-c,h>0){i=m*e;for(f=0;f<j;f++){k=i+f*p;for(g=0;g<j;g++)n[k+g]+=h}}};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,g,f,e,h,i,k,j,p,m=this.size-2;for(e=1;e<m;e++){p=this.size2*e;k=(e-this.halfsize)/this.halfsize;for(f=1;f<m;f++){j=p+this.size*f;i=(f-this.halfsize)/this.halfsize;for(g=1;g<m;g++)h=(g-this.halfsize)/this.halfsize,c=j+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(f){var e,h,i,k,j,p,m,n;for(e=0;e<f.count;e++)m=e*3,j=m+1,n=m+2,h=f.positionArray[m],
+i=f.positionArray[j],k=f.positionArray[n],p=new THREE.Vector3(h,i,k),h=f.normalArray[m],i=f.normalArray[j],k=f.normalArray[n],m=new THREE.Vector3(h,i,k),m.normalize(),j=new THREE.Vertex(p),c.vertices.push(j),g.push(m);p=f.count/3;for(e=0;e<p;e++)m=(a+e)*3,j=m+1,n=m+2,h=g[m],i=g[j],k=g[n],m=new THREE.Face3(m,j,n,[h,i,k]),c.faces.push(m);a+=p;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 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]);
@@ -344,20 +346,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,g,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>f?this.hits.push(g):this.hits.unshift(g),f=d;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 d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.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),d=Number.MAX_VALUE,g,f=0;f<c.numFaces;f++){var e=c.mesh.geometry.faces[f],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,j=c.mesh.geometry.vertices[e.c].position,k=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,j,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,f=0;f<c.numFaces;f++){var e=c.mesh.geometry.faces[f],h=c.mesh.geometry.vertices[e.a].position,i=c.mesh.geometry.vertices[e.b].position,k=c.mesh.geometry.vertices[e.c].position,j=e instanceof THREE.Face4?c.mesh.geometry.vertices[e.d].position:null;e instanceof THREE.Face3?(e=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+e instanceof THREE.Face4&&(e=this.rayTriangle(b,h,i,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),e=this.rayTriangle(b,i,k,j,d,this.collisionNormal,c.mesh),e<d&&(d=e,g=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,f,e){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;f.set(0,0,0);h.sub(b,c);i.sub(d,b);f.cross(h,i);h=f.dot(a.direction);if(!(h<0))if(e.doubleSided||e.flipSided)f.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;e=f.dot(c)-f.dot(a.origin);if(!(e<=0))return Number.MAX_VALUE;if(!(e>=h*g))return Number.MAX_VALUE;e/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(e);h.addSelf(a.origin);Math.abs(f.x)>
 Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=h.y-c.y,f=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,f=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=f*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=f*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return e};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
-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 d=0,g=0,f=0,e=0,h=0,i=0,j=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,j=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,j=!1,e=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,j=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
-j=!1,h=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,j=!1,i=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,j=!1,i=1);if(j)return-1;j=0;g>d&&(j=1,d=g);f>d&&(j=2,d=f);switch(j){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;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*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+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 d=0,g=0,f=0,e=0,h=0,i=0,k=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,k=!1,e=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,e=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,k=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
+k=!1,h=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,k=!1,i=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;g>d&&(k=1,d=g);f>d&&(k=2,d=f);switch(k){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;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*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
 d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:e=b.origin.x+b.direction.x*d;if(e<c.min.x||e>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-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 d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,l;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
-1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},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}"}),
-q=new THREE.Scene;q.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));q.add(t);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||j!==b.near||k!==b.far||l!==b.fov){i=b.aspect;j=b.near;k=b.far;l=b.fov;var s=b.projectionMatrix.clone(),m=125/30*0.5,v=m*j/125,w=j*Math.tan(l*Math.PI/360),x;e.n14=m;h.n14=-m;m=-w*i+v;x=w*i+v;s.n11=2*j/(x-m);s.n13=(x+m)/(x-m);g.projectionMatrix.copy(s);m=-w*i-v;x=w*i-v;s.n11=
-2*j/(x-m);s.n13=(x+m)/(x-m);f.projectionMatrix.copy(s)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);q.updateMatrixWorld();d.call(c,q,t)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,k,j,p;g.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},m=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
+1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:m},mapRight:{type:"t",value:1,texture:n}},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}"}),
+l=new THREE.Scene;l.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));l.add(t);this.setSize=function(a,d){b.call(c,a,d);m.width=a;m.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||j!==b.far||p!==b.fov){i=b.aspect;k=b.near;j=b.far;p=b.fov;var r=b.projectionMatrix.clone(),o=125/30*0.5,u=o*k/125,y=k*Math.tan(p*Math.PI/360),w;e.n14=o;h.n14=-o;o=-y*i+u;w=y*i+u;r.n11=2*k/(w-o);r.n13=(w+o)/(w-o);g.projectionMatrix.copy(r);o=-y*i-u;w=y*i-u;r.n11=
+2*k/(w-o);r.n13=(w+o)/(w-o);f.projectionMatrix.copy(r)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,m,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(e);f.position.copy(b.position);f.near=b.near;f.far=b.far;d.call(c,a,f,n,!0);l.updateMatrixWorld();d.call(c,l,t)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,f,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;f=d};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.copy(b.target);e.translateX(c.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,f);d.call(c,a,e);this.setViewport(g,0,g,f);d.call(c,a,h,!1)}};

文件差異過大導致無法顯示
+ 13 - 18
examples/obj/buffalo/buffalo.js


+ 87 - 111
examples/scenes/test_scene.js

@@ -1,10 +1,15 @@
-var scene = {
-	
-"type"		  :	"scene",
+{
+
+"metadata":
+{
+	"formatVersion": 3,
+	"type"		   : "scene"
+},
+
 "urlBaseType" : "relativeToHTML",
-	
-"objects": 
-{	
+
+"objects":
+{
 	"cube1" : {
 		"geometry" : "cube",
 		"materials": [ "lambert_red" ],
@@ -95,7 +100,7 @@ var scene = {
 		"scale"	   : [ 5, 5, 5 ],
 		"visible"  : true
 	},
-	
+
 	"veyron" : {
 		"geometry" : "veyron",
 		"materials": [ "face" ],
@@ -122,7 +127,7 @@ var scene = {
 		"scale"	   : [ 20, 20, 20 ],
 		"visible"  : true
 	},
-	
+
 	"ground" : {
 		"geometry" : "plane",
 		"materials": [ "basic_gray" ],
@@ -130,44 +135,44 @@ var scene = {
 		"rotation" : [ 1.57, 0, 0 ],
 		"scale"	   : [ 100, 100, 100 ],
 		"visible"  : true
-	}	
-	
+	}
+
 },
-	
+
 "geometries":
 {
 	"cube": {
 		"type"  : "cube",
-		"width" : 10, 
+		"width" : 10,
 		"height": 10,
-		"depth" : 10, 
-		"segmentsWidth"  : 1, 
+		"depth" : 10,
+		"segmentsWidth"  : 1,
 		"segmentsHeight" : 1,
 		"segmentsDepth"  : 1,
-		"flipped" : false, 
+		"flipped" : false,
 		"sides"   : { "px": true, "nx": true, "py": true, "ny": true, "pz": true, "nz": true }
 	},
 
 	"plane": {
 		"type"   : "plane",
-		"width"  : 10, 
+		"width"  : 10,
 		"height" : 10,
-		"segmentsWidth"  : 50, 
+		"segmentsWidth"  : 50,
 		"segmentsHeight" : 50
-	},	
+	},
 
 	"quad": {
 		"type"   : "plane",
-		"width"  : 10, 
+		"width"  : 10,
 		"height" : 10,
-		"segmentsWidth"  : 1, 
+		"segmentsWidth"  : 1,
 		"segmentsHeight" : 1
-	},	
+	},
 
 	"sphere": {
 		"type"    : "sphere",
-		"radius"  : 5, 
-		"segmentsWidth"  : 32, 
+		"radius"  : 5,
+		"segmentsWidth"  : 32,
 		"segmentsHeight" : 16
 	},
 
@@ -175,33 +180,33 @@ var scene = {
 		"type"    : "icosahedron",
 		"subdivisions"  : 2
 	},
-	
+
 	"torus": {
 		"type"    : "torus",
 		"radius"  : 5,
 		"tube"	  : 2,
-		"segmentsR" : 16, 
+		"segmentsR" : 16,
 		"segmentsT" : 32
 	},
-	
+
 	"cylinder": {
 		"type"    : "cylinder",
-		"topRad"   : 5, 
+		"topRad"   : 5,
 		"botRad"   : 5,
 		"height"   : 50,
-		"radSegs"  : 32, 
+		"radSegs"  : 32,
 		"heightSegs": 1
 	},
 
 	"cone": {
 		"type"    : "cylinder",
-		"topRad"   : 0, 
+		"topRad"   : 0,
 		"botRad"   : 5,
 		"height"   : 50,
-		"radSegs"  : 32, 
+		"radSegs"  : 32,
 		"heightSegs" : 1
 	},
-	
+
 	"WaltHead": {
 		"type": "bin_mesh",
 		"url" : "obj/walt/WaltHead_bin.js"
@@ -211,28 +216,28 @@ var scene = {
 		"type": "bin_mesh",
 		"url" : "obj/veyron/VeyronNoUv_bin.js"
 	},
-	
+
 	"colorcube": {
 		"type": "embedded_mesh",
 		"id"  : "cube_fvc"
 	}
-	
+
 },
-	
+
 "embeds": {
 
 	"cube_fvc": {
 
-    "version" : 2,
-    
-    "scale" : 1.000000,
-    
+    "metadata" : { "formatVersion" : 3 },
+
+    "scale" : 1.0,
+
     "materials": [	{
 	"DbgColor" : 15658734,
 	"DbgIndex" : 0,
 	"DbgName" : "Material",
 	"colorAmbient" : [0.0, 0.0, 0.0],
-	"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
+	"colorDiffuse" : [0.8, 0.8, 0.8],
 	"colorSpecular" : [0.5, 0.5, 0.5],
 	"specularCoef" : 50,
 	"transparency" : 1.0,
@@ -259,128 +264,102 @@ var scene = {
 
 "materials":
 {
-	/*
-	"basic_red": {
-		"type": "MeshBasicMaterial",
-		"parameters": { color: 0xff0000, wireframe: true } 
-	},
 
-	"basic_green": {
-		"type": "MeshBasicMaterial",
-		"parameters": { color: 0x007711, wireframe: true } 
-	},
-	
-	"basic_blue": {
-		"type": "MeshBasicMaterial",
-		"parameters": { color: 0x0000ff, wireframe: true } 
-	},
-		
-	"basic_black": {
-		"type": "MeshBasicMaterial",
-		"parameters": { color: 0x000000, wireframe: true } 
-	},
-	
-	"phong_white": {
-		"type": "MeshPhongMaterial",
-		"parameters": { color: 0xaaaaaa } 
-	},
-	*/
-	
 	"basic_gray": {
 		"type": "MeshBasicMaterial",
-		"parameters": { color: 0x666666, wireframe: true } 
+		"parameters": { "color": 6710886, "wireframe": true }
 	},
 
 	"basic_white": {
 		"type": "MeshBasicMaterial",
-		"parameters": { color: 0xffffff, wireframe: true } 
+		"parameters": { "color": 16777215, "wireframe": true }
 	},
 
 	"faceted_white": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0xffffff, shading: "flat" } 
+		"parameters": { "color": 16777215, "shading": "flat" }
 	},
-	
+
 	"lambert_red": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0xff0000 } 
+		"parameters": { "color": 16711680 }
 	},
-	
+
 	"lambert_green": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0x007711, blending: "AdditiveBlending", transparent: true } 
+		"parameters": { "color": 30481, "blending": "AdditiveBlending", "transparent": true }
 	},
 
 	"lambert_blue": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0x0055aa } 
+		"parameters": { "color": 21930 }
 	},
-	
+
 	"phong_orange": {
 		"type": "MeshPhongMaterial",
-		"parameters": { color:0x000000, specular: 0xaa5500 } 
+		"parameters": { "color": 0, "specular": 11162880 }
 	},
-	
+
 	"basic_refraction": {
 		"type": "MeshBasicMaterial",
-		"parameters": { color: 0xffffff, envMap: "cube_refraction", refractionRatio: 0.95 } 
+		"parameters": { "color": 16777215, "envMap": "cube_refraction", "refractionRatio": 0.95 }
 	},
-	
+
 	"lambert_cube": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0xff6600, envMap: "cube_reflection", combine: "MixOperation", reflectivity: 0.3 }
+		"parameters": { "color": 16737792, "envMap": "cube_reflection", "combine": "MixOperation", "reflectivity": 0.3 }
 	},
-	
+
 	"chrome": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0xffffff, envMap: "cube_reflection" }
+		"parameters": { "color": 16777215, "envMap": "cube_reflection" }
 	},
 
 	"darkerchrome": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0x222222, envMap: "cube_reflection" }
+		"parameters": { "color": 2236962, "envMap": "cube_reflection" }
 	},
-	
+
 	"glass": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0x101046, envMap: "cube_reflection", opacity: 0.25, transparent: true }
+		"parameters": { "color": 1052742, "envMap": "cube_reflection", "opacity": 0.25, "transparent": true }
 	},
 
 	"interior": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0x050505 }
+		"parameters": { "color": 328965 }
 	},
-	
-	"backlights": {	
+
+	"backlights": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0xff0000, opacity: 0.5 }
+		"parameters": { "color": 16711680, "opacity": 0.5 }
 	},
-	
+
 	"backsignals": {
 		"type": "MeshLambertMaterial",
-		"parameters": { color: 0xffbb00, opacity: 0.5 }
+		"parameters": { "color": 16759552, "opacity": 0.5 }
 	},
-	
+
 	"textured_bg": {
 		"type": "MeshBasicMaterial",
-		"parameters": { color: 0xffffff, map: "texture_bg" } 
+		"parameters": { "color": 16777215, "map": "texture_bg" }
 	},
 
 	"minecraft": {
 		"type": "MeshBasicMaterial",
-		"parameters": { color: 0xffffff, map: "texture_minecraft" } 
+		"parameters": { "color": 16777215, "map": "texture_minecraft" }
 	},
-	
+
 	"face": {
 		"type": "MeshFaceMaterial",
 		"parameters": {}
 	}
-	
+
 },
 
-"textures": 
+"textures":
 {
-	
+
 	"cube_reflection": {
 		"url": [ "textures/cube/SwedishRoyalCastle/px.jpg",
 				 "textures/cube/SwedishRoyalCastle/nx.jpg",
@@ -411,7 +390,7 @@ var scene = {
 		"magFilter": "NearestFilter",
 		"minFilter": "LinearMipMapLinearFilter"
 	}
-	
+
 },
 
 "cameras":
@@ -445,16 +424,16 @@ var scene = {
 	"light1": {
 		"type"		 : "directional",
 		"direction"	 : [0,1,1],
-		"color" 	 : 0xffffff,
+		"color" 	 : 16777215,
 		"intensity"	 : 0.8
 	},
 
 	"light2": {
 		"type"	  : "point",
 		"position": [0,0,0],
-		"color"   : 0xffffff
+		"color"   : 16777215
 	}
-	
+
 },
 
 "fogs":
@@ -465,21 +444,21 @@ var scene = {
 		"near" : 1,
 		"far"  : 1000
 	},
-	
+
 	"exponential": {
 		"type"    : "exp2",
 		"color"   : [1,1,1],
-		"density" : 0.005,
+		"density" : 0.005
 	},
-	
+
 	"black": {
 		"type"    : "exp2",
 		"color"   : [0,0,0],
-		"density" : 0.005,
+		"density" : 0.005
 	}
 },
-	
-"defaults" : 
+
+"defaults" :
 {
 	"bgcolor" : [0,0,0],
 	"bgalpha" : 1,
@@ -487,7 +466,4 @@ var scene = {
 	"fog"	  : "black"
 }
 
-};
-
-postMessage( scene );
-close();
+}

+ 456 - 417
src/extras/loaders/SceneLoader.js

@@ -13,760 +13,799 @@ THREE.SceneLoader = function () {
 
 };
 
-THREE.SceneLoader.prototype = {
+THREE.SceneLoader.prototype.constructor = THREE.SceneLoader;
 
-	load : function ( url, callbackFinished ) {
+THREE.SceneLoader.prototype.load = function( url, callbackFinished ) {
 
-		var scope = this;
+	var context = this;
 
-		var worker = new Worker( url );
-		worker.postMessage( 0 );
+	var xhr = new XMLHttpRequest();
 
-		var urlBase = THREE.Loader.prototype.extractUrlbase( url );
+	xhr.onreadystatechange = function() {
 
-		worker.onmessage = function( event ) {
+		if ( xhr.readyState == 4 ) {
 
-			var dg, dm, dd, dl, dc, df, dt,
-				g, o, m, l, d, p, r, q, s, c, t, f, tt, pp,
-				geometry, material, camera, fog,
-				texture, images,
-				materials, light,
-				data, binLoader, jsonLoader,
-				counter_models, counter_textures,
-				total_models, total_textures,
-				result;
+			if ( xhr.status == 200 || xhr.status == 0 ) {
 
-			data = event.data;
+				try {
 
-			binLoader = new THREE.BinaryLoader();
-			jsonLoader = new THREE.JSONLoader();
+					var json = JSON.parse( xhr.responseText );
 
-			counter_models = 0;
-			counter_textures = 0;
+					if ( json.metadata === undefined || json.metadata.formatVersion === undefined || json.metadata.formatVersion !== 3 ) {
 
-			result = {
+						console.error( 'Deprecated file format.' );
+						return;
 
-				scene: new THREE.Scene(),
-				geometries: {},
-				materials: {},
-				textures: {},
-				objects: {},
-				cameras: {},
-				lights: {},
-				fogs: {},
-				triggers: {},
-				empties: {}
+					}
 
-			};
+					context.createScene( json, callbackFinished, url );
 
-			// find out if there are some colliders
+				} catch ( error ) {
 
-			var hasColliders = false;
+					console.error( error );
+					console.warn( "DEPRECATED: [" + url + "] seems to be using old model format" );
 
-			for( dd in data.objects ) {
+				}
 
-				o = data.objects[ dd ];
+			} else {
 
-				if ( o.meshCollider )  {
+				console.error( "Couldn't load [" + url + "] [" + xhr.status + "]" );
 
-					hasColliders = true;
-					break;
+			}
 
-				}
+		}
 
-			}
+	};
 
-			if ( hasColliders ) {
+	xhr.open( "GET", url, true );
+	xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
+	xhr.setRequestHeader( "Content-Type", "text/plain" );
+	xhr.send( null );
 
-				result.scene.collisions = new THREE.CollisionSystem();
+};
 
-			}
+THREE.SceneLoader.prototype.createScene = function ( json, callbackFinished, url ) {
 
-			if ( data.transform ) {
+	var scope = this;
 
-				var position = data.transform.position,
-					rotation = data.transform.rotation,
-					scale = data.transform.scale;
+	var urlBase = THREE.Loader.prototype.extractUrlbase( url );
 
-				if ( position )
-					result.scene.position.set( position[ 0 ], position[ 1 ], position [ 2 ] );
+	var dg, dm, dd, dl, dc, df, dt,
+		g, o, m, l, d, p, r, q, s, c, t, f, tt, pp,
+		geometry, material, camera, fog,
+		texture, images,
+		materials, light,
+		data, binLoader, jsonLoader,
+		counter_models, counter_textures,
+		total_models, total_textures,
+		result;
 
-				if ( rotation )
-					result.scene.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation [ 2 ] );
+	data = json;
 
-				if ( scale )
-					result.scene.scale.set( scale[ 0 ], scale[ 1 ], scale [ 2 ] );
+	binLoader = new THREE.BinaryLoader();
+	jsonLoader = new THREE.JSONLoader();
 
-				if ( position || rotation || scale )
-					result.scene.updateMatrix();
+	counter_models = 0;
+	counter_textures = 0;
 
-			}
+	result = {
 
-			function get_url( source_url, url_type ) {
+		scene: new THREE.Scene(),
+		geometries: {},
+		materials: {},
+		textures: {},
+		objects: {},
+		cameras: {},
+		lights: {},
+		fogs: {},
+		triggers: {},
+		empties: {}
 
-				if ( url_type == "relativeToHTML" ) {
+	};
 
-					return source_url;
+	// find out if there are some colliders
 
-				} else {
+	var hasColliders = false;
 
-					return urlBase + "/" + source_url;
+	for( dd in data.objects ) {
 
-				}
+		o = data.objects[ dd ];
 
-			};
+		if ( o.meshCollider )  {
 
-			function handle_objects() {
+			hasColliders = true;
+			break;
 
-				var object;
+		}
 
-				for( dd in data.objects ) {
+	}
 
-					if ( !result.objects[ dd ] ) {
+	if ( hasColliders ) {
 
-						o = data.objects[ dd ];
+		result.scene.collisions = new THREE.CollisionSystem();
 
-						if ( o.geometry !== undefined ) {
+	}
 
-							geometry = result.geometries[ o.geometry ];
+	if ( data.transform ) {
 
-							// geometry already loaded
+		var position = data.transform.position,
+			rotation = data.transform.rotation,
+			scale = data.transform.scale;
 
-							if ( geometry ) {
+		if ( position )
+			result.scene.position.set( position[ 0 ], position[ 1 ], position [ 2 ] );
 
-								var hasNormals = false;
+		if ( rotation )
+			result.scene.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation [ 2 ] );
 
-								// not anymore support for multiple materials
-								// shouldn't really be array
+		if ( scale )
+			result.scene.scale.set( scale[ 0 ], scale[ 1 ], scale [ 2 ] );
 
-								for( i = 0; i < o.materials.length; i ++ ) {
+		if ( position || rotation || scale )
+			result.scene.updateMatrix();
 
-									materials = result.materials[ o.materials[ i ] ];
+	}
 
-									hasNormals = materials instanceof THREE.ShaderMaterial;
+	function get_url( source_url, url_type ) {
 
-								}
+		if ( url_type == "relativeToHTML" ) {
 
-								if ( hasNormals ) {
+			return source_url;
 
-									geometry.computeTangents();
+		} else {
 
-								}
+			return urlBase + "/" + source_url;
 
-								p = o.position;
-								r = o.rotation;
-								q = o.quaternion;
-								s = o.scale;
+		}
 
-								// turn off quaternions, for the moment
+	};
 
-								q = 0;
+	function handle_objects() {
 
-								if ( materials.length == 0 ) {
+		var object;
 
-									materials = new THREE.MeshFaceMaterial();
+		for( dd in data.objects ) {
 
-								}
+			if ( !result.objects[ dd ] ) {
 
-								// dirty hack to handle meshes with multiple materials
-								// just use face materials defined in model
+				o = data.objects[ dd ];
 
-								if ( materials.length > 1 ) {
+				if ( o.geometry !== undefined ) {
 
-									materials = new THREE.MeshFaceMaterial();
+					geometry = result.geometries[ o.geometry ];
 
-								}
+					// geometry already loaded
 
-								object = new THREE.Mesh( geometry, materials );
-								object.name = dd;
-								object.position.set( p[0], p[1], p[2] );
+					if ( geometry ) {
 
-								if ( q ) {
+						var hasNormals = false;
 
-									object.quaternion.set( q[0], q[1], q[2], q[3] );
-									object.useQuaternion = true;
+						// not anymore support for multiple materials
+						// shouldn't really be array
 
-								} else {
+						for( i = 0; i < o.materials.length; i ++ ) {
 
-									object.rotation.set( r[0], r[1], r[2] );
+							materials = result.materials[ o.materials[ i ] ];
 
-								}
+							hasNormals = materials instanceof THREE.ShaderMaterial;
 
-								object.scale.set( s[0], s[1], s[2] );
-								object.visible = o.visible;
+						}
 
-								result.scene.add( object );
+						if ( hasNormals ) {
 
-								result.objects[ dd ] = object;
+							geometry.computeTangents();
 
-								if ( o.meshCollider ) {
+						}
 
-									var meshCollider = THREE.CollisionUtils.MeshColliderWBox( object );
-									result.scene.collisions.colliders.push( meshCollider );
+						p = o.position;
+						r = o.rotation;
+						q = o.quaternion;
+						s = o.scale;
 
-								}
+						// turn off quaternions, for the moment
 
-								if ( o.castsShadow ) {
+						q = 0;
 
-									//object.visible = true;
-									//object.materials = [ new THREE.MeshBasicMaterial( { color: 0xff0000 } ) ];
+						if ( materials.length == 0 ) {
 
-									var shadow = new THREE.ShadowVolume( geometry )
-									result.scene.add( shadow );
+							materials = new THREE.MeshFaceMaterial();
 
-									shadow.position = object.position;
-									shadow.rotation = object.rotation;
-									shadow.scale = object.scale;
+						}
 
-								}
+						// dirty hack to handle meshes with multiple materials
+						// just use face materials defined in model
 
-								if ( o.trigger && o.trigger.toLowerCase() != "none" ) {
+						if ( materials.length > 1 ) {
 
-									var trigger = {
-									"type" 		: o.trigger,
-									"object"	: o
-									};
+							materials = new THREE.MeshFaceMaterial();
 
-									result.triggers[ object.name ] = trigger;
+						}
 
-								}
+						object = new THREE.Mesh( geometry, materials );
+						object.name = dd;
+						object.position.set( p[0], p[1], p[2] );
 
-							}
+						if ( q ) {
 
-						// pure Object3D
+							object.quaternion.set( q[0], q[1], q[2], q[3] );
+							object.useQuaternion = true;
 
 						} else {
 
-							p = o.position;
-							r = o.rotation;
-							q = o.quaternion;
-							s = o.scale;
+							object.rotation.set( r[0], r[1], r[2] );
 
-							// turn off quaternions, for the moment
+						}
 
-							q = 0;
+						object.scale.set( s[0], s[1], s[2] );
+						object.visible = o.visible;
 
-							object = new THREE.Object3D();
-							object.name = dd;
-							object.position.set( p[0], p[1], p[2] );
+						result.scene.add( object );
 
-							if ( q ) {
+						result.objects[ dd ] = object;
 
-								object.quaternion.set( q[0], q[1], q[2], q[3] );
-								object.useQuaternion = true;
+						if ( o.meshCollider ) {
 
-							} else {
+							var meshCollider = THREE.CollisionUtils.MeshColliderWBox( object );
+							result.scene.collisions.colliders.push( meshCollider );
 
-								object.rotation.set( r[0], r[1], r[2] );
+						}
 
-							}
+						if ( o.castsShadow ) {
 
-							object.scale.set( s[0], s[1], s[2] );
-							object.visible = ( o.visible !== undefined ) ? o.visible : false;
+							//object.visible = true;
+							//object.materials = [ new THREE.MeshBasicMaterial( { color: 0xff0000 } ) ];
 
-							result.scene.add( object );
+							var shadow = new THREE.ShadowVolume( geometry )
+							result.scene.add( shadow );
 
-							result.objects[ dd ] = object;
-							result.empties[ dd ] = object;
+							shadow.position = object.position;
+							shadow.rotation = object.rotation;
+							shadow.scale = object.scale;
 
-							if ( o.trigger && o.trigger.toLowerCase() != "none" ) {
+						}
 
-								var trigger = {
-								"type" 		: o.trigger,
-								"object"	: o
-								};
+						if ( o.trigger && o.trigger.toLowerCase() != "none" ) {
 
-								result.triggers[ object.name ] = trigger;
+							var trigger = {
+							"type" 		: o.trigger,
+							"object"	: o
+							};
 
-							}
+							result.triggers[ object.name ] = trigger;
 
 						}
 
 					}
 
-				}
+				// pure Object3D
 
-			};
+				} else {
 
-			function handle_mesh( geo, id ) {
+					p = o.position;
+					r = o.rotation;
+					q = o.quaternion;
+					s = o.scale;
 
-				result.geometries[ id ] = geo;
-				handle_objects();
+					// turn off quaternions, for the moment
 
-			};
+					q = 0;
 
-			function create_callback( id ) {
+					object = new THREE.Object3D();
+					object.name = dd;
+					object.position.set( p[0], p[1], p[2] );
 
-				return function( geo ) {
+					if ( q ) {
 
-					handle_mesh( geo, id );
+						object.quaternion.set( q[0], q[1], q[2], q[3] );
+						object.useQuaternion = true;
 
-					counter_models -= 1;
+					} else {
 
-					scope.onLoadComplete();
+						object.rotation.set( r[0], r[1], r[2] );
 
-					async_callback_gate();
+					}
 
-				}
+					object.scale.set( s[0], s[1], s[2] );
+					object.visible = ( o.visible !== undefined ) ? o.visible : false;
 
-			};
+					result.scene.add( object );
 
-			function create_callback_embed( id ) {
+					result.objects[ dd ] = object;
+					result.empties[ dd ] = object;
 
-				return function( geo ) {
+					if ( o.trigger && o.trigger.toLowerCase() != "none" ) {
 
-					result.geometries[ id ] = geo;
+						var trigger = {
+						"type" 		: o.trigger,
+						"object"	: o
+						};
+
+						result.triggers[ object.name ] = trigger;
+
+					}
 
 				}
 
-			};
+			}
 
-			function async_callback_gate() {
+		}
 
-				var progress = {
+	};
 
-					totalModels		: total_models,
-					totalTextures	: total_textures,
-					loadedModels	: total_models - counter_models,
-					loadedTextures	: total_textures - counter_textures
+	function handle_mesh( geo, id ) {
 
-				};
+		result.geometries[ id ] = geo;
+		handle_objects();
 
-				scope.callbackProgress( progress, result );
+	};
 
-				scope.onLoadProgress();
+	function create_callback( id ) {
 
-				if( counter_models == 0 && counter_textures == 0 ) {
+		return function( geo ) {
 
-					callbackFinished( result );
+			handle_mesh( geo, id );
 
-				}
+			counter_models -= 1;
 
-			};
+			scope.onLoadComplete();
 
-			var callbackTexture = function( images ) {
+			async_callback_gate();
 
-				counter_textures -= 1;
-				async_callback_gate();
+		}
 
-				scope.onLoadComplete();
+	};
 
-			};
+	function create_callback_embed( id ) {
 
-			// first go synchronous elements
+		return function( geo ) {
 
-			// cameras
+			result.geometries[ id ] = geo;
 
-			for( dc in data.cameras ) {
+		}
 
-				c = data.cameras[ dc ];
+	};
 
-				if ( c.type == "perspective" ) {
+	function async_callback_gate() {
 
-					camera = new THREE.PerspectiveCamera( c.fov, c.aspect, c.near, c.far );
+		var progress = {
 
-				} else if ( c.type == "ortho" ) {
+			totalModels		: total_models,
+			totalTextures	: total_textures,
+			loadedModels	: total_models - counter_models,
+			loadedTextures	: total_textures - counter_textures
 
-					camera = new THREE.OrthographicCamera( c.left, c.right, c.top, c.bottom, c.near, c.far );
+		};
 
-				}
+		scope.callbackProgress( progress, result );
 
-				p = c.position;
-				t = c.target;
-				camera.position.set( p[0], p[1], p[2] );
-				camera.target = new THREE.Vector3( t[0], t[1], t[2] );
+		scope.onLoadProgress();
 
-				result.cameras[ dc ] = camera;
+		if( counter_models == 0 && counter_textures == 0 ) {
 
-			}
+			callbackFinished( result );
 
-			// lights
+		}
 
-			var hex, intensity;
+	};
 
-			for ( dl in data.lights ) {
+	var callbackTexture = function( images ) {
 
-				l = data.lights[ dl ];
+		counter_textures -= 1;
+		async_callback_gate();
 
-				hex = ( l.color !== undefined ) ? l.color : 0xffffff;
-				intensity = ( l.intensity !== undefined ) ? l.intensity : 1;
+		scope.onLoadComplete();
 
-				if ( l.type == "directional" ) {
+	};
 
-					p = l.direction;
+	// first go synchronous elements
 
-					light = new THREE.DirectionalLight( hex, intensity );
-					light.position.set( p[0], p[1], p[2] );
-					light.position.normalize();
+	// cameras
 
-				} else if ( l.type == "point" ) {
+	for( dc in data.cameras ) {
 
-					p = l.position;
-					d = l.distance;
+		c = data.cameras[ dc ];
 
-					light = new THREE.PointLight( hex, intensity, d );
-					light.position.set( p[0], p[1], p[2] );
+		if ( c.type == "perspective" ) {
 
-				} else if ( l.type == "ambient" ) {
+			camera = new THREE.PerspectiveCamera( c.fov, c.aspect, c.near, c.far );
 
-					light = new THREE.AmbientLight( hex );
+		} else if ( c.type == "ortho" ) {
 
-				}
+			camera = new THREE.OrthographicCamera( c.left, c.right, c.top, c.bottom, c.near, c.far );
 
-				result.scene.add( light );
+		}
 
-				result.lights[ dl ] = light;
+		p = c.position;
+		t = c.target;
+		camera.position.set( p[0], p[1], p[2] );
+		camera.target = new THREE.Vector3( t[0], t[1], t[2] );
 
-			}
+		result.cameras[ dc ] = camera;
 
-			// fogs
+	}
 
-			for( df in data.fogs ) {
+	// lights
 
-				f = data.fogs[ df ];
+	var hex, intensity;
 
-				if ( f.type == "linear" ) {
+	for ( dl in data.lights ) {
 
-					fog = new THREE.Fog( 0x000000, f.near, f.far );
+		l = data.lights[ dl ];
 
-				} else if ( f.type == "exp2" ) {
+		hex = ( l.color !== undefined ) ? l.color : 0xffffff;
+		intensity = ( l.intensity !== undefined ) ? l.intensity : 1;
 
-					fog = new THREE.FogExp2( 0x000000, f.density );
+		if ( l.type == "directional" ) {
 
-				}
+			p = l.direction;
 
-				c = f.color;
-				fog.color.setRGB( c[0], c[1], c[2] );
+			light = new THREE.DirectionalLight( hex, intensity );
+			light.position.set( p[0], p[1], p[2] );
+			light.position.normalize();
 
-				result.fogs[ df ] = fog;
+		} else if ( l.type == "point" ) {
 
-			}
+			p = l.position;
+			d = l.distance;
 
-			// defaults
+			light = new THREE.PointLight( hex, intensity, d );
+			light.position.set( p[0], p[1], p[2] );
 
-			if ( result.cameras && data.defaults.camera ) {
+		} else if ( l.type == "ambient" ) {
 
-				result.currentCamera = result.cameras[ data.defaults.camera ];
+			light = new THREE.AmbientLight( hex );
 
-			}
+		}
 
-			if ( result.fogs && data.defaults.fog ) {
+		result.scene.add( light );
 
-				result.scene.fog = result.fogs[ data.defaults.fog ];
+		result.lights[ dl ] = light;
 
-			}
+	}
 
-			c = data.defaults.bgcolor;
-			result.bgColor = new THREE.Color();
-			result.bgColor.setRGB( c[0], c[1], c[2] );
+	// fogs
 
-			result.bgColorAlpha = data.defaults.bgalpha;
+	for( df in data.fogs ) {
 
-			// now come potentially asynchronous elements
+		f = data.fogs[ df ];
 
-			// geometries
+		if ( f.type == "linear" ) {
 
-			// count how many models will be loaded asynchronously
+			fog = new THREE.Fog( 0x000000, f.near, f.far );
 
-			for( dg in data.geometries ) {
+		} else if ( f.type == "exp2" ) {
 
-				g = data.geometries[ dg ];
+			fog = new THREE.FogExp2( 0x000000, f.density );
 
-				if ( g.type == "bin_mesh" || g.type == "ascii_mesh" ) {
+		}
 
-					counter_models += 1;
+		c = f.color;
+		fog.color.setRGB( c[0], c[1], c[2] );
 
-					scope.onLoadStart();
+		result.fogs[ df ] = fog;
 
-				}
+	}
 
-			}
+	// defaults
 
-			total_models = counter_models;
+	if ( result.cameras && data.defaults.camera ) {
 
-			for ( dg in data.geometries ) {
+		result.currentCamera = result.cameras[ data.defaults.camera ];
 
-				g = data.geometries[ dg ];
+	}
 
-				if ( g.type == "cube" ) {
+	if ( result.fogs && data.defaults.fog ) {
 
-					geometry = new THREE.CubeGeometry( g.width, g.height, g.depth, g.segmentsWidth, g.segmentsHeight, g.segmentsDepth, null, g.flipped, g.sides );
-					result.geometries[ dg ] = geometry;
+		result.scene.fog = result.fogs[ data.defaults.fog ];
 
-				} else if ( g.type == "plane" ) {
+	}
 
-					geometry = new THREE.PlaneGeometry( g.width, g.height, g.segmentsWidth, g.segmentsHeight );
-					result.geometries[ dg ] = geometry;
+	c = data.defaults.bgcolor;
+	result.bgColor = new THREE.Color();
+	result.bgColor.setRGB( c[0], c[1], c[2] );
 
-				} else if ( g.type == "sphere" ) {
+	result.bgColorAlpha = data.defaults.bgalpha;
 
-					geometry = new THREE.SphereGeometry( g.radius, g.segmentsWidth, g.segmentsHeight );
-					result.geometries[ dg ] = geometry;
+	// now come potentially asynchronous elements
 
-				} else if ( g.type == "cylinder" ) {
+	// geometries
 
-					geometry = new THREE.CylinderGeometry( g.topRad, g.botRad, g.height, g.radSegs, g.heightSegs );
-					result.geometries[ dg ] = geometry;
+	// count how many models will be loaded asynchronously
 
-				} else if ( g.type == "torus" ) {
+	for( dg in data.geometries ) {
 
-					geometry = new THREE.TorusGeometry( g.radius, g.tube, g.segmentsR, g.segmentsT );
-					result.geometries[ dg ] = geometry;
+		g = data.geometries[ dg ];
 
-				} else if ( g.type == "icosahedron" ) {
+		if ( g.type == "bin_mesh" || g.type == "ascii_mesh" ) {
 
-					geometry = new THREE.IcosahedronGeometry( g.subdivisions );
-					result.geometries[ dg ] = geometry;
+			counter_models += 1;
 
-				} else if ( g.type == "bin_mesh" ) {
+			scope.onLoadStart();
 
-					binLoader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ) );
+		}
 
-				} else if ( g.type == "ascii_mesh" ) {
+	}
 
-					jsonLoader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ) );
+	total_models = counter_models;
 
-				} else if ( g.type == "embedded_mesh" ) {
+	for ( dg in data.geometries ) {
 
-					var modelJson = data.embeds[ g.id ],
-						texture_path = "";
+		g = data.geometries[ dg ];
 
-					if ( modelJson ) {
+		if ( g.type == "cube" ) {
 
-						jsonLoader.createModel( modelJson, create_callback_embed( dg ), texture_path );
+			geometry = new THREE.CubeGeometry( g.width, g.height, g.depth, g.segmentsWidth, g.segmentsHeight, g.segmentsDepth, null, g.flipped, g.sides );
+			result.geometries[ dg ] = geometry;
 
-					}
+		} else if ( g.type == "plane" ) {
 
-				}
+			geometry = new THREE.PlaneGeometry( g.width, g.height, g.segmentsWidth, g.segmentsHeight );
+			result.geometries[ dg ] = geometry;
 
-			}
+		} else if ( g.type == "sphere" ) {
 
-			// textures
+			geometry = new THREE.SphereGeometry( g.radius, g.segmentsWidth, g.segmentsHeight );
+			result.geometries[ dg ] = geometry;
 
-			// count how many textures will be loaded asynchronously
+		} else if ( g.type == "cylinder" ) {
 
-			for( dt in data.textures ) {
+			geometry = new THREE.CylinderGeometry( g.topRad, g.botRad, g.height, g.radSegs, g.heightSegs );
+			result.geometries[ dg ] = geometry;
 
-				tt = data.textures[ dt ];
+		} else if ( g.type == "torus" ) {
 
-				if( tt.url instanceof Array ) {
+			geometry = new THREE.TorusGeometry( g.radius, g.tube, g.segmentsR, g.segmentsT );
+			result.geometries[ dg ] = geometry;
 
-					counter_textures += tt.url.length;
+		} else if ( g.type == "icosahedron" ) {
 
-					for( var n = 0; n < tt.url.length; n ++ ) {
+			geometry = new THREE.IcosahedronGeometry( g.subdivisions );
+			result.geometries[ dg ] = geometry;
 
-						scope.onLoadStart();
+		} else if ( g.type == "bin_mesh" ) {
 
-					}
+			binLoader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ) );
 
-				} else {
+		} else if ( g.type == "ascii_mesh" ) {
 
-					counter_textures += 1;
+			jsonLoader.load( get_url( g.url, data.urlBaseType ), create_callback( dg ) );
 
-					scope.onLoadStart();
+		} else if ( g.type == "embedded_mesh" ) {
 
-				}
+			var modelJson = data.embeds[ g.id ],
+				texture_path = "";
+
+			if ( modelJson ) {
+
+				jsonLoader.createModel( modelJson, create_callback_embed( dg ), texture_path );
 
 			}
 
-			total_textures = counter_textures;
+		}
 
-			for( dt in data.textures ) {
+	}
 
-				tt = data.textures[ dt ];
+	// textures
 
-				if ( tt.mapping != undefined && THREE[ tt.mapping ] != undefined  ) {
+	// count how many textures will be loaded asynchronously
 
-					tt.mapping = new THREE[ tt.mapping ]();
+	for( dt in data.textures ) {
 
-				}
+		tt = data.textures[ dt ];
 
-				if( tt.url instanceof Array ) {
+		if( tt.url instanceof Array ) {
 
-					var url_array = [];
+			counter_textures += tt.url.length;
 
-					for( var i = 0; i < tt.url.length; i ++ ) {
+			for( var n = 0; n < tt.url.length; n ++ ) {
 
-						url_array[ i ] = get_url( tt.url[ i ], data.urlBaseType );
+				scope.onLoadStart();
 
-					}
+			}
 
-					texture = THREE.ImageUtils.loadTextureCube( url_array, tt.mapping, callbackTexture );
+		} else {
 
-				} else {
+			counter_textures += 1;
 
-					texture = THREE.ImageUtils.loadTexture( get_url( tt.url, data.urlBaseType ), tt.mapping, callbackTexture );
+			scope.onLoadStart();
 
-					if ( THREE[ tt.minFilter ] != undefined )
-						texture.minFilter = THREE[ tt.minFilter ];
+		}
 
-					if ( THREE[ tt.magFilter ] != undefined )
-						texture.magFilter = THREE[ tt.magFilter ];
+	}
 
+	total_textures = counter_textures;
 
-					if ( tt.repeat ) {
+	for( dt in data.textures ) {
 
-						texture.repeat.set( tt.repeat[ 0 ], tt.repeat[ 1 ] );
+		tt = data.textures[ dt ];
 
-						if ( tt.repeat[ 0 ] != 1 ) texture.wrapS = THREE.RepeatWrapping;
-						if ( tt.repeat[ 1 ] != 1 ) texture.wrapT = THREE.RepeatWrapping;
+		if ( tt.mapping != undefined && THREE[ tt.mapping ] != undefined  ) {
 
-					}
+			tt.mapping = new THREE[ tt.mapping ]();
 
-					if ( tt.offset ) {
+		}
 
-						texture.offset.set( tt.offset[ 0 ], tt.offset[ 1 ] );
+		if( tt.url instanceof Array ) {
 
-					}
+			var url_array = [];
 
-					// handle wrap after repeat so that default repeat can be overriden
+			for( var i = 0; i < tt.url.length; i ++ ) {
 
-					if ( tt.wrap ) {
+				url_array[ i ] = get_url( tt.url[ i ], data.urlBaseType );
 
-						var wrapMap = {
-						"repeat" 	: THREE.RepeatWrapping,
-						"mirror"	: THREE.MirroredRepeatWrapping
-						}
+			}
 
-						if ( wrapMap[ tt.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ tt.wrap[ 0 ] ];
-						if ( wrapMap[ tt.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ tt.wrap[ 1 ] ];
+			texture = THREE.ImageUtils.loadTextureCube( url_array, tt.mapping, callbackTexture );
 
-					}
+		} else {
+
+			texture = THREE.ImageUtils.loadTexture( get_url( tt.url, data.urlBaseType ), tt.mapping, callbackTexture );
+
+			if ( THREE[ tt.minFilter ] != undefined )
+				texture.minFilter = THREE[ tt.minFilter ];
+
+			if ( THREE[ tt.magFilter ] != undefined )
+				texture.magFilter = THREE[ tt.magFilter ];
+
+
+			if ( tt.repeat ) {
+
+				texture.repeat.set( tt.repeat[ 0 ], tt.repeat[ 1 ] );
+
+				if ( tt.repeat[ 0 ] != 1 ) texture.wrapS = THREE.RepeatWrapping;
+				if ( tt.repeat[ 1 ] != 1 ) texture.wrapT = THREE.RepeatWrapping;
+
+			}
+
+			if ( tt.offset ) {
+
+				texture.offset.set( tt.offset[ 0 ], tt.offset[ 1 ] );
+
+			}
+
+			// handle wrap after repeat so that default repeat can be overriden
+
+			if ( tt.wrap ) {
 
+				var wrapMap = {
+				"repeat" 	: THREE.RepeatWrapping,
+				"mirror"	: THREE.MirroredRepeatWrapping
 				}
 
-				result.textures[ dt ] = texture;
+				if ( wrapMap[ tt.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ tt.wrap[ 0 ] ];
+				if ( wrapMap[ tt.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ tt.wrap[ 1 ] ];
 
 			}
 
-			// materials
+		}
 
-			for ( dm in data.materials ) {
+		result.textures[ dt ] = texture;
 
-				m = data.materials[ dm ];
+	}
 
-				for ( pp in m.parameters ) {
+	// materials
 
-					if ( pp == "envMap" || pp == "map" || pp == "lightMap" ) {
+	for ( dm in data.materials ) {
 
-						m.parameters[ pp ] = result.textures[ m.parameters[ pp ] ];
+		m = data.materials[ dm ];
 
-					} else if ( pp == "shading" ) {
+		for ( pp in m.parameters ) {
 
-						m.parameters[ pp ] = ( m.parameters[ pp ] == "flat" ) ? THREE.FlatShading : THREE.SmoothShading;
+			if ( pp == "envMap" || pp == "map" || pp == "lightMap" ) {
 
-					} else if ( pp == "blending" ) {
+				m.parameters[ pp ] = result.textures[ m.parameters[ pp ] ];
 
-						m.parameters[ pp ] = THREE[ m.parameters[ pp ] ] ? THREE[ m.parameters[ pp ] ] : THREE.NormalBlending;
+			} else if ( pp == "shading" ) {
 
-					} else if ( pp == "combine" ) {
+				m.parameters[ pp ] = ( m.parameters[ pp ] == "flat" ) ? THREE.FlatShading : THREE.SmoothShading;
 
-						m.parameters[ pp ] = ( m.parameters[ pp ] == "MixOperation" ) ? THREE.MixOperation : THREE.MultiplyOperation;
+			} else if ( pp == "blending" ) {
 
-					} else if ( pp == "vertexColors" ) {
+				m.parameters[ pp ] = THREE[ m.parameters[ pp ] ] ? THREE[ m.parameters[ pp ] ] : THREE.NormalBlending;
 
-						if ( m.parameters[ pp ] == "face" ) {
+			} else if ( pp == "combine" ) {
 
-							m.parameters[ pp ] = THREE.FaceColors;
+				m.parameters[ pp ] = ( m.parameters[ pp ] == "MixOperation" ) ? THREE.MixOperation : THREE.MultiplyOperation;
 
-						// default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false
+			} else if ( pp == "vertexColors" ) {
 
-						} else if ( m.parameters[ pp ] )   {
+				if ( m.parameters[ pp ] == "face" ) {
 
-							m.parameters[ pp ] = THREE.VertexColors;
+					m.parameters[ pp ] = THREE.FaceColors;
 
-						}
+				// default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false
 
-					}
+				} else if ( m.parameters[ pp ] )   {
+
+					m.parameters[ pp ] = THREE.VertexColors;
 
 				}
 
-				if ( m.parameters.opacity !== undefined && m.parameters.opacity < 1.0 ) {
+			}
 
-					m.parameters.transparent = true;
+		}
 
-				}
+		if ( m.parameters.opacity !== undefined && m.parameters.opacity < 1.0 ) {
 
-				if ( m.parameters.normalMap ) {
+			m.parameters.transparent = true;
 
-					var shader = THREE.ShaderUtils.lib[ "normal" ];
-					var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
+		}
 
-					var diffuse = m.parameters.color;
-					var specular = m.parameters.specular;
-					var ambient = m.parameters.ambient;
-					var shininess = m.parameters.shininess;
+		if ( m.parameters.normalMap ) {
 
-					uniforms[ "tNormal" ].texture = result.textures[ m.parameters.normalMap ];
+			var shader = THREE.ShaderUtils.lib[ "normal" ];
+			var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-					if ( m.parameters.normalMapFactor ) {
+			var diffuse = m.parameters.color;
+			var specular = m.parameters.specular;
+			var ambient = m.parameters.ambient;
+			var shininess = m.parameters.shininess;
 
-						uniforms[ "uNormalScale" ].value = m.parameters.normalMapFactor;
+			uniforms[ "tNormal" ].texture = result.textures[ m.parameters.normalMap ];
 
-					}
+			if ( m.parameters.normalMapFactor ) {
 
-					if ( m.parameters.map ) {
+				uniforms[ "uNormalScale" ].value = m.parameters.normalMapFactor;
 
-						uniforms[ "tDiffuse" ].texture = m.parameters.map;
-						uniforms[ "enableDiffuse" ].value = true;
+			}
 
-					}
+			if ( m.parameters.map ) {
 
-					if ( m.parameters.lightMap ) {
+				uniforms[ "tDiffuse" ].texture = m.parameters.map;
+				uniforms[ "enableDiffuse" ].value = true;
 
-						uniforms[ "tAO" ].texture = m.parameters.lightMap;
-						uniforms[ "enableAO" ].value = true;
+			}
 
-					}
+			if ( m.parameters.lightMap ) {
 
-					if ( m.parameters.specularMap ) {
+				uniforms[ "tAO" ].texture = m.parameters.lightMap;
+				uniforms[ "enableAO" ].value = true;
 
-						uniforms[ "tSpecular" ].texture = result.textures[ m.parameters.specularMap ];
-						uniforms[ "enableSpecular" ].value = true;
+			}
 
-					}
+			if ( m.parameters.specularMap ) {
 
-					uniforms[ "uDiffuseColor" ].value.setHex( diffuse );
-					uniforms[ "uSpecularColor" ].value.setHex( specular );
-					uniforms[ "uAmbientColor" ].value.setHex( ambient );
+				uniforms[ "tSpecular" ].texture = result.textures[ m.parameters.specularMap ];
+				uniforms[ "enableSpecular" ].value = true;
 
-					uniforms[ "uShininess" ].value = shininess;
+			}
 
-					if ( m.parameters.opacity ) {
+			uniforms[ "uDiffuseColor" ].value.setHex( diffuse );
+			uniforms[ "uSpecularColor" ].value.setHex( specular );
+			uniforms[ "uAmbientColor" ].value.setHex( ambient );
 
-						uniforms[ "uOpacity" ].value = m.parameters.opacity;
+			uniforms[ "uShininess" ].value = shininess;
 
-					}
+			if ( m.parameters.opacity ) {
 
-					var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true };
+				uniforms[ "uOpacity" ].value = m.parameters.opacity;
 
-					material = new THREE.ShaderMaterial( parameters );
+			}
 
-				} else {
+			var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true };
 
-					material = new THREE[ m.type ]( m.parameters );
+			material = new THREE.ShaderMaterial( parameters );
 
-				}
+		} else {
 
-				result.materials[ dm ] = material;
+			material = new THREE[ m.type ]( m.parameters );
 
-			}
+		}
 
-			// objects ( synchronous init of procedural primitives )
+		result.materials[ dm ] = material;
 
-			handle_objects();
+	}
 
-			// synchronous callback
+	// objects ( synchronous init of procedural primitives )
 
-			scope.callbackSync( result );
+	handle_objects();
 
-			// just in case there are no async elements:
-			async_callback_gate();
+	// synchronous callback
 
-		};
+	scope.callbackSync( result );
 
-	},
+	// just in case there are no async elements:
+	async_callback_gate();
 
-	constructor : THREE.SceneLoader
 
 };

部分文件因文件數量過多而無法顯示